Guillaume Chatelet | 3cc8f31 | 2020-10-12 08:55:20 +0000 | [diff] [blame] | 1 | // Copyright 2017 Google LLC |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 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 Chatelet | 8e58ef0 | 2018-02-01 10:38:48 +0100 | [diff] [blame] | 15 | #ifndef CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ |
| 16 | #define CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 17 | |
Artem Alekseev | 653d581 | 2019-07-02 17:52:25 +0300 | [diff] [blame] | 18 | #include "cpu_features_cache_info.h" |
Guillaume Chatelet | 22a5362 | 2020-09-23 11:52:20 +0200 | [diff] [blame] | 19 | #include "cpu_features_macros.h" |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 20 | |
Guillaume Chatelet | e419573 | 2018-02-12 16:15:15 +0100 | [diff] [blame] | 21 | CPU_FEATURES_START_CPP_NAMESPACE |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 22 | |
| 23 | typedef 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 Chatelet | 5911e96 | 2019-01-22 11:00:48 +0100 | [diff] [blame] | 28 | int r6 : 1; // True if is release 6 of the processor. |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 29 | |
| 30 | // Make sure to update MipsFeaturesEnum below if you add a field here. |
| 31 | } MipsFeatures; |
| 32 | |
| 33 | typedef struct { |
| 34 | MipsFeatures features; |
| 35 | } MipsInfo; |
| 36 | |
| 37 | MipsInfo GetMipsInfo(void); |
| 38 | |
| 39 | //////////////////////////////////////////////////////////////////////////////// |
| 40 | // Introspection functions |
| 41 | |
| 42 | typedef enum { |
| 43 | MIPS_MSA, |
| 44 | MIPS_EVA, |
Guillaume Chatelet | 5911e96 | 2019-01-22 11:00:48 +0100 | [diff] [blame] | 45 | MIPS_R6, |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 46 | MIPS_LAST_, |
| 47 | } MipsFeaturesEnum; |
| 48 | |
| 49 | int GetMipsFeaturesEnumValue(const MipsFeatures* features, |
| 50 | MipsFeaturesEnum value); |
| 51 | |
| 52 | const char* GetMipsFeaturesEnumName(MipsFeaturesEnum); |
| 53 | |
Guillaume Chatelet | e419573 | 2018-02-12 16:15:15 +0100 | [diff] [blame] | 54 | CPU_FEATURES_END_CPP_NAMESPACE |
Guillaume Chatelet | 439d371 | 2018-02-01 10:03:09 +0100 | [diff] [blame] | 55 | |
Guillaume Chatelet | 4155ee7 | 2019-01-18 13:38:22 +0100 | [diff] [blame] | 56 | #if !defined(CPU_FEATURES_ARCH_MIPS) |
| 57 | #error "Including cpuinfo_mips.h from a non-mips target." |
| 58 | #endif |
| 59 | |
Guillaume Chatelet | 8e58ef0 | 2018-02-01 10:38:48 +0100 | [diff] [blame] | 60 | #endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ |