From ef47a601eac2d17705a67007c89e2701fe00e3ba Mon Sep 17 00:00:00 2001
From: Martin Wilck <martin.wilck@ts.fujitsu.com>
Date: Tue, 8 Dec 2015 11:47:04 +0100
Subject: [PATCH] ID:405 - Use meaningful Generator ID for "ipmitool sel add"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
"ipmitool sel add" always sets the Generator ID field of the generated SEL entry
to 0x0000.
Looking at the IPMI spec v2, ยง13.2, this is questionable. The value 0 would be
read as a HW-generated event from IPMB with slave address 0, which is the
broadcast or ["general call"]http://www.i2c-bus.org/addressing/ address.
The spec says that the Generator ID should be "Software ID if event was
generated from system software", and goes on to say that bit 0 should be set to
1 and bit 1-7 should be set to the Software ID for software-generated events.
SEL entries generated by ipmitool will usually be software-generated.
Out of the SWIDs defined in ยง5.5 of the IPMI spec, "System management Software"
or "OEM" would match ipmitool's use best, thus it would make sense to set the
generator ID field to 0x0041 or 0x0061. I am using 0x0041 here.
Signed-off-by: Martin Wilck <martin.wilck@ts.fujitsu.com>
---
lib/ipmi_sel.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index 67e12e3..affaed8 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -412,7 +412,12 @@ ipmi_sel_add_entries_fromfile(struct ipmi_intf * intf, const char * filename)
memset(&sel_event, 0, sizeof(struct sel_event_record));
sel_event.record_id = 0x0000;
sel_event.record_type = 0x02;
- sel_event.sel_type.standard_type.gen_id = 0x00;
+ /*
+ * IPMI spec ยง32.1 generator ID
+ * Bit 0 = 1 "Software defined"
+ * Bit 1-7: SWID (IPMI spec ยง5.5), using 2 = "System management software"
+ */
+ sel_event.sel_type.standard_type.gen_id = 0x41;
sel_event.sel_type.standard_type.evm_rev = rqdata[0];
sel_event.sel_type.standard_type.sensor_type = rqdata[1];
sel_event.sel_type.standard_type.sensor_num = rqdata[2];
--
2.5.0