diff options
author | Glauber Costa <glommer@redhat.com> | 2009-06-17 09:05:30 -0400 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-22 10:10:50 -0500 |
commit | 406c8df3a96414c2c9602081727f0782369de699 (patch) | |
tree | d663a28ff170b87622a1f1aa51305cd4e2e2ebb9 /hw/pc.c | |
parent | 4a24470497360d8b77568b83008d0e9d6eb0787d (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.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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 */ |