aboutsummaryrefslogtreecommitdiff
path: root/core/pcie-slot.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-10-14 15:25:59 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-17 10:33:53 +1100
commit7809a56628bbfba99202626229e17da451a461b7 (patch)
treed2df56888395bf13782795bf97fd5b6a3ec65b26 /core/pcie-slot.c
parentfa0f3b9acbfa79e7981baff56d151d1273f97f35 (diff)
downloadskiboot-7809a56628bbfba99202626229e17da451a461b7.zip
skiboot-7809a56628bbfba99202626229e17da451a461b7.tar.gz
skiboot-7809a56628bbfba99202626229e17da451a461b7.tar.bz2
core/pci: Return error on invalid power state transition
This returns error (OPAL_PARAMETER) when having invalid power state transition requests. The invalid requests include: ON to ON, OFF to OFF. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/pcie-slot.c')
-rw-r--r--core/pcie-slot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 6854ef1..7fe3785 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -199,13 +199,13 @@ static int64_t pcie_slot_set_power_state(struct pci_slot *slot, uint8_t val)
uint32_t ecap;
uint16_t state;
+ if (slot->power_state == val)
+ return OPAL_PARAMETER;
+
/* Drop the request if functionality doesn't exist */
if (!(slot->slot_cap & PCICAP_EXP_SLOTCAP_PWCTRL))
return OPAL_SUCCESS;
- if (slot->power_state == val)
- return OPAL_SUCCESS;
-
pci_slot_set_state(slot, PCI_SLOT_STATE_SPOWER_START);
slot->power_state = val;
ecap = pci_cap(pd, PCI_CFG_CAP_ID_EXP, false);