diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-04-16 11:49:54 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-04-18 05:30:04 +1000 |
commit | 671db4d02680ed47ada64bd07efbe35468117698 (patch) | |
tree | 5528fe54a5ea37bffea2b5d7ef2514585f281dc1 /hw | |
parent | 9d0a41554b841249aa6265e84be99696cc642e4d (diff) | |
download | blackbird-skiboot-671db4d02680ed47ada64bd07efbe35468117698.tar.gz blackbird-skiboot-671db4d02680ed47ada64bd07efbe35468117698.zip |
pci: Fix presence detect on PHB3
The presence detect bit in the standard root complex config space is
not properly implemented on some IBM PHBs. Using it during probe is
incorrect.
We already have a workaround using the hotplug override "AB" detect
bits in the PHB3 code but it somewhat relies on the standard presence
detect bit returning false positives, which happened on Venice/Murano
but no longer happens in Naples.
Similarly, all the slot control stuff in the generic pci_enable_bridge()
isn't going to work properly on the PHB root complex and is unnecessary
as this code is only called after the upper layers have verified the
presence of a valid link on the PHB (the slot power control for the PHB
is handled separately).
This fixes it all by removing the AB detect flag, and unconditionally
using those bits in PHB3 presence detect along with making sure the
code in pci_enable_bridge() that manipulates the slot controls is
only executed on downstream ports.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/phb3.c | 27 |
1 files changed, 4 insertions, 23 deletions
@@ -470,9 +470,7 @@ static int64_t phb3_pci_reinit(struct phb *phb, uint64_t scope, uint64_t data) static int64_t phb3_presence_detect(struct phb *phb) { struct phb3 *p = phb_to_phb3(phb); - uint16_t slot_stat; uint64_t hp_override; - int64_t rc; /* Test for PHB in error state ? */ if (p->state == PHB3_STATE_BROKEN) @@ -480,30 +478,16 @@ static int64_t phb3_presence_detect(struct phb *phb) /* XXX Check bifurcation stuff ? */ - /* Read slot status register */ - rc = phb3_pcicfg_read16(&p->phb, 0, p->ecap + PCICAP_EXP_SLOTSTAT, - &slot_stat); - if (rc != OPAL_SUCCESS) - return OPAL_HARDWARE; - /* Read hotplug override */ hp_override = in_be64(p->regs + PHB_HOTPLUG_OVERRIDE); - PHBDBG(p, "slot_stat: 0x%04x, hp_override: 0x%016llx\n", - slot_stat, hp_override); - - /* So if the slot status says nothing connected, we bail out */ - if (!(slot_stat & PCICAP_EXP_SLOTSTAT_PDETECTST)) - return OPAL_SHPC_DEV_NOT_PRESENT; + PHBDBG(p, "hp_override: 0x%016llx\n", hp_override); /* - * At this point, we can have one of those funky IBM - * systems that has the presence bit set in the slot - * status and nothing actually connected. If so, we - * check the hotplug override A/B bits + * On P8, the slot status isn't wired up properly, we have to + * use the hotplug override A/B bits. */ - if (p->use_ab_detect && - (hp_override & PHB_HPOVR_PRESENCE_A) && + if ((hp_override & PHB_HPOVR_PRESENCE_A) && (hp_override & PHB_HPOVR_PRESENCE_B)) return OPAL_SHPC_DEV_NOT_PRESENT; @@ -4259,9 +4243,6 @@ static void phb3_create(struct dt_node *np) p->mm0_base, p->mm0_base + p->mm0_size - 1); free(path); - /* Check if we can use the A/B detect pins */ - p->use_ab_detect = dt_has_node_property(np, "ibm,use-ab-detect", NULL); - /* Find base location code from root node */ p->phb.base_loc_code = dt_prop_get_def(dt_root, "ibm,io-base-loc-code", NULL); |