Revision 7165448a

b/hw/pcnet.c
1557 1557
void pcnet_h_reset(void *opaque)
1558 1558
{
1559 1559
    PCNetState *s = opaque;
1560
    int i;
1561
    uint16_t checksum;
1562

  
1563
    /* Initialize the PROM */
1564

  
1565
    /*
1566
      Datasheet: http://pdfdata.datasheetsite.com/web/24528/AM79C970A.pdf
1567
      page 95
1568
    */
1569
    memcpy(s->prom, s->conf.macaddr.a, 6);
1570
    /* Reserved Location: must be 00h */
1571
    s->prom[6] = s->prom[7] = 0x00;
1572
    /* Reserved Location: must be 00h */
1573
    s->prom[8] = 0x00;
1574
    /* Hardware ID: must be 11h if compatibility to AMD drivers is desired */
1575
    s->prom[9] = 0x11;
1576
    /* User programmable space, init with 0 */
1577
    s->prom[10] = s->prom[11] = 0x00;
1578
    /* LSByte of two-byte checksum, which is the sum of bytes 00h-0Bh
1579
       and bytes 0Eh and 0Fh, must therefore be initialized with 0! */
1580
    s->prom[12] = s->prom[13] = 0x00;
1581
    /* Must be ASCII W (57h) if compatibility to AMD
1582
       driver software is desired */
1583
    s->prom[14] = s->prom[15] = 0x57;
1584

  
1585
    for (i = 0,checksum = 0; i < 16; i++)
1586
        checksum += s->prom[i];
1587
    *(uint16_t *)&s->prom[12] = cpu_to_le16(checksum);
1588

  
1589 1560

  
1590 1561
    s->bcr[BCR_MSRDA] = 0x0005;
1591 1562
    s->bcr[BCR_MSWRA] = 0x0005;
......
1752 1723

  
1753 1724
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info)
1754 1725
{
1726
    int i;
1727
    uint16_t checksum;
1728

  
1755 1729
    s->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, s);
1756 1730

  
1757 1731
    qemu_macaddr_default_if_unset(&s->conf.macaddr);
......
1760 1734

  
1761 1735
    add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0");
1762 1736

  
1737
    /* Initialize the PROM */
1738

  
1739
    /*
1740
      Datasheet: http://pdfdata.datasheetsite.com/web/24528/AM79C970A.pdf
1741
      page 95
1742
    */
1743
    memcpy(s->prom, s->conf.macaddr.a, 6);
1744
    /* Reserved Location: must be 00h */
1745
    s->prom[6] = s->prom[7] = 0x00;
1746
    /* Reserved Location: must be 00h */
1747
    s->prom[8] = 0x00;
1748
    /* Hardware ID: must be 11h if compatibility to AMD drivers is desired */
1749
    s->prom[9] = 0x11;
1750
    /* User programmable space, init with 0 */
1751
    s->prom[10] = s->prom[11] = 0x00;
1752
    /* LSByte of two-byte checksum, which is the sum of bytes 00h-0Bh
1753
       and bytes 0Eh and 0Fh, must therefore be initialized with 0! */
1754
    s->prom[12] = s->prom[13] = 0x00;
1755
    /* Must be ASCII W (57h) if compatibility to AMD
1756
       driver software is desired */
1757
    s->prom[14] = s->prom[15] = 0x57;
1758

  
1759
    for (i = 0, checksum = 0; i < 16; i++) {
1760
        checksum += s->prom[i];
1761
    }
1762
    *(uint16_t *)&s->prom[12] = cpu_to_le16(checksum);
1763

  
1763 1764
    return 0;
1764 1765
}
b/hw/rtl8139.c
1189 1189

  
1190 1190
    rtl8139_update_irq(s);
1191 1191

  
1192
    /* prepare eeprom */
1193
    s->eeprom.contents[0] = 0x8129;
1194
#if 1
1195
    // PCI vendor and device ID should be mirrored here
1196
    s->eeprom.contents[1] = PCI_VENDOR_ID_REALTEK;
1197
    s->eeprom.contents[2] = PCI_DEVICE_ID_REALTEK_8139;
1198
#endif
1199

  
1200
    s->eeprom.contents[7] = s->conf.macaddr.a[0] | s->conf.macaddr.a[1] << 8;
1201
    s->eeprom.contents[8] = s->conf.macaddr.a[2] | s->conf.macaddr.a[3] << 8;
1202
    s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
1203

  
1204 1192
    /* mark all status registers as owned by host */
1205 1193
    for (i = 0; i < 4; ++i)
1206 1194
    {
......
3392 3380

  
3393 3381
    qemu_macaddr_default_if_unset(&s->conf.macaddr);
3394 3382

  
3383
    /* prepare eeprom */
3384
    s->eeprom.contents[0] = 0x8129;
3385
#if 1
3386
    /* PCI vendor and device ID should be mirrored here */
3387
    s->eeprom.contents[1] = PCI_VENDOR_ID_REALTEK;
3388
    s->eeprom.contents[2] = PCI_DEVICE_ID_REALTEK_8139;
3389
#endif
3390
    s->eeprom.contents[7] = s->conf.macaddr.a[0] | s->conf.macaddr.a[1] << 8;
3391
    s->eeprom.contents[8] = s->conf.macaddr.a[2] | s->conf.macaddr.a[3] << 8;
3392
    s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
3393

  
3395 3394
    s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
3396 3395
                          dev->qdev.info->name, dev->qdev.id, s);
3397 3396
    qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);

Also available in: Unified diff