Silence two warnings. Only use the Qemu hard-coded address for VGA devices.
[coreboot.git] / src / devices / pci_device.c
index 7c8a75811674808c8e79de426c67a1f7c5372c08..3373c8481c2048b6cba6e519c47b79839b188b09 100644 (file)
@@ -285,11 +285,6 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index)
        unsigned long value;
        resource_t moving;
 
-       if ((dev->on_mainboard) && (dev->rom_address == 0)) {
-               /* Skip it if rom_address is not set in the MB Config.lb. */
-               return;
-       }
-
        /* Initialize the resources to nothing. */
        resource = new_resource(dev, index);
 
@@ -326,16 +321,6 @@ static void pci_get_rom_resource(struct device *dev, unsigned long index)
                }
                resource->flags = 0;
        }
-
-       /* For on board device with embedded ROM image, the ROM image is at
-        * fixed address specified in the Config.lb, the dev->rom_address is
-        * inited by driver_pci_onboard_ops::enable_dev() */
-       if ((dev->on_mainboard) && (dev->rom_address != 0)) {
-               resource->base = dev->rom_address;
-               resource->flags |= IORESOURCE_MEM | IORESOURCE_READONLY |
-                   IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
-       }
-
        compact_resources(dev);
 }
 
@@ -477,6 +462,11 @@ static void pci_set_resource(struct device *dev, struct resource *resource)
                return;
        }
 
+       /* If this resource is fixed don't worry about it. */
+       if (resource->flags & IORESOURCE_FIXED) {
+               return;
+       }
+
        /* If I have already stored this resource don't worry about it. */
        if (resource->flags & IORESOURCE_STORED) {
                return;
@@ -667,14 +657,13 @@ void pci_dev_init(struct device *dev)
        void run_bios(struct device *dev, unsigned long addr);
        struct rom_header *rom, *ram;
 
-#if CONFIG_PCI_ROM_RUN != 1
-       /* We want to execute VGA option ROMs when CONFIG_VGA_ROM_RUN
-        * is set but CONFIG_PCI_ROM_RUN is not. In this case we skip
-        * all other option ROM types.
-        */
-       if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+       if (CONFIG_PCI_ROM_RUN != 1 && /* Only execute VGA ROMs. */
+           ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA))
+               return;
+
+       if (CONFIG_VGA_ROM_RUN != 1 && /* Only execute non-VGA ROMs. */
+           ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA))
                return;
-#endif
 
        rom = pci_rom_probe(dev);
        if (rom == NULL)
@@ -745,7 +734,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev)
 #if CONFIG_PCIX_PLUGIN_SUPPORT == 1
        pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
        if (pos) {
-               printk_debug("%s subbordinate bus PCI-X\n", dev_path(dev));
+               printk_debug("%s subordinate bus PCI-X\n", dev_path(dev));
                return &default_pcix_ops_bus;
        }
 #endif
@@ -759,7 +748,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev)
                flags = pci_read_config16(dev, pos + PCI_CAP_FLAGS);
                if ((flags >> 13) == 1) {
                        /* Host or Secondary Interface */
-                       printk_debug("%s subbordinate bus Hypertransport\n",
+                       printk_debug("%s subordinate bus Hypertransport\n",
                                     dev_path(dev));
                        return &default_ht_ops_bus;
                }
@@ -774,11 +763,11 @@ static struct device_operations *get_pci_bridge_ops(device_t dev)
                case PCI_EXP_TYPE_ROOT_PORT:
                case PCI_EXP_TYPE_UPSTREAM:
                case PCI_EXP_TYPE_DOWNSTREAM:
-                       printk_debug("%s subbordinate bus PCI Express\n",
+                       printk_debug("%s subordinate bus PCI Express\n",
                                     dev_path(dev));
                        return &default_pciexp_ops_bus;
                case PCI_EXP_TYPE_PCI_BRIDGE:
-                       printk_debug("%s subbordinate PCI\n", dev_path(dev));
+                       printk_debug("%s subordinate PCI\n", dev_path(dev));
                        return &default_pci_ops_bus;
                default:
                        break;
@@ -808,7 +797,7 @@ static void set_pci_ops(struct device *dev)
        for (driver = &pci_drivers[0]; driver != &epci_drivers[0]; driver++) {
                if ((driver->vendor == dev->vendor) &&
                    (driver->device == dev->device)) {
-                       dev->ops = driver->ops;
+                       dev->ops = (struct device_operations *)driver->ops;
                        printk_spew("%s [%04x/%04x] %sops\n",
                                    dev_path(dev),
                                    driver->vendor, driver->device,
@@ -1222,7 +1211,6 @@ void pci_assign_irqs(unsigned bus, unsigned slot,
        device_t pdev;
        u8 line;
        u8 irq;
-       u8 readback;
 
        /* Each slot may contain up to eight functions */
        for (funct = 0; funct < 8; funct++) {
@@ -1246,8 +1234,8 @@ void pci_assign_irqs(unsigned bus, unsigned slot,
                        pIntAtoD[line - 1]);
 
 #ifdef PARANOID_IRQ_ASSIGNMENTS
-               readback = pci_read_config8(pdev, PCI_INTERRUPT_LINE);
-               printk_debug("  Readback = %d\n", readback);
+               irq = pci_read_config8(pdev, PCI_INTERRUPT_LINE);
+               printk_debug("  Readback = %d\n", irq);
 #endif
 
                // Change to level triggered