aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-02-05 04:14:41 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-02-05 04:14:41 +0000
commita41b2ff2ddd0ba05ac2ca1bb657603b1d09dc9bc (patch)
tree3dfb995363cc4046f782911fbf509ae070845a7f /hw/pc.c
parentd861b05ea30e6ac177de9b679da96194ebe21afc (diff)
Allow selection of emulated network card.
rtl8139 emulation. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1745 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 8e750b6849..fb8f87032a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -606,6 +606,16 @@ static void audio_init (PCIBus *pci_bus)
}
#endif
+static void pc_init_ne2k_isa(NICInfo *nd)
+{
+ static int nb_ne2k = 0;
+
+ if (nb_ne2k == NE2000_NB_MAX)
+ return;
+ isa_ne2000_init(ne2000_io[nb_ne2k], ne2000_irq[nb_ne2k], nd);
+ nb_ne2k++;
+}
+
/* PC hardware initialisation */
static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
@@ -614,11 +624,12 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
int pci_enabled)
{
char buf[1024];
- int ret, linux_boot, initrd_size, i, nb_nics1;
+ int ret, linux_boot, initrd_size, i;
unsigned long bios_offset, vga_bios_offset;
int bios_size, isa_bios_size;
PCIBus *pci_bus;
CPUState *env;
+ NICInfo *nd;
linux_boot = (kernel_filename != NULL);
@@ -800,19 +811,28 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
}
}
- if (pci_enabled) {
- for(i = 0; i < nb_nics; i++) {
- pci_ne2000_init(pci_bus, &nd_table[i]);
+ for(i = 0; i < nb_nics; i++) {
+ nd = &nd_table[i];
+ if (!nd->model) {
+ if (pci_enabled) {
+ nd->model = "ne2k_pci";
+ } else {
+ nd->model = "ne2k_isa";
+ }
}
- pci_piix3_ide_init(pci_bus, bs_table);
- } else {
- nb_nics1 = nb_nics;
- if (nb_nics1 > NE2000_NB_MAX)
- nb_nics1 = NE2000_NB_MAX;
- for(i = 0; i < nb_nics1; i++) {
- isa_ne2000_init(ne2000_io[i], ne2000_irq[i], &nd_table[i]);
+ if (strcmp(nd->model, "ne2k_isa") == 0) {
+ pc_init_ne2k_isa(nd);
+ } else if (pci_enabled) {
+ pci_nic_init(pci_bus, nd);
+ } else {
+ fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
+ exit(1);
}
+ }
+ if (pci_enabled) {
+ pci_piix3_ide_init(pci_bus, bs_table);
+ } else {
for(i = 0; i < 2; i++) {
isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
bs_table[2 * i], bs_table[2 * i + 1]);