qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] eepro100: Remove unused device status entries
@ 2009-09-19 11:41 Stefan Weil
       [not found] ` <m3d45naqws.fsf@neno.mitica>
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2009-09-19 11:41 UTC (permalink / raw)
  To: QEMU Developers

A lot of entries are unused (they were added by copy + paste
from other drivers during development of eepro100.c).

Removing them from nic_save, nic_load makes any
old saved status incompatible, so a new version
for the virtual machine data was needed, too.

This patch is a step to synchronize my maintainer version
of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the
version integrated in QEMU.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/eepro100.c |   78 +++++++++++---------------------------------------------
 1 files changed, 16 insertions(+), 62 deletions(-)

diff --git a/hw/eepro100.c b/hw/eepro100.c
index 1d66edb..a8f6b3f 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -195,19 +195,6 @@ typedef struct {
     uint8_t cmd;
     uint32_t start;
     uint32_t stop;
-    uint8_t boundary;
-    uint8_t tsr;
-    uint8_t tpsr;
-    uint16_t tcnt;
-    uint16_t rcnt;
-    uint32_t rsar;
-    uint8_t rsr;
-    uint8_t rxcr;
-    uint8_t isr;
-    uint8_t dcfg;
-    uint8_t imr;
-    uint8_t phys[6];            /* mac address */
-    uint8_t curpag;
     uint8_t mult[8];            /* multicast mask array */
     int mmio_index;
     VLANClientState *vc;
@@ -216,7 +203,6 @@ typedef struct {
     uint8_t int_stat;           /* PCI interrupt status */
     uint32_t region[3];         /* PCI region addresses */
     uint8_t macaddr[6];
-    uint32_t statcounter[19];
     uint16_t mdimem[32];
     eeprom_t *eeprom;
     uint32_t device;            /* device variant */
@@ -228,7 +214,8 @@ typedef struct {
     uint32_t ru_base;           /* RU base address */
     uint32_t ru_offset;         /* RU address offset */
     uint32_t statsaddr;         /* pointer to eepro100_stats_t */
-    eepro100_stats_t statistics;        /* statistical counters */
+    /* Statistical counters. Also used for wake-up packet (i82559). */
+    eepro100_stats_t statistics;
 #if 0
     uint16_t status;
 #endif
@@ -240,6 +227,10 @@ typedef struct {
     uint8_t mem[PCI_MEM_SIZE];
 } EEPRO100State;
 
+/* Parameters for nic_save, nic_load. */
+static const int eepro100_instance = -1;
+static const int eepro100_version = 20090807;
+
 /* Default values for MDI (PHY) registers */
 static const uint16_t eepro100_mdi_default[] = {
     /* MDI Registers 0 - 6, 7 */
@@ -1588,50 +1579,29 @@ static int nic_load(QEMUFile * f, void *opaque, int version_id)
     int i;
     int ret;
 
-    if (version_id > 3)
+    if (version_id != eepro100_version) {
         return -EINVAL;
-
-    if (version_id >= 3) {
-        ret = pci_device_load(&s->dev, f);
-        if (ret < 0)
-            return ret;
     }
 
-    if (version_id >= 2) {
-        qemu_get_8s(f, &s->rxcr);
-    } else {
-        s->rxcr = 0x0c;
+    ret = pci_device_load(&s->dev, f);
+    if (ret < 0) {
+        return ret;
     }
 
     qemu_get_8s(f, &s->cmd);
     qemu_get_be32s(f, &s->start);
     qemu_get_be32s(f, &s->stop);
-    qemu_get_8s(f, &s->boundary);
-    qemu_get_8s(f, &s->tsr);
-    qemu_get_8s(f, &s->tpsr);
-    qemu_get_be16s(f, &s->tcnt);
-    qemu_get_be16s(f, &s->rcnt);
-    qemu_get_be32s(f, &s->rsar);
-    qemu_get_8s(f, &s->rsr);
-    qemu_get_8s(f, &s->isr);
-    qemu_get_8s(f, &s->dcfg);
-    qemu_get_8s(f, &s->imr);
-    qemu_get_buffer(f, s->phys, 6);
-    qemu_get_8s(f, &s->curpag);
     qemu_get_buffer(f, s->mult, 8);
     qemu_get_buffer(f, s->mem, sizeof(s->mem));
 
     /* Restore all members of struct between scv_stat and mem. */
     qemu_get_8s(f, &s->scb_stat);
     qemu_get_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < ARRAY_SIZE(s->region); i++) {
         qemu_get_be32s(f, &s->region[i]);
     }
     qemu_get_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_get_be32s(f, &s->statcounter[i]);
-    }
-    for (i = 0; i < 32; i++) {
+    for (i = 0; i < ARRAY_SIZE(s->mdimem); i++) {
         qemu_get_be16s(f, &s->mdimem[i]);
     }
     /* The eeprom should be saved and restored by its own routines. */
@@ -1682,37 +1652,20 @@ static void nic_save(QEMUFile * f, void *opaque)
 
     pci_device_save(&s->dev, f);
 
-    qemu_put_8s(f, &s->rxcr);
-
     qemu_put_8s(f, &s->cmd);
     qemu_put_be32s(f, &s->start);
     qemu_put_be32s(f, &s->stop);
-    qemu_put_8s(f, &s->boundary);
-    qemu_put_8s(f, &s->tsr);
-    qemu_put_8s(f, &s->tpsr);
-    qemu_put_be16s(f, &s->tcnt);
-    qemu_put_be16s(f, &s->rcnt);
-    qemu_put_be32s(f, &s->rsar);
-    qemu_put_8s(f, &s->rsr);
-    qemu_put_8s(f, &s->isr);
-    qemu_put_8s(f, &s->dcfg);
-    qemu_put_8s(f, &s->imr);
-    qemu_put_buffer(f, s->phys, 6);
-    qemu_put_8s(f, &s->curpag);
     qemu_put_buffer(f, s->mult, 8);
     qemu_put_buffer(f, s->mem, sizeof(s->mem));
 
     /* Save all members of struct between scv_stat and mem. */
     qemu_put_8s(f, &s->scb_stat);
     qemu_put_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < ARRAY_SIZE(s->region); i++) {
         qemu_put_be32s(f, &s->region[i]);
     }
     qemu_put_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_put_be32s(f, &s->statcounter[i]);
-    }
-    for (i = 0; i < 32; i++) {
+    for (i = 0; i < ARRAY_SIZE(s->mdimem); i++) {
         qemu_put_be16s(f, &s->mdimem[i]);
     }
     /* The eeprom should be saved and restored by its own routines. */
@@ -1815,7 +1768,8 @@ static int nic_init(PCIDevice *pci_dev, uint32_t device)
 
     qemu_register_reset(nic_reset, s);
 
-    register_savevm(s->vc->model, -1, 3, nic_save, nic_load, s);
+    register_savevm(s->vc->model, eepro100_instance, eepro100_version,
+                    nic_save, nic_load, s);
     return 0;
 }
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] eepro100: Remove unused device status entries
       [not found] ` <m3d45naqws.fsf@neno.mitica>
