Revision 4e3db917
b/hw/eepro100.c | ||
---|---|---|
195 | 195 |
uint8_t cmd; |
196 | 196 |
uint32_t start; |
197 | 197 |
uint32_t stop; |
198 |
uint8_t boundary; |
|
199 |
uint8_t tsr; |
|
200 |
uint8_t tpsr; |
|
201 |
uint16_t tcnt; |
|
202 |
uint16_t rcnt; |
|
203 |
uint32_t rsar; |
|
204 |
uint8_t rsr; |
|
205 |
uint8_t rxcr; |
|
206 |
uint8_t isr; |
|
207 |
uint8_t dcfg; |
|
208 |
uint8_t imr; |
|
209 |
uint8_t phys[6]; /* mac address */ |
|
210 |
uint8_t curpag; |
|
198 | 211 |
uint8_t mult[8]; /* multicast mask array */ |
199 | 212 |
int mmio_index; |
200 | 213 |
VLANClientState *vc; |
... | ... | |
203 | 216 |
uint8_t int_stat; /* PCI interrupt status */ |
204 | 217 |
uint32_t region[3]; /* PCI region addresses */ |
205 | 218 |
uint8_t macaddr[6]; |
219 |
uint32_t statcounter[19]; |
|
206 | 220 |
uint16_t mdimem[32]; |
207 | 221 |
eeprom_t *eeprom; |
208 | 222 |
uint32_t device; /* device variant */ |
... | ... | |
214 | 228 |
uint32_t ru_base; /* RU base address */ |
215 | 229 |
uint32_t ru_offset; /* RU address offset */ |
216 | 230 |
uint32_t statsaddr; /* pointer to eepro100_stats_t */ |
217 |
/* Statistical counters. Also used for wake-up packet (i82559). */ |
|
218 |
eepro100_stats_t statistics; |
|
231 |
eepro100_stats_t statistics; /* statistical counters */ |
|
219 | 232 |
#if 0 |
220 | 233 |
uint16_t status; |
221 | 234 |
#endif |
... | ... | |
227 | 240 |
uint8_t mem[PCI_MEM_SIZE]; |
228 | 241 |
} EEPRO100State; |
229 | 242 |
|
230 |
/* Parameters for nic_save, nic_load. */ |
|
231 |
static const int eepro100_instance = -1; |
|
232 |
static const int eepro100_version = 20090807; |
|
233 |
|
|
234 | 243 |
/* Default values for MDI (PHY) registers */ |
235 | 244 |
static const uint16_t eepro100_mdi_default[] = { |
236 | 245 |
/* MDI Registers 0 - 6, 7 */ |
... | ... | |
1579 | 1588 |
int i; |
1580 | 1589 |
int ret; |
1581 | 1590 |
|
1582 |
if (version_id != eepro100_version) {
|
|
1591 |
if (version_id > 3)
|
|
1583 | 1592 |
return -EINVAL; |
1593 |
|
|
1594 |
if (version_id >= 3) { |
|
1595 |
ret = pci_device_load(&s->dev, f); |
|
1596 |
if (ret < 0) |
|
1597 |
return ret; |
|
1584 | 1598 |
} |
1585 | 1599 |
|
1586 |
ret = pci_device_load(&s->dev, f); |
|
1587 |
if (ret < 0) { |
|
1588 |
return ret; |
|
1600 |
if (version_id >= 2) { |
|
1601 |
qemu_get_8s(f, &s->rxcr); |
|
1602 |
} else { |
|
1603 |
s->rxcr = 0x0c; |
|
1589 | 1604 |
} |
1590 | 1605 |
|
1591 | 1606 |
qemu_get_8s(f, &s->cmd); |
1592 | 1607 |
qemu_get_be32s(f, &s->start); |
1593 | 1608 |
qemu_get_be32s(f, &s->stop); |
1609 |
qemu_get_8s(f, &s->boundary); |
|
1610 |
qemu_get_8s(f, &s->tsr); |
|
1611 |
qemu_get_8s(f, &s->tpsr); |
|
1612 |
qemu_get_be16s(f, &s->tcnt); |
|
1613 |
qemu_get_be16s(f, &s->rcnt); |
|
1614 |
qemu_get_be32s(f, &s->rsar); |
|
1615 |
qemu_get_8s(f, &s->rsr); |
|
1616 |
qemu_get_8s(f, &s->isr); |
|
1617 |
qemu_get_8s(f, &s->dcfg); |
|
1618 |
qemu_get_8s(f, &s->imr); |
|
1619 |
qemu_get_buffer(f, s->phys, 6); |
|
1620 |
qemu_get_8s(f, &s->curpag); |
|
1594 | 1621 |
qemu_get_buffer(f, s->mult, 8); |
1595 | 1622 |
qemu_get_buffer(f, s->mem, sizeof(s->mem)); |
1596 | 1623 |
|
1597 | 1624 |
/* Restore all members of struct between scv_stat and mem. */ |
1598 | 1625 |
qemu_get_8s(f, &s->scb_stat); |
1599 | 1626 |
qemu_get_8s(f, &s->int_stat); |
1600 |
for (i = 0; i < ARRAY_SIZE(s->region); i++) {
|
|
1627 |
for (i = 0; i < 3; i++) {
|
|
1601 | 1628 |
qemu_get_be32s(f, &s->region[i]); |
1602 | 1629 |
} |
1603 | 1630 |
qemu_get_buffer(f, s->macaddr, 6); |
1604 |
for (i = 0; i < ARRAY_SIZE(s->mdimem); i++) { |
|
1631 |
for (i = 0; i < 19; i++) { |
|
1632 |
qemu_get_be32s(f, &s->statcounter[i]); |
|
1633 |
} |
|
1634 |
for (i = 0; i < 32; i++) { |
|
1605 | 1635 |
qemu_get_be16s(f, &s->mdimem[i]); |
1606 | 1636 |
} |
1607 | 1637 |
/* The eeprom should be saved and restored by its own routines. */ |
... | ... | |
1652 | 1682 |
|
1653 | 1683 |
pci_device_save(&s->dev, f); |
1654 | 1684 |
|
1685 |
qemu_put_8s(f, &s->rxcr); |
|
1686 |
|
|
1655 | 1687 |
qemu_put_8s(f, &s->cmd); |
1656 | 1688 |
qemu_put_be32s(f, &s->start); |
1657 | 1689 |
qemu_put_be32s(f, &s->stop); |
1690 |
qemu_put_8s(f, &s->boundary); |
|
1691 |
qemu_put_8s(f, &s->tsr); |
|
1692 |
qemu_put_8s(f, &s->tpsr); |
|
1693 |
qemu_put_be16s(f, &s->tcnt); |
|
1694 |
qemu_put_be16s(f, &s->rcnt); |
|
1695 |
qemu_put_be32s(f, &s->rsar); |
|
1696 |
qemu_put_8s(f, &s->rsr); |
|
1697 |
qemu_put_8s(f, &s->isr); |
|
1698 |
qemu_put_8s(f, &s->dcfg); |
|
1699 |
qemu_put_8s(f, &s->imr); |
|
1700 |
qemu_put_buffer(f, s->phys, 6); |
|
1701 |
qemu_put_8s(f, &s->curpag); |
|
1658 | 1702 |
qemu_put_buffer(f, s->mult, 8); |
1659 | 1703 |
qemu_put_buffer(f, s->mem, sizeof(s->mem)); |
1660 | 1704 |
|
1661 | 1705 |
/* Save all members of struct between scv_stat and mem. */ |
1662 | 1706 |
qemu_put_8s(f, &s->scb_stat); |
1663 | 1707 |
qemu_put_8s(f, &s->int_stat); |
1664 |
for (i = 0; i < ARRAY_SIZE(s->region); i++) {
|
|
1708 |
for (i = 0; i < 3; i++) {
|
|
1665 | 1709 |
qemu_put_be32s(f, &s->region[i]); |
1666 | 1710 |
} |
1667 | 1711 |
qemu_put_buffer(f, s->macaddr, 6); |
1668 |
for (i = 0; i < ARRAY_SIZE(s->mdimem); i++) { |
|
1712 |
for (i = 0; i < 19; i++) { |
|
1713 |
qemu_put_be32s(f, &s->statcounter[i]); |
|
1714 |
} |
|
1715 |
for (i = 0; i < 32; i++) { |
|
1669 | 1716 |
qemu_put_be16s(f, &s->mdimem[i]); |
1670 | 1717 |
} |
1671 | 1718 |
/* The eeprom should be saved and restored by its own routines. */ |
... | ... | |
1768 | 1815 |
|
1769 | 1816 |
qemu_register_reset(nic_reset, s); |
1770 | 1817 |
|
1771 |
register_savevm(s->vc->model, eepro100_instance, eepro100_version, |
|
1772 |
nic_save, nic_load, s); |
|
1818 |
register_savevm(s->vc->model, -1, 3, nic_save, nic_load, s); |
|
1773 | 1819 |
return 0; |
1774 | 1820 |
} |
1775 | 1821 |
|
Also available in: Unified diff