Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Apr 2007 09:02:14 -0500
From:      Craig Boston <craig@tobuj.gank.org>
To:        Alan Garfield <alan@fromorbit.com>
Cc:        hackers@freebsd.org
Subject:   Re: Resources and ACPI
Message-ID:  <20070411140214.GA60020@nowhere>
In-Reply-To: <461CCB3D.1090402@fromorbit.com>
References:  <200704110951.l3B9p4hT024402@sana.init-main.com> <461CCB3D.1090402@fromorbit.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 11, 2007 at 09:49:17PM +1000, Alan Garfield wrote:
> I've done an acpidump and indeed the are _CRS and _PRS ResourceTemplates 
> that describe the io and irq requirements perfectly. How do I access 
> this data? ACPI seems to have very little documentation and nothing else 
> seems to get resource lists (except fdc_acpi.c and uart_bus_acpi.c which 
> don't seem to be complete. ACPI_EVALUATE_OBJECT?!?)

In general, you're not supposed to.  Use bus_alloc_resource and the
bus_space_* functions.  busdma was introduced in order to make it
possible to write device drivers without having to worry about the
specifics of resource allocation / access on any given platform.

If it seems like magic, that's because it is. :)  For PnP busses like
PCI, ISAPnP, and ISA-ACPI/LPC-ACPI, the OS takes care of figuring out
what resources to use and allocates them.  You only need to specify the
type (Memory, IO Port, IRQ) that you want and it takes care of whatever
needs to be done for the particular architecture and bus your device is
attached to.

This means that your driver will work regardless if the resources are
specified by ACPI, or if in the future if some mad scientist attaches
the hardware to the PCI bus on a SPARC64 instead (with only minimal
driver changes).

Craig



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