Skip to contentSkip to conversation

PCI: Override firmware settings if static enumeration is set

PATCH In review Tang, Jason (ES) 1 participant 1 message Sep 17, 2015 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 PCI: Override firmware settings if static enumeration is set

The PCI scanning algorithm currently preserves any bus numbers set by the firmware. If there exists static enumeration settings, then ignore those numbers and reenumerate everything. This may move devices around based upon the value of "hpbuses".

---
 drivers/pci/pci.h             | 2 ++
 drivers/pci/pci_static_enum.c | 9 +++++++++
 drivers/pci/probe.c           | 4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/pci/pci.h +2 -0
index e1a1cce..36b358d 100644
@@ -337,9 +337,11 @@ struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);
 
 #ifdef CONFIG_PCI_STATIC_ENUMERATION
 void pci_static_enum_set_opt(const char *str);
+bool pci_static_enum_is_set(void);
 void pci_static_enum_bridge(struct pci_bus *bus);
 #else
 static inline void pci_static_enum_set_opt(const char *str) { return; }
+static inline bool pci_static_enum_is_set(void) { return 0; }
 static inline void pci_static_enum_bridge(struct pci_bus *bus) { };
 #endif
 
drivers/pci/pci_static_enum.c +9 -0
index 47b7bd5..a7c595b 100644
@@ -38,6 +38,15 @@ void __init pci_static_enum_set_opt(const char *str)
 }
 
 /**
+ * pci_static_enum_is_set() - return true if static enumeration
+ * options are set
+ */
+bool pci_static_enum_is_set(void)
+{
+	return pci_static_enum_param[0] != '\0';
+}
+
+/**
  * pci_static_enum_find_setting() - find requested bridge within options
  * @bus: bridge to find
  * @setting: found static enumeration settings
drivers/pci/probe.c +3 -1
index 7cc80c3..91311e7 100644
@@ -802,6 +802,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 	pci_enable_crs(dev);
 
 	if ((secondary || subordinate) && !pcibios_assign_all_busses() &&
+	    !pci_static_enum_is_set() &&
 	    !is_cardbus && !broken) {
 		unsigned int cmax;
 		/*
@@ -840,7 +841,8 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 		 * do in the second pass.
 		 */
 		if (!pass) {
-			if (pcibios_assign_all_busses() || broken || is_cardbus)
+			if (pcibios_assign_all_busses() || broken ||
+			    is_cardbus || pci_static_enum_is_set())
 				/* Temporarily disable forwarding of the
 				   configuration cycles on all bridges in
 				   this bus segment to avoid possible
Signature · 1 line
1.8.3.1