sel: Add OEM SEL Record data structure
The code only supports SEL Event Records. Re-define the data structure
to use union to support different kinds of SEL records:
* SEL Event Records
* OEM SEL Record, type C0-DF
* OEM SEL Record, type E0-FF
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I7cf69c3e1d47664815c029308a52c62049c8e691
diff --git a/selutility.hpp b/selutility.hpp
index 49ec1b7..06fc453 100644
--- a/selutility.hpp
+++ b/selutility.hpp
@@ -60,13 +60,14 @@
uint8_t readLength; //!< Bytes to read.
} __attribute__((packed));
-/** @struct GetSELEntryResponse
+constexpr size_t SELRecordLength = 16;
+
+/** @struct SELEventRecord
*
- * IPMI payload for Get SEL Entry command response.
+ * IPMI SEL Event Record
*/
-struct GetSELEntryResponse
+struct SELEventRecord
{
- uint16_t nextRecordID; //!< Next RecordID.
uint16_t recordID; //!< Record ID.
uint8_t recordType; //!< Record Type.
uint32_t timeStamp; //!< Timestamp.
@@ -80,6 +81,56 @@
uint8_t eventData3; //!< Event Data 3.
} __attribute__((packed));
+static_assert(sizeof(SELEventRecord) == SELRecordLength);
+
+/** @struct SELOEMRecordTypeCD
+ *
+ * IPMI SEL OEM Record - Type C0h-DFh
+ */
+struct SELOEMRecordTypeCD
+{
+ uint16_t recordID; //!< Record ID.
+ uint8_t recordType; //!< Record Type.
+ uint32_t timeStamp; //!< Timestamp.
+ uint8_t manufacturerID[3]; //!< Manufacturer ID.
+ uint8_t oemDefined[6]; //!< OEM Defined data.
+} __attribute__((packed));
+
+static_assert(sizeof(SELOEMRecordTypeCD) == SELRecordLength);
+
+/** @struct SELOEMRecordTypeEF
+ *
+ * IPMI SEL OEM Record - Type E0h-FFh
+ */
+struct SELOEMRecordTypeEF
+{
+ uint16_t recordID; //!< Record ID.
+ uint8_t recordType; //!< Record Type.
+ uint8_t oemDefined[13]; //!< OEM Defined data.
+} __attribute__((packed));
+
+static_assert(sizeof(SELOEMRecordTypeEF) == SELRecordLength);
+
+union SELEventRecordFormat
+{
+ SELEventRecord eventRecord;
+ SELOEMRecordTypeCD oemCD;
+ SELOEMRecordTypeEF oemEF;
+};
+
+/** @struct GetSELEntryResponse
+ *
+ * IPMI payload for Get SEL Entry command response.
+ */
+struct GetSELEntryResponse
+{
+ uint16_t nextRecordID; //!< Next RecordID.
+ SELEventRecordFormat event; // !< The Event Record.
+} __attribute__((packed));
+
+static_assert(sizeof(GetSELEntryResponse) ==
+ SELRecordLength + sizeof(uint16_t));
+
static constexpr auto initiateErase = 0xAA;
static constexpr auto getEraseStatus = 0x00;
static constexpr auto eraseComplete = 0x01;