diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-11-05 22:38:27 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2014-11-12 00:28:49 -0500 |
commit | 608b286d1ddf38a7ceb624d2b689af095816d91c (patch) | |
tree | e891d55491482e2b4426360eaa8a65e621b66d83 | |
parent | 0df1f2487d2f0d04703f142813d53615d62a1da4 (diff) |
powerpc/powernv: Add OPAL IPMI interface
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>
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-wrappers.S | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal.c | 14 |
3 files changed, 33 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 9124b0ede1fc..5d073e50cac8 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -154,6 +154,8 @@ struct opal_sg_list { | |||
154 | #define OPAL_HANDLE_HMI 98 | 154 | #define OPAL_HANDLE_HMI 98 |
155 | #define OPAL_REGISTER_DUMP_REGION 101 | 155 | #define OPAL_REGISTER_DUMP_REGION 101 |
156 | #define OPAL_UNREGISTER_DUMP_REGION 102 | 156 | #define OPAL_UNREGISTER_DUMP_REGION 102 |
157 | #define OPAL_IPMI_SEND 107 | ||
158 | #define OPAL_IPMI_RECV 108 | ||
157 | 159 | ||
158 | #ifndef __ASSEMBLY__ | 160 | #ifndef __ASSEMBLY__ |
159 | 161 | ||
@@ -452,6 +454,17 @@ struct opal_msg { | |||
452 | __be64 params[8]; | 454 | __be64 params[8]; |
453 | }; | 455 | }; |
454 | 456 | ||
457 | enum { | ||
458 | OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1, | ||
459 | }; | ||
460 | |||
461 | struct opal_ipmi_msg { | ||
462 | uint8_t version; | ||
463 | uint8_t netfn; | ||
464 | uint8_t cmd; | ||
465 | uint8_t data[]; | ||
466 | }; | ||
467 | |||
455 | struct opal_machine_check_event { | 468 | struct opal_machine_check_event { |
456 | enum OpalMCE_Version version:8; /* 0x00 */ | 469 | enum OpalMCE_Version version:8; /* 0x00 */ |
457 | uint8_t in_use; /* 0x01 */ | 470 | uint8_t in_use; /* 0x01 */ |
@@ -963,6 +976,10 @@ int64_t opal_handle_hmi(void); | |||
963 | int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end); | 976 | int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end); |
964 | int64_t opal_unregister_dump_region(uint32_t id); | 977 | int64_t opal_unregister_dump_region(uint32_t id); |
965 | int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number); | 978 | int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number); |
979 | int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg, | ||
980 | uint64_t msg_len); | ||
981 | int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg, | ||
982 | uint64_t *msg_len); | ||
966 | 983 | ||
967 | /* Internal functions */ | 984 | /* Internal functions */ |
968 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, | 985 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, |
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index feb549aa3eea..4f4e4009c289 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -250,3 +250,5 @@ OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI); | |||
250 | OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION); | 250 | OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION); |
251 | OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION); | 251 | OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION); |
252 | OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE); | 252 | OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE); |
253 | OPAL_CALL(opal_ipmi_send, OPAL_IPMI_SEND); | ||
254 | OPAL_CALL(opal_ipmi_recv, OPAL_IPMI_RECV); | ||
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index d019b081df9d..0297702e8ae9 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c | |||
@@ -644,6 +644,16 @@ static void __init opal_dump_region_init(void) | |||
644 | pr_warn("DUMP: Failed to register kernel log buffer. " | 644 | pr_warn("DUMP: Failed to register kernel log buffer. " |
645 | "rc = %d\n", rc); | 645 | "rc = %d\n", rc); |
646 | } | 646 | } |
647 | |||
648 | static void opal_ipmi_init(struct device_node *opal_node) | ||
649 | { | ||
650 | struct device_node *np; | ||
651 | |||
652 | for_each_child_of_node(opal_node, np) | ||
653 | if (of_device_is_compatible(np, "ibm,opal-ipmi")) | ||
654 | of_platform_device_create(np, NULL, NULL); | ||
655 | } | ||
656 | |||
647 | static int __init opal_init(void) | 657 | static int __init opal_init(void) |
648 | { | 658 | { |
649 | struct device_node *np, *consoles; | 659 | struct device_node *np, *consoles; |
@@ -707,6 +717,8 @@ static int __init opal_init(void) | |||
707 | opal_msglog_init(); | 717 | opal_msglog_init(); |
708 | } | 718 | } |
709 | 719 | ||
720 | opal_ipmi_init(opal_node); | ||
721 | |||
710 | return 0; | 722 | return 0; |
711 | } | 723 | } |
712 | machine_subsys_initcall(powernv, opal_init); | 724 | machine_subsys_initcall(powernv, opal_init); |
@@ -742,6 +754,8 @@ void opal_shutdown(void) | |||
742 | 754 | ||
743 | /* Export this so that test modules can use it */ | 755 | /* Export this so that test modules can use it */ |
744 | EXPORT_SYMBOL_GPL(opal_invalid_call); | 756 | EXPORT_SYMBOL_GPL(opal_invalid_call); |
757 | EXPORT_SYMBOL_GPL(opal_ipmi_send); | ||
758 | EXPORT_SYMBOL_GPL(opal_ipmi_recv); | ||
745 | 759 | ||
746 | /* Convert a region of vmalloc memory to an opal sg list */ | 760 | /* Convert a region of vmalloc memory to an opal sg list */ |
747 | struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, | 761 | struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, |