diff options
author | Juan Quintela <quintela@redhat.com> | 2009-10-19 19:20:26 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-27 12:28:54 -0500 |
commit | 28366c3ac569d0f0adff9ebfdf808d0e7b1f984e (patch) | |
tree | 9138cbbcc1a6674d1f6e324fa17d2773b6698494 /hw/e1000.c | |
parent | 2e885049381f925fc2b430289c4aeeccd0ef4ed3 (diff) | |
download | qemu-28366c3ac569d0f0adff9ebfdf808d0e7b1f984e.zip qemu-28366c3ac569d0f0adff9ebfdf808d0e7b1f984e.tar.gz qemu-28366c3ac569d0f0adff9ebfdf808d0e7b1f984e.tar.bz2 |
e1000: unfold mac_regarraystosave array
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/e1000.c')
-rw-r--r-- | hw/e1000.c | 30 |
1 files changed, 14 insertions, 16 deletions
@@ -881,17 +881,11 @@ e1000_mmio_readw(void *opaque, target_phys_addr_t addr) (8 * (addr & 3))) & 0xffff; } -static const struct { - int size; - int array0; -} mac_regarraystosave[] = { {32, RA}, {128, MTA}, {128, VFTA} }; -enum { MAC_NARRAYS = ARRAY_SIZE(mac_regarraystosave) }; - static void nic_save(QEMUFile *f, void *opaque) { E1000State *s = opaque; - int i, j; + int i; pci_device_save(&s->dev, f); qemu_put_be32(f, 0); @@ -959,17 +953,19 @@ nic_save(QEMUFile *f, void *opaque) qemu_put_be32s(f, &s->mac_reg[TXDCTL]); qemu_put_be32s(f, &s->mac_reg[WUFC]); qemu_put_be32s(f, &s->mac_reg[VET]); - for (i = 0; i < MAC_NARRAYS; i++) - for (j = 0; j < mac_regarraystosave[i].size; j++) - qemu_put_be32s(f, - s->mac_reg + mac_regarraystosave[i].array0 + j); + for (i = RA; i < RA + 32; i++) + qemu_put_be32s(f, &s->mac_reg[i]); + for (i = MTA; i < MTA + 128; i++) + qemu_put_be32s(f, &s->mac_reg[i]); + for (i = VFTA; i < VFTA + 128; i++) + qemu_put_be32s(f, &s->mac_reg[i]); } static int nic_load(QEMUFile *f, void *opaque, int version_id) { E1000State *s = opaque; - int i, j, ret; + int i, ret; if ((ret = pci_device_load(&s->dev, f)) < 0) return ret; @@ -1040,10 +1036,12 @@ nic_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be32s(f, &s->mac_reg[TXDCTL]); qemu_get_be32s(f, &s->mac_reg[WUFC]); qemu_get_be32s(f, &s->mac_reg[VET]); - for (i = 0; i < MAC_NARRAYS; i++) - for (j = 0; j < mac_regarraystosave[i].size; j++) - qemu_get_be32s(f, - s->mac_reg + mac_regarraystosave[i].array0 + j); + for (i = RA; i < RA + 32; i++) + qemu_get_be32s(f, &s->mac_reg[i]); + for (i = MTA; i < MTA + 128; i++) + qemu_get_be32s(f, &s->mac_reg[i]); + for (i = VFTA; i < VFTA + 128; i++) + qemu_get_be32s(f, &s->mac_reg[i]); return 0; } |