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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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".

Signed-off-by: Jason Tang <jason.tang2@xxxxxxx>
---
 drivers/pci/pci.h             | 2 ++
 drivers/pci/pci_static_enum.c | 9 +++++++++
 drivers/pci/probe.c           | 4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index e1a1cce..36b358d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -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
 
diff --git a/drivers/pci/pci_static_enum.c b/drivers/pci/pci_static_enum.c
index 47b7bd5..a7c595b 100644
--- a/drivers/pci/pci_static_enum.c
+++ b/drivers/pci/pci_static_enum.c
@@ -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
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cc80c3..91311e7 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux