From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 18 14:06:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82B051065679 for ; Sat, 18 Jul 2009 14:06:51 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outB.internet-mail-service.net (outb.internet-mail-service.net [216.240.47.225]) by mx1.freebsd.org (Postfix) with ESMTP id 658AE8FC1A for ; Sat, 18 Jul 2009 14:06:51 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 3CEA5B094E; Sat, 18 Jul 2009 07:06:51 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id AF9FC2D6016; Sat, 18 Jul 2009 07:06:50 -0700 (PDT) Message-ID: <4A61D6FB.2090904@elischer.org> Date: Sat, 18 Jul 2009 07:06:51 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Andre Albsmeier References: <20090717190450.GA4697@curry.mchp.siemens.de> <4A60D6D1.3050703@elischer.org> <20090718081011.GA6920@curry.mchp.siemens.de> In-Reply-To: <20090718081011.GA6920@curry.mchp.siemens.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Rui Paulo Subject: Re: Reading acpi memory from a driver attached to hostb X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2009 14:06:52 -0000 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 ); try both with different devclass and other args. > > 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. > > Thanks, > > -Andre