newbus ioport usage

Nate Lawson nate at root.org
Tue Feb 3 11:15:04 PST 2004


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



More information about the freebsd-arch mailing list