summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-01-20 11:58:48 +0100
committerAvi Kivity <avi@redhat.com>2010-03-25 18:19:11 +0200
commitffe6c5b5feb073900e91240d400242f710887719 (patch)
treee553951154c46b3da818f47a9bb114ec82fcffa0
parentBail out when VCPU_CREATE fails (diff)
downloadqemu-kvm-ffe6c5b5feb073900e91240d400242f710887719.tar.gz
qemu-kvm-ffe6c5b5feb073900e91240d400242f710887719.tar.bz2
qemu-kvm-ffe6c5b5feb073900e91240d400242f710887719.zip
pci passthrough: zap option rom scanning.
Nowdays (qemu 0.12) seabios loads option roms from pci rom bars. So there is no need any more to scan for option roms and have qemu load them. Zap the code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> (cherry picked from commit 51c0dad5ce383be94ca7c46e491ada17cc9ec416)
-rw-r--r--hw/device-assignment.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 5564504d9..801950eaf 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1311,77 +1311,6 @@ void add_assigned_devices(PCIBus *bus, const char **devices, int n_devices)
}
}
-/* Option ROM header */
-struct option_rom_header {
- uint8_t signature[2];
- uint8_t rom_size;
- uint32_t entry_point;
- uint8_t reserved[17];
- uint16_t pci_header_offset;
- uint16_t expansion_header_offset;
-} __attribute__ ((packed));
-
-/* Option ROM PCI data structure */
-struct option_rom_pci_header {
- uint8_t signature[4];
- uint16_t vendor_id;
- uint16_t device_id;
- uint16_t vital_product_data_offset;
- uint16_t structure_length;
- uint8_t structure_revision;
- uint8_t class_code[3];
- uint16_t image_length;
- uint16_t image_revision;
- uint8_t code_type;
- uint8_t indicator;
- uint16_t reserved;
-} __attribute__ ((packed));
-
-/*
- * Scan the list of Option ROMs at roms. If a suitable Option ROM is found,
- * allocate a ram space and copy it there. Then return its size aligned to
- * both 2KB and target page size.
- */
-#define OPTION_ROM_ALIGN(x) (((x) + 2047) & ~2047)
-static void scan_option_rom(const char *name, uint8_t devfn, void *roms)
-{
- int i, size;
- uint8_t csum;
- struct option_rom_header *rom;
- struct option_rom_pci_header *pcih;
-
- rom = roms;
-
- for ( ; ; ) {
- /* Invalid signature means we're out of option ROMs. */
- if (strncmp((char *)rom->signature, "\x55\xaa", 2) ||
- (rom->rom_size == 0))
- break;
-
- size = rom->rom_size * 512;
- /* Invalid checksum means we're out of option ROMs. */
- csum = 0;
- for (i = 0; i < size; i++)
- csum += ((uint8_t *)rom)[i];
- if (csum != 0)
- break;
-
- /* Check the PCI header (if any) for a match. */
- pcih = (struct option_rom_pci_header *)
- ((char *)rom + rom->pci_header_offset);
- if ((rom->pci_header_offset != 0) &&
- !strncmp((char *)pcih->signature, "PCIR", 4))
- goto found;
-
- rom = (struct option_rom_header *)((char *)rom + size);
- }
- return;
-
- found:
- rom_add_blob(name ? name : "assigned device", rom, size, 0);
- return;
-}
-
/*
* Scan the assigned devices for the devices that have an option ROM, and then
* load the corresponding ROM data to RAM. If an error occurs while loading an
@@ -1445,9 +1374,5 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)
size, PROT_READ);
}
- if (!dev->dev.qdev.hotplugged) {
- /* Scan the buffer for suitable ROMs and increase the offset */
- scan_option_rom(dev->dev.qdev.id, dev->dev.devfn, buf);
- }
free(buf);
}