Kernel Functions for Drivers ddi_regs_map_setup(9F)
NAME
ddi_regs_map_setup - set up a mapping for a register address
spaceSYNOPSIS
#include
#include
int ddi_regs_map_setup(dev_info_t *dip, uint_t rnumber, caddr_t *addrp,
offset_t offset, offset_t len, ddi_device_acc_attr_t *accattrp,
ddi_acc_handle_t *handlep);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).PARAMETERS
dip Pointer to the device's dev_info structure.
rnumber Index number to the register address space set.addrp A platform-dependent value that, when added to
an offset that is less than or equal to the lenparameter (see below), is used for the dev_addr
argument to the ddi_get, ddi_mem_get, and
ddi_io_get/put routines.
offset Offset into the register address space. len Length to be mapped. accattrp Pointer to a device access attribute structureof this mapping (see ddi_device_acc_attr(9S)).
handlep Pointer to a data access handle.DESCRIPTION
ddi_regs_map_setup() maps in the register set given by
rnumber. The register number determines which register set is mapped if more than one exists.SunOS 5.11 Last change: 18 Nov 2004 1
Kernel Functions for Drivers ddi_regs_map_setup(9F)
offset specifies the starting location within the register space and len indicates the size of the area to be mapped.If len is non-zero, it overrides the length given in the
register set description. If both len and offset are 0, the entire space is mapped. The base of the mapped register space is returned in addrp. The device access attributes are specified in the location pointed by the accattrp argument (seeddi_device_acc_attr(9S) for details).
The data access handle is returned in handlep. handlep is opaque; drivers should not attempt to interpret its value. The handle is used by the system to encode information forsubsequent data access function calls to maintain a con-
sistent view between the host and the device.RETURN VALUES
ddi_regs_map_setup() returns:
DDI_SUCCESS Successfully set up the mapping for
data access.DDI_FAILURE Invalid register number rnumber,
offset offset, or length len.DDI_ME_RNUMBER_RANGE Invalid register number rnumber or
unable to find reg property.DDI_REGS_ACC_CONFLICT Cannot enable the register mapping
due to access conflicts with other enabled mappings.Note that the return value DDI_ME_RNUMBER_RANGE is not sup-
ported on all platforms. Also, there is potential overlapbetween DDI_ME_RNUMBER_RANGE and DDI_FAILURE. Drivers should
check for !=DDI_SUCCESS rather than checking for a specific
failure value.CONTEXT
ddi_regs_map_setup() must be called from user or kernel con-
text.ATTRIBUTES
SunOS 5.11 Last change: 18 Nov 2004 2
Kernel Functions for Drivers ddi_regs_map_setup(9F)
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | PCI Local Bus, SBus, ISA ||_____________________________|_____________________________|
SEE ALSO
attributes(5), ddi_regs_map_free(9F),
ddi_device_acc_attr(9S)
Writing Device DriversSunOS 5.11 Last change: 18 Nov 2004 3