Register reset functions for e1000 and rtl8139
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
98ba2632fc
commit
32c86e95b2
21
hw/e1000.c
21
hw/e1000.c
|
@ -1058,6 +1058,18 @@ pci_e1000_uninit(PCIDevice *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void e1000_reset(void *opaque)
|
||||||
|
{
|
||||||
|
E1000State *d = opaque;
|
||||||
|
|
||||||
|
memset(d->phy_reg, 0, sizeof d->phy_reg);
|
||||||
|
memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);
|
||||||
|
memset(d->mac_reg, 0, sizeof d->mac_reg);
|
||||||
|
memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);
|
||||||
|
d->rxbuf_min_shift = 1;
|
||||||
|
memset(&d->tx, 0, sizeof d->tx);
|
||||||
|
}
|
||||||
|
|
||||||
static void pci_e1000_init(PCIDevice *pci_dev)
|
static void pci_e1000_init(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
E1000State *d = (E1000State *)pci_dev;
|
E1000State *d = (E1000State *)pci_dev;
|
||||||
|
@ -1098,13 +1110,6 @@ static void pci_e1000_init(PCIDevice *pci_dev)
|
||||||
checksum = (uint16_t) EEPROM_SUM - checksum;
|
checksum = (uint16_t) EEPROM_SUM - checksum;
|
||||||
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
|
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
|
||||||
|
|
||||||
memset(d->phy_reg, 0, sizeof d->phy_reg);
|
|
||||||
memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);
|
|
||||||
memset(d->mac_reg, 0, sizeof d->mac_reg);
|
|
||||||
memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);
|
|
||||||
d->rxbuf_min_shift = 1;
|
|
||||||
memset(&d->tx, 0, sizeof d->tx);
|
|
||||||
|
|
||||||
d->vc = qdev_get_vlan_client(&d->dev.qdev,
|
d->vc = qdev_get_vlan_client(&d->dev.qdev,
|
||||||
e1000_receive, e1000_can_receive,
|
e1000_receive, e1000_can_receive,
|
||||||
e1000_cleanup, d);
|
e1000_cleanup, d);
|
||||||
|
@ -1114,6 +1119,8 @@ static void pci_e1000_init(PCIDevice *pci_dev)
|
||||||
|
|
||||||
register_savevm(info_str, -1, 2, nic_save, nic_load, d);
|
register_savevm(info_str, -1, 2, nic_save, nic_load, d);
|
||||||
d->dev.unregister = pci_e1000_uninit;
|
d->dev.unregister = pci_e1000_uninit;
|
||||||
|
qemu_register_reset(e1000_reset, 0, d);
|
||||||
|
e1000_reset(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void e1000_register_devices(void)
|
static void e1000_register_devices(void)
|
||||||
|
|
|
@ -1170,8 +1170,9 @@ static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
|
||||||
s->RxBufAddr = 0;
|
s->RxBufAddr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtl8139_reset(RTL8139State *s)
|
static void rtl8139_reset(void *opaque)
|
||||||
{
|
{
|
||||||
|
RTL8139State *s = opaque;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* restore MAC address */
|
/* restore MAC address */
|
||||||
|
@ -3473,6 +3474,7 @@ static void pci_rtl8139_init(PCIDevice *dev)
|
||||||
|
|
||||||
s->pci_dev = (PCIDevice *)d;
|
s->pci_dev = (PCIDevice *)d;
|
||||||
qdev_get_macaddr(&dev->qdev, s->macaddr);
|
qdev_get_macaddr(&dev->qdev, s->macaddr);
|
||||||
|
qemu_register_reset(rtl8139_reset, 0, s);
|
||||||
rtl8139_reset(s);
|
rtl8139_reset(s);
|
||||||
s->vc = qdev_get_vlan_client(&dev->qdev,
|
s->vc = qdev_get_vlan_client(&dev->qdev,
|
||||||
rtl8139_receive, rtl8139_can_receive,
|
rtl8139_receive, rtl8139_can_receive,
|
||||||
|
|
Loading…
Reference in a new issue