aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/pci-slot.c3
-rw-r--r--core/pcie-slot.c12
-rw-r--r--doc/pci-slot.rst22
-rw-r--r--include/pci-slot.h1
4 files changed, 26 insertions, 12 deletions
diff --git a/core/pci-slot.c b/core/pci-slot.c
index 075b34c..c703fe9 100644
--- a/core/pci-slot.c
+++ b/core/pci-slot.c
@@ -121,6 +121,9 @@ void pci_slot_add_dt_properties(struct pci_slot *slot,
dt_add_property_cells(np, "ibm,slot-pluggable", slot->pluggable);
dt_add_property_cells(np, "ibm,slot-surprise-pluggable",
slot->surprise_pluggable);
+ if (pci_slot_has_flags(slot, PCI_SLOT_FLAG_BROKEN_PDC))
+ dt_add_property_cells(np, "ibm,slot-broken-pdc", 1);
+
dt_add_property_cells(np, "ibm,slot-power-ctl", slot->power_ctl);
dt_add_property_cells(np, "ibm,slot-power-led-ctlled",
slot->power_led_ctl);
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index e92aa8d..64f0da6 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -490,11 +490,19 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
* relies on presence or link state change events. In order for the
* link state change event to be properly raised during surprise hot
* add/remove, the power supply to the slot should be always on.
+ *
+ * For PCI slots that don't claim surprise hotplug capability explicitly.
+ * Its PDC (Presence Detection Change) isn't reliable. To mark that as
+ * broken on them.
*/
- if ((slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_SURP) ||
- (slot->link_cap & PCICAP_EXP_LCAP_DL_ACT_REP))
+ if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_SURP) {
+ slot->surprise_pluggable = 1;
+ } else if (slot->link_cap & PCICAP_EXP_LCAP_DL_ACT_REP) {
slot->surprise_pluggable = 1;
+ pci_slot_add_flags(slot, PCI_SLOT_FLAG_BROKEN_PDC);
+ }
+
/* Standard slot operations */
slot->ops.get_presence_state = pcie_slot_get_presence_state;
slot->ops.get_link_state = pcie_slot_get_link_state;
diff --git a/doc/pci-slot.rst b/doc/pci-slot.rst
index a095737..fd3fd7d 100644
--- a/doc/pci-slot.rst
+++ b/doc/pci-slot.rst
@@ -60,16 +60,18 @@ node for a root port, a PCIE switch port, or a PCIE to PCIx bridge. If the
individual platforms (e.g. Firenze and Apollo) have VPD for the PCI slot, they
should extract the PCI slot properties from VPD and export them accordingly.
-====================== ==========
-Property Definition
-====================== ==========
-ibm,reset-by-firmware Boolean indicating whether the slot reset should be done in firmware
-ibm,slot-pluggable Boolean indicating whether the slot is pluggable
-ibm,slot-power-ctl Boolean indicating whether the slot has power control
-ibm,slot-wired-lanes The number of hardware lanes that are wired
-ibm,slot-pwr-led-ctl Presence of slot power led, and controlling entity
-ibm,slot-attn-led-ctl Presence of slot ATTN led, and controlling entity
-====================== ==========
+=========================== ==========
+Property Definition
+=========================== ==========
+ibm,reset-by-firmware Boolean indicating whether the slot reset should be done in firmware
+ibm,slot-pluggable Boolean indicating whether the slot is pluggable
+ibm,slot-surprise-pluggable Boolean indicating whether the slot supports surprise hotplug
+ibm,slot-broken-pdc Boolean indicating whether PDC (Presence Detection Change) is broken
+ibm,slot-power-ctl Boolean indicating whether the slot has power control
+ibm,slot-wired-lanes The number of hardware lanes that are wired
+ibm,slot-pwr-led-ctl Presence of slot power led, and controlling entity
+ibm,slot-attn-led-ctl Presence of slot ATTN led, and controlling entity
+=========================== ==========
PCI Hotplug
-----------
diff --git a/include/pci-slot.h b/include/pci-slot.h
index 7f16ddd..4ebe043 100644
--- a/include/pci-slot.h
+++ b/include/pci-slot.h
@@ -147,6 +147,7 @@ struct pci_slot {
uint32_t flags;
#define PCI_SLOT_FLAG_BOOTUP 0x1
#define PCI_SLOT_FLAG_FORCE_POWERON 0x2
+#define PCI_SLOT_FLAG_BROKEN_PDC 0x4
struct phb *phb;
struct pci_device *pd;