1ddi_map_regs(9F) Kernel Functions for Drivers ddi_map_regs(9F)
2
3
4
6 ddi_map_regs, ddi_unmap_regs - map or unmap registers
7
9 #include <sys/conf.h>
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13
14
15 int ddi_map_regs(dev_info_t *dip, uint_t rnumber, caddr_t *kaddrp,
16 off_t offset, off_t len);
17
18
19 void ddi_unmap_regs(dev_info_t *dip, uint_t rnumber, caddr_t *kaddrp,
20 off_t offset, off_t len);
21
22
24 These interfaces are obsolete. Use ddi_regs_map_setup(9F) instead of
25 ddi_map_regs(). Use ddi_regs_map_free(9F) instead of ddi_unmap_regs().
26
28 ddi_map_regs()
29 dip Pointer to the device's dev_info structure.
30
31
32 rnumber Register set number.
33
34
35 kaddrp Pointer to the base kernel address of the mapped region (set
36 on return).
37
38
39 offset Offset into register space.
40
41
42 len Length to be mapped.
43
44
45 ddi_unmap_regs()
46 dip Pointer to the device's dev_info structure.
47
48
49 rnumber Register set number.
50
51
52 kaddrp Pointer to the base kernel address of the region to be
53 unmapped.
54
55
56 offset Offset into register space.
57
58
59 len Length to be unmapped.
60
61
63 The ddi_map_regs() function maps in the register set given by rnumber.
64 The register number determines which register set will be mapped if
65 more than one exists. The base kernel virtual address of the mapped
66 register set is returned in kaddrp. offset specifies an offset into the
67 register space to start from and len indicates the size of the area to
68 be mapped. If len is non-zero, it overrides the length given in the
69 register set description. See the discussion of the reg property in
70 sbus(4) and for more information on register set descriptions. If len
71 and offset are 0, the entire space is mapped.
72
73
74 The ddi_unmap_regs() function undoes mappings set up by ddi_map_regs().
75 This is provided for drivers preparing to detach themselves from the
76 system, allowing them to release allocated mappings. Mappings must be
77 released in the same way they were mapped (a call to ddi_unmap_regs()
78 must correspond to a previous call to ddi_map_regs()). Releasing por‐
79 tions of previous mappings is not allowed. rnumber determines which
80 register set will be unmapped if more than one exists. The kaddrp, off‐
81 set and len specify the area to be unmapped. kaddrp is a pointer to the
82 address returned from ddi_map_regs(); offset and len should match what
83 ddi_map_regs() was called with.
84
86 The ddi_map_regs() function returns:
87
88 DDI_SUCCESS on success.
89
90
92 These functions can be called from user, interrupt, or kernel context.
93
95 See attributes(5) for a description of the following attributes:
96
97
98
99
100 ┌─────────────────────────────┬─────────────────────────────┐
101 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
102 ├─────────────────────────────┼─────────────────────────────┤
103 │Interface Stability │Obsolete │
104 └─────────────────────────────┴─────────────────────────────┘
105
107 attributes(5), sbus(4), ddi_regs_map_free(9F), ddi_regs_map_setup(9F)
108
109
110 Writing Device Drivers
111
112
113
114SunOS 5.11 16 Jan 2006 ddi_map_regs(9F)