Commit bd000b82 authored by Russell Currey's avatar Russell Currey Committed by Michael Ellerman

powerpc/pseries/eeh: Refactor the configure_bridge RTAS tokens

The RTAS calls "ibm,configure-pe" and "ibm,configure-bridge" perform the
same actions, however the former can skip configuration if unnecessary.
The existing code treats them as different tokens even though only one
will ever be called.  Refactor this by making a single token that is
assigned during init.
Signed-off-by: default avatarRussell Currey <ruscur@russell.cc>
Acked-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 871e178e
...@@ -53,7 +53,6 @@ static int ibm_read_slot_reset_state2; ...@@ -53,7 +53,6 @@ static int ibm_read_slot_reset_state2;
static int ibm_slot_error_detail; static int ibm_slot_error_detail;
static int ibm_get_config_addr_info; static int ibm_get_config_addr_info;
static int ibm_get_config_addr_info2; static int ibm_get_config_addr_info2;
static int ibm_configure_bridge;
static int ibm_configure_pe; static int ibm_configure_pe;
/* /*
...@@ -81,7 +80,14 @@ static int pseries_eeh_init(void) ...@@ -81,7 +80,14 @@ static int pseries_eeh_init(void)
ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2"); 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_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
ibm_configure_pe = rtas_token("ibm,configure-pe"); ibm_configure_pe = rtas_token("ibm,configure-pe");
ibm_configure_bridge = rtas_token("ibm,configure-bridge");
/*
* ibm,configure-pe and ibm,configure-bridge have the same semantics,
* however ibm,configure-pe can be faster. If we can't find
* ibm,configure-pe then fall back to using ibm,configure-bridge.
*/
if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE)
ibm_configure_pe = rtas_token("ibm,configure-bridge");
/* /*
* Necessary sanity check. We needn't check "get-config-addr-info" * Necessary sanity check. We needn't check "get-config-addr-info"
...@@ -93,8 +99,7 @@ static int pseries_eeh_init(void) ...@@ -93,8 +99,7 @@ static int pseries_eeh_init(void)
(ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE && (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) || ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) ||
ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE || ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE ||
(ibm_configure_pe == RTAS_UNKNOWN_SERVICE && ibm_configure_pe == RTAS_UNKNOWN_SERVICE) {
ibm_configure_bridge == RTAS_UNKNOWN_SERVICE)) {
pr_info("EEH functionality not supported\n"); pr_info("EEH functionality not supported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -624,18 +629,9 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe) ...@@ -624,18 +629,9 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
config_addr = pe->addr; config_addr = pe->addr;
while (max_wait > 0) { while (max_wait > 0) {
/* Use new configure-pe function, if supported */ ret = rtas_call(ibm_configure_pe, 3, 1, NULL,
if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { config_addr, BUID_HI(pe->phb->buid),
ret = rtas_call(ibm_configure_pe, 3, 1, NULL, BUID_LO(pe->phb->buid));
config_addr, BUID_HI(pe->phb->buid),
BUID_LO(pe->phb->buid));
} else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) {
ret = rtas_call(ibm_configure_bridge, 3, 1, NULL,
config_addr, BUID_HI(pe->phb->buid),
BUID_LO(pe->phb->buid));
} else {
return -EFAULT;
}
if (!ret) if (!ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment