]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/setup-bus.c
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / drivers / pci / setup-bus.c
index 47c1071ad84ea06b057faac42e6ea60aeb87c5fe..3554f3948814aee7f23ea9db72523dc0fde9eeb1 100644 (file)
 
 #define ROUND_UP(x, a)         (((x) + (a) - 1) & ~((a) - 1))
 
-/*
- * FIXME: IO should be max 256 bytes.  However, since we may
- * have a P2P bridge below a cardbus bridge, we need 4K.
- */
-#define CARDBUS_IO_SIZE                (256)
-#define CARDBUS_MEM_SIZE       (32*1024*1024)
-
 static void __devinit
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
@@ -57,10 +50,17 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
 
                /* Don't touch classless devices or host bridges or ioapics.  */
                if (class == PCI_CLASS_NOT_DEFINED ||
-                   class == PCI_CLASS_BRIDGE_HOST ||
-                   class == PCI_CLASS_SYSTEM_PIC)
+                   class == PCI_CLASS_BRIDGE_HOST)
                        continue;
 
+               /* Don't touch ioapic devices already enabled by firmware */
+               if (class == PCI_CLASS_SYSTEM_PIC) {
+                       u16 command;
+                       pci_read_config_word(dev, PCI_COMMAND, &command);
+                       if (command & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))
+                               continue;
+               }
+
                pdev_sort_resources(dev, &head);
        }
 
@@ -408,12 +408,12 @@ pci_bus_size_cardbus(struct pci_bus *bus)
         * Reserve some resources for CardBus.  We reserve
         * a fixed amount of bus space for CardBus bridges.
         */
-       b_res[0].start = CARDBUS_IO_SIZE;
-       b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1;
+       b_res[0].start = pci_cardbus_io_size;
+       b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1;
        b_res[0].flags |= IORESOURCE_IO;
 
-       b_res[1].start = CARDBUS_IO_SIZE;
-       b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1;
+       b_res[1].start = pci_cardbus_io_size;
+       b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1;
        b_res[1].flags |= IORESOURCE_IO;
 
        /*
@@ -433,16 +433,16 @@ pci_bus_size_cardbus(struct pci_bus *bus)
         * twice the size.
         */
        if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
-               b_res[2].start = CARDBUS_MEM_SIZE;
-               b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1;
+               b_res[2].start = pci_cardbus_mem_size;
+               b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1;
                b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
 
-               b_res[3].start = CARDBUS_MEM_SIZE;
-               b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1;
+               b_res[3].start = pci_cardbus_mem_size;
+               b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1;
                b_res[3].flags |= IORESOURCE_MEM;
        } else {
-               b_res[3].start = CARDBUS_MEM_SIZE * 2;
-               b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1;
+               b_res[3].start = pci_cardbus_mem_size * 2;
+               b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1;
                b_res[3].flags |= IORESOURCE_MEM;
        }
 }