On Thursday 23 July 2009 1:53:51 pm Andre Albsmeier wrote:
> John, apparently you sent me an email (thanks a lot) which I never
> received (we have to blame our company's spam filters which I do
> not control). I'll comment on it here in my reply to Doug...

Yes, I saw the bounces.  Hopefully you see the list version of this.

> > | Did you try 
> > | doing 'bus_alloc_resource(device_get_parent(device_get_parent(dev))' in 
your 
> > | driver that is a child of hostb0?
> 
> I tried this, well, something similar: I had to do 4 times
> device_get_parent() to end up at acpi0:
> 
> mydriver -> hostb0 -> pci0 -> pcib0 -> acpi0

You don't actually need to do that.  pci0 will pass the request up to acpi0 
eventually.  You just need to ask pci0 to allocate it for you and it will see 
you are not a direct child and take the 'passthrough' case here:

struct resource *
pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
                   u_long start, u_long end, u_long count, u_int flags)
{
        ...

        if (device_get_parent(child) != dev)
                return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
                    type, rid, start, end, count, flags));
        ...
}

Rather than trying to allocate the whole chunk of the ACPI resource, I would 
just do a specific allocation like so:

        rid = 0;
        res = BUS_ALLOC_RESOURCE(device_get_parent(device_get_parent(dev)),
            dev, SYS_RES_MEMORY, &rid, <the real start address>, <the real
            end address>, <the length>, RF_ACTIVE);

-- 
John Baldwin
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to