powerpc/powernv: Add OPAL IPMI interface
authorJeremy Kerr <jk@ozlabs.org>
Thu, 6 Nov 2014 03:38:27 +0000 (11:38 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 12 Nov 2014 05:28:49 +0000 (16:28 +1100)
Recent OPAL firmare adds a couple of functions to send and receive IPMI
messages:

  https://github.com/open-power/skiboot/commit/b2a374da

This change updates the token list and wrappers to suit, and adds the
platform devices for any IPMI interfaces.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/opal.h
arch/powerpc/platforms/powernv/opal-wrappers.S
arch/powerpc/platforms/powernv/opal.c

index 9124b0ede1fc7f531a97d369169706024741ce17..5d073e50cac8eba917d6657bee52a04d6bfc896b 100644 (file)
@@ -154,6 +154,8 @@ struct opal_sg_list {
 #define OPAL_HANDLE_HMI                                98
 #define OPAL_REGISTER_DUMP_REGION              101
 #define OPAL_UNREGISTER_DUMP_REGION            102
+#define OPAL_IPMI_SEND                         107
+#define OPAL_IPMI_RECV                         108
 
 #ifndef __ASSEMBLY__
 
@@ -452,6 +454,17 @@ struct opal_msg {
        __be64 params[8];
 };
 
+enum {
+       OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1,
+};
+
+struct opal_ipmi_msg {
+       uint8_t         version;
+       uint8_t         netfn;
+       uint8_t         cmd;
+       uint8_t         data[];
+};
+
 struct opal_machine_check_event {
        enum OpalMCE_Version    version:8;      /* 0x00 */
        uint8_t                 in_use;         /* 0x01 */
@@ -963,6 +976,10 @@ int64_t opal_handle_hmi(void);
 int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
 int64_t opal_unregister_dump_region(uint32_t id);
 int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
+int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg,
+               uint64_t msg_len);
+int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
+               uint64_t *msg_len);
 
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
index feb549aa3eea98ee5369f6c3ecf5087dc871b4d8..4f4e4009c289923c270b4ef0f8081509094489c6 100644 (file)
@@ -250,3 +250,5 @@ OPAL_CALL(opal_handle_hmi,                  OPAL_HANDLE_HMI);
 OPAL_CALL(opal_register_dump_region,           OPAL_REGISTER_DUMP_REGION);
 OPAL_CALL(opal_unregister_dump_region,         OPAL_UNREGISTER_DUMP_REGION);
 OPAL_CALL(opal_pci_set_phb_cxl_mode,           OPAL_PCI_SET_PHB_CXL_MODE);
+OPAL_CALL(opal_ipmi_send,                      OPAL_IPMI_SEND);
+OPAL_CALL(opal_ipmi_recv,                      OPAL_IPMI_RECV);
index d019b081df9d846177c76b5c923b7e0a41e12fe8..0297702e8ae9172e2057a35b3dcf7ae8034b9b9a 100644 (file)
@@ -644,6 +644,16 @@ static void __init opal_dump_region_init(void)
                pr_warn("DUMP: Failed to register kernel log buffer. "
                        "rc = %d\n", rc);
 }
+
+static void opal_ipmi_init(struct device_node *opal_node)
+{
+       struct device_node *np;
+
+       for_each_child_of_node(opal_node, np)
+               if (of_device_is_compatible(np, "ibm,opal-ipmi"))
+                       of_platform_device_create(np, NULL, NULL);
+}
+
 static int __init opal_init(void)
 {
        struct device_node *np, *consoles;
@@ -707,6 +717,8 @@ static int __init opal_init(void)
                opal_msglog_init();
        }
 
+       opal_ipmi_init(opal_node);
+
        return 0;
 }
 machine_subsys_initcall(powernv, opal_init);
@@ -742,6 +754,8 @@ void opal_shutdown(void)
 
 /* Export this so that test modules can use it */
 EXPORT_SYMBOL_GPL(opal_invalid_call);
+EXPORT_SYMBOL_GPL(opal_ipmi_send);
+EXPORT_SYMBOL_GPL(opal_ipmi_recv);
 
 /* Convert a region of vmalloc memory to an opal sg list */
 struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,