From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7uez-0003SF-5E for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:42:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7uex-0003Ym-5q for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:42:12 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:47451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7uex-0003Yg-36 for qemu-devel@nongnu.org; Mon, 18 Oct 2010 14:42:11 -0400 Received: by qwh5 with SMTP id 5so920997qwh.4 for ; Mon, 18 Oct 2010 11:42:10 -0700 (PDT) Message-ID: <4CBC94FE.5010003@codemonkey.ws> Date: Mon, 18 Oct 2010 13:42:06 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 1/2] pci: Automatically patch PCI vendor id and device id in PCI ROM References: <4CBC6CDB.109@redhat.com> <1287424511-22021-1-git-send-email-weil@mail.berlios.de> <20101018175821.GA27606@redhat.com> In-Reply-To: <20101018175821.GA27606@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Gerd Hoffmann , Markus Armbruster , QEMU Developers 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. >> >> 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? > A bad/missing PnP header does not mean it's an invalid ROM. Regards, Anthony Liguori