From patchwork Wed Oct 7 14:56:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 35302 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 2935CB7B96 for ; Thu, 8 Oct 2009 02:18:13 +1100 (EST) Received: from localhost ([127.0.0.1]:59462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvYHK-00048i-5v for incoming@patchwork.ozlabs.org; Wed, 07 Oct 2009 11:18:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvXwz-00035Z-26 for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:57:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvXwr-0002x3-RZ for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:57:05 -0400 Received: from [199.232.76.173] (port=55163 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvXwq-0002w9-Qi for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:57:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5674) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvXwq-0003fp-1i for qemu-devel@nongnu.org; Wed, 07 Oct 2009 10:57:00 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n97EuxB0023541 for ; Wed, 7 Oct 2009 10:56:59 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n97Eulnu016943; Wed, 7 Oct 2009 10:56:58 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 7 Oct 2009 16:56:25 +0200 Message-Id: <7fe182ac77e5b59fbb157ca8ed7e12bc2325baa3.1254927187.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 08/12] ide: PCIIDEState type field is not needed anymore 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 We have split the functions that needed it for cmd646 Signed-off-by: Juan Quintela --- hw/ide/cmd646.c | 34 +++++++++++----------------------- hw/ide/pci.h | 5 ----- hw/ide/piix.c | 2 -- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index a700be2..37cfe01 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -80,24 +80,17 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr) break; case 1: pci_dev = bm->pci_dev; - if (pci_dev->type == IDE_TYPE_CMD646) { - val = pci_dev->dev.config[MRDMODE]; - } else { - val = 0xff; - } + val = pci_dev->dev.config[MRDMODE]; break; case 2: val = bm->status; break; case 3: pci_dev = bm->pci_dev; - if (pci_dev->type == IDE_TYPE_CMD646) { - if (bm == &pci_dev->bmdma[0]) - val = pci_dev->dev.config[UDIDETCR0]; - else - val = pci_dev->dev.config[UDIDETCR1]; + if (bm == &pci_dev->bmdma[0]) { + val = pci_dev->dev.config[UDIDETCR0]; } else { - val = 0xff; + val = pci_dev->dev.config[UDIDETCR1]; } break; default: @@ -120,23 +113,19 @@ static void bmdma_writeb(void *opaque, uint32_t addr, uint32_t val) switch(addr & 3) { case 1: pci_dev = bm->pci_dev; - if (pci_dev->type == IDE_TYPE_CMD646) { - pci_dev->dev.config[MRDMODE] = - (pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30); - cmd646_update_irq(pci_dev); - } + pci_dev->dev.config[MRDMODE] = + (pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30); + cmd646_update_irq(pci_dev); break; case 2: bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06); break; case 3: pci_dev = bm->pci_dev; - if (pci_dev->type == IDE_TYPE_CMD646) { - if (bm == &pci_dev->bmdma[0]) - pci_dev->dev.config[UDIDETCR0] = val; - else - pci_dev->dev.config[UDIDETCR1] = val; - } + if (bm == &pci_dev->bmdma[0]) + pci_dev->dev.config[UDIDETCR0] = val; + else + pci_dev->dev.config[UDIDETCR1] = val; break; } } @@ -211,7 +200,6 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) uint8_t *pci_conf = d->dev.config; qemu_irq *irq; - d->type = IDE_TYPE_CMD646; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646); diff --git a/hw/ide/pci.h b/hw/ide/pci.h index 063ae96..690d057 100644 --- a/hw/ide/pci.h +++ b/hw/ide/pci.h @@ -3,15 +3,10 @@ #include -#define IDE_TYPE_PIIX3 0 -#define IDE_TYPE_CMD646 1 -#define IDE_TYPE_PIIX4 2 - typedef struct PCIIDEState { PCIDevice dev; IDEBus bus[2]; BMDMAState bmdma[2]; - int type; /* see IDE_TYPE_xxx */ uint32_t secondary; } PCIIDEState; diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 47d736d..4583c42 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -141,7 +141,6 @@ static int pci_piix3_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); - d->type = IDE_TYPE_PIIX3; pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371SB_1); return pci_piix_ide_initfn(d); @@ -151,7 +150,6 @@ static int pci_piix4_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); - d->type = IDE_TYPE_PIIX4; pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB); return pci_piix_ide_initfn(d);