From: Gleb Natapov <gleb@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus
Date: Mon, 25 Oct 2010 17:42:36 +0200 [thread overview]
Message-ID: <20101025154236.GH2343@redhat.com> (raw)
In-Reply-To: <m3pquywdkg.fsf@blackfin.pond.sub.org>
On Mon, Oct 25, 2010 at 04:29:35PM +0200, Markus Armbruster wrote:
> Gleb Natapov <gleb@redhat.com> writes:
>
> > Without this patch both buses on PIIX3_IDE device have the same unit id.
>
> Are you sure that's wrong?
>
So how do I know which bus is it on PIIX3_IDE?
> As far as I can see, IDEBus member unit is the currently active unit,
> set by write to port 6 (in ide_ioport_write()) and cleared on reset (in
> ide_bus_reset()).
>
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > 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..3da93df 100644
> > --- a/hw/ide/internal.h
> > +++ b/hw/ide/internal.h
> > @@ -564,7 +564,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 unit);
> > 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..1705a12 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 unit)
> > {
> > qbus_create_inplace(&idebus->qbus, &ide_bus_info, dev, NULL);
> > + idebus->unit = unit;
> > }
> >
> > 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);
> > --
> > Gleb.
--
Gleb.
next prev parent reply other threads:[~2010-10-25 15:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 16:23 [Qemu-devel] [PATCH] initialize unit id of IDE bus Gleb Natapov
2010-10-25 14:29 ` Markus Armbruster
2010-10-25 15:42 ` Gleb Natapov [this message]
2010-10-25 16:22 ` Markus Armbruster
2010-10-25 16:49 ` Gleb Natapov
2010-10-25 18:06 ` Markus Armbruster
2010-10-25 18:20 ` Gleb Natapov
2010-10-26 9:29 ` Markus Armbruster
2010-10-26 10:23 ` Gleb Natapov
2010-10-26 11:59 ` Markus Armbruster
2010-10-26 12:32 ` Gleb Natapov
2010-10-26 7:28 ` Gleb Natapov
2010-10-26 9:14 ` Markus Armbruster
2010-10-26 10:15 ` Gleb Natapov
2010-10-26 11:20 ` Markus Armbruster
2010-10-26 12:12 ` Gleb Natapov
2010-10-26 12:39 ` Markus Armbruster
2010-10-26 13:03 ` Gleb Natapov
2010-10-26 14:15 ` Alex Williamson
2010-10-26 14:26 ` Gleb Natapov
2010-10-26 14:44 ` Alex Williamson
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=20101025154236.GH2343@redhat.com \
--to=gleb@redhat.com \
--cc=armbru@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.