From owner-acpi-jp@jp.FreeBSD.org Wed Mar 31 08:12:24 2004
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id i2UNCON57502;
	Wed, 31 Mar 2004 08:12:24 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from harmony.village.org (warner@rover.bsdimp.com [204.144.255.66])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id i2UNCNd57497
	for <acpi-jp@jp.FreeBSD.org>; Wed, 31 Mar 2004 08:12:23 +0900 (JST)
	(envelope-from imp@bsdimp.com)
Received: from localhost (warner@rover2.village.org [10.0.0.1])
	by harmony.village.org (8.12.10/8.12.9) with ESMTP id i2UNCLkj015271;
	Tue, 30 Mar 2004 16:12:21 -0700 (MST)
	(envelope-from imp@bsdimp.com)
Message-Id: <20040330.161234.88818967.imp@bsdimp.com>
To: nate@root.org
Cc: acpi-jp@jp.FreeBSD.org
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20040330144040.R83277@root.org>
References: <20040330.134534.82839532.imp@bsdimp.com>
	<20040330.145814.04787623.imp@bsdimp.com>
	<20040330144040.R83277@root.org>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
Date: Tue, 30 Mar 2004 16:12:34 -0700
X-Sequence: acpi-jp 3175
Subject: [acpi-jp 3175] Re: hot after resume
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: imp@bsdimp.com
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+040307

In message: <20040330144040.R83277@root.org>
            Nate Lawson <nate@root.org> writes:
: > http://people.freebsd.org/~imp/power-20040330.diff.gz
: >
: > They have the following problems:
: 
: 0a) diff not in format patch can understand

ah.  I diffed from the p4 repo and forgot that I need to run it
through a filter.

: 0b) s/EvaluateInteger/GetInteger

OK.

: > 1) Need to handle the !acpi host bridge case of resource allocation.
: 
: If you can give me some guidance on the changes I need to make for acpi
: rman, you can just copy the approach I took.  There are sticky problems
: that show up in implementing it that indicate no one has worked on actual
: child rman pools that map a subset of the space (not 0-inf as nexus does).
: For instance, acpi gets a resource from nexus with BUS_ALLOC_RESOURCE and
: adds it to the local rman (rman_manage_region), but it then needs to be
: partially released before doing the rman_reserve_resource, otherwise it's
: allocated to both acpi and the child and you get a panic.  There's no
: current way to tell nexus that acpi owns a region but it's not currently
: allocated as a resource.  We probably need a BUS_MANAGE_REGION to pull a
: region out of the parent without allocating a resource for it.  Or there
: needs to be a way to take a resource received via BUS_ALLOC_RESOURCE and
: free the resource data while leaving the region reserved on the parent.

Yes there is a way.  You allocate it.  But you don't activate the
resource.  That what the pci patches that I post do: it allocates the
resource and has it owned by the pci bus.  When the driver wants it,
it transfers ownership to the driver.  Then activation happens
normally.  On release, the ownership is returned to the bus (that's
the part that isn't happening at the moment).

But that's not the issue with the host bridge.  To get the memory
allocation to work, it needs to basically say 'only allocate out of
the top 256MB of RAM' or whatever is most appropriate for that
bridge.  There's no standard way of finding out what a good range is,
so I settled on the 'most host bridges do it this way' approach for
acpi and just haven't put that code into the !acpi host bridge.

: > 2) unloading a driver that has resources reserved causes them to be
: >    really freed, not merely returned to the reserved pool.  This can
: >    cause problems.
: 
: They should just be released.  Why is that harder than freeing them?

A small matter of coding: setting the owner of the resource,
deactivating it, etc.

Warner
