blob: fd65a230d729369703424b26063e6dc47b74c135 [file] [log] [blame]
Guillaume Chatelet439d3712018-02-01 10:03:09 +01001// Copyright 2017 Google Inc.
2//
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
18#include "cpu_features_macros.h"
19
Guillaume Chatelete4195732018-02-12 16:15:15 +010020CPU_FEATURES_START_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010021
22typedef struct {
23 int msa : 1; // MIPS SIMD Architecture
24 // https://www.mips.com/products/architectures/ase/simd/
25 int eva : 1; // Enhanced Virtual Addressing
26 // https://www.mips.com/products/architectures/mips64/
Guillaume Chatelet5911e962019-01-22 11:00:48 +010027 int r6 : 1; // True if is release 6 of the processor.
Guillaume Chatelet439d3712018-02-01 10:03:09 +010028
29 // Make sure to update MipsFeaturesEnum below if you add a field here.
30} MipsFeatures;
31
32typedef struct {
33 MipsFeatures features;
34} MipsInfo;
35
36MipsInfo GetMipsInfo(void);
37
38////////////////////////////////////////////////////////////////////////////////
39// Introspection functions
40
41typedef enum {
42 MIPS_MSA,
43 MIPS_EVA,
Guillaume Chatelet5911e962019-01-22 11:00:48 +010044 MIPS_R6,
Guillaume Chatelet439d3712018-02-01 10:03:09 +010045 MIPS_LAST_,
46} MipsFeaturesEnum;
47
48int GetMipsFeaturesEnumValue(const MipsFeatures* features,
49 MipsFeaturesEnum value);
50
51const char* GetMipsFeaturesEnumName(MipsFeaturesEnum);
52
Guillaume Chatelete4195732018-02-12 16:15:15 +010053CPU_FEATURES_END_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010054
Guillaume Chatelet4155ee72019-01-18 13:38:22 +010055#if !defined(CPU_FEATURES_ARCH_MIPS)
56#error "Including cpuinfo_mips.h from a non-mips target."
57#endif
58
Guillaume Chatelet8e58ef02018-02-01 10:38:48 +010059#endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_