pci: Automatically patch PCI vendor id and device id in PCI ROM

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.

Only qemu's built-in default rom files will be patched.

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

v3:
    * Don't patch a rom file when its name was set by the user.
      Thus we avoid modifications of unknown rom data.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 file changed
tree: 73a620da19278e68fe06b019e4bd07fb8a270097
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. linux-user/
  12. net/
  13. pc-bios/
  14. QMP/
  15. roms/
  16. slirp/
  17. sysconfigs/
  18. target-alpha/
  19. target-arm/
  20. target-cris/
  21. target-i386/
  22. target-m68k/
  23. target-microblaze/
  24. target-mips/
  25. target-ppc/
  26. target-s390x/
  27. target-sh4/
  28. target-sparc/
  29. tcg/
  30. tests/
  31. ui/
  32. .gitignore
  33. .gitmodules
  34. a.out.h
  35. acl.c
  36. acl.h
  37. aes.c
  38. aes.h
  39. aio.c
  40. alpha-dis.c
  41. alpha.ld
  42. arch_init.c
  43. arch_init.h
  44. arm-dis.c
  45. arm-semi.c
  46. arm.ld
  47. async.c
  48. balloon.c
  49. balloon.h
  50. block-migration.c
  51. block-migration.h
  52. block.c
  53. block.h
  54. block_int.h
  55. blockdev.c
  56. blockdev.h
  57. bswap.h
  58. bt-host.c
  59. bt-host.h
  60. bt-vhci.c
  61. buffered_file.c
  62. buffered_file.h
  63. cache-utils.c
  64. cache-utils.h
  65. Changelog
  66. check-qdict.c
  67. check-qfloat.c
  68. check-qint.c
  69. check-qjson.c
  70. check-qlist.c
  71. check-qstring.c
  72. cmd.c
  73. cmd.h
  74. CODING_STYLE
  75. compatfd.c
  76. compatfd.h
  77. config.h
  78. configure
  79. console.c
  80. console.h
  81. COPYING
  82. COPYING.LIB
  83. cpu-all.h
  84. cpu-common.h
  85. cpu-defs.h
  86. cpu-exec.c
  87. cpus.c
  88. cpus.h
  89. create_config
  90. cris-dis.c
  91. cursor.c
  92. cursor_hidden.xpm
  93. cursor_left_ptr.xpm
  94. cutils.c
  95. def-helper.h
  96. device_tree.c
  97. device_tree.h
  98. dis-asm.h
  99. disas.c
  100. disas.h
  101. dma-helpers.c
  102. dma.h
  103. dyngen-exec.h
  104. elf.h
  105. envlist.c
  106. envlist.h
  107. exec-all.h
  108. exec.c
  109. feature_to_c.sh
  110. gdbstub.c
  111. gdbstub.h
  112. gen-icount.h
  113. HACKING
  114. hmp-commands.hx
  115. host-utils.c
  116. host-utils.h
  117. hpet.h
  118. hppa-dis.c
  119. hppa.ld
  120. hxtool
  121. i386-dis.c
  122. i386.ld
  123. ia64-dis.c
  124. ia64.ld
  125. input.c
  126. ioport-user.c
  127. ioport.c
  128. ioport.h
  129. iov.c
  130. iov.h
  131. json-lexer.c
  132. json-lexer.h
  133. json-parser.c
  134. json-parser.h
  135. json-streamer.c
  136. json-streamer.h
  137. kvm-all.c
  138. kvm-stub.c
  139. kvm.h
  140. libfdt_env.h
  141. LICENSE
  142. linux-aio.c
  143. m68k-dis.c
  144. m68k-semi.c
  145. m68k.ld
  146. MAINTAINERS
  147. Makefile
  148. Makefile.dis
  149. Makefile.hw
  150. Makefile.objs
  151. Makefile.target
  152. Makefile.user
  153. microblaze-dis.c
  154. migration-exec.c
  155. migration-fd.c
  156. migration-tcp.c
  157. migration-unix.c
  158. migration.c
  159. migration.h
  160. mips-dis.c
  161. mips.ld
  162. module.c
  163. module.h
  164. monitor.c
  165. monitor.h
  166. nbd.c
  167. nbd.h
  168. net-checksum.c
  169. net.c
  170. net.h
  171. notify.c
  172. notify.h
  173. os-posix.c
  174. os-win32.c
  175. osdep.c
  176. osdep.h
  177. oslib-posix.c
  178. oslib-win32.c
  179. path.c
  180. pci-ids.txt
  181. pflib.c
  182. pflib.h
  183. poison.h
  184. posix-aio-compat.c
  185. ppc-dis.c
  186. ppc.ld
  187. ppc64.ld
  188. qbool.c
  189. qbool.h
  190. qdict-test-data.txt
  191. qdict.c
  192. qdict.h
  193. qemu-aio.h
  194. qemu-barrier.h
  195. qemu-binfmt-conf.sh
  196. qemu-char.c
  197. qemu-char.h
  198. qemu-common.h
  199. qemu-config.c
  200. qemu-config.h
  201. qemu-doc.texi
  202. qemu-error.c
  203. qemu-error.h
  204. qemu-img-cmds.hx
  205. qemu-img.c
  206. qemu-img.texi
  207. qemu-io.c
  208. qemu-lock.h
  209. qemu-log.h
  210. qemu-malloc.c
  211. qemu-nbd.c
  212. qemu-nbd.texi
  213. qemu-objects.h
  214. qemu-option.c
  215. qemu-option.h
  216. qemu-options.h
  217. qemu-options.hx
  218. qemu-os-posix.h
  219. qemu-os-win32.h
  220. qemu-queue.h
  221. qemu-sockets.c
  222. qemu-tech.texi
  223. qemu-thread.c
  224. qemu-thread.h
  225. qemu-timer-common.c
  226. qemu-timer.c
  227. qemu-timer.h
  228. qemu-tool.c
  229. qemu-x509.h
  230. qemu.sasl
  231. qemu_socket.h
  232. qerror.c
  233. qerror.h
  234. qfloat.c
  235. qfloat.h
  236. qint.c
  237. qint.h
  238. qjson.c
  239. qjson.h
  240. qlist.c
  241. qlist.h
  242. qmp-commands.hx
  243. qobject.h
  244. qstring.c
  245. qstring.h
  246. range.h
  247. readline.c
  248. readline.h
  249. README
  250. rules.mak
  251. rwhandler.c
  252. rwhandler.h
  253. s390-dis.c
  254. s390.ld
  255. savevm.c
  256. sh4-dis.c
  257. simpletrace.c
  258. simpletrace.h
  259. simpletrace.py
  260. softmmu-semi.h
  261. softmmu_defs.h
  262. softmmu_exec.h
  263. softmmu_header.h
  264. softmmu_template.h
  265. sparc-dis.c
  266. sparc.ld
  267. sparc64.ld
  268. sysemu.h
  269. targphys.h
  270. tcg-runtime.c
  271. texi2pod.pl
  272. thunk.c
  273. thunk.h
  274. TODO
  275. trace-events
  276. tracetool
  277. translate-all.c
  278. uboot_image.h
  279. usb-bsd.c
  280. usb-linux.c
  281. usb-stub.c
  282. VERSION
  283. version.rc
  284. vgafont.h
  285. vl.c
  286. x86_64.ld