[Skiboot] [PATCH 4/8] core/pcie-slot: Set power state from the PWRCTL flag

Oliver O'Halloran oohall at gmail.com
Mon Mar 18 17:10:54 AEDT 2019


For some reason we look at the power control indicator and use that to
determine if the slot is "off" rather than the power control flag that
is used to power down the slot.

While we're here change the default behaviour so that the slot is
assumed to be powered on if there's no slot capability, or if there's
no power control available.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/pcie-slot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 45996342a2ad..e90fc5d3a932 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -473,14 +473,14 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
 	if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_CAP)
 		slot->pluggable = 1;
 
+	/* Assume the slot is powered on by default */
+	slot->power_state = PCI_SLOT_POWER_ON;
 	if (slot->slot_cap & PCICAP_EXP_SLOTCAP_PWCTRL) {
 		slot->power_ctl = 1;
 
-		/* The power is on by default */
-		slot->power_state = PCI_SLOT_POWER_ON;
 		pci_cfg_read16(phb, pd->bdfn, ecap + PCICAP_EXP_SLOTCTL,
 			       &slot_ctl);
-		if (((slot_ctl & PCICAP_EXP_SLOTCTL_PWRI) >> 8) == PCIE_INDIC_OFF)
+		if (slot_ctl & PCICAP_EXP_SLOTCTL_PWRCTLR)
 			slot->power_state = PCI_SLOT_POWER_OFF;
 	}
 
-- 
2.20.1



More information about the Skiboot mailing list