@ 2009-09-19 15:58   ` Stefan Weil
  2009-10-05 13:20     ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2009-09-19 15:58 UTC (permalink / raw)
  To: Juan Quintela; +Cc: QEMU Developers

Juan Quintela schrieb:
> Stefan Weil <weil@mail.berlios.de> wrote:
>> A lot of entries are unused (they were added by copy + paste
>> from other drivers during development of eepro100.c).
>>
>> Removing them from nic_save, nic_load makes any
>> old saved status incompatible, so a new version
>> for the virtual machine data was needed, too.
>>
>> This patch is a step to synchronize my maintainer version
>> of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the
>> version integrated in QEMU.
>>
>> +/* Parameters for nic_save, nic_load. */
>> +static const int eepro100_instance = -1;
>> +static const int eepro100_version = 20090807;
>
>
> Please, don't make version big numbers, idea is that versions are small
> numbers.
>
> Why do you want to be incompatible with the old saved state? We are
> going to big troubles to make everythnig backwards compatible, removing
> fields just makes everybody life worse. You can just rename as:
>
> s/foo/foo_dummy/ or /foo_vmstate/ and let it into the state.
>
> Later, Juan.

hi Juan

backward compatibility is ok for widely used features in stable software
releases,
and for a short moment I had thought about implementing it. Reading dummies
would have been sufficient (no need to keep dummies in the state).
But I decided against it.

I doubt that anybody is using saved machine states with eepro100 driver
data,
because those network cards are not QEMU's default, and they are still
unfinished.
So backward compatibility would have been an unnecessary burden here.
It is also better not to pretend that there is any backward compatibility
when it is nearly impossible to test this (and I am sure that there are
severe
faults in it).

My patch aims at finishing (or at least fixing and completing) this driver.
Some more patches are still needed for this goal (see my version on
repo.or.cz).

Personally, I prefer version numbers which express something, for example
the date of a change (as in my case). If it helps, I promise to send a patch
which sets the version number to 4 as soon as the rest of eepro100.c is ok.

Antony, please take the patch for now as it is, because I won't send a
new one
just to change the version number.

Regards

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Re: [PATCH] eepro100: Remove unused device status entries
  2009-09-19 15:58   ` [Qemu-devel] " Stefan Weil
