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