Lines Matching +full:powered +full:- +full:on
1 // SPDX-License-Identifier: GPL-2.0+
3 * PCI Hot Plug Controller Driver for RPA-compliant PPC64 platform.
15 #include <asm/pci-bridge.h>
23 * RTAS call get-sensor-state(DR_ENTITY_SENSE) return values as per PAPR:
24 * -- generic return codes ---
25 * -1: Hardware Error
26 * -2: RTAS_BUSY
27 * -3: Invalid sensor. RTAS Parameter Error.
28 * -- rtas_get_sensor function specific return codes ---
29 * -9000: Need DR entity to be powered up and unisolated before RTAS call
30 * -9001: Need DR entity to be powered up, but not unisolated, before RTAS call
31 * -9002: DR entity unusable
32 * 990x: Extended delay - where x is a number in the range of 0-5
34 #define RTAS_SLOT_UNISOLATED -9000
35 #define RTAS_SLOT_NOT_UNISOLATED -9001
36 #define RTAS_SLOT_NOT_USABLE -9002
46 return -EFAULT; in rtas_get_sensor_errno()
48 return -ENODEV; in rtas_get_sensor_errno()
51 return -EBUSY; in rtas_get_sensor_errno()
59 * On certain PHB failures, the RTAS call rtas_call(get-sensor-state) returns
61 * interface rtas_get_sensor() loops over the RTAS call on extended delay
63 * (-1). This causes the EEH handler to get stuck for ~6 seconds before it
66 * invoke rtas_call(get-sensor-state) directly if the respective PE is in EEH
67 * recovery state and return -EBUSY error based on RTAS return status. This
75 int token = rtas_token("get-sensor-state"); in __rpaphp_get_sensor_state()
78 struct pci_controller *phb = PCI_DN(slot->dn)->phb; in __rpaphp_get_sensor_state()
81 return -ENOENT; in __rpaphp_get_sensor_state()
87 pdn = list_first_entry_or_null(&PCI_DN(phb->dn)->child_list, in __rpaphp_get_sensor_state()
92 pe = eeh_dev_to_pe(pdn->edev); in __rpaphp_get_sensor_state()
93 if (pe && (pe->state & EEH_PE_RECOVERING)) { in __rpaphp_get_sensor_state()
95 slot->index); in __rpaphp_get_sensor_state()
99 return rtas_get_sensor(DR_ENTITY_SENSE, slot->index, state); in __rpaphp_get_sensor_state()
110 if (rc == -EFAULT || rc == -EEXIST) { in rpaphp_get_sensor_state()
111 dbg("%s: slot must be power up to get sensor-state\n", in rpaphp_get_sensor_state()
114 /* some slots have to be powered up in rpaphp_get_sensor_state()
115 * before get-sensor will succeed. in rpaphp_get_sensor_state()
117 rc = rtas_set_power_level(slot->power_domain, POWER_ON, in rpaphp_get_sensor_state()
120 dbg("%s: power on slot[%s] failed rc=%d.\n", in rpaphp_get_sensor_state()
121 __func__, slot->name, rc); in rpaphp_get_sensor_state()
125 } else if (rc == -ENODEV) in rpaphp_get_sensor_state()
134 * rpaphp_enable_slot - record slot state, config pci device
146 slot->state = EMPTY; in rpaphp_enable_slot()
148 /* Find out if the power is turned on for the slot */ in rpaphp_enable_slot()
149 rc = rtas_get_power_level(slot->power_domain, &level); in rpaphp_enable_slot()
158 bus = pci_find_bus_by_node(slot->dn); in rpaphp_enable_slot()
160 err("%s: no pci_bus for dn %pOF\n", __func__, slot->dn); in rpaphp_enable_slot()
161 return -EINVAL; in rpaphp_enable_slot()
164 slot->bus = bus; in rpaphp_enable_slot()
165 slot->pci_devs = &bus->devices; in rpaphp_enable_slot()
169 slot->state = NOT_CONFIGURED; in rpaphp_enable_slot()
171 /* non-empty slot has to have child */ in rpaphp_enable_slot()
172 if (!slot->dn->child) { in rpaphp_enable_slot()
174 __func__, slot->name); in rpaphp_enable_slot()
175 return -EINVAL; in rpaphp_enable_slot()
178 if (list_empty(&bus->devices)) { in rpaphp_enable_slot()
179 pseries_eeh_init_edev_recursive(PCI_DN(slot->dn)); in rpaphp_enable_slot()
183 if (!list_empty(&bus->devices)) { in rpaphp_enable_slot()
184 slot->state = CONFIGURED; in rpaphp_enable_slot()
189 dbg("%s: pci_devs of slot[%pOF]\n", __func__, slot->dn); in rpaphp_enable_slot()
190 list_for_each_entry(dev, &bus->devices, bus_list) in rpaphp_enable_slot()