diff options
Diffstat (limited to 'src/devices/pci_rom.c')
-rw-r--r-- | src/devices/pci_rom.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c index 64a85bb700..fbc6130bc3 100644 --- a/src/devices/pci_rom.c +++ b/src/devices/pci_rom.c @@ -22,14 +22,15 @@ struct rom_header * pci_rom_probe(struct device *dev) } printk_debug("rom address for %s = %x\n", dev_path(dev), rom_address); + + if(!dev->on_mainboard) { + /* enable expansion ROM address decoding */ + pci_write_config32(dev, PCI_ROM_ADDRESS, + rom_address|PCI_ROM_ADDRESS_ENABLE); + } - /* enable expansion ROM address decoding */ - pci_write_config32(dev, PCI_ROM_ADDRESS, - rom_address|PCI_ROM_ADDRESS_ENABLE); - - rom_header = (struct rom_header *) rom_address; - printk_spew("PCI Expansion ROM, signature 0x%04x, \n\t" - "INIT size 0x%04x, data ptr 0x%04x\n", + rom_header = (struct rom_header *)rom_address; + printk_spew("PCI Expansion ROM, signature 0x%04x, INIT size 0x%04x, data ptr 0x%04x\n", le32_to_cpu(rom_header->signature), rom_header->size * 512, le32_to_cpu(rom_header->data)); if (le32_to_cpu(rom_header->signature) != PCI_ROM_HDR) { @@ -38,7 +39,7 @@ struct rom_header * pci_rom_probe(struct device *dev) return NULL; } - rom_data = (struct pci_data *) ((unsigned char *) rom_header + le32_to_cpu(rom_header->data)); + rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data); printk_spew("PCI ROM Image, Vendor %04x, Device %04x,\n", rom_data->vendor, rom_data->device); if (dev->vendor != rom_data->vendor || dev->device != rom_data->device) { @@ -51,7 +52,7 @@ struct rom_header * pci_rom_probe(struct device *dev) rom_data->class_hi, rom_data->class_lo, rom_data->type); if (dev->class != ((rom_data->class_hi << 8) | rom_data->class_lo)) { - printk_err("Class Code mismatch ROM %08x, dev %08x\n", + printk_debug("Class Code mismatch ROM %08x, dev %08x\n", (rom_data->class_hi << 8) | rom_data->class_lo, dev->class); //return NULL; } @@ -59,12 +60,14 @@ struct rom_header * pci_rom_probe(struct device *dev) return rom_header; } -static void *pci_ram_image_start = PCI_RAM_IMAGE_START; +static void *pci_ram_image_start = (void *)PCI_RAM_IMAGE_START; #if CONFIG_CONSOLE_VGA == 1 -int vga_inited = 0; // used by vga_console.c +extern int vga_inited; // defined in vga_console.c +#if CONFIG_CONSOLE_VGA_MULTI == 0 extern device_t vga_pri; // the primary vga device, defined in device.c #endif +#endif struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header) { @@ -76,8 +79,8 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS); do { - rom_header = (struct rom_header *) ((unsigned char *) rom_header + image_size); // get next image - rom_data = (struct pci_data *) ((unsigned char *) rom_header + le32_to_cpu(rom_header->data)); + rom_header = (unsigned char *) rom_header + image_size; // get next image + rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data); image_size = le32_to_cpu(rom_data->ilen) * 512; } while ((rom_data->type!=0) && (rom_data->indicator!=0)); // make sure we got x86 version @@ -87,7 +90,9 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) { #if CONFIG_CONSOLE_VGA == 1 + #if CONFIG_CONSOLE_VGA_MULTI == 0 if (dev != vga_pri) return NULL; // only one VGA supported + #endif printk_debug("copying VGA ROM Image from %x to %x, %x bytes\n", rom_header, PCI_VGA_RAM_IMAGE_START, rom_size); memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size); @@ -95,11 +100,11 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START); #endif } else { - printk_spew("%s, copying non-VGA ROM Image from %x to %x, %x bytes\n", - __func__, rom_header, pci_ram_image_start, rom_size); + printk_debug("copying non-VGA ROM Image from %x to %x, %x bytes\n", + rom_header, pci_ram_image_start, rom_size); memcpy(pci_ram_image_start, rom_header, rom_size); pci_ram_image_start += rom_size; - return (struct rom_header *) pci_ram_image_start; + return (struct rom_header *) (pci_ram_image_start-rom_size); } /* disable expansion ROM address decoding */ pci_write_config32(dev, PCI_ROM_ADDRESS, rom_address & ~PCI_ROM_ADDRESS_ENABLE); |