mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
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>
This commit is contained in:
parent
4a24470497
commit
406c8df3a9
4 changed files with 43 additions and 37 deletions
19
hw/pc.c
19
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue