Re: [0/4] NUMA-Q: remove PCI bus number mangling

William Lee Irwin III (wli@holomorphy.com)
Tue, 12 Nov 2002 15:58:24 -0800


On Tue, Nov 12, 2002 at 03:53:49PM -0800, Martin J. Bligh wrote:
>> Right, I'm not against the sysdata thing, seems like a much better way
>> to do it in general (what I did was a quick hack). Was just confused
>> by the global bus number assertion, but if we use the sysdata stuff,
>> it's all a non-issue ;-)
>
On Tue, Nov 12, 2002 at 02:59:37PM -0800, William Lee Irwin III wrote:
> Non-issue for merging...
> The pain isn't over yet. =(
> Core PCI code is assuming unique bus numbers in several places.

Okay, an attempt to remedy this world-breaking braindamage with the
fewest lines of code:

This alters PCI bus number "clash" detection to compare ->sysdata in
addition to the numbers. The bus number is not a unique identifier.

drivers/pci/probe.c | 14 ++++++++++++--
include/linux/pci.h | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)

diff -urpN pci-2.5.47-8/drivers/pci/probe.c pci-2.5.47-8-dbg/drivers/pci/probe.c
--- pci-2.5.47-8/drivers/pci/probe.c 2002-11-12 13:37:56.000000000 -0800
+++ pci-2.5.47-8-dbg/drivers/pci/probe.c 2002-11-12 14:27:54.000000000 -0800
@@ -548,11 +548,21 @@ int __devinit pci_bus_exists(const struc
return 0;
}

-struct pci_bus * __devinit pci_alloc_primary_bus(int bus)
+static int __devinit pci_root_bus_exists(int number, void *sysdata)
+{
+ const struct pci_bus *bus;
+
+ list_for_each_entry(bus, &pci_root_buses, node)
+ if (bus->number == number && bus->sysdata == sysdata)
+ return 1;
+ return 0;
+}
+
+struct pci_bus * __devinit pci_alloc_primary_bus(int bus, void *sysdata)
{
struct pci_bus *b;

- if (pci_bus_exists(&pci_root_buses, bus)) {
+ if (pci_root_bus_exists(bus, sysdata)) {
/* If we already got to this bus through a different bridge, ignore it */
DBG("PCI: Bus %02x already known\n", bus);
return NULL;
diff -urpN pci-2.5.47-8/include/linux/pci.h pci-2.5.47-8-dbg/include/linux/pci.h
--- pci-2.5.47-8/include/linux/pci.h 2002-11-10 19:28:13.000000000 -0800
+++ pci-2.5.47-8-dbg/include/linux/pci.h 2002-11-12 14:29:13.000000000 -0800
@@ -537,7 +537,7 @@ int pcibios_write_config_dword (unsigned

int pci_bus_exists(const struct list_head *list, int nr);
struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
-struct pci_bus *pci_alloc_primary_bus(int bus);
+struct pci_bus *pci_alloc_primary_bus(int bus, void *sysdata);
struct pci_dev *pci_scan_slot(struct pci_dev *temp);
int pci_proc_attach_device(struct pci_dev *dev);
int pci_proc_detach_device(struct pci_dev *dev);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/