]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86_64/pci/mmconfig.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-2.6-omap-h63xx.git] / arch / x86_64 / pci / mmconfig.c
index b493ed977e7c1e8248150d2d01eda527116c2134..3c55c76c6fd5de3d262e20fd7727653cc6849750 100644 (file)
 
 #include "pci.h"
 
-#define MMCONFIG_APER_SIZE (256*1024*1024)
+/* aperture is up to 256MB but BIOS may reserve less */
+#define MMCONFIG_APER_MIN      (2 * 1024*1024)
+#define MMCONFIG_APER_MAX      (256 * 1024*1024)
+
 /* Verify the first 16 busses. We assume that systems with more busses
    get MCFG right. */
 #define MAX_CHECK_BUS 16
@@ -75,7 +78,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
        char __iomem *addr;
 
        /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
-       if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) {
+       if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
                *value = -1;
                return -EINVAL;
        }
@@ -142,7 +145,7 @@ static __init void unreachable_devices(void)
 {
        int i, k;
        /* Use the max bus number from ACPI here? */
-       for (k = 0; i < MAX_CHECK_BUS; k++) {
+       for (k = 0; k < MAX_CHECK_BUS; k++) {
                for (i = 0; i < 32; i++) {
                        u32 val1;
                        char __iomem *addr;
@@ -175,9 +178,10 @@ void __init pci_mmcfg_init(void)
                return;
 
        if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
-                       pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE,
+                       pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN,
                        E820_RESERVED)) {
-               printk(KERN_ERR "PCI: BIOS Bug: MCFG area is not E820-reserved\n");
+               printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n",
+                               pci_mmcfg_config[0].base_address);
                printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
                return;
        }
@@ -190,7 +194,8 @@ void __init pci_mmcfg_init(void)
        }
        for (i = 0; i < pci_mmcfg_config_num; ++i) {
                pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
-               pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, MMCONFIG_APER_SIZE);
+               pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address,
+                                                        MMCONFIG_APER_MAX);
                if (!pci_mmcfg_virt[i].virt) {
                        printk("PCI: Cannot map mmconfig aperture for segment %d\n",
                               pci_mmcfg_config[i].pci_segment_group_number);