From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36490 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7u4h-00048b-HQ for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:04:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7u4f-00056t-I9 for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:04:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7u4f-00056U-Bz for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:04:41 -0400 Date: Mon, 18 Oct 2010 19:58:21 +0200 From: "Michael S. Tsirkin" Message-ID: <20101018175821.GA27606@redhat.com> References: <4CBC6CDB.109@redhat.com> <1287424511-22021-1-git-send-email-weil@mail.berlios.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1287424511-22021-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] Re: [PATCH 1/2] pci: Automatically patch PCI vendor id and device id in PCI ROM List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Markus Armbruster , QEMU Developers , Gerd Hoffmann 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. > > v2: > > * Patch also the vendor id (and remove the sanity check for vendor id). > > Cc: Gerd Hoffmann > Cc: Markus Armbruster > Cc: Michael S. Tsirkin > Signed-off-by: Stefan Weil > --- > 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?