eepro100: Add a dev field to eeprom new/free functions
This allows us to create a more meaningful savevm string. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
7685ee6abc
commit
5fce2b3e46
@ -1835,7 +1835,7 @@ static int pci_nic_uninit(PCIDevice *pci_dev)
|
|||||||
|
|
||||||
cpu_unregister_io_memory(s->mmio_index);
|
cpu_unregister_io_memory(s->mmio_index);
|
||||||
vmstate_unregister(&pci_dev->qdev, s->vmstate, s);
|
vmstate_unregister(&pci_dev->qdev, s->vmstate, s);
|
||||||
eeprom93xx_free(s->eeprom);
|
eeprom93xx_free(&pci_dev->qdev, s->eeprom);
|
||||||
qemu_del_vlan_client(&s->nic->nc);
|
qemu_del_vlan_client(&s->nic->nc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1862,7 +1862,7 @@ static int e100_nic_init(PCIDevice *pci_dev)
|
|||||||
|
|
||||||
/* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM,
|
/* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM,
|
||||||
* i82559 and later support 64 or 256 word EEPROM. */
|
* i82559 and later support 64 or 256 word EEPROM. */
|
||||||
s->eeprom = eeprom93xx_new(EEPROM_SIZE);
|
s->eeprom = eeprom93xx_new(&pci_dev->qdev, EEPROM_SIZE);
|
||||||
|
|
||||||
/* Handler for memory-mapped I/O */
|
/* Handler for memory-mapped I/O */
|
||||||
s->mmio_index =
|
s->mmio_index =
|
||||||
|
@ -289,7 +289,7 @@ void eeprom93xx_reset(eeprom_t *eeprom)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eeprom_t *eeprom93xx_new(uint16_t nwords)
|
eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)
|
||||||
{
|
{
|
||||||
/* Add a new EEPROM (with 16, 64 or 256 words). */
|
/* Add a new EEPROM (with 16, 64 or 256 words). */
|
||||||
eeprom_t *eeprom;
|
eeprom_t *eeprom;
|
||||||
@ -316,15 +316,15 @@ eeprom_t *eeprom93xx_new(uint16_t nwords)
|
|||||||
/* Output DO is tristate, read results in 1. */
|
/* Output DO is tristate, read results in 1. */
|
||||||
eeprom->eedo = 1;
|
eeprom->eedo = 1;
|
||||||
logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords);
|
logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords);
|
||||||
vmstate_register(NULL, 0, &vmstate_eeprom, eeprom);
|
vmstate_register(dev, 0, &vmstate_eeprom, eeprom);
|
||||||
return eeprom;
|
return eeprom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeprom93xx_free(eeprom_t *eeprom)
|
void eeprom93xx_free(DeviceState *dev, eeprom_t *eeprom)
|
||||||
{
|
{
|
||||||
/* Destroy EEPROM. */
|
/* Destroy EEPROM. */
|
||||||
logout("eeprom = 0x%p\n", eeprom);
|
logout("eeprom = 0x%p\n", eeprom);
|
||||||
vmstate_unregister(NULL, &vmstate_eeprom, eeprom);
|
vmstate_unregister(dev, &vmstate_eeprom, eeprom);
|
||||||
qemu_free(eeprom);
|
qemu_free(eeprom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
typedef struct _eeprom_t eeprom_t;
|
typedef struct _eeprom_t eeprom_t;
|
||||||
|
|
||||||
/* Create a new EEPROM with (nwords * 2) bytes. */
|
/* Create a new EEPROM with (nwords * 2) bytes. */
|
||||||
eeprom_t *eeprom93xx_new(uint16_t nwords);
|
eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords);
|
||||||
|
|
||||||
/* Destroy an existing EEPROM. */
|
/* Destroy an existing EEPROM. */
|
||||||
void eeprom93xx_free(eeprom_t *eeprom);
|
void eeprom93xx_free(DeviceState *dev, eeprom_t *eeprom);
|
||||||
|
|
||||||
/* Read from the EEPROM. */
|
/* Read from the EEPROM. */
|
||||||
uint16_t eeprom93xx_read(eeprom_t *eeprom);
|
uint16_t eeprom93xx_read(eeprom_t *eeprom);
|
||||||
|
Loading…
Reference in New Issue
Block a user