1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #pragma once 4 #include <nlohmann/json.hpp> 5 6 namespace memory 7 { 8 // clang-format off 9 10 enum class MemoryType{ 11 Invalid, 12 DRAM, 13 NVDIMM_N, 14 NVDIMM_F, 15 NVDIMM_P, 16 IntelOptane, 17 Cache, 18 }; 19 20 enum class MemoryDeviceType{ 21 Invalid, 22 DDR, 23 DDR2, 24 DDR3, 25 DDR4, 26 DDR4_SDRAM, 27 DDR4E_SDRAM, 28 LPDDR4_SDRAM, 29 DDR3_SDRAM, 30 LPDDR3_SDRAM, 31 DDR2_SDRAM, 32 DDR2_SDRAM_FB_DIMM, 33 DDR2_SDRAM_FB_DIMM_PROBE, 34 DDR_SGRAM, 35 DDR_SDRAM, 36 ROM, 37 SDRAM, 38 EDO, 39 FastPageMode, 40 PipelinedNibble, 41 Logical, 42 HBM, 43 HBM2, 44 HBM2E, 45 HBM3, 46 GDDR, 47 GDDR2, 48 GDDR3, 49 GDDR4, 50 GDDR5, 51 GDDR5X, 52 GDDR6, 53 DDR5, 54 OEM, 55 LPDDR5_SDRAM, 56 }; 57 58 enum class BaseModuleType{ 59 Invalid, 60 RDIMM, 61 UDIMM, 62 SO_DIMM, 63 LRDIMM, 64 Mini_RDIMM, 65 Mini_UDIMM, 66 SO_RDIMM_72b, 67 SO_UDIMM_72b, 68 SO_DIMM_16b, 69 SO_DIMM_32b, 70 Die, 71 }; 72 73 enum class MemoryMedia{ 74 Invalid, 75 DRAM, 76 NAND, 77 Intel3DXPoint, 78 Proprietary, 79 }; 80 81 enum class SecurityStates{ 82 Invalid, 83 Enabled, 84 Disabled, 85 Unlocked, 86 Locked, 87 Frozen, 88 Passphraselimit, 89 }; 90 91 enum class ErrorCorrection{ 92 Invalid, 93 NoECC, 94 SingleBitECC, 95 MultiBitECC, 96 AddressParity, 97 }; 98 99 enum class MemoryClassification{ 100 Invalid, 101 Volatile, 102 ByteAccessiblePersistent, 103 Block, 104 }; 105 106 enum class OperatingMemoryModes{ 107 Invalid, 108 Volatile, 109 PMEM, 110 Block, 111 }; 112 113 NLOHMANN_JSON_SERIALIZE_ENUM(MemoryType, { 114 {MemoryType::Invalid, "Invalid"}, 115 {MemoryType::DRAM, "DRAM"}, 116 {MemoryType::NVDIMM_N, "NVDIMM_N"}, 117 {MemoryType::NVDIMM_F, "NVDIMM_F"}, 118 {MemoryType::NVDIMM_P, "NVDIMM_P"}, 119 {MemoryType::IntelOptane, "IntelOptane"}, 120 {MemoryType::Cache, "Cache"}, 121 }); 122 123 NLOHMANN_JSON_SERIALIZE_ENUM(MemoryDeviceType, { 124 {MemoryDeviceType::Invalid, "Invalid"}, 125 {MemoryDeviceType::DDR, "DDR"}, 126 {MemoryDeviceType::DDR2, "DDR2"}, 127 {MemoryDeviceType::DDR3, "DDR3"}, 128 {MemoryDeviceType::DDR4, "DDR4"}, 129 {MemoryDeviceType::DDR4_SDRAM, "DDR4_SDRAM"}, 130 {MemoryDeviceType::DDR4E_SDRAM, "DDR4E_SDRAM"}, 131 {MemoryDeviceType::LPDDR4_SDRAM, "LPDDR4_SDRAM"}, 132 {MemoryDeviceType::DDR3_SDRAM, "DDR3_SDRAM"}, 133 {MemoryDeviceType::LPDDR3_SDRAM, "LPDDR3_SDRAM"}, 134 {MemoryDeviceType::DDR2_SDRAM, "DDR2_SDRAM"}, 135 {MemoryDeviceType::DDR2_SDRAM_FB_DIMM, "DDR2_SDRAM_FB_DIMM"}, 136 {MemoryDeviceType::DDR2_SDRAM_FB_DIMM_PROBE, "DDR2_SDRAM_FB_DIMM_PROBE"}, 137 {MemoryDeviceType::DDR_SGRAM, "DDR_SGRAM"}, 138 {MemoryDeviceType::DDR_SDRAM, "DDR_SDRAM"}, 139 {MemoryDeviceType::ROM, "ROM"}, 140 {MemoryDeviceType::SDRAM, "SDRAM"}, 141 {MemoryDeviceType::EDO, "EDO"}, 142 {MemoryDeviceType::FastPageMode, "FastPageMode"}, 143 {MemoryDeviceType::PipelinedNibble, "PipelinedNibble"}, 144 {MemoryDeviceType::Logical, "Logical"}, 145 {MemoryDeviceType::HBM, "HBM"}, 146 {MemoryDeviceType::HBM2, "HBM2"}, 147 {MemoryDeviceType::HBM2E, "HBM2E"}, 148 {MemoryDeviceType::HBM3, "HBM3"}, 149 {MemoryDeviceType::GDDR, "GDDR"}, 150 {MemoryDeviceType::GDDR2, "GDDR2"}, 151 {MemoryDeviceType::GDDR3, "GDDR3"}, 152 {MemoryDeviceType::GDDR4, "GDDR4"}, 153 {MemoryDeviceType::GDDR5, "GDDR5"}, 154 {MemoryDeviceType::GDDR5X, "GDDR5X"}, 155 {MemoryDeviceType::GDDR6, "GDDR6"}, 156 {MemoryDeviceType::DDR5, "DDR5"}, 157 {MemoryDeviceType::OEM, "OEM"}, 158 {MemoryDeviceType::LPDDR5_SDRAM, "LPDDR5_SDRAM"}, 159 }); 160 161 NLOHMANN_JSON_SERIALIZE_ENUM(BaseModuleType, { 162 {BaseModuleType::Invalid, "Invalid"}, 163 {BaseModuleType::RDIMM, "RDIMM"}, 164 {BaseModuleType::UDIMM, "UDIMM"}, 165 {BaseModuleType::SO_DIMM, "SO_DIMM"}, 166 {BaseModuleType::LRDIMM, "LRDIMM"}, 167 {BaseModuleType::Mini_RDIMM, "Mini_RDIMM"}, 168 {BaseModuleType::Mini_UDIMM, "Mini_UDIMM"}, 169 {BaseModuleType::SO_RDIMM_72b, "SO_RDIMM_72b"}, 170 {BaseModuleType::SO_UDIMM_72b, "SO_UDIMM_72b"}, 171 {BaseModuleType::SO_DIMM_16b, "SO_DIMM_16b"}, 172 {BaseModuleType::SO_DIMM_32b, "SO_DIMM_32b"}, 173 {BaseModuleType::Die, "Die"}, 174 }); 175 176 NLOHMANN_JSON_SERIALIZE_ENUM(MemoryMedia, { 177 {MemoryMedia::Invalid, "Invalid"}, 178 {MemoryMedia::DRAM, "DRAM"}, 179 {MemoryMedia::NAND, "NAND"}, 180 {MemoryMedia::Intel3DXPoint, "Intel3DXPoint"}, 181 {MemoryMedia::Proprietary, "Proprietary"}, 182 }); 183 184 NLOHMANN_JSON_SERIALIZE_ENUM(SecurityStates, { 185 {SecurityStates::Invalid, "Invalid"}, 186 {SecurityStates::Enabled, "Enabled"}, 187 {SecurityStates::Disabled, "Disabled"}, 188 {SecurityStates::Unlocked, "Unlocked"}, 189 {SecurityStates::Locked, "Locked"}, 190 {SecurityStates::Frozen, "Frozen"}, 191 {SecurityStates::Passphraselimit, "Passphraselimit"}, 192 }); 193 194 NLOHMANN_JSON_SERIALIZE_ENUM(ErrorCorrection, { 195 {ErrorCorrection::Invalid, "Invalid"}, 196 {ErrorCorrection::NoECC, "NoECC"}, 197 {ErrorCorrection::SingleBitECC, "SingleBitECC"}, 198 {ErrorCorrection::MultiBitECC, "MultiBitECC"}, 199 {ErrorCorrection::AddressParity, "AddressParity"}, 200 }); 201 202 NLOHMANN_JSON_SERIALIZE_ENUM(MemoryClassification, { 203 {MemoryClassification::Invalid, "Invalid"}, 204 {MemoryClassification::Volatile, "Volatile"}, 205 {MemoryClassification::ByteAccessiblePersistent, "ByteAccessiblePersistent"}, 206 {MemoryClassification::Block, "Block"}, 207 }); 208 209 NLOHMANN_JSON_SERIALIZE_ENUM(OperatingMemoryModes, { 210 {OperatingMemoryModes::Invalid, "Invalid"}, 211 {OperatingMemoryModes::Volatile, "Volatile"}, 212 {OperatingMemoryModes::PMEM, "PMEM"}, 213 {OperatingMemoryModes::Block, "Block"}, 214 }); 215 216 } 217 // clang-format on 218