dbus-sdr: fix SEL record Generator ID to fit SPEC
- According the SEL Event Record format(IPMI SPEC Table 32),
the Generator ID has 2 bytes, and LUN is saved at the lowest
two bits in the High byte.
In the origin code, the LUN is saved in the low byte. It will
let the sensor name cannot be found when call sel elist like below:
~# ipmitool sel elist
1 | Pre-Init |0000000063| Power Unit #0x0d | AC lost | Asserted
2 | Pre-Init |0000000071| Power Unit #0x0d | Power off/down | Deasserted
~# ipmitool sel elist -v
Loading IANA PEN Registry...
Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
Invalid completion code received: Invalid command
Discovered IPMB address 0x0
SEL Record ID : 0001
Record Type : 02
Timestamp : 00:01:03 GMT 00:01:03 GMT
Generator ID : 0021
EvM Revision : 04
Sensor Type : Power Unit
Sensor Number : 0d
Event Type : Sensor-specific Discrete
Event Direction : Assertion Event
Event Data : 04ffff
Description : AC lost
SEL Record ID : 0002
Record Type : 02
Timestamp : 00:01:11 GMT 00:01:11 GMT
Generator ID : 0021
EvM Revision : 04
Sensor Type : Power Unit
Sensor Number : 0d
Event Type : Sensor-specific Discrete
Event Direction : Deassertion Event
Event Data : 00ffff
Description : Power off/down
After fixing Generator_Id problem:
~# ipmitool sel elist
1 | Pre-Init |0000000063| Power Unit chassis0 | AC lost | Asserted
2 | Pre-Init |0000000071| Power Unit chassis0 | Power off/down | Deasserted
~# ipmitool sel elist -v
Loading IANA PEN Registry...
Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
Invalid completion code received: Invalid command
Discovered IPMB address 0x0
SEL Record ID : 0001
Record Type : 02
Timestamp : 00:01:03 GMT 00:01:03 GMT
Generator ID : 0120
EvM Revision : 04
Sensor Type : Power Unit
Sensor Number : 0d
Event Type : Sensor-specific Discrete
Event Direction : Assertion Event
Event Data : 04ffff
Description : AC lost
SEL Record ID : 0002
Record Type : 02
Timestamp : 00:01:11 GMT 00:01:11 GMT
Generator ID : 0120
EvM Revision : 04
Sensor Type : Power Unit
Sensor Number : 0d
Event Type : Sensor-specific Discrete
Event Direction : Deassertion Event
Event Data : 00ffff
Description : Power off/down
Signed-off-by: Harvey.Wu <Harvey.Wu@quantatw.com>
Change-Id: I3a7745fd3a3040375bc03bef7da7ae84ae22e04c
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 6d55211..b0849ce 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -1055,7 +1055,16 @@
sensorType = getSensorTypeFromPath(sensorPath);
sensorAndLun = getSensorNumberFromPath(sensorPath);
sensorNum = static_cast<uint8_t>(sensorAndLun);
- generatorID |= sensorAndLun >> 8;
+ if ((generatorID & 0x0001) == 0)
+ {
+ // IPMB Address
+ generatorID |= sensorAndLun & 0x0300;
+ }
+ else
+ {
+ // system software
+ generatorID |= sensorAndLun >> 8;
+ }
eventType = getSensorEventTypeFromPath(sensorPath);
// Get the event direction