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