From 99937b9438458967ab205b37854d6c469990162b Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Mon, 18 Mar 2019 17:10:54 +1100 Subject: core/pcie-slot: Set power state from the PWRCTL flag 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 Signed-off-by: Stewart Smith --- core/pcie-slot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/pcie-slot.c b/core/pcie-slot.c index 4599634..e90fc5d 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; } -- cgit v1.1