aboutsummaryrefslogtreecommitdiff
path: root/vl.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 /vl.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 'vl.c')
-rw-r--r--vl.c39
1 files changed, 4 insertions, 35 deletions
diff --git a/vl.c b/vl.c
index 3242c230ea..2d9f04e4c2 100644
--- a/vl.c
+++ b/vl.c
@@ -5801,7 +5801,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
linux_boot = (kernel_filename != NULL);
- net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
if (!linux_boot && *kernel_cmdline != '\0') {
fprintf(stderr, "-append only allowed with -kernel option\n");
@@ -5849,41 +5848,11 @@ int main(int argc, char **argv, char **envp)
if (net_client_parse(net_clients[i]) < 0)
exit(1);
}
- net_client_check();
-#ifdef TARGET_I386
- /* XXX: this should be moved in the PC machine instantiation code */
- if (net_boot != 0) {
- int netroms = 0;
- for (i = 0; i < nb_nics && i < 4; i++) {
- const char *model = nd_table[i].model;
- char buf[1024];
- char *filename;
- if (net_boot & (1 << i)) {
- if (model == NULL)
- model = "ne2k_pci";
- snprintf(buf, sizeof(buf), "pxe-%s.bin", model);
- filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, buf);
- if (filename && get_image_size(filename) > 0) {
- if (nb_option_roms >= MAX_OPTION_ROMS) {
- fprintf(stderr, "Too many option ROMs\n");
- exit(1);
- }
- option_rom[nb_option_roms] = qemu_strdup(buf);
- nb_option_roms++;
- netroms++;
- }
- if (filename) {
- qemu_free(filename);
- }
- }
- }
- if (netroms == 0) {
- fprintf(stderr, "No valid PXE rom found for network device\n");
- exit(1);
- }
- }
-#endif
+ net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
+ net_set_boot_mask(net_boot);
+
+ net_client_check();
/* init the bluetooth world */
for (i = 0; i < nb_bt_opts; i++)