aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorGlauber Costa <glommer@redhat.com>2009-06-17 09:05:30 -0400
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-22 10:10:50 -0500
commit406c8df3a96414c2c9602081727f0782369de699 (patch)
treed663a28ff170b87622a1f1aa51305cd4e2e2ebb9 /hw/pc.c
parent4a24470497360d8b77568b83008d0e9d6eb0787d (diff)
Make nic option rom loading less painful.
The code how it is today, is totally painful to read and keep. To begin with, the code is duplicated with the option rom loading code that linux_boot and vga are already using. This patch introduces a "bootable" state in NICInfo structure, that we can use to keep track of whether or not a given nic should be bootable, avoiding the introduction of yet another global state. With that in hands, we move the code in vl.c to hw/pc.c, and use the already existing infra structure to load those option roms. Error checking code suggested by Mark McLoughlin Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 143b697c70..3521d29ae5 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -977,8 +977,23 @@ static void pc_init1(ram_addr_t ram_size,
}
for (i = 0; i < nb_option_roms; i++) {
- oprom_area_size += load_option_rom(option_rom[i],
- 0xc0000 + oprom_area_size, 0xe0000);
+ oprom_area_size += load_option_rom(option_rom[i], 0xc0000 + oprom_area_size,
+ 0xe0000);
+ }
+
+ for (i = 0; i < nb_nics; i++) {
+ char nic_oprom[1024];
+ const char *model = nd_table[i].model;
+
+ if (!nd_table[i].bootable)
+ continue;
+
+ if (model == NULL)
+ model = "ne2k_pci";
+ snprintf(nic_oprom, sizeof(nic_oprom), "pxe-%s.bin", model);
+
+ oprom_area_size += load_option_rom(nic_oprom, 0xc0000 + oprom_area_size,
+ 0xe0000);
}
/* map all the bios at the top of memory */