blob: f5068c975cb6066311a528ee8e4eca07f2af60d2 [file] [log] [blame]
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -05001#pragma once
2
3#include <cstdint>
4#include <iostream>
Anupama B R657aaa82025-10-30 04:12:24 -05005#include <vector>
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -05006namespace vpd
7{
8namespace constants
9{
10static constexpr auto KEYWORD_SIZE = 2;
11static constexpr auto RECORD_SIZE = 4;
12
13static constexpr uint8_t IPZ_DATA_START = 11;
14static constexpr uint8_t IPZ_DATA_START_TAG = 0x84;
15static constexpr uint8_t IPZ_RECORD_END_TAG = 0x78;
16
17static constexpr uint8_t KW_VPD_DATA_START = 0;
18static constexpr uint8_t KW_VPD_START_TAG = 0x82;
19static constexpr uint8_t KW_VPD_PAIR_START_TAG = 0x84;
20static constexpr uint8_t ALT_KW_VPD_PAIR_START_TAG = 0x90;
21static constexpr uint8_t KW_VPD_END_TAG = 0x78;
22static constexpr uint8_t KW_VAL_PAIR_END_TAG = 0x79;
23static constexpr uint8_t AMM_ENABLED_IN_VPD = 2;
24static constexpr uint8_t AMM_DISABLED_IN_VPD = 1;
25
26static constexpr auto DDIMM_11S_BARCODE_START = 416;
27static constexpr auto DDIMM_11S_BARCODE_START_TAG = "11S";
28static constexpr auto DDIMM_11S_FORMAT_LEN = 3;
29static constexpr auto DDIMM_11S_BARCODE_LEN = 26;
30static constexpr auto PART_NUM_LEN = 7;
31static constexpr auto SERIAL_NUM_LEN = 12;
32static constexpr auto CCIN_LEN = 4;
33static constexpr auto CONVERT_MB_TO_KB = 1024;
34static constexpr auto CONVERT_GB_TO_KB = 1024 * 1024;
35
36static constexpr auto SPD_BYTE_2 = 2;
37static constexpr auto SPD_BYTE_3 = 3;
38static constexpr auto SPD_BYTE_4 = 4;
39static constexpr auto SPD_BYTE_6 = 6;
40static constexpr auto SPD_BYTE_12 = 12;
41static constexpr auto SPD_BYTE_13 = 13;
42static constexpr auto SPD_BYTE_18 = 18;
43static constexpr auto SPD_BYTE_234 = 234;
44static constexpr auto SPD_BYTE_235 = 235;
45static constexpr auto SPD_BYTE_BIT_0_3_MASK = 0x0F;
46static constexpr auto SPD_BYTE_MASK = 0xFF;
47static constexpr auto SPD_MODULE_TYPE_DDIMM = 0x0A;
48static constexpr auto SPD_DRAM_TYPE_DDR5 = 0x12;
49static constexpr auto SPD_DRAM_TYPE_DDR4 = 0x0C;
50
51static constexpr auto JEDEC_SDRAM_CAP_MASK = 0x0F;
52static constexpr auto JEDEC_PRI_BUS_WIDTH_MASK = 0x07;
53static constexpr auto JEDEC_SDRAM_WIDTH_MASK = 0x07;
54static constexpr auto JEDEC_NUM_RANKS_MASK = 0x38;
55static constexpr auto JEDEC_DIE_COUNT_MASK = 0x70;
56static constexpr auto JEDEC_SINGLE_LOAD_STACK = 0x02;
57static constexpr auto JEDEC_SIGNAL_LOADING_MASK = 0x03;
58
59static constexpr auto JEDEC_SDRAMCAP_MULTIPLIER = 256;
60static constexpr auto JEDEC_PRI_BUS_WIDTH_MULTIPLIER = 8;
61static constexpr auto JEDEC_SDRAM_WIDTH_MULTIPLIER = 4;
62static constexpr auto JEDEC_SDRAMCAP_RESERVED = 7;
63static constexpr auto JEDEC_RESERVED_BITS = 3;
64static constexpr auto JEDEC_DIE_COUNT_RIGHT_SHIFT = 4;
65
66static constexpr auto LAST_KW = "PF";
67static constexpr auto POUND_KW = '#';
68static constexpr auto POUND_KW_PREFIX = "PD_";
69static constexpr auto MB_YEAR_END = 4;
70static constexpr auto MB_MONTH_END = 7;
71static constexpr auto MB_DAY_END = 10;
72static constexpr auto MB_HOUR_END = 13;
73static constexpr auto MB_MIN_END = 16;
74static constexpr auto MB_RESULT_LEN = 19;
75static constexpr auto MB_LEN_BYTES = 8;
76static constexpr auto UUID_LEN_BYTES = 16;
77static constexpr auto UUID_TIME_LOW_END = 8;
78static constexpr auto UUID_TIME_MID_END = 13;
79static constexpr auto UUID_TIME_HIGH_END = 18;
80static constexpr auto UUID_CLK_SEQ_END = 23;
81static constexpr auto MAC_ADDRESS_LEN_BYTES = 6;
82static constexpr auto ONE_BYTE = 1;
83static constexpr auto TWO_BYTES = 2;
84
85static constexpr auto VALUE_0 = 0;
86static constexpr auto VALUE_1 = 1;
87static constexpr auto VALUE_2 = 2;
88static constexpr auto VALUE_3 = 3;
89static constexpr auto VALUE_4 = 4;
90static constexpr auto VALUE_5 = 5;
91static constexpr auto VALUE_6 = 6;
92static constexpr auto VALUE_7 = 7;
93static constexpr auto VALUE_8 = 8;
Sunny Srivastava78c91072025-02-05 14:09:50 +053094static constexpr auto VALUE_21 = 21;
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -050095
96static constexpr auto MASK_BYTE_BITS_01 = 0x03;
97static constexpr auto MASK_BYTE_BITS_345 = 0x38;
98static constexpr auto MASK_BYTE_BITS_012 = 0x07;
99static constexpr auto MASK_BYTE_BITS_567 = 0xE0;
100static constexpr auto MASK_BYTE_BITS_01234 = 0x1F;
101
102static constexpr auto MASK_BYTE_BIT_6 = 0x40;
103static constexpr auto MASK_BYTE_BIT_7 = 0x80;
104
105static constexpr auto SHIFT_BITS_0 = 0;
106static constexpr auto SHIFT_BITS_3 = 3;
107static constexpr auto SHIFT_BITS_5 = 5;
108
109static constexpr auto ASCII_OF_SPACE = 32;
110
111// Size of 8 EQs' in CP00's PG keyword
112static constexpr auto SIZE_OF_8EQ_IN_PG = 24;
113
114// Zero based index position of first EQ in CP00's PG keyword
115static constexpr auto INDEX_OF_EQ0_IN_PG = 97;
116
Sunny Srivastavac6ef42d2025-02-19 19:17:10 +0530117static constexpr auto HEX_VALUE_50 = 0x50;
118static constexpr auto HEX_VALUE_30 = 0x30;
119static constexpr auto HEX_VALUE_10 = 0x10;
120static constexpr auto HEX_VALUE_00 = 0x00;
121
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500122constexpr auto systemInvPath = "/xyz/openbmc_project/inventory/system";
123constexpr auto pimPath = "/xyz/openbmc_project/inventory";
124constexpr auto pimIntf = "xyz.openbmc_project.Inventory.Manager";
125constexpr auto ipzVpdInf = "com.ibm.ipzvpd.";
126constexpr auto kwdVpdInf = "com.ibm.ipzvpd.VINI";
127constexpr auto vsysInf = "com.ibm.ipzvpd.VSYS";
128constexpr auto utilInf = "com.ibm.ipzvpd.UTIL";
129constexpr auto vcenInf = "com.ibm.ipzvpd.VCEN";
Sunny Srivastava78c91072025-02-05 14:09:50 +0530130constexpr auto viniInf = "com.ibm.ipzvpd.VINI";
131constexpr auto vsbpInf = "com.ibm.ipzvpd.VSBP";
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500132constexpr auto kwdCCIN = "CC";
133constexpr auto kwdRG = "RG";
Jinu Joy Thomas2bbe7f32025-09-26 00:05:53 -0500134constexpr auto kwdAMM = "MM";
Jinu Joy Thomas71fd2792025-09-25 03:49:42 -0500135constexpr auto kwdClearNVRAM_CreateLPAR = "BA";
136constexpr auto kwdKeepAndClear = "BA";
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500137constexpr auto kwdFC = "FC";
138constexpr auto kwdTM = "TM";
139constexpr auto kwdSE = "SE";
Sunny Srivastava78c91072025-02-05 14:09:50 +0530140constexpr auto kwdHW = "HW";
141constexpr auto kwdIM = "IM";
Sunny Srivastava022112b2025-02-19 19:53:29 +0530142constexpr auto kwdPN = "PN";
Sunny Srivastava22793832025-03-20 12:09:09 +0530143constexpr auto kwdFN = "FN";
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500144constexpr auto recVSYS = "VSYS";
145constexpr auto recVCEN = "VCEN";
RekhaAparna01d3e693e2025-03-04 05:08:30 -0600146constexpr auto recVSBP = "VSBP";
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500147constexpr auto locationCodeInf = "com.ibm.ipzvpd.Location";
148constexpr auto xyzLocationCodeInf =
149 "xyz.openbmc_project.Inventory.Decorator.LocationCode";
150constexpr auto operationalStatusInf =
151 "xyz.openbmc_project.State.Decorator.OperationalStatus";
152constexpr auto enableInf = "xyz.openbmc_project.Object.Enable";
153constexpr auto assetInf = "xyz.openbmc_project.Inventory.Decorator.Asset";
154constexpr auto inventoryItemInf = "xyz.openbmc_project.Inventory.Item";
155constexpr auto pldmServiceName = "xyz.openbmc_project.PLDM";
156constexpr auto pimServiceName = "xyz.openbmc_project.Inventory.Manager";
157constexpr auto biosConfigMgrObjPath =
158 "/xyz/openbmc_project/bios_config/manager";
159constexpr auto biosConfigMgrService = "xyz.openbmc_project.BIOSConfigManager";
160constexpr auto biosConfigMgrInterface =
161 "xyz.openbmc_project.BIOSConfig.Manager";
162constexpr auto objectMapperService = "xyz.openbmc_project.ObjectMapper";
163constexpr auto objectMapperPath = "/xyz/openbmc_project/object_mapper";
164constexpr auto objectMapperInf = "xyz.openbmc_project.ObjectMapper";
165constexpr auto systemVpdInvPath =
166 "/xyz/openbmc_project/inventory/system/chassis/motherboard";
167constexpr auto assetTagInf = "xyz.openbmc_project.Inventory.Decorator.AssetTag";
168constexpr auto hostObjectPath = "/xyz/openbmc_project/state/host0";
169constexpr auto hostInterface = "xyz.openbmc_project.State.Host";
170constexpr auto hostService = "xyz.openbmc_project.State.Host";
171constexpr auto hostRunningState =
172 "xyz.openbmc_project.State.Host.HostState.Running";
Sunny Srivastavac6ef42d2025-02-19 19:17:10 +0530173constexpr auto imageUpdateService = "xyz.openbmc_project.Software.BMC.Updater";
174constexpr auto imagePrirotyInf =
175 "xyz.openbmc_project.Software.RedundancyPriority";
176constexpr auto imageExtendedVerInf =
177 "xyz.openbmc_project.Software.ExtendedVersion";
178constexpr auto functionalImageObjPath =
179 "/xyz/openbmc_project/software/functional";
180constexpr auto associationInterface = "xyz.openbmc_project.Association";
181constexpr auto powerVsImagePrefix_MY = "MY";
182constexpr auto powerVsImagePrefix_MZ = "MZ";
183constexpr auto powerVsImagePrefix_NY = "NY";
184constexpr auto powerVsImagePrefix_NZ = "NZ";
Souvik Roy0f370432025-04-08 01:55:58 -0500185constexpr auto badVpdDir = "/var/lib/vpd/dumps/";
Sunny Srivastavac6ef42d2025-02-19 19:17:10 +0530186
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500187static constexpr auto BD_YEAR_END = 4;
188static constexpr auto BD_MONTH_END = 7;
189static constexpr auto BD_DAY_END = 10;
190static constexpr auto BD_HOUR_END = 13;
191
192constexpr uint8_t UNEXP_LOCATION_CODE_MIN_LENGTH = 4;
193constexpr uint8_t EXP_LOCATION_CODE_MIN_LENGTH = 17;
194static constexpr auto SE_KWD_LENGTH = 7;
195static constexpr auto INVALID_NODE_NUMBER = -1;
196
197static constexpr auto CMD_BUFFER_LENGTH = 256;
198
199// To be explicitly used for string comparision.
200static constexpr auto STR_CMP_SUCCESS = 0;
201
202// Just a random value. Can be adjusted as required.
203static constexpr uint8_t MAX_THREADS = 10;
204
205static constexpr auto FAILURE = -1;
206static constexpr auto SUCCESS = 0;
207
208constexpr auto bmcStateService = "xyz.openbmc_project.State.BMC";
209constexpr auto bmcZeroStateObject = "/xyz/openbmc_project/state/bmc0";
210constexpr auto bmcStateInterface = "xyz.openbmc_project.State.BMC";
211constexpr auto currentBMCStateProperty = "CurrentBMCState";
212constexpr auto bmcReadyState = "xyz.openbmc_project.State.BMC.BMCState.Ready";
213
214static constexpr auto eventLoggingServiceName = "xyz.openbmc_project.Logging";
215static constexpr auto eventLoggingObjectPath = "/xyz/openbmc_project/logging";
216static constexpr auto eventLoggingInterface =
217 "xyz.openbmc_project.Logging.Create";
218
219static constexpr auto systemdService = "org.freedesktop.systemd1";
220static constexpr auto systemdObjectPath = "/org/freedesktop/systemd1";
221static constexpr auto systemdManagerInterface =
222 "org.freedesktop.systemd1.Manager";
Priyanga Ramasamy1aad7832024-12-12 22:13:52 -0600223
Anupama B R5cd1b2d2025-08-05 04:57:40 -0500224static constexpr auto vpdCollectionInterface =
225 "xyz.openbmc_project.Common.Progress";
Priyanga Ramasamy1aad7832024-12-12 22:13:52 -0600226
Anupama B R0d631232025-09-15 12:10:46 -0500227// enumerated values of collection Status D-bus property defined under
228// xyz.openbmc_project.Common.Progress interface.
Anupama B R5cd1b2d2025-08-05 04:57:40 -0500229static constexpr auto vpdCollectionCompleted =
230 "xyz.openbmc_project.Common.Progress.OperationStatus.Completed";
231static constexpr auto vpdCollectionFailed =
232 "xyz.openbmc_project.Common.Progress.OperationStatus.Failed";
Priyanga Ramasamy1aad7832024-12-12 22:13:52 -0600233static constexpr auto vpdCollectionInProgress =
Anupama B R5cd1b2d2025-08-05 04:57:40 -0500234 "xyz.openbmc_project.Common.Progress.OperationStatus.InProgress";
Priyanga Ramasamy1aad7832024-12-12 22:13:52 -0600235static constexpr auto vpdCollectionNotStarted =
Anupama B R5cd1b2d2025-08-05 04:57:40 -0500236 "xyz.openbmc_project.Common.Progress.OperationStatus.NotStarted";
Sunny Srivastava022112b2025-02-19 19:53:29 +0530237static constexpr auto power_vs_50003_json =
238 "/usr/share/vpd/50003_power_vs.json";
239static constexpr auto power_vs_50001_json =
240 "/usr/share/vpd/50001_power_vs.json";
Souvik Roy3d4af4a2025-06-23 04:45:27 -0500241static constexpr auto correlatedPropJsonFile =
242 "/usr/share/vpd/correlated_properties.json";
Anupama B R657aaa82025-10-30 04:12:24 -0500243
244static constexpr auto rbmcPositionInterface =
245 "xyz.openbmc_project.Inventory.Decorator.Position";
246static std::vector<uint8_t> rbmcPrototypeSystemImValue{
247 55, 54, 48, 48, 50, 48, 48, 48};
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500248} // namespace constants
249} // namespace vpd