qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 09/16] ipmi: Add a firmware configuration reposit


From: minyard
Subject: [Qemu-devel] [PATCH v3 09/16] ipmi: Add a firmware configuration repository
Date: Mon, 8 Jun 2015 20:12:04 -0500

From: Corey Minyard <address@hidden>

Add a way for IPMI devices to register their firmware information
with the IPMI subsystem so that various firmware entities can pull
that information later for adding to firmware tables.

Signed-off-by: Corey Minyard <address@hidden>
---
 hw/ipmi/ipmi.c         | 25 +++++++++++++++++++++++++
 include/hw/ipmi/ipmi.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
index 7d17469..ced588d 100644
--- a/hw/ipmi/ipmi.c
+++ b/hw/ipmi/ipmi.c
@@ -123,3 +123,28 @@ static void ipmi_register_types(void)
 }
 
 type_init(ipmi_register_types)
+
+struct fw_entry_handlers {
+    IPMIFwHandler handler;
+    void *opaque;
+    QSLIST_ENTRY(fw_entry_handlers) next;
+};
+static QSLIST_HEAD(, fw_entry_handlers) fw_entries;
+
+void ipmi_add_fwinfo(IPMIFwInfo *info)
+{
+    struct fw_entry_handlers *e;
+
+    QSLIST_FOREACH(e, &fw_entries, next) {
+        e->handler(info, e->opaque);
+    }
+}
+
+void ipmi_register_fwinfo_handler(IPMIFwHandler handler, void *opaque)
+{
+    struct fw_entry_handlers *e = g_malloc(sizeof(*e));
+
+    e->handler = handler;
+    e->opaque = opaque;
+    QSLIST_INSERT_HEAD(&fw_entries, e, next);
+}
diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h
index e4f7738..9bd9c9d 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -168,6 +168,41 @@ typedef struct IPMIBmcClass {
  */
 void ipmi_bmc_find_and_link(Object *obj, Object **bmc);
 
+/*
+ * Used for transferring information to interfaces that add 
+ * entries to firmware tables.
+ */
+typedef struct IPMIFwInfo {
+    const char *interface_name;
+    int interface_type;
+    uint8_t ipmi_spec_major_revision;
+    uint8_t ipmi_spec_minor_revision;
+    uint8_t i2c_slave_address;
+
+    uint64_t base_address;
+    uint64_t register_length;
+    uint8_t register_spacing;
+    enum {
+        IPMI_MEMSPACE_IO,
+        IPMI_MEMSPACE_MEM32,
+        IPMI_MEMSPACE_MEM64,
+        IPMI_MEMSPACE_SMBUS
+    } memspace;
+
+    int interrupt_number;
+    enum {
+        IPMI_LEVEL_IRQ,
+        IPMI_EDGE_IRQ
+    } irq_type;
+
+    const char *acpi_parent;
+} IPMIFwInfo;
+
+typedef void (*IPMIFwHandler)(IPMIFwInfo *info, void *opaque);
+
+void ipmi_add_fwinfo(IPMIFwInfo *info);
+void ipmi_register_fwinfo_handler(IPMIFwHandler handler, void *opaque);
+
 #ifdef IPMI_DEBUG
 #define ipmi_debug(fs, ...) \
     fprintf(stderr, "IPMI (%s): " fs, __func__, ##__VA_ARGS__)
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]