[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 1/2] pci: Automatically patch PCI vendor id

From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: [PATCH 1/2] pci: Automatically patch PCI vendor id and device id in PCI ROM
Date: Mon, 18 Oct 2010 13:42:06 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100915 Lightning/1.0b1 Thunderbird/3.0.8

On 10/18/2010 12:58 PM, Michael S. Tsirkin wrote:
On Mon, Oct 18, 2010 at 07:55:11PM +0200, Stefan Weil wrote:
PCI devices with different vendor or device ids sometimes share
the same rom code. Only the ids and the checksum
differs in a boot rom for such devices.

The i825xx ethernet controller family is a typical example
which is implemented in hw/eepro100.c. It uses at least
3 different device ids, so normally 3 boot roms would be needed.

By automatically patching vendor id and device id (and the checksum)
in qemu, all emulated family members can share the same boot rom.

VGA bios roms are another example with different vendor and device ids.


* Patch also the vendor id (and remove the sanity check for vendor id).

Cc: Gerd Hoffmann<address@hidden>
Cc: Markus Armbruster<address@hidden>
Cc: Michael S. Tsirkin<address@hidden>
Signed-off-by: Stefan Weil<address@hidden>
  hw/pci.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 1280d4d..139eb24 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1797,6 +1797,62 @@ static void pci_map_option_rom(PCIDevice *pdev, int 
region_num, pcibus_t addr, p
      cpu_register_physical_memory(addr, size, pdev->rom_offset);

+/* Patch the PCI vendor and device ids in a PCI rom image if necessary.
+   This is needed for an option rom which is used for more than one device. */
+static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, int size)
let's return an error code on malformed roms so management can detect errors?

A bad/missing PnP header does not mean it's an invalid ROM.


Anthony Liguori

reply via email to

[Prev in Thread] Current Thread [Next in Thread]