On Saturday 18 July 2009 9:39:38 am Andre Albsmeier wrote: > On Sat, 18-Jul-2009 at 10:25:06 +0100, Rui Paulo wrote: > > On 18 Jul 2009, at 09:10, Andre Albsmeier wrote: > > > > > On Fri, 17-Jul-2009 at 12:53:53 -0700, Julian Elischer wrote: > > >> Andre Albsmeier wrote: > > >>> [CC'ing this to Rui Paulo since he tried to help me a while ago] > > >>> > > >>> Since my driver is a child of hostb0, I have no idea of how to > > >>> access > > >>> acpi0's memory area. Here is a devinfo -r to make things clear: > > >>> > > >> ... > > >>> > > >>> Earlier, I was given the hint to attach as a child of acpi (see the > > >>> old mail attached below) but in this case I didn't have access to > > >>> the > > >>> hostb registers which I need as well. > > >>> > > >>> The only thing I see is: Attach two drivers -- one as child of acpi > > >>> and another as child of hostb and let them communicate somehow (no > > >>> idea how to do this). > > >>> > > >>> I have also done crazy things like searching for acpi0 and trying > > >>> to bus_alloc_resource() the memory I am interested in but this also > > >>> failed. > > >>> > > >>> Or is it possible to free(!) somehow the address space from acpi0 > > >>> and pass it to hostb0 so I can bus_alloc_resource() it? > > >>> > > >> > > >> You can probably make two drivers in one which cooperate to > > >> allow access to both sets of resources. > > > > > > Hmm, that's what I meant by: Attach two drivers -- one as child of > > > acpi > > > and another as child of hostb... > > > > > > And that's similar to Rui Paulo's suggestion a while ago: > > > > > >> You'll probably need to create a fake ACPI child driver to access it. > > >> > > >> Create your identify routine with something like: > > >> > > >> static void mydriver_identify(driver_t *driver, device_t parent) > > >> { > > >> if (device_find_child(parent, "mydriver", -1) == NULL && > > >> mydriver_match(parent)) > > >> device_add_child(parent, "mydriver", -1); > > >> } > > >> > > >> mydriver_match() should check if you were given the acpi0 device. > > > > > > But in order to attach to acpi0, I need to say > > > > > > DRIVER_MODULE( eccmon, acpi, eccmon_driver, eccmon_devclass, NULL, > > > NULL ); > > > > > > instead of > > > > > > DRIVER_MODULE( eccmon, hostb, eccmon_driver, eccmon_devclass, NULL, > > > NULL ); > > > > > > This way I could attach to acpi but not to hostb anymore.... > > > > > > I have searched the net for solutions, I have read newbus-draft.txt > > > and newbus-intro.txt and Warner Losh's newbus-led.c (thanks to all > > > of these my driver is working on other mainboards where it doesn't > > > have to access foreign memory) but didn't find anything. > > > > I'm out of ideas. > > John, do you know if this is a newbus limitation or if it can be > > worked around ? > > I assume it is possible somehow, I am just too stupid (it is the first > driver I wrote). John, for easy reference, here is my initial message: > > http://lists.freebsd.org/pipermail/freebsd-hackers/2009-July/029127.html > > Please remember all, that I need the access to the acpi0 memory location > only for a few reads during probing/attaching, not later. > > I have also read somewhere that, when resources are allocated, the > system "walks up" the device tree until it finds the resource. Since > my driver is below hostb0 and hostb0 is below acpi0 I thought it > should work but it doesn't..
I think you want to probably patch hostb0 to let bus_set_resource() work and then use that. You could also just explicitly by-pass hostb0 and allocate a resource from its parent as a quick hack. The PCI bus should pass the requst up to acpi0. That is, do: BUS_ALLOC_RESOURCE(device_get_parent(device_get_parent(dev)), dev, ...); instead of bus_alloc_resource(dev, ...); -- 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"