From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] Store IDE bus id in IDEBus structure for easy access.
Date: Tue, 26 Oct 2010 12:48:09 +0200 [thread overview]
Message-ID: <1288090091-25874-4-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1288090091-25874-1-git-send-email-gleb@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
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 ff80dd5..b2cbdbc 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -257,8 +257,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 4165543..bde2664 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -448,6 +448,7 @@ struct IDEBus {
IDEDevice *slave;
BMDMAState *bmdma;
IDEState ifs[2];
+ uint8_t bus_id;
uint8_t unit;
uint8_t cmd;
qemu_irq irq;
@@ -564,7 +565,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, uint8_t 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 163ffba..907d862 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 07483e8..d0b04a3 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -129,8 +129,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 0808760..97a666d 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, uint8_t 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 b2c7cad..cc48b2b 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -158,8 +158,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);
--
1.7.1
next prev parent reply other threads:[~2010-10-26 10:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 10:48 [Qemu-devel] [PATCH 0/5] boot order specification Gleb Natapov
2010-10-26 10:48 ` [Qemu-devel] [PATCH 1/5] Keep track of ISA ports ISA device is using in qdev Gleb Natapov
2010-10-26 13:25 ` Anthony Liguori
2010-10-26 13:30 ` Gleb Natapov
2010-10-26 13:32 ` Anthony Liguori
2010-10-26 15:42 ` Blue Swirl
2010-10-26 10:48 ` [Qemu-devel] [PATCH 2/5] Add get_dev_path callback to ISA bus " Gleb Natapov
2010-10-26 10:48 ` Gleb Natapov [this message]
2010-10-26 10:48 ` [Qemu-devel] [PATCH 4/5] Add get_dev_path callback to IDE bus Gleb Natapov
2010-10-26 10:48 ` [Qemu-devel] [PATCH 5/5] Add bootindex parameter to net/block/fd device Gleb Natapov
2010-10-26 13:29 ` Anthony Liguori
2010-10-26 14:16 ` Gleb Natapov
2010-10-26 12:40 ` [Qemu-devel] [PATCH 0/5] boot order specification Bernhard Kohl
2010-10-26 13:07 ` Gleb Natapov
2010-10-26 13:35 ` Bernhard Kohl
2010-10-26 13:38 ` Gleb Natapov
2010-10-26 15:35 ` Blue Swirl
2010-10-26 15:43 ` Gleb Natapov
2010-10-26 17:00 ` Blue Swirl
2010-10-26 19:35 ` Gleb Natapov
2010-10-26 19:57 ` Blue Swirl
2010-10-26 20:34 ` Gleb Natapov
2010-10-26 20:49 ` Blue Swirl
2010-10-26 21:02 ` Gleb Natapov
2010-10-26 21:14 ` Scott Wood
2010-10-27 8:57 ` Gleb Natapov
2010-10-27 16:39 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288090091-25874-4-git-send-email-gleb@redhat.com \
--to=gleb@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).