[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus
From: |
Gleb Natapov |
Subject: |
Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus |
Date: |
Tue, 26 Oct 2010 09:28:43 +0200 |
On Mon, Oct 25, 2010 at 06:22:12PM +0200, Markus Armbruster wrote:
> Gleb Natapov <address@hidden> writes:
>
> > On Mon, Oct 25, 2010 at 04:29:35PM +0200, Markus Armbruster wrote:
> >> Gleb Natapov <address@hidden> 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?
> [...]
>
> Let me try to explain the IDE pointer thicket.
>
> piix3-ide provides two IDE buses. pci_piix_ide_initfn() stores them in
> PCIIDEState member IDEBus bus[2]. Technically redundant, because qdev
> stores child buses in dev.qdev.child_bus.
>
> IDEBus points back: qbus.parent.
>
> Up to two IDE devices can sit on each IDE bus. The first one uses
> IDEBus members master and ifs[0], the second one uses slave and ifs[1].
>
> ifs[i].bus points back to the IDE bus.
>
> {master,slave}.qdev.parent_bus point back to the IDE bus.
>
> Say you got an IDEDevice and want to know which to which of the two
> buses it's connected. Let's call it d.
>
> d->qdev.parent_bus is the BusState.
>
> Upcast to IDEBus: b = DO_UPCAST(IDEBus, qbus, d->qdev.parent_bus).
>
> b->qbus.parent is the IDE controller.
>
> Upcast to PCIIDEState: c = DO_UPCAST(PCIIDEState, dev, n->qbus.parent);
>
This will not work if IDEBus sits on ISA bus. Any other ideas?
> If c->bus[0] == b, it's on the first bus.
>
> Else it must be on the second bus, i.e. c->bus[1] == b.
>
> Hope I didn't screw this up too badly.
--
Gleb.
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, (continued)
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/25
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus,
Gleb Natapov <=
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Markus Armbruster, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Alex Williamson, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Gleb Natapov, 2010/10/26
- Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus, Alex Williamson, 2010/10/26