activate or deactivate a resource
, int type
, int type
These functions activate or deactivate a previously allocated resource. In
general, resources must be activated before they can be accessed by the
driver. Bus drivers may perform additional actions to ensure that the resource
is ready to be accessed. For example, the PCI bus driver enables memory
decoding in a PCI device's command register when activating a memory resource.
The arguments are as follows:
- The device that requests ownership of the resource. Before allocation, the
resource is owned by the parent bus.
- The type of resource you want to allocate. It is one of:
- for PCI bus numbers
- for IRQs
- for ISA DMA lines
- for I/O ports
- for I/O memory
- A pointer to a bus specific handle that identifies the resource being
- A pointer to the struct resource returned
Resources which can be mapped for CPU access by a
tag and handle will create a mapping of the entire resource when activated.
The tag and handle for this mapping are stored in
and can be retrieved via
These can be used with the
API to access device registers or memory described by
. If the mapping is associated with a
virtual address, the virtual address can be retrieved via
This implicit mapping can be disabled by passing the
A driver may use this if it wishes to allocate its own mappings of a resource
A wrapper API for
is also provided that accepts the associated resource as the first argument in
place of the
tag and handle. The functions in this wrapper API are named similarly to the
API except that “_space” is removed from their name. For
() can be used in place
(). The wrapper API is
preferred in new drivers.
These two statements both read a 32-bit register at the start of a resource:
bus_space_read_4(rman_get_bustag(res), rman_get_bushandle(res), 0);
Zero is returned on success, otherwise an error is returned.
This manual page was written by Warner Losh