1ddi_regs_map_setup(9F) Kernel Functions for Drivers ddi_regs_map_setup(9F)
2
3
4
6 ddi_regs_map_setup - set up a mapping for a register address space
7
9 #include <sys/ddi.h>
10 #include <sys/sunddi.h>
11
12
13
14 int ddi_regs_map_setup(dev_info_t *dip, uint_t rnumber, caddr_t *addrp,
15 offset_t offset, offset_t len, ddi_device_acc_attr_t *accattrp,
16 ddi_acc_handle_t *handlep);
17
18
20 Solaris DDI specific (Solaris DDI).
21
23 dip Pointer to the device's dev_info structure.
24
25
26 rnumber Index number to the register address space set.
27
28
29 addrp A platform-dependent value that, when added to an offset
30 that is less than or equal to the len parameter (see
31 below), is used for the dev_addr argument to the ddi_get,
32 ddi_mem_get, and ddi_io_get/put routines.
33
34
35 offset Offset into the register address space.
36
37
38 len Length to be mapped.
39
40
41 accattrp Pointer to a device access attribute structure of this map‐
42 ping (see ddi_device_acc_attr(9S)).
43
44
45 handlep Pointer to a data access handle.
46
47
49 ddi_regs_map_setup() maps in the register set given by rnumber. The
50 register number determines which register set is mapped if more than
51 one exists.
52
53
54 offset specifies the starting location within the register space and
55 len indicates the size of the area to be mapped. If len is non-zero,
56 it overrides the length given in the register set description. If both
57 len and offset are 0, the entire space is mapped. The base of the
58 mapped register space is returned in addrp.
59
60
61 The device access attributes are specified in the location pointed by
62 the accattrp argument (see ddi_device_acc_attr(9S) for details).
63
64
65 The data access handle is returned in handlep. handlep is opaque;
66 drivers should not attempt to interpret its value. The handle is used
67 by the system to encode information for subsequent data access function
68 calls to maintain a consistent view between the host and the device.
69
71 ddi_regs_map_setup() returns:
72
73 DDI_SUCCESS Successfully set up the mapping for data
74 access.
75
76
77 DDI_FAILURE Invalid register number rnumber, offset off‐
78 set, or length len.
79
80
81 DDI_ME_RNUMBER_RANGE Invalid register number rnumber or unable to
82 find reg property.
83
84
85 DDI_REGS_ACC_CONFLICT Cannot enable the register mapping due to
86 access conflicts with other enabled mappings.
87
88
89
90 Note that the return value DDI_ME_RNUMBER_RANGE is not supported on all
91 platforms. Also, there is potential overlap between DDI_ME_RNUM‐
92 BER_RANGE and DDI_FAILURE. Drivers should check for !=DDI_SUCCESS
93 rather than checking for a specific failure value.
94
96 ddi_regs_map_setup() must be called from user or kernel context.
97
99 See attributes(5) for descriptions of the following attributes:
100
101
102
103
104 ┌─────────────────────────────┬─────────────────────────────┐
105 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
106 ├─────────────────────────────┼─────────────────────────────┤
107 │Architecture │PCI Local Bus, SBus, ISA │
108 └─────────────────────────────┴─────────────────────────────┘
109
111 attributes(5), ddi_regs_map_free(9F), ddi_device_acc_attr(9S)
112
113
114 Writing Device Drivers
115
116
117
118SunOS 5.11 18 Nov 2004 ddi_regs_map_setup(9F)