diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2018-07-31 18:43:22 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-08-01 01:30:04 -0500 |
commit | 7a311b9dec275522d3479e019354913553b1f5bc (patch) | |
tree | e251384a2339830905d696d0c37e6d94ddbdbf4e /core/pci.c | |
parent | b465be797e8673a38e6b136b18ed593335cfe11e (diff) | |
download | skiboot-7a311b9dec275522d3479e019354913553b1f5bc.zip skiboot-7a311b9dec275522d3479e019354913553b1f5bc.tar.gz skiboot-7a311b9dec275522d3479e019354913553b1f5bc.tar.bz2 |
pci: Clarify power down logic
Currently pci_scan_bus() unconditionally calls pci_slot_set_power_state()
when it's finished scanning a bus. This is one of those things that
makes you go "WHAT?" when you first see it and frankly the skiboot PCI
code could do with less of that.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core/pci.c')
-rw-r--r-- | core/pci.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -401,8 +401,10 @@ static void pci_slot_set_power_state(struct phb *phb, if (state == PCI_SLOT_POWER_OFF) { /* Bail if there're something connected */ - if (!list_empty(&pd->children)) + if (!list_empty(&pd->children)) { + PCIERR(phb, pd->bdfn, "Attempted to power off slot with attached devices!\n"); return; + } pci_slot_add_flags(slot, PCI_SLOT_FLAG_BOOTUP); rc = slot->ops.get_power_state(slot, &cur_state); @@ -915,7 +917,9 @@ uint8_t pci_scan_bus(struct phb *phb, uint8_t bus, uint8_t max_bus, pci_cfg_write8(phb, pd->bdfn, PCI_CFG_SUBORDINATE_BUS, max_sub); next_bus = max_sub + 1; - pci_slot_set_power_state(phb, pd, PCI_SLOT_POWER_OFF); + /* power off the slot if there's nothing below it */ + if (list_empty(&pd->children)) + pci_slot_set_power_state(phb, pd, PCI_SLOT_POWER_OFF); } return max_sub; |