Remove bitfields from the SEL record structures
Bitfields are not endian-safe, so this change removes the
bitfields from the SEL record structures and defines the
event direction as an offset.
Tested:
Confirmed that SEL events are still added and listed with the
correct assertion state.
Change-Id: I4b7428d28b2738f729612e6d793a61694853f89a
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/include/storagecommands.hpp b/include/storagecommands.hpp
index 946161b..3f7c401 100644
--- a/include/storagecommands.hpp
+++ b/include/storagecommands.hpp
@@ -119,8 +119,7 @@
uint8_t eventMsgRevision;
uint8_t sensorType;
uint8_t sensorNum;
- uint8_t eventType : 7;
- uint8_t eventDir : 1;
+ uint8_t eventType;
uint8_t eventData[intel_oem::ipmi::sel::systemEventSize];
} system;
struct
@@ -148,8 +147,7 @@
uint8_t eventMsgRevision;
uint8_t sensorType;
uint8_t sensorNum;
- uint8_t eventType : 7;
- uint8_t eventDir : 1;
+ uint8_t eventType;
uint8_t eventData[intel_oem::ipmi::sel::systemEventSize];
} system;
struct
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 33e4611..daf1fec 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -93,7 +93,8 @@
"xyz.openbmc_project.FruDevice";
constexpr static const size_t cacheTimeoutSeconds = 10;
-constexpr static const uint8_t deassertionEvent = 1;
+// event direction is bit[7] of eventType where 1b = Deassertion event
+constexpr static const uint8_t deassertionEvent = 0x80;
static std::vector<uint8_t> fruCache;
static uint8_t cacheBus = 0xFF;
@@ -852,7 +853,7 @@
// Set the event direction
if (eventDir == 0)
{
- record.record.system.eventDir = deassertionEvent;
+ record.record.system.eventType |= deassertionEvent;
}
std::vector<uint8_t> evtData;
@@ -983,7 +984,7 @@
req->record.system.eventData,
req->record.system.eventData +
intel_oem::ipmi::sel::systemEventSize);
- bool assert = req->record.system.eventDir ? false : true;
+ bool assert = !(req->record.system.eventType & deassertionEvent);
uint16_t genId = req->record.system.generatorID;
sdbusplus::message::message writeSEL = bus.new_method_call(
ipmiSELObject, ipmiSELPath, ipmiSELAddInterface, "IpmiSelAdd");