blob: 5faf8da8ab0564132bc89381b4cf595272ae0763 [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;
93
94static constexpr auto MASK_BYTE_BITS_01 = 0x03;
95static constexpr auto MASK_BYTE_BITS_345 = 0x38;
96static constexpr auto MASK_BYTE_BITS_012 = 0x07;
97static constexpr auto MASK_BYTE_BITS_567 = 0xE0;
98static constexpr auto MASK_BYTE_BITS_01234 = 0x1F;
99
100static constexpr auto MASK_BYTE_BIT_6 = 0x40;
101static constexpr auto MASK_BYTE_BIT_7 = 0x80;
102
103static constexpr auto SHIFT_BITS_0 = 0;
104static constexpr auto SHIFT_BITS_3 = 3;
105static constexpr auto SHIFT_BITS_5 = 5;
106
107static constexpr auto ASCII_OF_SPACE = 32;
108
109// Size of 8 EQs' in CP00's PG keyword
110static constexpr auto SIZE_OF_8EQ_IN_PG = 24;
111
112// Zero based index position of first EQ in CP00's PG keyword
113static constexpr auto INDEX_OF_EQ0_IN_PG = 97;
114
115constexpr auto systemInvPath = "/xyz/openbmc_project/inventory/system";
116constexpr auto pimPath = "/xyz/openbmc_project/inventory";
117constexpr auto pimIntf = "xyz.openbmc_project.Inventory.Manager";
118constexpr auto ipzVpdInf = "com.ibm.ipzvpd.";
119constexpr auto kwdVpdInf = "com.ibm.ipzvpd.VINI";
120constexpr auto vsysInf = "com.ibm.ipzvpd.VSYS";
121constexpr auto utilInf = "com.ibm.ipzvpd.UTIL";
122constexpr auto vcenInf = "com.ibm.ipzvpd.VCEN";
123constexpr auto kwdCCIN = "CC";
124constexpr auto kwdRG = "RG";
125constexpr auto kwdAMM = "D0";
126constexpr auto kwdClearNVRAM_CreateLPAR = "D1";
127constexpr auto kwdKeepAndClear = "D1";
128constexpr auto kwdFC = "FC";
129constexpr auto kwdTM = "TM";
130constexpr auto kwdSE = "SE";
131constexpr auto recVSYS = "VSYS";
132constexpr auto recVCEN = "VCEN";
133constexpr auto locationCodeInf = "com.ibm.ipzvpd.Location";
134constexpr auto xyzLocationCodeInf =
135 "xyz.openbmc_project.Inventory.Decorator.LocationCode";
136constexpr auto operationalStatusInf =
137 "xyz.openbmc_project.State.Decorator.OperationalStatus";
138constexpr auto enableInf = "xyz.openbmc_project.Object.Enable";
139constexpr auto assetInf = "xyz.openbmc_project.Inventory.Decorator.Asset";
140constexpr auto inventoryItemInf = "xyz.openbmc_project.Inventory.Item";
141constexpr auto pldmServiceName = "xyz.openbmc_project.PLDM";
142constexpr auto pimServiceName = "xyz.openbmc_project.Inventory.Manager";
143constexpr auto biosConfigMgrObjPath =
144 "/xyz/openbmc_project/bios_config/manager";
145constexpr auto biosConfigMgrService = "xyz.openbmc_project.BIOSConfigManager";
146constexpr auto biosConfigMgrInterface =
147 "xyz.openbmc_project.BIOSConfig.Manager";
148constexpr auto objectMapperService = "xyz.openbmc_project.ObjectMapper";
149constexpr auto objectMapperPath = "/xyz/openbmc_project/object_mapper";
150constexpr auto objectMapperInf = "xyz.openbmc_project.ObjectMapper";
151constexpr auto systemVpdInvPath =
152 "/xyz/openbmc_project/inventory/system/chassis/motherboard";
153constexpr auto assetTagInf = "xyz.openbmc_project.Inventory.Decorator.AssetTag";
154constexpr auto hostObjectPath = "/xyz/openbmc_project/state/host0";
155constexpr auto hostInterface = "xyz.openbmc_project.State.Host";
156constexpr auto hostService = "xyz.openbmc_project.State.Host";
157constexpr auto hostRunningState =
158 "xyz.openbmc_project.State.Host.HostState.Running";
159static constexpr auto BD_YEAR_END = 4;
160static constexpr auto BD_MONTH_END = 7;
161static constexpr auto BD_DAY_END = 10;
162static constexpr auto BD_HOUR_END = 13;
163
164constexpr uint8_t UNEXP_LOCATION_CODE_MIN_LENGTH = 4;
165constexpr uint8_t EXP_LOCATION_CODE_MIN_LENGTH = 17;
166static constexpr auto SE_KWD_LENGTH = 7;
167static constexpr auto INVALID_NODE_NUMBER = -1;
168
169static constexpr auto CMD_BUFFER_LENGTH = 256;
170
171// To be explicitly used for string comparision.
172static constexpr auto STR_CMP_SUCCESS = 0;
173
174// Just a random value. Can be adjusted as required.
175static constexpr uint8_t MAX_THREADS = 10;
176
177static constexpr auto FAILURE = -1;
178static constexpr auto SUCCESS = 0;
179
180constexpr auto bmcStateService = "xyz.openbmc_project.State.BMC";
181constexpr auto bmcZeroStateObject = "/xyz/openbmc_project/state/bmc0";
182constexpr auto bmcStateInterface = "xyz.openbmc_project.State.BMC";
183constexpr auto currentBMCStateProperty = "CurrentBMCState";
184constexpr auto bmcReadyState = "xyz.openbmc_project.State.BMC.BMCState.Ready";
185
186static constexpr auto eventLoggingServiceName = "xyz.openbmc_project.Logging";
187static constexpr auto eventLoggingObjectPath = "/xyz/openbmc_project/logging";
188static constexpr auto eventLoggingInterface =
189 "xyz.openbmc_project.Logging.Create";
190
191static constexpr auto systemdService = "org.freedesktop.systemd1";
192static constexpr auto systemdObjectPath = "/org/freedesktop/systemd1";
193static constexpr auto systemdManagerInterface =
194 "org.freedesktop.systemd1.Manager";
195} // namespace constants
196} // namespace vpd