Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 2004 11:14:59 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        arch@freebsd.org
Subject:   Re: newbus ioport usage
Message-ID:  <20040203111312.Q32201@root.org>
In-Reply-To: <20040127.032119.28084825.imp@bsdimp.com>
References:  <20040126.181720.15264443.imp@bsdimp.com> <20040126191657.B31071@root.org> <20040127.032119.28084825.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I'm trying to get a basic version working, using rman.  Currently, I
attempt to allocate resources from the parent first, via
BUS_ALLOC_RESOURCE. If that succeeds, I add the resource to my rman pool
via rman_manage_region and return it.  If it fails, I look up the default
values for the resource with resource_list_find and then attempt to
reserve it with rman_reserve_resource.  If that succeeds, I activate the
resource and return it.  The release function just deactivates it and
always returns it to the local pool via rman_release_resource.  I set up
the initial resources by calling bus_set_resource on the acpi0 device
whenever I run into the system resources object.  This has the effect that
early allocations will come from nexus0 and later allocations (after
sysresource has been detected) come from acpi0.  I think that should be ok
for now.

A few questions:

1. Do I have to do all the bus_set_handle gyrations found in nexus?  I
thought that they could be dispensed with since nexus should do all those
when acpi0 allocates resources from it with BUS_ALLOC_RESOURCE.  I can
certainly leave out the PC98 ifdefs since I'm relatively certain there are
no PC98 ACPI machines, right?

2. Do I have to make acpi_alloc_resource/release_resource machdep now
since there are so many MD things like i386 bus handles and the like?  It
seems that nexus on all 3 archs (ia32, ia64, amd64) is exactly the same.

3. After I have gotten a resource from nexus via BUS_ALLOC_RESOURCE and
added it to the local pool through rman_manage_region, do I have to then
rman_reserve_resource before returning it to the user?

In the future, I'll make two passes, first to detect system resource
objects (PNP0C01 and PNP0C02) and reserve resources and the second to
actually probe acpi devices.  I'd rather wait for newbus to do this
multi-pass approach than attempt it myself with hacks to try to localize
it.

-Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040203111312.Q32201>