acpi: unneccessary to scan the PCI bus already scanned
author[email protected] <[email protected]>
Tue, 15 Apr 2008 21:34:49 +0000 (14:34 -0700)
committerLinus Torvalds <[email protected]>
Wed, 16 Apr 2008 02:35:41 +0000 (19:35 -0700)
http://bugzilla.kernel.org/show_bug.cgi?id=10124

this change:

      commit 08f1c192c3c32797068bfe97738babb3295bbf42
      Author: Muli Ben-Yehuda <[email protected]>
      Date:   Sun Jul 22 00:23:39 2007 +0300

         x86-64: introduce struct pci_sysdata to facilitate sharing of ->sysdata

         This patch introduces struct pci_sysdata to x86 and x86-64, and
         converts the existing two users (NUMA, Calgary) to use it.

         This lays the groundwork for having other users of sysdata, such as
         the PCI domains work.

         The Calgary bits are tested, the NUMA bits just look ok.

replaces pcibios_scan_root by pci_scan_bus_parented...

but in pcibios_scan_root we have a check about scanned busses.

Cc: <[email protected]>
Cc: Stian Jordet <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "Yinghai Lu" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/ia64/pci/pci.c
arch/x86/pci/acpi.c

index e282c348dcde0b9a4a6b04b0d7a5077f449518b1..53d0a8ee35d75cbdd252d4899403713db1846767 100644 (file)
@@ -362,7 +362,12 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
        info.name = name;
        acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window,
                        &info);
-
+       /*
+        * See arch/x86/pci/acpi.c.
+        * The desired pci bus might already be scanned in a quirk. We
+        * should handle the case here, but it appears that IA64 hasn't
+        * such quirk. So we just ignore the case now.
+        */
        pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller);
        if (pbus)
                pcibios_setup_root_windows(pbus, controller);
index 0234f2831bf371194f69779753ce2fb017570984..378136fb50447b86e9257655bddfe34578b94405 100644 (file)
@@ -219,8 +219,21 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
        if (pxm >= 0)
                sd->node = pxm_to_node(pxm);
 #endif
+       /*
+        * Maybe the desired pci bus has been already scanned. In such case
+        * it is unnecessary to scan the pci bus with the given domain,busnum.
+        */
+       bus = pci_find_bus(domain, busnum);
+       if (bus) {
+               /*
+                * If the desired bus exits, the content of bus->sysdata will
+                * be replaced by sd.
+                */
+               memcpy(bus->sysdata, sd, sizeof(*sd));
+               kfree(sd);
+       } else
+               bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
 
-       bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
        if (!bus)
                kfree(sd);
 
@@ -228,7 +241,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
        if (bus != NULL) {
                if (pxm >= 0) {
                        printk("bus %d -> pxm %d -> node %d\n",
-                               busnum, pxm, sd->node);
+                               busnum, pxm, pxm_to_node(pxm));
                }
        }
 #endif