powerpc/eeh: pseries platform EEH initialization
authorGavin Shan <shangw@linux.vnet.ibm.com>
Mon, 27 Feb 2012 20:03:54 +0000 (20:03 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Mar 2012 00:09:36 +0000 (11:09 +1100)
The platform specific EEH operations have been abstracted by
struct eeh_ops. The individual platroms, including pSeries, needs
doing necessary initialization before the platform dependent EEH
operations work properly.

The patch is addressing that and do necessary platform initialization
for pSeries platform. More specificly, it will figure out the tokens
of EEH related RTAS calls.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/eeh.c
arch/powerpc/platforms/pseries/eeh_pseries.c

index b0e3fb0b32a5a8dca8cfd69f277cff54f98bcd27..bb6de6c97911631e2ba0d0a9617a8a66ef6cfa27 100644 (file)
@@ -1279,6 +1279,18 @@ void __init eeh_init(void)
 {
        struct device_node *phb, *np;
        struct eeh_early_enable_info info;
+       int ret;
+
+       /* call platform initialization function */
+       if (!eeh_ops) {
+               pr_warning("%s: Platform EEH operation not found\n",
+                       __func__);
+               return;
+       } else if ((ret = eeh_ops->init())) {
+               pr_warning("%s: Failed to call platform init function (%d)\n",
+                       __func__, ret);
+               return;
+       }
 
        raw_spin_lock_init(&confirm_error_lock);
        spin_lock_init(&slot_errbuf_lock);
index 61a9050ba9695fa5168848b51a8be22267260c0f..1a9410a2d452642d706863566fae0cb38236dee5 100644 (file)
 #include <asm/ppc-pci.h>
 #include <asm/rtas.h>
 
+/* RTAS tokens */
+static int ibm_set_eeh_option;
+static int ibm_set_slot_reset;
+static int ibm_read_slot_reset_state;
+static int ibm_read_slot_reset_state2;
+static int ibm_slot_error_detail;
+static int ibm_get_config_addr_info;
+static int ibm_get_config_addr_info2;
+static int ibm_configure_bridge;
+static int ibm_configure_pe;
+
 /**
  * pseries_eeh_init - EEH platform dependent initialization
  *
  */
 static int pseries_eeh_init(void)
 {
+       /* figure out EEH RTAS function call tokens */
+       ibm_set_eeh_option              = rtas_token("ibm,set-eeh-option");
+       ibm_set_slot_reset              = rtas_token("ibm,set-slot-reset");
+       ibm_read_slot_reset_state2      = rtas_token("ibm,read-slot-reset-state2");
+       ibm_read_slot_reset_state       = rtas_token("ibm,read-slot-reset-state");
+       ibm_slot_error_detail           = rtas_token("ibm,slot-error-detail");
+       ibm_get_config_addr_info2       = rtas_token("ibm,get-config-addr-info2");
+       ibm_get_config_addr_info        = rtas_token("ibm,get-config-addr-info");
+       ibm_configure_pe                = rtas_token("ibm,configure-pe");
+       ibm_configure_bridge            = rtas_token ("ibm,configure-bridge");
+
+       /* necessary sanity check */
+       if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n",
+                       __func__);
+               return -EINVAL;
+       } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm, set-slot-reset> invalid\n",
+                       __func__);
+               return -EINVAL;
+       } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
+                  ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm,read-slot-reset-state2> and "
+                       "<ibm,read-slot-reset-state> invalid\n",
+                       __func__);
+               return -EINVAL;
+       } else if (ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n",
+                       __func__);
+               return -EINVAL;
+       } else if (ibm_get_config_addr_info2 == RTAS_UNKNOWN_SERVICE &&
+                  ibm_get_config_addr_info == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm,get-config-addr-info2> and "
+                       "<ibm,get-config-addr-info> invalid\n",
+                       __func__);
+               return -EINVAL;
+       } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
+                  ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
+               pr_warning("%s: RTAS service <ibm,configure-pe> and "
+                       "<ibm,configure-bridge> invalid\n",
+                       __func__);
+               return -EINVAL;
+       }
+
        return 0;
 }