1devmap_callback_ctl(9S) Data Structures for Drivers devmap_callback_ctl(9S)
2
3
4
6 devmap_callback_ctl - device mapping-control structure
7
9 #include <sys/ddidevmap.h>
10
11
13 Solaris DDI specific (Solaris DDI).
14
16 A devmap_callback_ctl structure describes a set of callback routines
17 that are called by the system to notify a device driver to manage
18 events on the device mappings created by devmap_setup(9F) or
19 ddi_devmap_segmap(9F).
20
21
22 Device drivers pass the initialized devmap_callback_ctl structure to
23 either devmap_devmem_setup(9F) or devmap_umem_setup(9F) in the
24 devmap(9E) entry point during the mapping setup. The system makes a
25 private copy of the structure for later use. Device drivers can specify
26 different devmap_callback_ctl for different mappings.
27
28
29 A device driver should allocate the device mapping control structure
30 and initialize the following fields, if the driver wants the entry
31 points to be called by the system:
32
33 devmap_rev Version number. Set this to DEVMAP_OPS_REV.
34
35
36 devmap_map Set to the address of the devmap_map(9E) entry point
37 or to NULL if the driver does not support this call‐
38 back. If set, the system calls the devmap_map(9E)
39 entry point during the mmap(2) system call. The
40 drivers typically allocate driver private data struc‐
41 ture in this function and return the pointer to the
42 private data structure to the system for later use.
43
44
45 devmap_access Set to the address of the devmap_access(9E) entry
46 point or to NULL if the driver does not support this
47 callback. If set, the system calls the driver's
48 devmap_access(9E) entry point during memory access.
49 The system expects devmap_access(9E) to call either
50 devmap_do_ctxmgt(9F) or devmap_default_access(9F) to
51 load the memory address translations before it
52 returns to the system.
53
54
55 devmap_dup Set to the address of the devmap_dup(9E) entry point
56 or to NULL if the driver does not support this call.
57 If set, the system calls the devmap_dup(9E) entry
58 point during the fork(2) system call.
59
60
61 devmap_unmap Set to the address of the devmap_unmap(9E) entry
62 point or to NULL if the driver does not support this
63 call. If set, the system will call the
64 devmap_unmap(9E) entry point during the munmap(2) or
65 exit(2) system calls.
66
67
69 int devmap_rev;
70 int (*devmap_map)(devmap_cookie_t dhp, dev_t dev,
71 uint_t flags,offset_t off, size_t len, void **pvtp);
72 int (*devmap_access)(devmap_cookie_t dhp, void *pvtp,
73 offset_t off, size_t len, uint_t type, uint_t rw);
74 int (*devmap_dup)(devmap_cookie_t dhp, void *pvtp,
75 devmap_cookie_t new_dhp, void **new_pvtp);
76 void (*devmap_unmap)(devmap_cookie_t dhp, void *pvtp,
77 offset_t off, size_t len, devmap_cookie_t new_dhp1,
78 void **new_pvtp1, devmap_cookie_t new_dhp2, void **new_pvtp2);
79
80
82 exit(2), fork(2), mmap(2), munmap(2), devmap(9E), devmap_access(9E),
83 devmap_dup(9E), devmap_map(9E), devmap_unmap(9E),
84 ddi_devmap_segmap(9F), devmap_default_access(9F), devmap_devmem_set‐
85 up(9F), devmap_do_ctxmgt(9F), devmap_setup(9F), devmap_umem_setup(9F)
86
87
88 Writing Device Drivers
89
90
91
92SunOS 5.11 24 Jul 1996 devmap_callback_ctl(9S)