1*fa5e4d32SSunny Srivastava #pragma once 2*fa5e4d32SSunny Srivastava 3*fa5e4d32SSunny Srivastava #include <cstdint> 4*fa5e4d32SSunny Srivastava #include <iostream> 5*fa5e4d32SSunny Srivastava namespace vpd 6*fa5e4d32SSunny Srivastava { 7*fa5e4d32SSunny Srivastava namespace constants 8*fa5e4d32SSunny Srivastava { 9*fa5e4d32SSunny Srivastava static constexpr auto KEYWORD_SIZE = 2; 10*fa5e4d32SSunny Srivastava static constexpr auto RECORD_SIZE = 4; 11*fa5e4d32SSunny Srivastava 12*fa5e4d32SSunny Srivastava static constexpr uint8_t IPZ_DATA_START = 11; 13*fa5e4d32SSunny Srivastava static constexpr uint8_t IPZ_DATA_START_TAG = 0x84; 14*fa5e4d32SSunny Srivastava static constexpr uint8_t IPZ_RECORD_END_TAG = 0x78; 15*fa5e4d32SSunny Srivastava 16*fa5e4d32SSunny Srivastava static constexpr uint8_t KW_VPD_DATA_START = 0; 17*fa5e4d32SSunny Srivastava static constexpr uint8_t KW_VPD_START_TAG = 0x82; 18*fa5e4d32SSunny Srivastava static constexpr uint8_t KW_VPD_PAIR_START_TAG = 0x84; 19*fa5e4d32SSunny Srivastava static constexpr uint8_t ALT_KW_VPD_PAIR_START_TAG = 0x90; 20*fa5e4d32SSunny Srivastava static constexpr uint8_t KW_VPD_END_TAG = 0x78; 21*fa5e4d32SSunny Srivastava static constexpr uint8_t KW_VAL_PAIR_END_TAG = 0x79; 22*fa5e4d32SSunny Srivastava static constexpr uint8_t AMM_ENABLED_IN_VPD = 2; 23*fa5e4d32SSunny Srivastava static constexpr uint8_t AMM_DISABLED_IN_VPD = 1; 24*fa5e4d32SSunny Srivastava 25*fa5e4d32SSunny Srivastava static constexpr auto DDIMM_11S_BARCODE_START = 416; 26*fa5e4d32SSunny Srivastava static constexpr auto DDIMM_11S_BARCODE_START_TAG = "11S"; 27*fa5e4d32SSunny Srivastava static constexpr auto DDIMM_11S_FORMAT_LEN = 3; 28*fa5e4d32SSunny Srivastava static constexpr auto DDIMM_11S_BARCODE_LEN = 26; 29*fa5e4d32SSunny Srivastava static constexpr auto PART_NUM_LEN = 7; 30*fa5e4d32SSunny Srivastava static constexpr auto SERIAL_NUM_LEN = 12; 31*fa5e4d32SSunny Srivastava static constexpr auto CCIN_LEN = 4; 32*fa5e4d32SSunny Srivastava static constexpr auto CONVERT_MB_TO_KB = 1024; 33*fa5e4d32SSunny Srivastava static constexpr auto CONVERT_GB_TO_KB = 1024 * 1024; 34*fa5e4d32SSunny Srivastava 35*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_2 = 2; 36*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_3 = 3; 37*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_4 = 4; 38*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_6 = 6; 39*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_12 = 12; 40*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_13 = 13; 41*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_18 = 18; 42*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_234 = 234; 43*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_235 = 235; 44*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_BIT_0_3_MASK = 0x0F; 45*fa5e4d32SSunny Srivastava static constexpr auto SPD_BYTE_MASK = 0xFF; 46*fa5e4d32SSunny Srivastava static constexpr auto SPD_MODULE_TYPE_DDIMM = 0x0A; 47*fa5e4d32SSunny Srivastava static constexpr auto SPD_DRAM_TYPE_DDR5 = 0x12; 48*fa5e4d32SSunny Srivastava static constexpr auto SPD_DRAM_TYPE_DDR4 = 0x0C; 49*fa5e4d32SSunny Srivastava 50*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SDRAM_CAP_MASK = 0x0F; 51*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_PRI_BUS_WIDTH_MASK = 0x07; 52*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SDRAM_WIDTH_MASK = 0x07; 53*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_NUM_RANKS_MASK = 0x38; 54*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_DIE_COUNT_MASK = 0x70; 55*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SINGLE_LOAD_STACK = 0x02; 56*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SIGNAL_LOADING_MASK = 0x03; 57*fa5e4d32SSunny Srivastava 58*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SDRAMCAP_MULTIPLIER = 256; 59*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_PRI_BUS_WIDTH_MULTIPLIER = 8; 60*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SDRAM_WIDTH_MULTIPLIER = 4; 61*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_SDRAMCAP_RESERVED = 7; 62*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_RESERVED_BITS = 3; 63*fa5e4d32SSunny Srivastava static constexpr auto JEDEC_DIE_COUNT_RIGHT_SHIFT = 4; 64*fa5e4d32SSunny Srivastava 65*fa5e4d32SSunny Srivastava static constexpr auto LAST_KW = "PF"; 66*fa5e4d32SSunny Srivastava static constexpr auto POUND_KW = '#'; 67*fa5e4d32SSunny Srivastava static constexpr auto POUND_KW_PREFIX = "PD_"; 68*fa5e4d32SSunny Srivastava static constexpr auto MB_YEAR_END = 4; 69*fa5e4d32SSunny Srivastava static constexpr auto MB_MONTH_END = 7; 70*fa5e4d32SSunny Srivastava static constexpr auto MB_DAY_END = 10; 71*fa5e4d32SSunny Srivastava static constexpr auto MB_HOUR_END = 13; 72*fa5e4d32SSunny Srivastava static constexpr auto MB_MIN_END = 16; 73*fa5e4d32SSunny Srivastava static constexpr auto MB_RESULT_LEN = 19; 74*fa5e4d32SSunny Srivastava static constexpr auto MB_LEN_BYTES = 8; 75*fa5e4d32SSunny Srivastava static constexpr auto UUID_LEN_BYTES = 16; 76*fa5e4d32SSunny Srivastava static constexpr auto UUID_TIME_LOW_END = 8; 77*fa5e4d32SSunny Srivastava static constexpr auto UUID_TIME_MID_END = 13; 78*fa5e4d32SSunny Srivastava static constexpr auto UUID_TIME_HIGH_END = 18; 79*fa5e4d32SSunny Srivastava static constexpr auto UUID_CLK_SEQ_END = 23; 80*fa5e4d32SSunny Srivastava static constexpr auto MAC_ADDRESS_LEN_BYTES = 6; 81*fa5e4d32SSunny Srivastava static constexpr auto ONE_BYTE = 1; 82*fa5e4d32SSunny Srivastava static constexpr auto TWO_BYTES = 2; 83*fa5e4d32SSunny Srivastava 84*fa5e4d32SSunny Srivastava static constexpr auto VALUE_0 = 0; 85*fa5e4d32SSunny Srivastava static constexpr auto VALUE_1 = 1; 86*fa5e4d32SSunny Srivastava static constexpr auto VALUE_2 = 2; 87*fa5e4d32SSunny Srivastava static constexpr auto VALUE_3 = 3; 88*fa5e4d32SSunny Srivastava static constexpr auto VALUE_4 = 4; 89*fa5e4d32SSunny Srivastava static constexpr auto VALUE_5 = 5; 90*fa5e4d32SSunny Srivastava static constexpr auto VALUE_6 = 6; 91*fa5e4d32SSunny Srivastava static constexpr auto VALUE_7 = 7; 92*fa5e4d32SSunny Srivastava static constexpr auto VALUE_8 = 8; 93*fa5e4d32SSunny Srivastava 94*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BITS_01 = 0x03; 95*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BITS_345 = 0x38; 96*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BITS_012 = 0x07; 97*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BITS_567 = 0xE0; 98*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BITS_01234 = 0x1F; 99*fa5e4d32SSunny Srivastava 100*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BIT_6 = 0x40; 101*fa5e4d32SSunny Srivastava static constexpr auto MASK_BYTE_BIT_7 = 0x80; 102*fa5e4d32SSunny Srivastava 103*fa5e4d32SSunny Srivastava static constexpr auto SHIFT_BITS_0 = 0; 104*fa5e4d32SSunny Srivastava static constexpr auto SHIFT_BITS_3 = 3; 105*fa5e4d32SSunny Srivastava static constexpr auto SHIFT_BITS_5 = 5; 106*fa5e4d32SSunny Srivastava 107*fa5e4d32SSunny Srivastava static constexpr auto ASCII_OF_SPACE = 32; 108*fa5e4d32SSunny Srivastava 109*fa5e4d32SSunny Srivastava // Size of 8 EQs' in CP00's PG keyword 110*fa5e4d32SSunny Srivastava static constexpr auto SIZE_OF_8EQ_IN_PG = 24; 111*fa5e4d32SSunny Srivastava 112*fa5e4d32SSunny Srivastava // Zero based index position of first EQ in CP00's PG keyword 113*fa5e4d32SSunny Srivastava static constexpr auto INDEX_OF_EQ0_IN_PG = 97; 114*fa5e4d32SSunny Srivastava 115*fa5e4d32SSunny Srivastava constexpr auto systemInvPath = "/xyz/openbmc_project/inventory/system"; 116*fa5e4d32SSunny Srivastava constexpr auto pimPath = "/xyz/openbmc_project/inventory"; 117*fa5e4d32SSunny Srivastava constexpr auto pimIntf = "xyz.openbmc_project.Inventory.Manager"; 118*fa5e4d32SSunny Srivastava constexpr auto ipzVpdInf = "com.ibm.ipzvpd."; 119*fa5e4d32SSunny Srivastava constexpr auto kwdVpdInf = "com.ibm.ipzvpd.VINI"; 120*fa5e4d32SSunny Srivastava constexpr auto vsysInf = "com.ibm.ipzvpd.VSYS"; 121*fa5e4d32SSunny Srivastava constexpr auto utilInf = "com.ibm.ipzvpd.UTIL"; 122*fa5e4d32SSunny Srivastava constexpr auto vcenInf = "com.ibm.ipzvpd.VCEN"; 123*fa5e4d32SSunny Srivastava constexpr auto kwdCCIN = "CC"; 124*fa5e4d32SSunny Srivastava constexpr auto kwdRG = "RG"; 125*fa5e4d32SSunny Srivastava constexpr auto kwdAMM = "D0"; 126*fa5e4d32SSunny Srivastava constexpr auto kwdClearNVRAM_CreateLPAR = "D1"; 127*fa5e4d32SSunny Srivastava constexpr auto kwdKeepAndClear = "D1"; 128*fa5e4d32SSunny Srivastava constexpr auto kwdFC = "FC"; 129*fa5e4d32SSunny Srivastava constexpr auto kwdTM = "TM"; 130*fa5e4d32SSunny Srivastava constexpr auto kwdSE = "SE"; 131*fa5e4d32SSunny Srivastava constexpr auto recVSYS = "VSYS"; 132*fa5e4d32SSunny Srivastava constexpr auto recVCEN = "VCEN"; 133*fa5e4d32SSunny Srivastava constexpr auto locationCodeInf = "com.ibm.ipzvpd.Location"; 134*fa5e4d32SSunny Srivastava constexpr auto xyzLocationCodeInf = 135*fa5e4d32SSunny Srivastava "xyz.openbmc_project.Inventory.Decorator.LocationCode"; 136*fa5e4d32SSunny Srivastava constexpr auto operationalStatusInf = 137*fa5e4d32SSunny Srivastava "xyz.openbmc_project.State.Decorator.OperationalStatus"; 138*fa5e4d32SSunny Srivastava constexpr auto enableInf = "xyz.openbmc_project.Object.Enable"; 139*fa5e4d32SSunny Srivastava constexpr auto assetInf = "xyz.openbmc_project.Inventory.Decorator.Asset"; 140*fa5e4d32SSunny Srivastava constexpr auto inventoryItemInf = "xyz.openbmc_project.Inventory.Item"; 141*fa5e4d32SSunny Srivastava constexpr auto pldmServiceName = "xyz.openbmc_project.PLDM"; 142*fa5e4d32SSunny Srivastava constexpr auto pimServiceName = "xyz.openbmc_project.Inventory.Manager"; 143*fa5e4d32SSunny Srivastava constexpr auto biosConfigMgrObjPath = 144*fa5e4d32SSunny Srivastava "/xyz/openbmc_project/bios_config/manager"; 145*fa5e4d32SSunny Srivastava constexpr auto biosConfigMgrService = "xyz.openbmc_project.BIOSConfigManager"; 146*fa5e4d32SSunny Srivastava constexpr auto biosConfigMgrInterface = 147*fa5e4d32SSunny Srivastava "xyz.openbmc_project.BIOSConfig.Manager"; 148*fa5e4d32SSunny Srivastava constexpr auto objectMapperService = "xyz.openbmc_project.ObjectMapper"; 149*fa5e4d32SSunny Srivastava constexpr auto objectMapperPath = "/xyz/openbmc_project/object_mapper"; 150*fa5e4d32SSunny Srivastava constexpr auto objectMapperInf = "xyz.openbmc_project.ObjectMapper"; 151*fa5e4d32SSunny Srivastava constexpr auto systemVpdInvPath = 152*fa5e4d32SSunny Srivastava "/xyz/openbmc_project/inventory/system/chassis/motherboard"; 153*fa5e4d32SSunny Srivastava constexpr auto assetTagInf = "xyz.openbmc_project.Inventory.Decorator.AssetTag"; 154*fa5e4d32SSunny Srivastava constexpr auto hostObjectPath = "/xyz/openbmc_project/state/host0"; 155*fa5e4d32SSunny Srivastava constexpr auto hostInterface = "xyz.openbmc_project.State.Host"; 156*fa5e4d32SSunny Srivastava constexpr auto hostService = "xyz.openbmc_project.State.Host"; 157*fa5e4d32SSunny Srivastava constexpr auto hostRunningState = 158*fa5e4d32SSunny Srivastava "xyz.openbmc_project.State.Host.HostState.Running"; 159*fa5e4d32SSunny Srivastava static constexpr auto BD_YEAR_END = 4; 160*fa5e4d32SSunny Srivastava static constexpr auto BD_MONTH_END = 7; 161*fa5e4d32SSunny Srivastava static constexpr auto BD_DAY_END = 10; 162*fa5e4d32SSunny Srivastava static constexpr auto BD_HOUR_END = 13; 163*fa5e4d32SSunny Srivastava 164*fa5e4d32SSunny Srivastava constexpr uint8_t UNEXP_LOCATION_CODE_MIN_LENGTH = 4; 165*fa5e4d32SSunny Srivastava constexpr uint8_t EXP_LOCATION_CODE_MIN_LENGTH = 17; 166*fa5e4d32SSunny Srivastava static constexpr auto SE_KWD_LENGTH = 7; 167*fa5e4d32SSunny Srivastava static constexpr auto INVALID_NODE_NUMBER = -1; 168*fa5e4d32SSunny Srivastava 169*fa5e4d32SSunny Srivastava static constexpr auto CMD_BUFFER_LENGTH = 256; 170*fa5e4d32SSunny Srivastava 171*fa5e4d32SSunny Srivastava // To be explicitly used for string comparision. 172*fa5e4d32SSunny Srivastava static constexpr auto STR_CMP_SUCCESS = 0; 173*fa5e4d32SSunny Srivastava 174*fa5e4d32SSunny Srivastava // Just a random value. Can be adjusted as required. 175*fa5e4d32SSunny Srivastava static constexpr uint8_t MAX_THREADS = 10; 176*fa5e4d32SSunny Srivastava 177*fa5e4d32SSunny Srivastava static constexpr auto FAILURE = -1; 178*fa5e4d32SSunny Srivastava static constexpr auto SUCCESS = 0; 179*fa5e4d32SSunny Srivastava 180*fa5e4d32SSunny Srivastava constexpr auto bmcStateService = "xyz.openbmc_project.State.BMC"; 181*fa5e4d32SSunny Srivastava constexpr auto bmcZeroStateObject = "/xyz/openbmc_project/state/bmc0"; 182*fa5e4d32SSunny Srivastava constexpr auto bmcStateInterface = "xyz.openbmc_project.State.BMC"; 183*fa5e4d32SSunny Srivastava constexpr auto currentBMCStateProperty = "CurrentBMCState"; 184*fa5e4d32SSunny Srivastava constexpr auto bmcReadyState = "xyz.openbmc_project.State.BMC.BMCState.Ready"; 185*fa5e4d32SSunny Srivastava 186*fa5e4d32SSunny Srivastava static constexpr auto eventLoggingServiceName = "xyz.openbmc_project.Logging"; 187*fa5e4d32SSunny Srivastava static constexpr auto eventLoggingObjectPath = "/xyz/openbmc_project/logging"; 188*fa5e4d32SSunny Srivastava static constexpr auto eventLoggingInterface = 189*fa5e4d32SSunny Srivastava "xyz.openbmc_project.Logging.Create"; 190*fa5e4d32SSunny Srivastava 191*fa5e4d32SSunny Srivastava static constexpr auto systemdService = "org.freedesktop.systemd1"; 192*fa5e4d32SSunny Srivastava static constexpr auto systemdObjectPath = "/org/freedesktop/systemd1"; 193*fa5e4d32SSunny Srivastava static constexpr auto systemdManagerInterface = 194*fa5e4d32SSunny Srivastava "org.freedesktop.systemd1.Manager"; 195*fa5e4d32SSunny Srivastava } // namespace constants 196*fa5e4d32SSunny Srivastava } // namespace vpd 197