diff options
author | William Dauchy <wdauchy@gmail.com> | 2011-03-06 22:27:18 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-03-13 13:24:42 +0000 |
commit | 7165448a913bd8f757f588e8f1581c170d8b1775 (patch) | |
tree | 3fa5ca7e5cb2df7f6c1e6da064e42426b54d9699 /hw/rtl8139.c | |
parent | e14c8062f4c4c336c6e5fa5b51472ffff5f3fe38 (diff) | |
download | qemu-7165448a913bd8f757f588e8f1581c170d8b1775.zip qemu-7165448a913bd8f757f588e8f1581c170d8b1775.tar.gz qemu-7165448a913bd8f757f588e8f1581c170d8b1775.tar.bz2 |
moving eeprom initialization
The initialization should not be only on reset but also when initializing
the device.
It resolves a bug when hot plugging a pci network device: the mac address
was always null.
Signed-off-by: William Dauchy <wdauchy@gmail.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index a22530c..7a87522 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -1189,18 +1189,6 @@ static void rtl8139_reset(DeviceState *d) rtl8139_update_irq(s); - /* prepare eeprom */ - s->eeprom.contents[0] = 0x8129; -#if 1 - // PCI vendor and device ID should be mirrored here - s->eeprom.contents[1] = PCI_VENDOR_ID_REALTEK; - s->eeprom.contents[2] = PCI_DEVICE_ID_REALTEK_8139; -#endif - - s->eeprom.contents[7] = s->conf.macaddr.a[0] | s->conf.macaddr.a[1] << 8; - s->eeprom.contents[8] = s->conf.macaddr.a[2] | s->conf.macaddr.a[3] << 8; - s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8; - /* mark all status registers as owned by host */ for (i = 0; i < 4; ++i) { @@ -3392,6 +3380,17 @@ static int pci_rtl8139_init(PCIDevice *dev) qemu_macaddr_default_if_unset(&s->conf.macaddr); + /* prepare eeprom */ + s->eeprom.contents[0] = 0x8129; +#if 1 + /* PCI vendor and device ID should be mirrored here */ + s->eeprom.contents[1] = PCI_VENDOR_ID_REALTEK; + s->eeprom.contents[2] = PCI_DEVICE_ID_REALTEK_8139; +#endif + s->eeprom.contents[7] = s->conf.macaddr.a[0] | s->conf.macaddr.a[1] << 8; + s->eeprom.contents[8] = s->conf.macaddr.a[2] | s->conf.macaddr.a[3] << 8; + s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8; + s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf, dev->qdev.info->name, dev->qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); |