]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ipmi: introduce an ipmi_bmc_sdr_find() API
authorCédric Le Goater <clg@kaod.org>
Wed, 5 Apr 2017 12:41:33 +0000 (14:41 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 26 Apr 2017 02:41:55 +0000 (12:41 +1000)
This patch exposes a new IPMI routine to query a sdr entry from the
sdr table maintained by the IPMI BMC simulator. The API is very
similar to the internal sdr_find_entry() routine and should be used
the same way to query one or all sdrs.

A typical use would be to loop on the sdrs to build nodes of a device
tree.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ipmi/ipmi_bmc_sim.c
include/hw/ipmi/ipmi.h

index feb7627b05d3edd54b05a9d7b83931c2d75acc8d..09213ab36fa9e83bc9462c6c6be17d1e875fa7d4 100644 (file)
@@ -416,6 +416,22 @@ static int sdr_find_entry(IPMISdr *sdr, uint16_t recid,
     return 1;
 }
 
+int ipmi_bmc_sdr_find(IPMIBmc *b, uint16_t recid,
+                      const struct ipmi_sdr_compact **sdr, uint16_t *nextrec)
+
+{
+    IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b);
+    unsigned int pos;
+
+    pos = 0;
+    if (sdr_find_entry(&ibs->sdr, recid, &pos, nextrec)) {
+        return -1;
+    }
+
+    *sdr = (const struct ipmi_sdr_compact *) &ibs->sdr.sdr[pos];
+    return 0;
+}
+
 static void sel_inc_reservation(IPMISel *sel)
 {
     sel->reservation++;
index 91b83b5bb0b631eddb23f906e1856e86433c0187..0d36cfc6b7f3c88231b5b384e166f0b8a332fc43 100644 (file)
@@ -259,4 +259,6 @@ struct ipmi_sdr_compact {
 
 typedef uint8_t ipmi_sdr_compact_buffer[sizeof(struct ipmi_sdr_compact)];
 
+int ipmi_bmc_sdr_find(IPMIBmc *b, uint16_t recid,
+                      const struct ipmi_sdr_compact **sdr, uint16_t *nextrec);
 #endif