From patchwork Thu Oct 8 06:15:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 35408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9B889B7B65 for ; Thu, 8 Oct 2009 17:17:01 +1100 (EST) Received: from localhost ([127.0.0.1]:50812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvmJ6-0000uR-UI for incoming@patchwork.ozlabs.org; Thu, 08 Oct 2009 02:16:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvmID-0000r4-6w for qemu-devel@nongnu.org; Thu, 08 Oct 2009 02:16:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvmI8-0000l1-BI for qemu-devel@nongnu.org; Thu, 08 Oct 2009 02:16:00 -0400 Received: from [199.232.76.173] (port=42553 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvmI7-0000ko-Sr for qemu-devel@nongnu.org; Thu, 08 Oct 2009 02:15:55 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52347) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvmI7-0005HU-Cj for qemu-devel@nongnu.org; Thu, 08 Oct 2009 02:15:55 -0400 Received: from flocke.weilnetz.de (p54ADE7E8.dip.t-dialin.net [84.173.231.232]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LqYLt-1MQaCp3t7R-00dmhx; Thu, 08 Oct 2009 08:15:39 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.69) (envelope-from ) id 1MvmHp-0001fQ-Tz; Thu, 08 Oct 2009 08:15:37 +0200 From: Stefan Weil To: anthony@codemonkey.ws, quintela@trasno.org, QEMU Developers Date: Thu, 8 Oct 2009 08:15:37 +0200 Message-Id: <1254982537-6377-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <4AC9F29B.5060404@codemonkey.ws> References: <4AC9F29B.5060404@codemonkey.ws> X-Provags-ID: V01U2FsdGVkX1+AK6KAfNLSuBkw2CZ6pqudT7IZygYJHnyZKId 3/LS11JBL4c+TGeTG8CEPc84cDmI++pZkLnEANNahvFwR3reYA dYuI8pWS54V/ZxhFCL6rJ2poKhCZFskWRCAgVduBJI= X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] eepro100: Remove unused device status entries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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]); }