Handle unconnected vlan case in lance
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2878 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
833c7174ce
commit
dbe06e1841
31
hw/pcnet.c
31
hw/pcnet.c
|
@ -1267,7 +1267,8 @@ static void pcnet_transmit(PCNetState *s)
|
||||||
if (CSR_LOOP(s))
|
if (CSR_LOOP(s))
|
||||||
pcnet_receive(s, s->buffer, s->xmit_pos);
|
pcnet_receive(s, s->buffer, s->xmit_pos);
|
||||||
else
|
else
|
||||||
qemu_send_packet(s->vc, s->buffer, s->xmit_pos);
|
if (s->vc)
|
||||||
|
qemu_send_packet(s->vc, s->buffer, s->xmit_pos);
|
||||||
|
|
||||||
s->csr[0] &= ~0x0008; /* clear TDMD */
|
s->csr[0] &= ~0x0008; /* clear TDMD */
|
||||||
s->csr[4] |= 0x0004; /* set TXSTRT */
|
s->csr[4] |= 0x0004; /* set TXSTRT */
|
||||||
|
@ -1562,7 +1563,8 @@ static void pcnet_h_reset(void *opaque)
|
||||||
|
|
||||||
/* Initialize the PROM */
|
/* Initialize the PROM */
|
||||||
|
|
||||||
memcpy(s->prom, s->nd->macaddr, 6);
|
if (s->nd)
|
||||||
|
memcpy(s->prom, s->nd->macaddr, 6);
|
||||||
s->prom[12] = s->prom[13] = 0x00;
|
s->prom[12] = s->prom[13] = 0x00;
|
||||||
s->prom[14] = s->prom[15] = 0x57;
|
s->prom[14] = s->prom[15] = 0x57;
|
||||||
|
|
||||||
|
@ -1898,18 +1900,21 @@ static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str)
|
||||||
|
|
||||||
d->nd = nd;
|
d->nd = nd;
|
||||||
|
|
||||||
d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive,
|
if (nd && nd->vlan) {
|
||||||
pcnet_can_receive, d);
|
d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive,
|
||||||
|
pcnet_can_receive, d);
|
||||||
snprintf(d->vc->info_str, sizeof(d->vc->info_str),
|
|
||||||
"pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
|
||||||
d->nd->macaddr[0],
|
|
||||||
d->nd->macaddr[1],
|
|
||||||
d->nd->macaddr[2],
|
|
||||||
d->nd->macaddr[3],
|
|
||||||
d->nd->macaddr[4],
|
|
||||||
d->nd->macaddr[5]);
|
|
||||||
|
|
||||||
|
snprintf(d->vc->info_str, sizeof(d->vc->info_str),
|
||||||
|
"pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
d->nd->macaddr[0],
|
||||||
|
d->nd->macaddr[1],
|
||||||
|
d->nd->macaddr[2],
|
||||||
|
d->nd->macaddr[3],
|
||||||
|
d->nd->macaddr[4],
|
||||||
|
d->nd->macaddr[5]);
|
||||||
|
} else {
|
||||||
|
d->vc = NULL;
|
||||||
|
}
|
||||||
pcnet_h_reset(d);
|
pcnet_h_reset(d);
|
||||||
register_savevm("pcnet", 0, 2, pcnet_save, pcnet_load, d);
|
register_savevm("pcnet", 0, 2, pcnet_save, pcnet_load, d);
|
||||||
}
|
}
|
||||||
|
|
16
hw/sun4m.c
16
hw/sun4m.c
|
@ -349,15 +349,15 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int ram_size,
|
||||||
}
|
}
|
||||||
tcx_init(ds, hwdef->tcx_base, phys_ram_base + ram_size, ram_size,
|
tcx_init(ds, hwdef->tcx_base, phys_ram_base + ram_size, ram_size,
|
||||||
hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
|
hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
|
||||||
if (nd_table[0].vlan) {
|
|
||||||
if (nd_table[0].model == NULL
|
if (nd_table[0].model == NULL
|
||||||
|| strcmp(nd_table[0].model, "lance") == 0) {
|
|| strcmp(nd_table[0].model, "lance") == 0) {
|
||||||
lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq);
|
lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
|
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0,
|
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0,
|
||||||
hwdef->nvram_size, 8);
|
hwdef->nvram_size, 8);
|
||||||
for (i = 0; i < MAX_CPUS; i++) {
|
for (i = 0; i < MAX_CPUS; i++) {
|
||||||
|
|
Loading…
Reference in a new issue