From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 18 09:47:48 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 32C60106564A for ; Sat, 18 Jul 2009 09:47:48 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from mail-ew0-f220.google.com (mail-ew0-f220.google.com [209.85.219.220]) by mx1.freebsd.org (Postfix) with ESMTP id AE1BC8FC13 for ; Sat, 18 Jul 2009 09:47:47 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by ewy20 with SMTP id 20so1130580ewy.43 for ; Sat, 18 Jul 2009 02:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=X46w0mXfMipnTDAUWp8QQE6XY9bYlPxhDpMsAlDEhrg=; b=p1lgyqfwyWagaw/5QSBtx+NSyk5wJlZqhjmnou5tXsilAf680JXsd0z1HnYDq1wzky 5T1woTG02wz33OxcNsOCZZr6wK5WawpZ0rpnL186H9khYol8wnuOBnXoAadR70GEGtFz oRA4iBaZ8rHVQI3XkqTdIFNOwkV5zqqbp2J/I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=xzbZKkgfj8MJdS8pr2ZNGmy53MZS/Ik3nspM5RcCq6nOLrCeGxsbHs+QFKiDmEOZE9 dHld2LPy+K0UBThs+9EVuyF6sXcdII5gom6SH3YXwdtXh9oxJEk81vGz8AbQol5xbPR7 wmZbTUSzJUNNoiVtqipfVJCTZ3gPv1b4yledI= Received: by 10.210.19.7 with SMTP id 7mr946863ebs.7.1247909108425; Sat, 18 Jul 2009 02:25:08 -0700 (PDT) Received: from omega.lan (bl6-149-62.dsl.telepac.pt [82.155.149.62]) by mx.google.com with ESMTPS id 5sm363372eyf.17.2009.07.18.02.25.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 18 Jul 2009 02:25:07 -0700 (PDT) Sender: Rui Paulo Message-Id: From: Rui Paulo To: Andre Albsmeier In-Reply-To: <20090718081011.GA6920@curry.mchp.siemens.de> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Sat, 18 Jul 2009 10:25:06 +0100 References: <20090717190450.GA4697@curry.mchp.siemens.de> <4A60D6D1.3050703@elischer.org> <20090718081011.GA6920@curry.mchp.siemens.de> X-Mailer: Apple Mail (2.935.3) Cc: freebsd-hackers@freebsd.org, Julian Elischer 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 09:47:48 -0000 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 ? -- Rui Paulo