blob: 9e5e7fc5706001b0232a4c150ce86afea2faa423 [file] [log] [blame]
Guillaume Chatelet3cc8f312020-10-12 08:55:20 +00001// Copyright 2017 Google LLC
Guillaume Chatelet439d3712018-02-01 10:03:09 +01002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Guillaume Chatelet8e58ef02018-02-01 10:38:48 +010015#ifndef CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_
16#define CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_
Guillaume Chatelet439d3712018-02-01 10:03:09 +010017
Artem Alekseev653d5812019-07-02 17:52:25 +030018#include "cpu_features_cache_info.h"
Guillaume Chatelet22a53622020-09-23 11:52:20 +020019#include "cpu_features_macros.h"
Guillaume Chatelet439d3712018-02-01 10:03:09 +010020
Guillaume Chatelete4195732018-02-12 16:15:15 +010021CPU_FEATURES_START_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010022
23typedef struct {
24 int msa : 1; // MIPS SIMD Architecture
25 // https://www.mips.com/products/architectures/ase/simd/
26 int eva : 1; // Enhanced Virtual Addressing
27 // https://www.mips.com/products/architectures/mips64/
Guillaume Chatelet5911e962019-01-22 11:00:48 +010028 int r6 : 1; // True if is release 6 of the processor.
Guillaume Chatelet439d3712018-02-01 10:03:09 +010029
30 // Make sure to update MipsFeaturesEnum below if you add a field here.
31} MipsFeatures;
32
33typedef struct {
34 MipsFeatures features;
35} MipsInfo;
36
37MipsInfo GetMipsInfo(void);
38
39////////////////////////////////////////////////////////////////////////////////
40// Introspection functions
41
42typedef enum {
43 MIPS_MSA,
44 MIPS_EVA,
Guillaume Chatelet5911e962019-01-22 11:00:48 +010045 MIPS_R6,
Guillaume Chatelet439d3712018-02-01 10:03:09 +010046 MIPS_LAST_,
47} MipsFeaturesEnum;
48
49int GetMipsFeaturesEnumValue(const MipsFeatures* features,
50 MipsFeaturesEnum value);
51
52const char* GetMipsFeaturesEnumName(MipsFeaturesEnum);
53
Guillaume Chatelete4195732018-02-12 16:15:15 +010054CPU_FEATURES_END_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010055
Guillaume Chatelet4155ee72019-01-18 13:38:22 +010056#if !defined(CPU_FEATURES_ARCH_MIPS)
57#error "Including cpuinfo_mips.h from a non-mips target."
58#endif
59
Guillaume Chatelet8e58ef02018-02-01 10:38:48 +010060#endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_