diff options
author | Michael Neuling <mikey@neuling.org> | 2017-07-12 12:06:54 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-07-13 10:19:45 +1000 |
commit | 652340ac11a2f163bb860d698d8110057c618bef (patch) | |
tree | 0f95c0f1a4ff799de3753c3f320b22c70d736415 | |
parent | 17b6f2b88a53d0da52bd6b50c6f22f660d7abd56 (diff) | |
download | skiboot-652340ac11a2f163bb860d698d8110057c618bef.zip skiboot-652340ac11a2f163bb860d698d8110057c618bef.tar.gz skiboot-652340ac11a2f163bb860d698d8110057c618bef.tar.bz2 |
phb4: Rework retries so we can do more than one
This reworks the pci link training retry code so that we can do more
than one retry.
This will now also print an error if a link fails to train.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/phb4.c | 14 | ||||
-rw-r--r-- | include/pci-slot.h | 1 |
2 files changed, 8 insertions, 7 deletions
@@ -2166,13 +2166,12 @@ static int64_t phb4_retry_state(struct pci_slot *slot) { struct phb4 *p = phb_to_phb4(slot->phb); - if (slot->retry_state == PCI_SLOT_STATE_NORMAL) - return OPAL_WRONG_STATE; + if (!slot->link_retries--) { + PHBERR(p, "Link detected but won't train\n"); + return OPAL_HARDWARE; + } - PHBDBG(p, "Retry state %08x\n", slot->retry_state); - slot->delay_tgt_tb = 0; - pci_slot_set_state(slot, slot->retry_state); - slot->retry_state = PCI_SLOT_STATE_NORMAL; + pci_slot_set_state(slot, PHB4_SLOT_CRESET_START); return pci_slot_set_sm_timeout(slot, msecs_to_tb(1)); } @@ -2325,7 +2324,7 @@ static int64_t phb4_freset(struct pci_slot *slot) } PHBDBG(p, "FRESET: Prepare for link down\n"); - slot->retry_state = PHB4_SLOT_CRESET_START; + if (slot->ops.prepare_link_change) slot->ops.prepare_link_change(slot, false); /* fall through */ @@ -2513,6 +2512,7 @@ static struct pci_slot *phb4_slot_create(struct phb *phb) slot->ops.hreset = phb4_hreset; slot->ops.freset = phb4_freset; slot->ops.creset = phb4_creset; + slot->link_retries = 1; return slot; } diff --git a/include/pci-slot.h b/include/pci-slot.h index 1d031ea..479bc08 100644 --- a/include/pci-slot.h +++ b/include/pci-slot.h @@ -184,6 +184,7 @@ struct pci_slot { uint32_t slot_cap; uint64_t delay_tgt_tb; uint64_t retries; + uint64_t link_retries; struct pci_slot_ops ops; void *data; }; |