[Top][All Lists]

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

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

From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 1/2] pci: Automatically patch PCI device id in PCI ROM
Date: Mon, 18 Oct 2010 13:16:10 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100913 Iceowl/1.0b1 Icedove/3.0.7

Am 18.10.2010 12:04, schrieb Gerd Hoffmann:

+ /* Don't patch a rom with wrong vendor id (might be changed if needed). */
+    if (vendor_id != rom_vendor_id) {
+        return;
+    }

Yes, please drop that one.  If this is accepted I'd like to use this for
vga roms too, so we have to carry only two of them instead of four.

+    if (device_id != rom_device_id) {
+ /* Patch device id and checksum (at offset 6 for etherboot roms). */

Does this offset work for all roms?

As far as I know there is no well-defined checksum offset.
The checksum is simply set by modifying any byte (which
normally should be unused).

Etherboot has some unused bytes at the beginning of rom data
and always uses the same offset 6.

For other roms which also don't use the byte at offset 6, this approach
will work, too. If they store code or vital data at that location,
we destroy that data, so it won't work.

The VGA bios roms have a sequence of several bytes of zero
starting at offset 6, so maybe this data is not important and
we may change the byte at offset 6, but that should be checked
before using this mechanism.

  /* Add an option rom for the device */
  static int pci_add_option_rom(PCIDevice *pdev)
@@ -1849,6 +1900,8 @@ static int pci_add_option_rom(PCIDevice *pdev)
      load_image(path, ptr);

+    pci_patch_device_id(pdev, ptr, size);

I'd prefer this being opt-in per driver instead of being applied globally (and maybe also pass in a flag whenever a vendor mismatch is fine or not).


As long as the driver specifies the romfile name,
we get an implicitly defined behaviour: either the
rom matches and nothing special is done, or it doesn't
and the id(s) will be fixed.

So neither flag nor opt-in seems to be needed.

reply via email to

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