@ 2009-10-05 13:20     ` Anthony Liguori
  2009-10-08  6:15       ` [Qemu-devel] " Stefan Weil
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2009-10-05 13:20 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Juan Quintela, QEMU Developers

Stefan Weil wrote:
> Personally, I prefer version numbers which express something, for example
> the date of a change (as in my case). If it helps, I promise to send a patch
> which sets the version number to 4 as soon as the rest of eepro100.c is ok.
>
> Antony, please take the patch for now as it is, because I won't send a
> new one
> just to change the version number.
>   

No, the version number is wrong.  It also shouldn't be a variable.  And 
since eepro100 was in the 0.11.0 release, we need support backwards 
compatibility appropriately.

Regards,

Anthony Liguori

> Regards
>
> Stefan
>
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] eepro100: Remove unused device status entries
  2009-10-05 13:20     ` Anthony Liguori
@ 2009-10-08  6:15       ` Stefan Weil
  2009-10-08 19:00         ` Stuart Brady
  2009-10-09 17:49         ` Stefan Weil
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Weil @ 2009-10-08  6:15 UTC (permalink / raw)
  To: anthony, quintela, QEMU Developers

Once upon the time when QEMU hacking was fun
there was a brave knight who wanted to have
a driver for a special intel nic.

So he started by cloning ne2000.c which also
meant that the new born eepro100.c was
immediately three years old.

Other knights who also wanted to have fun and
take their part in the battle thought that it
would be a good idea to remove stupid code
which says "missing nic load, missing nic save".

They saved everything they saw, man and women,
ne2000 code and runtime address offsets, and
put all saved elements in a prison called
vm data.

When the first knight came back and noticed
the unhappy prisoners, he wanted to set them
free. But the keepers of the keys told him
that they would have to stay there forever
for compatibility reasons.

So our brave knight now takes a new effort
to save the souls of the poor prisoners by
removing their names.

Their bodies will have to rot in the dungeons
of compatibility forever, watched by the
keepers of the keys.
---
 hw/eepro100.c |   94 ++++++++++++--------------------------------------------
 1 files changed, 20 insertions(+), 74 deletions(-)

