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 ProcessorMemoryType{ 24 Invalid, 25 Cache, 26 L1Cache, 27 L2Cache, 28 L3Cache, 29 L4Cache, 30 L5Cache, 31 L6Cache, 32 L7Cache, 33 HBM1, 34 HBM2, 35 HBM2E, 36 HBM3, 37 SGRAM, 38 GDDR, 39 GDDR2, 40 GDDR3, 41 GDDR4, 42 GDDR5, 43 GDDR5X, 44 GDDR6, 45 DDR, 46 DDR2, 47 DDR3, 48 DDR4, 49 DDR5, 50 SDRAM, 51 SRAM, 52 Flash, 53 OEM, 54 }; 55 56 enum class FpgaType{ 57 Invalid, 58 Integrated, 59 Discrete, 60 }; 61 62 enum class SystemInterfaceType{ 63 Invalid, 64 QPI, 65 UPI, 66 PCIe, 67 Ethernet, 68 AMBA, 69 CCIX, 70 CXL, 71 OEM, 72 }; 73 74 enum class TurboState{ 75 Invalid, 76 Enabled, 77 Disabled, 78 }; 79 80 enum class BaseSpeedPriorityState{ 81 Invalid, 82 Enabled, 83 Disabled, 84 }; 85 86 enum class ThrottleCause{ 87 Invalid, 88 PowerLimit, 89 ThermalLimit, 90 ClockLimit, 91 ManagementDetectedFault, 92 Unknown, 93 OEM, 94 }; 95 96 NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorType, { 97 {ProcessorType::Invalid, "Invalid"}, 98 {ProcessorType::CPU, "CPU"}, 99 {ProcessorType::GPU, "GPU"}, 100 {ProcessorType::FPGA, "FPGA"}, 101 {ProcessorType::DSP, "DSP"}, 102 {ProcessorType::Accelerator, "Accelerator"}, 103 {ProcessorType::Core, "Core"}, 104 {ProcessorType::Thread, "Thread"}, 105 {ProcessorType::Partition, "Partition"}, 106 {ProcessorType::OEM, "OEM"}, 107 }); 108 109 NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorMemoryType, { 110 {ProcessorMemoryType::Invalid, "Invalid"}, 111 {ProcessorMemoryType::Cache, "Cache"}, 112 {ProcessorMemoryType::L1Cache, "L1Cache"}, 113 {ProcessorMemoryType::L2Cache, "L2Cache"}, 114 {ProcessorMemoryType::L3Cache, "L3Cache"}, 115 {ProcessorMemoryType::L4Cache, "L4Cache"}, 116 {ProcessorMemoryType::L5Cache, "L5Cache"}, 117 {ProcessorMemoryType::L6Cache, "L6Cache"}, 118 {ProcessorMemoryType::L7Cache, "L7Cache"}, 119 {ProcessorMemoryType::HBM1, "HBM1"}, 120 {ProcessorMemoryType::HBM2, "HBM2"}, 121 {ProcessorMemoryType::HBM2E, "HBM2E"}, 122 {ProcessorMemoryType::HBM3, "HBM3"}, 123 {ProcessorMemoryType::SGRAM, "SGRAM"}, 124 {ProcessorMemoryType::GDDR, "GDDR"}, 125 {ProcessorMemoryType::GDDR2, "GDDR2"}, 126 {ProcessorMemoryType::GDDR3, "GDDR3"}, 127 {ProcessorMemoryType::GDDR4, "GDDR4"}, 128 {ProcessorMemoryType::GDDR5, "GDDR5"}, 129 {ProcessorMemoryType::GDDR5X, "GDDR5X"}, 130 {ProcessorMemoryType::GDDR6, "GDDR6"}, 131 {ProcessorMemoryType::DDR, "DDR"}, 132 {ProcessorMemoryType::DDR2, "DDR2"}, 133 {ProcessorMemoryType::DDR3, "DDR3"}, 134 {ProcessorMemoryType::DDR4, "DDR4"}, 135 {ProcessorMemoryType::DDR5, "DDR5"}, 136 {ProcessorMemoryType::SDRAM, "SDRAM"}, 137 {ProcessorMemoryType::SRAM, "SRAM"}, 138 {ProcessorMemoryType::Flash, "Flash"}, 139 {ProcessorMemoryType::OEM, "OEM"}, 140 }); 141 142 NLOHMANN_JSON_SERIALIZE_ENUM(FpgaType, { 143 {FpgaType::Invalid, "Invalid"}, 144 {FpgaType::Integrated, "Integrated"}, 145 {FpgaType::Discrete, "Discrete"}, 146 }); 147 148 NLOHMANN_JSON_SERIALIZE_ENUM(SystemInterfaceType, { 149 {SystemInterfaceType::Invalid, "Invalid"}, 150 {SystemInterfaceType::QPI, "QPI"}, 151 {SystemInterfaceType::UPI, "UPI"}, 152 {SystemInterfaceType::PCIe, "PCIe"}, 153 {SystemInterfaceType::Ethernet, "Ethernet"}, 154 {SystemInterfaceType::AMBA, "AMBA"}, 155 {SystemInterfaceType::CCIX, "CCIX"}, 156 {SystemInterfaceType::CXL, "CXL"}, 157 {SystemInterfaceType::OEM, "OEM"}, 158 }); 159 160 NLOHMANN_JSON_SERIALIZE_ENUM(TurboState, { 161 {TurboState::Invalid, "Invalid"}, 162 {TurboState::Enabled, "Enabled"}, 163 {TurboState::Disabled, "Disabled"}, 164 }); 165 166 NLOHMANN_JSON_SERIALIZE_ENUM(BaseSpeedPriorityState, { 167 {BaseSpeedPriorityState::Invalid, "Invalid"}, 168 {BaseSpeedPriorityState::Enabled, "Enabled"}, 169 {BaseSpeedPriorityState::Disabled, "Disabled"}, 170 }); 171 172 NLOHMANN_JSON_SERIALIZE_ENUM(ThrottleCause, { 173 {ThrottleCause::Invalid, "Invalid"}, 174 {ThrottleCause::PowerLimit, "PowerLimit"}, 175 {ThrottleCause::ThermalLimit, "ThermalLimit"}, 176 {ThrottleCause::ClockLimit, "ClockLimit"}, 177 {ThrottleCause::ManagementDetectedFault, "ManagementDetectedFault"}, 178 {ThrottleCause::Unknown, "Unknown"}, 179 {ThrottleCause::OEM, "OEM"}, 180 }); 181 182 } 183 // clang-format on 184