aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/pcie-slot.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 711e2e2..fed3462 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -90,11 +90,15 @@ static int64_t pcie_slot_get_link_state(struct pci_slot *slot,
static int64_t pcie_slot_get_power_state(struct pci_slot *slot __unused,
uint8_t *val)
{
- /* The power is always on if no functionality is supported */
- if (!(slot->slot_cap & PCICAP_EXP_SLOTCAP_PWCTRL))
- *val = PCI_SLOT_POWER_ON;
- else
- *val = slot->power_state;
+ /* We should return the cached power state that is same to
+ * the PCI slot hotplug state (added/removed). Otherwise,
+ * the OS will see mismatched states, causing the adapter
+ * behind the slot can't be probed successfully on request
+ * of hot add. So we could run into the situation where the
+ * OS sees power-off but it's on in hardware.
+ */
+ *val = slot->power_state;
+
return OPAL_SUCCESS;
}