|
NAMEbus_activate_resource ,
bus_deactivate_resource —
activate or deactivate a resource
SYNOPSIS#include <sys/param.h>
#include <sys/bus.h>
int
int
DESCRIPTIONThese 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:
Resource MappingResources which can be mapped for CPU access by a bus_space(9) tag and handle will create a mapping of the entire resource when activated. The tag and handle for this mapping are stored in r and can be retrieved via rman_get_bustag(9) and rman_get_bushandle(9). These can be used with the bus_space(9) API to access device registers or memory described by r. If the mapping is associated with a virtual address, the virtual address can be retrieved via rman_get_virtual(9).This implicit mapping can be disabled by passing the
A wrapper API for
bus_space(9)
is also provided that accepts the associated resource as the first argument
in place of the
bus_space(9)
tag and handle. The functions in this wrapper API are named similarly to the
bus_space(9)
API except that “_space” is removed from their name. For
example, 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); bus_read_4(res, 0); RETURN VALUESZero is returned on success, otherwise an error is returned.SEE ALSObus_alloc_resource(9), bus_map_resource(9), bus_space(9), device(9), driver(9)AUTHORSThis manual page was written by Warner Losh <imp@FreeBSD.org>.
Visit the GSP FreeBSD Man Page Interface. |