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