1*eca53ba6SRoland Levillain // Copyright 2022 IBM 2*eca53ba6SRoland Levillain // 3*eca53ba6SRoland Levillain // Licensed under the Apache License, Version 2.0 (the "License"); 4*eca53ba6SRoland Levillain // you may not use this file except in compliance with the License. 5*eca53ba6SRoland Levillain // You may obtain a copy of the License at 6*eca53ba6SRoland Levillain // 7*eca53ba6SRoland Levillain // http://www.apache.org/licenses/LICENSE-2.0 8*eca53ba6SRoland Levillain // 9*eca53ba6SRoland Levillain // Unless required by applicable law or agreed to in writing, software 10*eca53ba6SRoland Levillain // distributed under the License is distributed on an "AS IS" BASIS, 11*eca53ba6SRoland Levillain // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*eca53ba6SRoland Levillain // See the License for the specific language governing permissions and 13*eca53ba6SRoland Levillain // limitations under the License. 14*eca53ba6SRoland Levillain 15*eca53ba6SRoland Levillain #ifndef CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ 16*eca53ba6SRoland Levillain #define CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ 17*eca53ba6SRoland Levillain 18*eca53ba6SRoland Levillain #include "cpu_features_cache_info.h" 19*eca53ba6SRoland Levillain #include "cpu_features_macros.h" 20*eca53ba6SRoland Levillain 21*eca53ba6SRoland Levillain CPU_FEATURES_START_CPP_NAMESPACE 22*eca53ba6SRoland Levillain 23*eca53ba6SRoland Levillain typedef struct { 24*eca53ba6SRoland Levillain int esan3: 1; // instructions named N3, "backported" to esa-mode 25*eca53ba6SRoland Levillain int zarch: 1; // z/Architecture mode active 26*eca53ba6SRoland Levillain int stfle: 1; // store-facility-list-extended 27*eca53ba6SRoland Levillain int msa: 1; // message-security assist 28*eca53ba6SRoland Levillain int ldisp: 1; // long-displacement 29*eca53ba6SRoland Levillain int eimm: 1; // extended-immediate 30*eca53ba6SRoland Levillain int dfp: 1; // decimal floating point & perform floating point operation 31*eca53ba6SRoland Levillain int edat: 1; // huge page support 32*eca53ba6SRoland Levillain int etf3eh: 1; // extended-translation facility 3 enhancement 33*eca53ba6SRoland Levillain int highgprs: 1; // 64-bit register support for 31-bit processes 34*eca53ba6SRoland Levillain int te: 1; // transactional execution 35*eca53ba6SRoland Levillain int vx: 1; // vector extension facility 36*eca53ba6SRoland Levillain int vxd: 1; // vector-packed-decimal facility 37*eca53ba6SRoland Levillain int vxe: 1; // vector-enhancement facility 1 38*eca53ba6SRoland Levillain int gs: 1; // guarded-storage facility 39*eca53ba6SRoland Levillain int vxe2: 1; // vector-enhancements facility 2 40*eca53ba6SRoland Levillain int vxp: 1; // vector-packed-decimal-enhancement facility 41*eca53ba6SRoland Levillain int sort: 1; // enhanced-sort facility 42*eca53ba6SRoland Levillain int dflt: 1; // deflate-conversion facility 43*eca53ba6SRoland Levillain int vxp2: 1; // vector-packed-decimal-enhancement facility 2 44*eca53ba6SRoland Levillain int nnpa: 1; // neural network processing assist facility 45*eca53ba6SRoland Levillain int pcimio: 1; // PCI mio facility 46*eca53ba6SRoland Levillain int sie: 1; // virtualization support 47*eca53ba6SRoland Levillain 48*eca53ba6SRoland Levillain // Make sure to update S390XFeaturesEnum below if you add a field here. 49*eca53ba6SRoland Levillain } S390XFeatures; 50*eca53ba6SRoland Levillain 51*eca53ba6SRoland Levillain typedef struct { 52*eca53ba6SRoland Levillain S390XFeatures features; 53*eca53ba6SRoland Levillain } S390XInfo; 54*eca53ba6SRoland Levillain 55*eca53ba6SRoland Levillain S390XInfo GetS390XInfo(void); 56*eca53ba6SRoland Levillain 57*eca53ba6SRoland Levillain typedef struct { 58*eca53ba6SRoland Levillain char platform[64]; // 0 terminated string 59*eca53ba6SRoland Levillain } S390XPlatformTypeStrings; 60*eca53ba6SRoland Levillain 61*eca53ba6SRoland Levillain typedef struct { 62*eca53ba6SRoland Levillain int num_processors; // -1 if N/A 63*eca53ba6SRoland Levillain S390XPlatformTypeStrings type; 64*eca53ba6SRoland Levillain } S390XPlatformStrings; 65*eca53ba6SRoland Levillain 66*eca53ba6SRoland Levillain S390XPlatformStrings GetS390XPlatformStrings(void); 67*eca53ba6SRoland Levillain 68*eca53ba6SRoland Levillain //////////////////////////////////////////////////////////////////////////////// 69*eca53ba6SRoland Levillain // Introspection functions 70*eca53ba6SRoland Levillain 71*eca53ba6SRoland Levillain typedef enum { 72*eca53ba6SRoland Levillain S390_ESAN3, 73*eca53ba6SRoland Levillain S390_ZARCH, 74*eca53ba6SRoland Levillain S390_STFLE, 75*eca53ba6SRoland Levillain S390_MSA, 76*eca53ba6SRoland Levillain S390_LDISP, 77*eca53ba6SRoland Levillain S390_EIMM, 78*eca53ba6SRoland Levillain S390_DFP, 79*eca53ba6SRoland Levillain S390_EDAT, 80*eca53ba6SRoland Levillain S390_ETF3EH, 81*eca53ba6SRoland Levillain S390_HIGHGPRS, 82*eca53ba6SRoland Levillain S390_TE, 83*eca53ba6SRoland Levillain S390_VX, 84*eca53ba6SRoland Levillain S390_VXD, 85*eca53ba6SRoland Levillain S390_VXE, 86*eca53ba6SRoland Levillain S390_GS, 87*eca53ba6SRoland Levillain S390_VXE2, 88*eca53ba6SRoland Levillain S390_VXP, 89*eca53ba6SRoland Levillain S390_SORT, 90*eca53ba6SRoland Levillain S390_DFLT, 91*eca53ba6SRoland Levillain S390_VXP2, 92*eca53ba6SRoland Levillain S390_NNPA, 93*eca53ba6SRoland Levillain S390_PCIMIO, 94*eca53ba6SRoland Levillain S390_SIE, 95*eca53ba6SRoland Levillain S390X_LAST_, 96*eca53ba6SRoland Levillain } S390XFeaturesEnum; 97*eca53ba6SRoland Levillain 98*eca53ba6SRoland Levillain int GetS390XFeaturesEnumValue(const S390XFeatures* features, S390XFeaturesEnum value); 99*eca53ba6SRoland Levillain 100*eca53ba6SRoland Levillain const char* GetS390XFeaturesEnumName(S390XFeaturesEnum); 101*eca53ba6SRoland Levillain 102*eca53ba6SRoland Levillain CPU_FEATURES_END_CPP_NAMESPACE 103*eca53ba6SRoland Levillain 104*eca53ba6SRoland Levillain #if !defined(CPU_FEATURES_ARCH_S390X) 105*eca53ba6SRoland Levillain #error "Including cpuinfo_s390x.h from a non-s390x target." 106*eca53ba6SRoland Levillain #endif 107*eca53ba6SRoland Levillain 108*eca53ba6SRoland Levillain #endif // CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ 109