From patchwork Mon Dec 6 13:54:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 74357 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 1CA42B6EEB for ; Tue, 7 Dec 2010 01:10:37 +1100 (EST) Received: from localhost ([127.0.0.1]:41934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPbly-0002C6-1t for incoming@patchwork.ozlabs.org; Mon, 06 Dec 2010 09:10:34 -0500 Received: from [140.186.70.92] (port=46258 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPbX0-0002xf-18 for qemu-devel@nongnu.org; Mon, 06 Dec 2010 08:55:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPbWt-00025z-Mk for qemu-devel@nongnu.org; Mon, 06 Dec 2010 08:55:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPbWt-00025X-Bt for qemu-devel@nongnu.org; Mon, 06 Dec 2010 08:54:59 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB6DsoDZ031281 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Dec 2010 08:54:50 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB6DsnqO027047; Mon, 6 Dec 2010 08:54:50 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 0808218D3A0; Mon, 6 Dec 2010 15:54:48 +0200 (IST) From: Gleb Natapov To: qemu-devel@nongnu.org Date: Mon, 6 Dec 2010 15:54:36 +0200 Message-Id: <1291643687-32232-6-git-send-email-gleb@redhat.com> In-Reply-To: <1291643687-32232-1-git-send-email-gleb@redhat.com> References: <1291643687-32232-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: blauwirbel@gmail.com, kevin@koconnor.net, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCHv7 05/16] Store IDE bus id in IDEBus structure for easy access. 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 Signed-off-by: Gleb Natapov --- hw/ide/cmd646.c | 4 ++-- hw/ide/internal.h | 3 ++- hw/ide/isa.c | 2 +- hw/ide/piix.c | 4 ++-- hw/ide/qdev.c | 3 ++- hw/ide/via.c | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index dfe6091..ea5d2dc 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -253,8 +253,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1 irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); - ide_bus_new(&d->bus[0], &d->dev.qdev); - ide_bus_new(&d->bus[1], &d->dev.qdev); + ide_bus_new(&d->bus[0], &d->dev.qdev, 0); + ide_bus_new(&d->bus[1], &d->dev.qdev, 1); ide_init2(&d->bus[0], irq[0]); ide_init2(&d->bus[1], irq[1]); diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 85f4a16..71af66f 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -449,6 +449,7 @@ struct IDEBus { IDEDevice *slave; BMDMAState *bmdma; IDEState ifs[2]; + int bus_id; uint8_t unit; uint8_t cmd; qemu_irq irq; @@ -567,7 +568,7 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, void ide_init_ioport(IDEBus *bus, int iobase, int iobase2); /* hw/ide/qdev.c */ -void ide_bus_new(IDEBus *idebus, DeviceState *dev); +void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id); IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive); #endif /* HW_IDE_INTERNAL_H */ diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 4206afd..8c59c5a 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -67,7 +67,7 @@ static int isa_ide_initfn(ISADevice *dev) { ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, dev); - ide_bus_new(&s->bus, &s->dev.qdev); + ide_bus_new(&s->bus, &s->dev.qdev, 0); ide_init_ioport(&s->bus, s->iobase, s->iobase2); isa_init_irq(dev, &s->irq, s->isairq); isa_init_ioport_range(dev, s->iobase, 8); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index e02b89a..1c0cb0c 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -125,8 +125,8 @@ static int pci_piix_ide_initfn(PCIIDEState *d) vmstate_register(&d->dev.qdev, 0, &vmstate_ide_pci, d); - ide_bus_new(&d->bus[0], &d->dev.qdev); - ide_bus_new(&d->bus[1], &d->dev.qdev); + ide_bus_new(&d->bus[0], &d->dev.qdev, 0); + ide_bus_new(&d->bus[1], &d->dev.qdev, 1); ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6); ide_init_ioport(&d->bus[1], 0x170, 0x376); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6d27b60..88ff657 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -29,9 +29,10 @@ static struct BusInfo ide_bus_info = { .size = sizeof(IDEBus), }; -void ide_bus_new(IDEBus *idebus, DeviceState *dev) +void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id) { qbus_create_inplace(&idebus->qbus, &ide_bus_info, dev, NULL); + idebus->bus_id = bus_id; } static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) diff --git a/hw/ide/via.c b/hw/ide/via.c index 66be0c4..78857e8 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -154,8 +154,8 @@ static int vt82c686b_ide_initfn(PCIDevice *dev) vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d); - ide_bus_new(&d->bus[0], &d->dev.qdev); - ide_bus_new(&d->bus[1], &d->dev.qdev); + ide_bus_new(&d->bus[0], &d->dev.qdev, 0); + ide_bus_new(&d->bus[1], &d->dev.qdev, 1); ide_init2(&d->bus[0], isa_reserve_irq(14)); ide_init2(&d->bus[1], isa_reserve_irq(15)); ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6);