1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #pragma once 4 #include <nlohmann/json.hpp> 5 6 namespace processor 7 { 8 // clang-format off 9 10 enum class ProcessorType{ 11 Invalid, 12 CPU, 13 GPU, 14 FPGA, 15 DSP, 16 Accelerator, 17 Core, 18 Thread, 19 Partition, 20 OEM, 21 }; 22 23 enum class ProcessorArchitecture{ 24 Invalid, 25 x86, 26 IA64, 27 ARM, 28 MIPS, 29 Power, 30 RISCV, 31 OEM, 32 }; 33 34 enum class InstructionSet{ 35 Invalid, 36 x86, 37 x8664, 38 IA64, 39 ARMA32, 40 ARMA64, 41 MIPS32, 42 MIPS64, 43 PowerISA, 44 RV32, 45 RV64, 46 OEM, 47 }; 48 49 enum class ProcessorMemoryType{ 50 Invalid, 51 Cache, 52 L1Cache, 53 L2Cache, 54 L3Cache, 55 L4Cache, 56 L5Cache, 57 L6Cache, 58 L7Cache, 59 HBM1, 60 HBM2, 61 HBM2E, 62 HBM3, 63 SGRAM, 64 GDDR, 65 GDDR2, 66 GDDR3, 67 GDDR4, 68 GDDR5, 69 GDDR5X, 70 GDDR6, 71 DDR, 72 DDR2, 73 DDR3, 74 DDR4, 75 DDR5, 76 SDRAM, 77 SRAM, 78 Flash, 79 OEM, 80 }; 81 82 enum class FpgaType{ 83 Invalid, 84 Integrated, 85 Discrete, 86 }; 87 88 enum class SystemInterfaceType{ 89 Invalid, 90 QPI, 91 UPI, 92 PCIe, 93 Ethernet, 94 AMBA, 95 CCIX, 96 CXL, 97 OEM, 98 }; 99 100 enum class TurboState{ 101 Invalid, 102 Enabled, 103 Disabled, 104 }; 105 106 enum class BaseSpeedPriorityState{ 107 Invalid, 108 Enabled, 109 Disabled, 110 }; 111 112 enum class ThrottleCause{ 113 Invalid, 114 PowerLimit, 115 ThermalLimit, 116 ClockLimit, 117 ManagementDetectedFault, 118 Unknown, 119 OEM, 120 }; 121 122 NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorType, { 123 {ProcessorType::Invalid, "Invalid"}, 124 {ProcessorType::CPU, "CPU"}, 125 {ProcessorType::GPU, "GPU"}, 126 {ProcessorType::FPGA, "FPGA"}, 127 {ProcessorType::DSP, "DSP"}, 128 {ProcessorType::Accelerator, "Accelerator"}, 129 {ProcessorType::Core, "Core"}, 130 {ProcessorType::Thread, "Thread"}, 131 {ProcessorType::Partition, "Partition"}, 132 {ProcessorType::OEM, "OEM"}, 133 }); 134 135 NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorArchitecture, { 136 {ProcessorArchitecture::Invalid, "Invalid"}, 137 {ProcessorArchitecture::x86, "x86"}, 138 {ProcessorArchitecture::IA64, "IA-64"}, 139 {ProcessorArchitecture::ARM, "ARM"}, 140 {ProcessorArchitecture::MIPS, "MIPS"}, 141 {ProcessorArchitecture::Power, "Power"}, 142 {ProcessorArchitecture::RISCV, "RISC-V"}, 143 {ProcessorArchitecture::OEM, "OEM"}, 144 }); 145 146 NLOHMANN_JSON_SERIALIZE_ENUM(InstructionSet, { 147 {InstructionSet::Invalid, "Invalid"}, 148 {InstructionSet::x86, "x86"}, 149 {InstructionSet::x8664, "x86-64"}, 150 {InstructionSet::IA64, "IA-64"}, 151 {InstructionSet::ARMA32, "ARM-A32"}, 152 {InstructionSet::ARMA64, "ARM-A64"}, 153 {InstructionSet::MIPS32, "MIPS32"}, 154 {InstructionSet::MIPS64, "MIPS64"}, 155 {InstructionSet::PowerISA, "PowerISA"}, 156 {InstructionSet::RV32, "RV32"}, 157 {InstructionSet::RV64, "RV64"}, 158 {InstructionSet::OEM, "OEM"}, 159 }); 160 161 NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorMemoryType, { 162 {ProcessorMemoryType::Invalid, "Invalid"}, 163 {ProcessorMemoryType::Cache, "Cache"}, 164 {ProcessorMemoryType::L1Cache, "L1Cache"}, 165 {ProcessorMemoryType::L2Cache, "L2Cache"}, 166 {ProcessorMemoryType::L3Cache, "L3Cache"}, 167 {ProcessorMemoryType::L4Cache, "L4Cache"}, 168 {ProcessorMemoryType::L5Cache, "L5Cache"}, 169 {ProcessorMemoryType::L6Cache, "L6Cache"}, 170 {ProcessorMemoryType::L7Cache, "L7Cache"}, 171 {ProcessorMemoryType::HBM1, "HBM1"}, 172 {ProcessorMemoryType::HBM2, "HBM2"}, 173 {ProcessorMemoryType::HBM2E, "HBM2E"}, 174 {ProcessorMemoryType::HBM3, "HBM3"}, 175 {ProcessorMemoryType::SGRAM, "SGRAM"}, 176 {ProcessorMemoryType::GDDR, "GDDR"}, 177 {ProcessorMemoryType::GDDR2, "GDDR2"}, 178 {ProcessorMemoryType::GDDR3, "GDDR3"}, 179 {ProcessorMemoryType::GDDR4, "GDDR4"}, 180 {ProcessorMemoryType::GDDR5, "GDDR5"}, 181 {ProcessorMemoryType::GDDR5X, "GDDR5X"}, 182 {ProcessorMemoryType::GDDR6, "GDDR6"}, 183 {ProcessorMemoryType::DDR, "DDR"}, 184 {ProcessorMemoryType::DDR2, "DDR2"}, 185 {ProcessorMemoryType::DDR3, "DDR3"}, 186 {ProcessorMemoryType::DDR4, "DDR4"}, 187 {ProcessorMemoryType::DDR5, "DDR5"}, 188 {ProcessorMemoryType::SDRAM, "SDRAM"}, 189 {ProcessorMemoryType::SRAM, "SRAM"}, 190 {ProcessorMemoryType::Flash, "Flash"}, 191 {ProcessorMemoryType::OEM, "OEM"}, 192 }); 193 194 NLOHMANN_JSON_SERIALIZE_ENUM(FpgaType, { 195 {FpgaType::Invalid, "Invalid"}, 196 {FpgaType::Integrated, "Integrated"}, 197 {FpgaType::Discrete, "Discrete"}, 198 }); 199 200 NLOHMANN_JSON_SERIALIZE_ENUM(SystemInterfaceType, { 201 {SystemInterfaceType::Invalid, "Invalid"}, 202 {SystemInterfaceType::QPI, "QPI"}, 203 {SystemInterfaceType::UPI, "UPI"}, 204 {SystemInterfaceType::PCIe, "PCIe"}, 205 {SystemInterfaceType::Ethernet, "Ethernet"}, 206 {SystemInterfaceType::AMBA, "AMBA"}, 207 {SystemInterfaceType::CCIX, "CCIX"}, 208 {SystemInterfaceType::CXL, "CXL"}, 209 {SystemInterfaceType::OEM, "OEM"}, 210 }); 211 212 NLOHMANN_JSON_SERIALIZE_ENUM(TurboState, { 213 {TurboState::Invalid, "Invalid"}, 214 {TurboState::Enabled, "Enabled"}, 215 {TurboState::Disabled, "Disabled"}, 216 }); 217 218 NLOHMANN_JSON_SERIALIZE_ENUM(BaseSpeedPriorityState, { 219 {BaseSpeedPriorityState::Invalid, "Invalid"}, 220 {BaseSpeedPriorityState::Enabled, "Enabled"}, 221 {BaseSpeedPriorityState::Disabled, "Disabled"}, 222 }); 223 224 NLOHMANN_JSON_SERIALIZE_ENUM(ThrottleCause, { 225 {ThrottleCause::Invalid, "Invalid"}, 226 {ThrottleCause::PowerLimit, "PowerLimit"}, 227 {ThrottleCause::ThermalLimit, "ThermalLimit"}, 228 {ThrottleCause::ClockLimit, "ClockLimit"}, 229 {ThrottleCause::ManagementDetectedFault, "ManagementDetectedFault"}, 230 {ThrottleCause::Unknown, "Unknown"}, 231 {ThrottleCause::OEM, "OEM"}, 232 }); 233 234 } 235 // clang-format on 236