Commit dbe06e1841028ffa080ffe06273397fc583a7fcc
1 parent
833c7174
Handle unconnected vlan case in lance
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2878 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
27 additions
and
22 deletions
hw/pcnet.c
... | ... | @@ -1267,7 +1267,8 @@ static void pcnet_transmit(PCNetState *s) |
1267 | 1267 | if (CSR_LOOP(s)) |
1268 | 1268 | pcnet_receive(s, s->buffer, s->xmit_pos); |
1269 | 1269 | else |
1270 | - qemu_send_packet(s->vc, s->buffer, s->xmit_pos); | |
1270 | + if (s->vc) | |
1271 | + qemu_send_packet(s->vc, s->buffer, s->xmit_pos); | |
1271 | 1272 | |
1272 | 1273 | s->csr[0] &= ~0x0008; /* clear TDMD */ |
1273 | 1274 | s->csr[4] |= 0x0004; /* set TXSTRT */ |
... | ... | @@ -1562,7 +1563,8 @@ static void pcnet_h_reset(void *opaque) |
1562 | 1563 | |
1563 | 1564 | /* Initialize the PROM */ |
1564 | 1565 | |
1565 | - memcpy(s->prom, s->nd->macaddr, 6); | |
1566 | + if (s->nd) | |
1567 | + memcpy(s->prom, s->nd->macaddr, 6); | |
1566 | 1568 | s->prom[12] = s->prom[13] = 0x00; |
1567 | 1569 | s->prom[14] = s->prom[15] = 0x57; |
1568 | 1570 | |
... | ... | @@ -1898,18 +1900,21 @@ static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str) |
1898 | 1900 | |
1899 | 1901 | d->nd = nd; |
1900 | 1902 | |
1901 | - d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive, | |
1902 | - pcnet_can_receive, d); | |
1903 | - | |
1904 | - snprintf(d->vc->info_str, sizeof(d->vc->info_str), | |
1905 | - "pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x", | |
1906 | - d->nd->macaddr[0], | |
1907 | - d->nd->macaddr[1], | |
1908 | - d->nd->macaddr[2], | |
1909 | - d->nd->macaddr[3], | |
1910 | - d->nd->macaddr[4], | |
1911 | - d->nd->macaddr[5]); | |
1912 | - | |
1903 | + if (nd && nd->vlan) { | |
1904 | + d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive, | |
1905 | + pcnet_can_receive, d); | |
1906 | + | |
1907 | + snprintf(d->vc->info_str, sizeof(d->vc->info_str), | |
1908 | + "pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x", | |
1909 | + d->nd->macaddr[0], | |
1910 | + d->nd->macaddr[1], | |
1911 | + d->nd->macaddr[2], | |
1912 | + d->nd->macaddr[3], | |
1913 | + d->nd->macaddr[4], | |
1914 | + d->nd->macaddr[5]); | |
1915 | + } else { | |
1916 | + d->vc = NULL; | |
1917 | + } | |
1913 | 1918 | pcnet_h_reset(d); |
1914 | 1919 | register_savevm("pcnet", 0, 2, pcnet_save, pcnet_load, d); |
1915 | 1920 | } | ... | ... |
hw/sun4m.c
... | ... | @@ -349,15 +349,15 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int ram_size, |
349 | 349 | } |
350 | 350 | tcx_init(ds, hwdef->tcx_base, phys_ram_base + ram_size, ram_size, |
351 | 351 | hwdef->vram_size, graphic_width, graphic_height, graphic_depth); |
352 | - if (nd_table[0].vlan) { | |
353 | - if (nd_table[0].model == NULL | |
354 | - || strcmp(nd_table[0].model, "lance") == 0) { | |
355 | - lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq); | |
356 | - } else { | |
357 | - fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); | |
358 | - exit (1); | |
359 | - } | |
352 | + | |
353 | + if (nd_table[0].model == NULL | |
354 | + || strcmp(nd_table[0].model, "lance") == 0) { | |
355 | + lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq); | |
356 | + } else { | |
357 | + fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); | |
358 | + exit (1); | |
360 | 359 | } |
360 | + | |
361 | 361 | nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, |
362 | 362 | hwdef->nvram_size, 8); |
363 | 363 | for (i = 0; i < MAX_CPUS; i++) { | ... | ... |