Common file to hold all constant values
This commit introduces a const.hpp file to hold all the
constants related to the openpower vpd repository.
All new and ongoing implementations can make use of this
file to declare or reuse constants.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: Ib93c1c264dc8c69198140d63318e7e132d33fb13
diff --git a/const.hpp b/const.hpp
new file mode 100644
index 0000000..b62621c
--- /dev/null
+++ b/const.hpp
@@ -0,0 +1,85 @@
+#pragma once
+
+#include <iostream>
+
+namespace openpower
+{
+namespace vpd
+{
+namespace constants
+{
+
+using RecordId = uint8_t;
+using RecordOffset = uint16_t;
+using RecordSize = uint16_t;
+using RecordType = uint16_t;
+using RecordLength = uint16_t;
+using KwSize = uint8_t;
+using PoundKwSize = uint16_t;
+using ECCOffset = uint16_t;
+using ECCLength = uint16_t;
+using LE2ByteData = uint16_t;
+
+static constexpr auto MAC_ADDRESS_LEN_BYTES = 6;
+static constexpr auto LAST_KW = "PF";
+static constexpr auto POUND_KW = '#';
+static constexpr auto UUID_LEN_BYTES = 16;
+static constexpr auto UUID_TIME_LOW_END = 8;
+static constexpr auto UUID_TIME_MID_END = 13;
+static constexpr auto UUID_TIME_HIGH_END = 18;
+static constexpr auto UUID_CLK_SEQ_END = 23;
+
+static constexpr auto MB_RESULT_LEN = 19;
+static constexpr auto MB_LEN_BYTES = 8;
+static constexpr auto MB_YEAR_END = 4;
+static constexpr auto MB_MONTH_END = 7;
+static constexpr auto MB_DAY_END = 10;
+static constexpr auto MB_HOUR_END = 13;
+static constexpr auto MB_MIN_END = 16;
+
+constexpr int IPZ_DATA_START = 11;
+constexpr uint8_t KW_VAL_PAIR_START_TAG = 0x84;
+constexpr uint8_t RECORD_END_TAG = 0x78;
+
+const std::string service = "xyz.openbmc_project.Inventory.Manager";
+const std::string VPD_OBJ_PATH_PREFIX = "/xyz/openbmc_project/inventory";
+
+namespace lengths
+{
+enum Lengths
+{
+ RECORD_NAME = 4,
+ KW_NAME = 2,
+ RECORD_OFFSET = 2,
+ RECORD_MIN = 44,
+ RECORD_LENGTH = 2,
+ RECORD_ECC_OFFSET = 2,
+ VHDR_ECC_LENGTH = 11,
+ VHDR_RECORD_LENGTH = 44
+}; // enum Lengths
+} // namespace lengths
+
+namespace offsets
+{
+enum Offsets
+{
+ VHDR = 17,
+ VHDR_TOC_ENTRY = 29,
+ VTOC_PTR = 35,
+ VTOC_DATA = 13,
+ VHDR_ECC = 0,
+ VHDR_RECORD = 11
+};
+} // namespace offsets
+
+namespace eccStatus
+{
+enum Status
+{
+ SUCCESS = 0,
+ FAILED = -1
+};
+} // namespace eccStatus
+} // namespace constants
+} // namespace vpd
+} // namespace openpower