Reorganize option rom (+linux kernel) loading.

This patch adds infrastructure to maintain memory regions which must be
restored on reset.  That includes roms (vga bios and option roms on pc),
but is also used when loading linux kernels directly.  Features:

  - loading files is supported.
  - passing blobs is supported.
  - target address range is supported (for optionrom area).
  - fixed target memory address is supported (linux kernel).

New in v2:
  - writes to ROM are done only at initial boot.
  - also handle aout and uimage loaders.
  - drop unused fread_targphys() function.

The final memory layout is created once all memory regions are
registered.  The option roms get addresses assigned and the
registered regions are checked against overlaps.  Finally all data
is copyed to the guest memory.

Advantages:

  (1) Filling memory on initial boot and on reset takes the same
      code path, making reset more robust.
  (2) The need to keep track of the option rom load address is gone.
  (3) Due to (2) option roms can be loaded outside pc_init().  This
      allows to move the pxe rom loading into the nic drivers for
      example.

Additional bonus:  There is a 'info roms' monitor command now.

The patch also switches over pc.c and removes the
option_rom_setup_reset() and load_option_rom() functions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
6 files changed
tree: 0dc2589b1b21401e50f54666c70e42df29c245eb
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. fpu/
  6. gdb-xml/
  7. hw/
  8. linux-user/
  9. pc-bios/
  10. roms/
  11. slirp/
  12. target-alpha/
  13. target-arm/
  14. target-cris/
  15. target-i386/
  16. target-m68k/
  17. target-microblaze/
  18. target-mips/
  19. target-ppc/
  20. target-sh4/
  21. target-sparc/
  22. tcg/
  23. tests/
  24. .gitignore
  25. .gitmodules
  26. a.out.h
  27. acl.c
  28. acl.h
  29. aes.c
  30. aes.h
  31. aio.c
  32. alpha-dis.c
  33. alpha.ld
  34. arm-dis.c
  35. arm-semi.c
  36. arm.ld
  37. balloon.h
  38. block.c
  39. block.h
  40. block_int.h
  41. bswap.h
  42. bt-host.c
  43. bt-host.h
  44. bt-vhci.c
  45. buffered_file.c
  46. buffered_file.h
  47. cache-utils.c
  48. cache-utils.h
  49. Changelog
  50. check-qdict.c
  51. check-qint.c
  52. check-qstring.c
  53. cmd.c
  54. cmd.h
  55. cocoa.m
  56. CODING_STYLE
  57. configure
  58. console.c
  59. console.h
  60. COPYING
  61. COPYING.LIB
  62. cpu-all.h
  63. cpu-common.h
  64. cpu-defs.h
  65. cpu-exec.c
  66. create_config
  67. cris-dis.c
  68. curses.c
  69. curses_keys.h
  70. cutils.c
  71. d3des.c
  72. d3des.h
  73. def-helper.h
  74. device_tree.c
  75. device_tree.h
  76. dis-asm.h
  77. disas.c
  78. disas.h
  79. dma-helpers.c
  80. dma.h
  81. dyngen-exec.h
  82. elf.h
  83. envlist.c
  84. envlist.h
  85. exec-all.h
  86. exec.c
  87. feature_to_c.sh
  88. gdbstub.c
  89. gdbstub.h
  90. gen-icount.h
  91. host-utils.c
  92. host-utils.h
  93. hostregs_helper.h
  94. hpet.h
  95. hppa-dis.c
  96. hppa.ld
  97. hxtool
  98. i386-dis.c
  99. i386.ld
  100. ia64.ld
  101. ioport-user.c
  102. ioport.c
  103. ioport.h
  104. keymaps.c
  105. keymaps.h
  106. kvm-all.c
  107. kvm.h
  108. libfdt_env.h
  109. LICENSE
  110. linux-aio.c
  111. m68k-dis.c
  112. m68k-semi.c
  113. m68k.ld
  114. MAINTAINERS
  115. Makefile
  116. Makefile.hw
  117. Makefile.target
  118. Makefile.user
  119. microblaze-dis.c
  120. migration-exec.c
  121. migration-fd.c
  122. migration-tcp.c
  123. migration-unix.c
  124. migration.c
  125. migration.h
  126. mips-dis.c
  127. mips.ld
  128. module.c
  129. module.h
  130. monitor.c
  131. monitor.h
  132. nbd.c
  133. nbd.h
  134. net-checksum.c
  135. net.c
  136. net.h
  137. osdep.c
  138. osdep.h
  139. path.c
  140. pci-ids.txt
  141. posix-aio-compat.c
  142. ppc-dis.c
  143. ppc.ld
  144. ppc64.ld
  145. qdict-test-data.txt
  146. qdict.c
  147. qdict.h
  148. qemu-aio.h
  149. qemu-binfmt-conf.sh
  150. qemu-char.c
  151. qemu-char.h
  152. qemu-common.h
  153. qemu-config.c
  154. qemu-config.h
  155. qemu-doc.texi
  156. qemu-img-cmds.hx
  157. qemu-img.c
  158. qemu-img.texi
  159. qemu-io.c
  160. qemu-lock.h
  161. qemu-log.h
  162. qemu-malloc.c
  163. qemu-monitor.hx
  164. qemu-nbd.c
  165. qemu-nbd.texi
  166. qemu-option.c
  167. qemu-option.h
  168. qemu-options.hx
  169. qemu-queue.h
  170. qemu-sockets.c
  171. qemu-tech.texi
  172. qemu-thread.c
  173. qemu-thread.h
  174. qemu-timer.h
  175. qemu-tool.c
  176. qemu.sasl
  177. qemu_socket.h
  178. qint.c
  179. qint.h
  180. qobject.h
  181. qstring.c
  182. qstring.h
  183. readline.c
  184. readline.h
  185. README
  186. rules.mak
  187. s390-dis.c
  188. s390.ld
  189. savevm.c
  190. sdl.c
  191. sdl_keysym.h
  192. sdl_zoom.c
  193. sdl_zoom.h
  194. sdl_zoom_template.h
  195. sh4-dis.c
  196. softmmu-semi.h
  197. softmmu_defs.h
  198. softmmu_exec.h
  199. softmmu_header.h
  200. softmmu_template.h
  201. sparc-dis.c
  202. sparc.ld
  203. sparc64.ld
  204. sysemu.h
  205. tap-win32.c
  206. targphys.h
  207. tcg-runtime.c
  208. texi2pod.pl
  209. thunk.c
  210. thunk.h
  211. TODO
  212. translate-all.c
  213. uboot_image.h
  214. usb-bsd.c
  215. usb-linux.c
  216. usb-stub.c
  217. VERSION
  218. vgafont.h
  219. vl.c
  220. vnc-auth-sasl.c
  221. vnc-auth-sasl.h
  222. vnc-auth-vencrypt.c
  223. vnc-auth-vencrypt.h
  224. vnc-tls.c
  225. vnc-tls.h
  226. vnc.c
  227. vnc.h
  228. vnc_keysym.h
  229. vnchextile.h
  230. x86_64.ld
  231. x_keymap.c
  232. x_keymap.h