From 51931bad325e3feba934eaf95b422deeb24cf4e5 Mon Sep 17 00:00:00 2001 From: Gavin Shan Date: Fri, 14 Oct 2016 15:26:05 +1100 Subject: core/pci: Claim surprise hotplug capability This claims PCIe surprise hotplug capability through device node's property "ibm,slot-surprise-pluggable". The slot has the capability when surprise hotplug is supported in its slot's capability bits or link state change reporting is supported in PCIe link capability bits. In order for link state events to be properly raised during surprise hotplug, the power supply to the slot should be always on. The slot's power state should be switched accordingly during fundamental reset. Signed-off-by: Gavin Shan Signed-off-by: Stewart Smith --- platforms/ibm-fsp/firenze-pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'platforms/ibm-fsp') diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c index 1d834091..2b8c0c69 100644 --- a/platforms/ibm-fsp/firenze-pci.c +++ b/platforms/ibm-fsp/firenze-pci.c @@ -653,6 +653,16 @@ static int64_t firenze_pci_slot_set_power_state(struct pci_slot *slot, if (slot->power_state == val) return OPAL_SUCCESS; + /* Update with the requested power state and bail immediately when + * surprise hotplug is supported on the slot. It keeps the power + * supply to the slot on and it guarentees the link state change + * events will be raised properly during surprise hot add/remove. + */ + if (slot->surprise_pluggable) { + slot->power_state = val; + return OPAL_SUCCESS; + } + slot->power_state = val; pci_slot_set_state(slot, FIRENZE_PCI_SLOT_SPOWER_START); -- cgit v1.2.1