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 |
}
|