aboutsummaryrefslogtreecommitdiff
path: root/hw/phb4.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2017-07-12 12:06:54 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-13 10:19:45 +1000
commit652340ac11a2f163bb860d698d8110057c618bef (patch)
tree0f95c0f1a4ff799de3753c3f320b22c70d736415 /hw/phb4.c
parent17b6f2b88a53d0da52bd6b50c6f22f660d7abd56 (diff)
downloadskiboot-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>
Diffstat (limited to 'hw/phb4.c')
-rw-r--r--hw/phb4.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/phb4.c b/hw/phb4.c
index 55b5695..041c626 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -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;
}