|DDI_REGS_MAP_SETUP(9F)||Kernel Functions for Drivers||DDI_REGS_MAP_SETUP(9F)|
#include <sys/ddi.h> #include <sys/sunddi.h> 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);
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 (see ddi_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 for subsequent data access function calls to maintain a consistent view between the host and the device.
For example, with PCI and PCI Express devices, the first base address register (BAR) with a non-zero value is in rnumber 1 because it is the second tuple in the reg property. The second BAR with a non-zero value is in the third tuple (rnumber 2).
For a full treatment of the meaning of the reg property for PCI devices, see pci(4). For PCI express devices, see pcie(4). For ISA devices, see isa(4). For cardbus, see cardbus(4). For SBus devices, see sbus(4).
Note that the return value DDI_ME_RNUMBER_RANGE is not supported on all platforms. Also, there is potential overlap between DDI_ME_RNUMBER_RANGE and DDI_FAILURE. Drivers should check for !=DDI_SUCCESS rather than checking for a specific failure value.
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|
|Architecture||PCI Local Bus, SBus, ISA|
Writing Device Drivers
|April 18, 2019||OmniOS|