diff --git a/hw/eepro100.c b/hw/eepro100.c
index 445d46c..62207da 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -191,32 +191,14 @@ typedef enum {
 
 typedef struct {
     PCIDevice dev;
-#if 1
-    uint8_t cmd;
-    uint32_t start;
-    uint32_t stop;
-    uint8_t boundary;
-    uint8_t tsr;
-    uint8_t tpsr;
-    uint16_t tcnt;
-    uint16_t rcnt;
-    uint32_t rsar;
-    uint8_t rsr;
-    uint8_t rxcr;
-    uint8_t isr;
-    uint8_t dcfg;
-    uint8_t imr;
-    uint8_t phys[6];            /* mac address */
-    uint8_t curpag;
     uint8_t mult[8];            /* multicast mask array */
     int mmio_index;
     VLANClientState *vc;
-#endif
     uint8_t scb_stat;           /* SCB stat/ack byte */
     uint8_t int_stat;           /* PCI interrupt status */
+    /* region must not be saved by nic_save. */
     uint32_t region[3];         /* PCI region addresses */
     uint8_t macaddr[6];
-    uint32_t statcounter[19];
     uint16_t mdimem[32];
     eeprom_t *eeprom;
     uint32_t device;            /* device variant */
@@ -1618,51 +1600,31 @@ static int nic_load(QEMUFile * f, void *opaque, int version_id)
     if (version_id > 3)
         return -EINVAL;
 
-    if (version_id >= 3) {
-        ret = pci_device_load(&s->dev, f);
-        if (ret < 0)
-            return ret;
+    ret = pci_device_load(&s->dev, f);
+    if (ret < 0) {
+        return ret;
     }
 
-    if (version_id >= 2) {
-        qemu_get_8s(f, &s->rxcr);
-    } else {
-        s->rxcr = 0x0c;
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 32, SEEK_CUR);
 
-    qemu_get_8s(f, &s->cmd);
-    qemu_get_be32s(f, &s->start);
-    qemu_get_be32s(f, &s->stop);
-    qemu_get_8s(f, &s->boundary);
-    qemu_get_8s(f, &s->tsr);
-    qemu_get_8s(f, &s->tpsr);
-    qemu_get_be16s(f, &s->tcnt);
-    qemu_get_be16s(f, &s->rcnt);
-    qemu_get_be32s(f, &s->rsar);
-    qemu_get_8s(f, &s->rsr);
-    qemu_get_8s(f, &s->isr);
-    qemu_get_8s(f, &s->dcfg);
-    qemu_get_8s(f, &s->imr);
-    qemu_get_buffer(f, s->phys, 6);
-    qemu_get_8s(f, &s->curpag);
     qemu_get_buffer(f, s->mult, 8);
     qemu_get_buffer(f, s->mem, sizeof(s->mem));
 
-    /* Restore all members of struct between scv_stat and mem. */
+    /* Restore all members of struct between scb_stat and mem. */
     qemu_get_8s(f, &s->scb_stat);
     qemu_get_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
-        qemu_get_be32s(f, &s->region[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 3 * 4, SEEK_CUR);
     qemu_get_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_get_be32s(f, &s->statcounter[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 19 * 4, SEEK_CUR);
     for (i = 0; i < 32; i++) {
         qemu_get_be16s(f, &s->mdimem[i]);
     }
     /* The eeprom should be saved and restored by its own routines. */
     qemu_get_be32s(f, &s->device);
+    // TODO check device.
     qemu_get_be32s(f, &s->pointer);
     qemu_get_be32s(f, &s->cu_base);
     qemu_get_be32s(f, &s->cu_offset);
@@ -1709,36 +1671,20 @@ static void nic_save(QEMUFile * f, void *opaque)
 
     pci_device_save(&s->dev, f);
 
-    qemu_put_8s(f, &s->rxcr);
-
-    qemu_put_8s(f, &s->cmd);
-    qemu_put_be32s(f, &s->start);
-    qemu_put_be32s(f, &s->stop);
-    qemu_put_8s(f, &s->boundary);
-    qemu_put_8s(f, &s->tsr);
-    qemu_put_8s(f, &s->tpsr);
-    qemu_put_be16s(f, &s->tcnt);
-    qemu_put_be16s(f, &s->rcnt);
-    qemu_put_be32s(f, &s->rsar);
-    qemu_put_8s(f, &s->rsr);
-    qemu_put_8s(f, &s->isr);
-    qemu_put_8s(f, &s->dcfg);
-    qemu_put_8s(f, &s->imr);
-    qemu_put_buffer(f, s->phys, 6);
-    qemu_put_8s(f, &s->curpag);
+    /* Skip unused entries. */
+    qemu_fseek(f, 32, SEEK_CUR);
+
     qemu_put_buffer(f, s->mult, 8);
     qemu_put_buffer(f, s->mem, sizeof(s->mem));
 
-    /* Save all members of struct between scv_stat and mem. */
+    /* Save all members of struct between scb_stat and mem. */
     qemu_put_8s(f, &s->scb_stat);
     qemu_put_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
-        qemu_put_be32s(f, &s->region[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 3 * 4, SEEK_CUR);
     qemu_put_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_put_be32s(f, &s->statcounter[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 19 * 4, SEEK_CUR);
     for (i = 0; i < 32; i++) {
         qemu_put_be16s(f, &s->mdimem[i]);
     }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] eepro100: Remove unused device status entries
  2009-10-08  6:15       ` [Qemu-devel] " Stefan Weil
@ 2009-10-08 19:00         ` Stuart Brady
  2009-10-08 19:19           ` Stefan Weil
  2009-10-09 17:49         ` Stefan Weil
  1 sibling, 1 reply; 7+ messages in thread
From: Stuart Brady @ 2009-10-08 19:00 UTC (permalink / raw)
  To: qemu-devel

On Thu, Oct 08, 2009 at 08:15:37AM +0200, Stefan Weil wrote:

[snip entertaining patch description]

> -    if (version_id >= 2) {
> -        qemu_get_8s(f, &s->rxcr);
> -    } else {
> -        s->rxcr = 0x0c;
> -    }
> +    /* Skip unused entries. */
> +    qemu_fseek(f, 32, SEEK_CUR);

Shouldn't the number of bytes skipped depend on the version ID?

Cheers,
-- 
Stuart Brady

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] eepro100: Remove unused device status entries
  2009-10-08 19:00         ` Stuart Brady
@ 2009-10-08 19:19           ` Stefan Weil
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2009-10-08 19:19 UTC (permalink / raw)
  To: Stuart Brady; +Cc: qemu-devel

Stuart Brady schrieb:
> On Thu, Oct 08, 2009 at 08:15:37AM +0200, Stefan Weil wrote:
>
> [snip entertaining patch description]
>
>   
>> -    if (version_id >= 2) {
>> -        qemu_get_8s(f, &s->rxcr);
>> -    } else {
>> -        s->rxcr = 0x0c;
>> -    }
>> +    /* Skip unused entries. */
>> +    qemu_fseek(f, 32, SEEK_CUR);
>>     
>
> Shouldn't the number of bytes skipped depend on the version ID?
>
> Cheers,
>   

There was never a version id other than 3, so the "else" was junk.
The old code was a copy from ne2000.c, my original contribution
had marked it as work in progress.

Regards
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] eepro100: Remove unused device status entries
  2009-10-08  6:15       ` [Qemu-devel] " Stefan Weil
  2009-10-08 19:00         ` Stuart Brady
@ 2009-10-09 17:49         ` Stefan Weil
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2009-10-09 17:49 UTC (permalink / raw)
  To: QEMU Developers

Once upon the time when QEMU hacking was fun
there was a brave knight who wanted to have
a driver for a special intel nic.

So he started by cloning ne2000.c which also
meant that the new born eepro100.c was
immediately three years old.

Other knights who also wanted to have fun and
take their part in the battle thought that it
would be a good idea to remove stupid code
which says "missing nic load, missing nic save".

They saved everything they saw, man and women,
ne2000 code and runtime address offsets, and
put all saved elements in a prison called
vm data.

When the first knight came back and noticed
the unhappy prisoners, he wanted to set them
free. But the keepers of the keys told him
that they would have to stay there forever
for compatibility reasons.

So our brave knight now takes a new effort
to save the souls of the poor prisoners by
removing their names.

Their bodies will have to rot in the dungeons
of compatibility forever, watched by the
keepers of the keys.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/eepro100.c |   94 ++++++++++++--------------------------------------------
 1 files changed, 20 insertions(+), 74 deletions(-)

diff --git a/hw/eepro100.c b/hw/eepro100.c
index 445d46c..62207da 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -191,32 +191,14 @@ typedef enum {
 
 typedef struct {
     PCIDevice dev;
-#if 1
-    uint8_t cmd;
-    uint32_t start;
-    uint32_t stop;
-    uint8_t boundary;
-    uint8_t tsr;
-    uint8_t tpsr;
-    uint16_t tcnt;
-    uint16_t rcnt;
-    uint32_t rsar;
-    uint8_t rsr;
-    uint8_t rxcr;
-    uint8_t isr;
-    uint8_t dcfg;
-    uint8_t imr;
-    uint8_t phys[6];            /* mac address */
-    uint8_t curpag;
     uint8_t mult[8];            /* multicast mask array */
     int mmio_index;
     VLANClientState *vc;
-#endif
     uint8_t scb_stat;           /* SCB stat/ack byte */
     uint8_t int_stat;           /* PCI interrupt status */
+    /* region must not be saved by nic_save. */
     uint32_t region[3];         /* PCI region addresses */
     uint8_t macaddr[6];
-    uint32_t statcounter[19];
     uint16_t mdimem[32];
     eeprom_t *eeprom;
     uint32_t device;            /* device variant */
@@ -1618,51 +1600,31 @@ static int nic_load(QEMUFile * f, void *opaque, int version_id)
     if (version_id > 3)
         return -EINVAL;
 
-    if (version_id >= 3) {
-        ret = pci_device_load(&s->dev, f);
-        if (ret < 0)
-            return ret;
+    ret = pci_device_load(&s->dev, f);
+    if (ret < 0) {
+        return ret;
     }
 
-    if (version_id >= 2) {
-        qemu_get_8s(f, &s->rxcr);
-    } else {
-        s->rxcr = 0x0c;
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 32, SEEK_CUR);
 
-    qemu_get_8s(f, &s->cmd);
-    qemu_get_be32s(f, &s->start);
-    qemu_get_be32s(f, &s->stop);
-    qemu_get_8s(f, &s->boundary);
-    qemu_get_8s(f, &s->tsr);
-    qemu_get_8s(f, &s->tpsr);
-    qemu_get_be16s(f, &s->tcnt);
-    qemu_get_be16s(f, &s->rcnt);
-    qemu_get_be32s(f, &s->rsar);
-    qemu_get_8s(f, &s->rsr);
-    qemu_get_8s(f, &s->isr);
-    qemu_get_8s(f, &s->dcfg);
-    qemu_get_8s(f, &s->imr);
-    qemu_get_buffer(f, s->phys, 6);
-    qemu_get_8s(f, &s->curpag);
     qemu_get_buffer(f, s->mult, 8);
     qemu_get_buffer(f, s->mem, sizeof(s->mem));
 
-    /* Restore all members of struct between scv_stat and mem. */
+    /* Restore all members of struct between scb_stat and mem. */
     qemu_get_8s(f, &s->scb_stat);
     qemu_get_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
-        qemu_get_be32s(f, &s->region[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 3 * 4, SEEK_CUR);
     qemu_get_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_get_be32s(f, &s->statcounter[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 19 * 4, SEEK_CUR);
     for (i = 0; i < 32; i++) {
         qemu_get_be16s(f, &s->mdimem[i]);
     }
     /* The eeprom should be saved and restored by its own routines. */
     qemu_get_be32s(f, &s->device);
+    // TODO check device.
     qemu_get_be32s(f, &s->pointer);
     qemu_get_be32s(f, &s->cu_base);
     qemu_get_be32s(f, &s->cu_offset);
@@ -1709,36 +1671,20 @@ static void nic_save(QEMUFile * f, void *opaque)
 
     pci_device_save(&s->dev, f);
 
-    qemu_put_8s(f, &s->rxcr);
-
-    qemu_put_8s(f, &s->cmd);
-    qemu_put_be32s(f, &s->start);
-    qemu_put_be32s(f, &s->stop);
-    qemu_put_8s(f, &s->boundary);
-    qemu_put_8s(f, &s->tsr);
-    qemu_put_8s(f, &s->tpsr);
-    qemu_put_be16s(f, &s->tcnt);
-    qemu_put_be16s(f, &s->rcnt);
-    qemu_put_be32s(f, &s->rsar);
-    qemu_put_8s(f, &s->rsr);
-    qemu_put_8s(f, &s->isr);
-    qemu_put_8s(f, &s->dcfg);
-    qemu_put_8s(f, &s->imr);
-    qemu_put_buffer(f, s->phys, 6);
-    qemu_put_8s(f, &s->curpag);
+    /* Skip unused entries. */
+    qemu_fseek(f, 32, SEEK_CUR);
+
     qemu_put_buffer(f, s->mult, 8);
     qemu_put_buffer(f, s->mem, sizeof(s->mem));
 
-    /* Save all members of struct between scv_stat and mem. */
+    /* Save all members of struct between scb_stat and mem. */
     qemu_put_8s(f, &s->scb_stat);
     qemu_put_8s(f, &s->int_stat);
-    for (i = 0; i < 3; i++) {
-        qemu_put_be32s(f, &s->region[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 3 * 4, SEEK_CUR);
     qemu_put_buffer(f, s->macaddr, 6);
-    for (i = 0; i < 19; i++) {
-        qemu_put_be32s(f, &s->statcounter[i]);
-    }
+    /* Skip unused entries. */
+    qemu_fseek(f, 19 * 4, SEEK_CUR);
     for (i = 0; i < 32; i++) {
         qemu_put_be16s(f, &s->mdimem[i]);
     }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-09 17:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 11:41 [Qemu-devel] [PATCH] eepro100: Remove unused device status entries Stefan Weil
     [not found] ` <m3d45naqws.fsf@neno.mitica>
2009-09-19 15:58   ` [Qemu-devel] " Stefan Weil
2009-10-05 13:20     ` Anthony Liguori
2009-10-08  6:15       ` [Qemu-devel] " Stefan Weil
2009-10-08 19:00         ` Stuart Brady
2009-10-08 19:19           ` Stefan Weil
2009-10-09 17:49         ` Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).