Commit 2657c6633280f6ed9b1b5e75a6c60f069b39f702

Authored by balrog
1 parent fbd1711d

E100 savevm/loadvm support, patch by Jason Wessel.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3041 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 98 additions and 4 deletions
hw/eepro100.c
... ... @@ -1571,10 +1571,9 @@ static void nic_receive(void *opaque, const uint8_t * buf, int size)
1571 1571 static int nic_load(QEMUFile * f, void *opaque, int version_id)
1572 1572 {
1573 1573 EEPRO100State *s = (EEPRO100State *) opaque;
  1574 + int i;
1574 1575 int ret;
1575 1576  
1576   - missing("NIC load");
1577   -
1578 1577 if (version_id > 3)
1579 1578 return -EINVAL;
1580 1579  
... ... @@ -1608,14 +1607,61 @@ static int nic_load(QEMUFile * f, void *opaque, int version_id)
1608 1607 qemu_get_buffer(f, s->mult, 8);
1609 1608 qemu_get_buffer(f, s->mem, sizeof(s->mem));
1610 1609  
  1610 + /* Restore all members of struct between scv_stat and mem */
  1611 + qemu_get_8s(f, &s->scb_stat);
  1612 + qemu_get_8s(f, &s->int_stat);
  1613 + for (i = 0; i < 3; i++)
  1614 + qemu_get_be32s(f, &s->region[i]);
  1615 + qemu_get_buffer(f, s->macaddr, 6);
  1616 + for (i = 0; i < 19; i++)
  1617 + qemu_get_be32s(f, &s->statcounter[i]);
  1618 + for (i = 0; i < 32; i++)
  1619 + qemu_get_be16s(f, &s->mdimem[i]);
  1620 + /* The eeprom should be saved and restored by its own routines */
  1621 + qemu_get_be32s(f, &s->device);
  1622 + qemu_get_be32s(f, &s->pointer);
  1623 + qemu_get_be32s(f, &s->cu_base);
  1624 + qemu_get_be32s(f, &s->cu_offset);
  1625 + qemu_get_be32s(f, &s->ru_base);
  1626 + qemu_get_be32s(f, &s->ru_offset);
  1627 + qemu_get_be32s(f, &s->statsaddr);
  1628 + /* Restore epro100_stats_t statistics */
  1629 + qemu_get_be32s(f, &s->statistics.tx_good_frames);
  1630 + qemu_get_be32s(f, &s->statistics.tx_max_collisions);
  1631 + qemu_get_be32s(f, &s->statistics.tx_late_collisions);
  1632 + qemu_get_be32s(f, &s->statistics.tx_underruns);
  1633 + qemu_get_be32s(f, &s->statistics.tx_lost_crs);
  1634 + qemu_get_be32s(f, &s->statistics.tx_deferred);
  1635 + qemu_get_be32s(f, &s->statistics.tx_single_collisions);
  1636 + qemu_get_be32s(f, &s->statistics.tx_multiple_collisions);
  1637 + qemu_get_be32s(f, &s->statistics.tx_total_collisions);
  1638 + qemu_get_be32s(f, &s->statistics.rx_good_frames);
  1639 + qemu_get_be32s(f, &s->statistics.rx_crc_errors);
  1640 + qemu_get_be32s(f, &s->statistics.rx_alignment_errors);
  1641 + qemu_get_be32s(f, &s->statistics.rx_resource_errors);
  1642 + qemu_get_be32s(f, &s->statistics.rx_overrun_errors);
  1643 + qemu_get_be32s(f, &s->statistics.rx_cdt_errors);
  1644 + qemu_get_be32s(f, &s->statistics.rx_short_frame_errors);
  1645 + qemu_get_be32s(f, &s->statistics.fc_xmt_pause);
  1646 + qemu_get_be32s(f, &s->statistics.fc_rcv_pause);
  1647 + qemu_get_be32s(f, &s->statistics.fc_rcv_unsupported);
  1648 + qemu_get_be16s(f, &s->statistics.xmt_tco_frames);
  1649 + qemu_get_be16s(f, &s->statistics.rcv_tco_frames);
  1650 + qemu_get_be32s(f, &s->statistics.complete);
  1651 +#if 0
  1652 + qemu_get_be16s(f, &s->status);
  1653 +#endif
  1654 +
  1655 + /* Configuration bytes. */
  1656 + qemu_get_buffer(f, s->configuration, sizeof(s->configuration));
  1657 +
1611 1658 return 0;
1612 1659 }
1613 1660  
1614 1661 static void nic_save(QEMUFile * f, void *opaque)
1615 1662 {
1616 1663 EEPRO100State *s = (EEPRO100State *) opaque;
1617   -
1618   - missing("NIC save");
  1664 + int i;
1619 1665  
1620 1666 if (s->pci_dev)
1621 1667 pci_device_save(s->pci_dev, f);
... ... @@ -1639,6 +1685,54 @@ static void nic_save(QEMUFile * f, void *opaque)
1639 1685 qemu_put_8s(f, &s->curpag);
1640 1686 qemu_put_buffer(f, s->mult, 8);
1641 1687 qemu_put_buffer(f, s->mem, sizeof(s->mem));
  1688 +
  1689 + /* Save all members of struct between scv_stat and mem */
  1690 + qemu_put_8s(f, &s->scb_stat);
  1691 + qemu_put_8s(f, &s->int_stat);
  1692 + for (i = 0; i < 3; i++)
  1693 + qemu_put_be32s(f, &s->region[i]);
  1694 + qemu_put_buffer(f, s->macaddr, 6);
  1695 + for (i = 0; i < 19; i++)
  1696 + qemu_put_be32s(f, &s->statcounter[i]);
  1697 + for (i = 0; i < 32; i++)
  1698 + qemu_put_be16s(f, &s->mdimem[i]);
  1699 + /* The eeprom should be saved and restored by its own routines */
  1700 + qemu_put_be32s(f, &s->device);
  1701 + qemu_put_be32s(f, &s->pointer);
  1702 + qemu_put_be32s(f, &s->cu_base);
  1703 + qemu_put_be32s(f, &s->cu_offset);
  1704 + qemu_put_be32s(f, &s->ru_base);
  1705 + qemu_put_be32s(f, &s->ru_offset);
  1706 + qemu_put_be32s(f, &s->statsaddr);
  1707 + /* Save epro100_stats_t statistics */
  1708 + qemu_put_be32s(f, &s->statistics.tx_good_frames);
  1709 + qemu_put_be32s(f, &s->statistics.tx_max_collisions);
  1710 + qemu_put_be32s(f, &s->statistics.tx_late_collisions);
  1711 + qemu_put_be32s(f, &s->statistics.tx_underruns);
  1712 + qemu_put_be32s(f, &s->statistics.tx_lost_crs);
  1713 + qemu_put_be32s(f, &s->statistics.tx_deferred);
  1714 + qemu_put_be32s(f, &s->statistics.tx_single_collisions);
  1715 + qemu_put_be32s(f, &s->statistics.tx_multiple_collisions);
  1716 + qemu_put_be32s(f, &s->statistics.tx_total_collisions);
  1717 + qemu_put_be32s(f, &s->statistics.rx_good_frames);
  1718 + qemu_put_be32s(f, &s->statistics.rx_crc_errors);
  1719 + qemu_put_be32s(f, &s->statistics.rx_alignment_errors);
  1720 + qemu_put_be32s(f, &s->statistics.rx_resource_errors);
  1721 + qemu_put_be32s(f, &s->statistics.rx_overrun_errors);
  1722 + qemu_put_be32s(f, &s->statistics.rx_cdt_errors);
  1723 + qemu_put_be32s(f, &s->statistics.rx_short_frame_errors);
  1724 + qemu_put_be32s(f, &s->statistics.fc_xmt_pause);
  1725 + qemu_put_be32s(f, &s->statistics.fc_rcv_pause);
  1726 + qemu_put_be32s(f, &s->statistics.fc_rcv_unsupported);
  1727 + qemu_put_be16s(f, &s->statistics.xmt_tco_frames);
  1728 + qemu_put_be16s(f, &s->statistics.rcv_tco_frames);
  1729 + qemu_put_be32s(f, &s->statistics.complete);
  1730 +#if 0
  1731 + qemu_put_be16s(f, &s->status);
  1732 +#endif
  1733 +
  1734 + /* Configuration bytes. */
  1735 + qemu_put_buffer(f, s->configuration, sizeof(s->configuration));
1642 1736 }
1643 1737  
1644 1738 static void nic_init(PCIBus * bus, NICInfo * nd,
... ...