summaryrefslogtreecommitdiff
path: root/net.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 /net.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 'net.c')
-rw-r--r--net.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net.c b/net.c
index af9de7334d..c83999b03a 100644
--- a/net.c
+++ b/net.c
@@ -2457,6 +2457,26 @@ int net_client_parse(const char *str)
return net_client_init(NULL, device, p);
}
+void net_set_boot_mask(int net_boot_mask)
+{
+ int i;
+
+ /* Only the first four NICs may be bootable */
+ net_boot_mask = net_boot_mask & 0xF;
+
+ for (i = 0; i < nb_nics; i++) {
+ if (net_boot_mask & (1 << i)) {
+ nd_table[i].bootable = 1;
+ net_boot_mask &= ~(1 << i);
+ }
+ }
+
+ if (net_boot_mask) {
+ fprintf(stderr, "Cannot boot from non-existent NIC\n");
+ exit(1);
+ }
+}
+
void do_info_network(Monitor *mon)
{
VLANState *vlan;