From 87dc8e1ccd2455de59651177a33dd6a2f76562f1 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Thu, 6 Jan 2011 09:50:18 -0200 Subject: [PATCH 05/28] Store IDE bus id in IDEBus structure for easy access. RH-Author: Gleb Natapov Message-id: <1294307430-1358-6-git-send-email-gleb@redhat.com> Patchwork-id: 15826 O-Subject: [PATCH RHEL6.1 05/17] Store IDE bus id in IDEBus structure for easy access. Bugzilla: 643687 RH-Acked-by: Markus Armbruster RH-Acked-by: Juan Quintela RH-Acked-by: Jes Sorensen Signed-off-by: Gleb Natapov Signed-off-by: Blue Swirl Upstream commit: 3835510f10ac74553ff19df3eb254809f0b593c0 --- 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 ++- 5 files changed, 9 insertions(+), 7 deletions(-) Signed-off-by: Luiz Capitulino --- 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 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index f002568..bb4efd0 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -230,8 +230,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) pci_conf[0x3d] = 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], NULL, NULL, irq[0]); ide_init2(&d->bus[1], NULL, NULL, irq[1]); diff --git a/hw/ide/internal.h b/hw/ide/internal.h index d871137..ce32ba4 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -448,6 +448,7 @@ struct IDEBus { IDEDevice *slave; BMDMAState *bmdma; IDEState ifs[2]; + int bus_id; uint8_t unit; uint8_t cmd; qemu_irq irq; @@ -565,7 +566,7 @@ void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, 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 b3907a6..208afd9 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 2b527a3..95f8f14 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -127,8 +127,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 c29d26d..66204c2 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) -- 1.7.4.rc1.16.gd2f15e