[PATCH] mmconfig: fix unreachable_devices()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Tue, 13 Feb 2007 12:26:20 +0000 (13:26 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 13 Feb 2007 12:26:20 +0000 (13:26 +0100)
Currently, unreachable_devices() compares value of mmconfig and value
of conf1. But it doesn't check the device is reachable or not.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andi Kleen <ak@suse.de>
arch/i386/pci/mmconfig-shared.c
arch/i386/pci/mmconfig.c
arch/i386/pci/pci.h
arch/x86_64/pci/mmconfig.c

index 4ea0852487a4e0db8207bed16f749aacb7da542e..473db6257013aaeb84f62160c3764227c9c6bd12 100644 (file)
@@ -43,12 +43,14 @@ static void __init unreachable_devices(void)
                        if (val1 == 0xffffffff)
                                continue;
 
-                       raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
-                       if (val1 != val2) {
-                               set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
-                               printk(KERN_NOTICE "PCI: No mmconfig possible"
-                                      " on device %02x:%02x\n", bus, i);
+                       if (pci_mmcfg_arch_reachable(0, bus, devfn)) {
+                               raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
+                               if (val1 == val2)
+                                       continue;
                        }
+                       set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
+                       printk(KERN_NOTICE "PCI: No mmconfig possible on device"
+                              " %02x:%02x\n", bus, i);
                }
        }
 }
index 11be089efd7daddd6f8baa2635407f8bdc2af8ef..bb1afd9e589d5bdf27a5bfe91b2c4cd78107e8f1 100644 (file)
@@ -136,6 +136,12 @@ static struct pci_raw_ops pci_mmcfg = {
        .write =        pci_mmcfg_write,
 };
 
+int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+                                   unsigned int devfn)
+{
+       return get_base_addr(seg, bus, devfn) != 0;
+}
+
 int __init pci_mmcfg_arch_init(void)
 {
        printk(KERN_INFO "PCI: Using MMCONFIG\n");
index 2ce3d44b09d4fa61c2fc413fc9be12f1ee294829..e58bae2076ad50b96a0e2fb78493e198e44816ec 100644 (file)
@@ -101,4 +101,6 @@ extern void pcibios_sort(void);
 #define PCI_MMCFG_MAX_CHECK_BUS 16
 extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
 
+extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+                                          unsigned int devfn);
 extern int __init pci_mmcfg_arch_init(void);
index 918fc5b95a06fb656ee878d8d786796eeb6743e9..65d82736987e600b642646f4d14e515b4fc020fc 100644 (file)
@@ -126,6 +126,12 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
        return addr;
 }
 
+int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
+                                   unsigned int devfn)
+{
+       return pci_dev_base(seg, bus, devfn) != NULL;
+}
+
 int __init pci_mmcfg_arch_init(void)
 {
        int i;