[Skiboot] [PATCH] phb4: Fix slot presence detect

Michael Neuling mikey at neuling.org
Fri May 5 15:47:48 AEST 2017


phb4_get_presence_state() needs to set *val to indicate the presence
of something in the slot. Currently it doesn't set *val at all.

The existing logic is correct, so this patch just sets val in the
right places.

This has the nice side effect of improving boot times since we no
longer waste time tring to train links that don't have anything
present.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 hw/phb4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/phb4.c b/hw/phb4.c
index 0065a3f79a..49d4a0f4c9 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1847,6 +1847,7 @@ static int64_t phb4_get_presence_state(struct pci_slot *slot, uint8_t *val)
 	PHBDBG(p, "hp_status=0x%016llx, dlp_train_ctl=0x%016llx\n",
 	       hps, dtctl);
 
+	*val = OPAL_PCI_SLOT_PRESENT;
 	/* Check presence detect */
 	if (hps & PHB_PCIE_HPSTAT_PRESENCE) {
 		/* If it says not present but link is up, then we assume
@@ -1857,6 +1858,7 @@ static int64_t phb4_get_presence_state(struct pci_slot *slot, uint8_t *val)
 			PHBERR(p, "Presence detect 0 but link set !\n");
 			return OPAL_SHPC_DEV_PRESENT;
 		}
+		*val = OPAL_PCI_SLOT_EMPTY;
 		return OPAL_SHPC_DEV_NOT_PRESENT;
 	}
 
-- 
2.11.0



More information about the Skiboot mailing list