1ddi_iopb_alloc(9F) Kernel Functions for Drivers ddi_iopb_alloc(9F)
2
3
4
6 ddi_iopb_alloc, ddi_iopb_free - allocate and free non-sequentially
7 accessed memory
8
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13 int ddi_iopb_alloc(dev_info_t *dip, ddi_dma_lim_t *limits,
14 uint_t length, caddr_t *iopbp);
15
16
17 void ddi_iopb_free(caddr_t iopb);
18
19
21 These interfaces are obsolete. Use ddi_dma_mem_alloc(9F) instead of
22 ddi_iopb_alloc(). Use ddi_dma_mem_free(9F) instead of ddi_iopb_free().
23
25 ddi_iopb_alloc()
26 dip A pointer to the device's dev_info structure.
27
28
29 limits A pointer to a DMA limits structure for this device (see
30 ddi_dma_lim_sparc(9S) or ddi_dma_lim_x86(9S)). If this
31 pointer is NULL, a default set of DMA limits is assumed.
32
33
34 length The length in bytes of the desired allocation.
35
36
37 iopbp A pointer to a caddr_t. On a successful return, *iopbp points
38 to the allocated storage.
39
40
41 ddi_iopb_free()
42 iopb The iopb returned from a successful call to ddi_iopb_alloc().
43
44
46 The ddi_iopb_alloc() function allocates memory for DMA transfers and
47 should be used if the device accesses memory in a non-sequential fash‐
48 ion, or if synchronization steps using ddi_dma_sync(9F) should be as
49 lightweight as possible, due to frequent use on small objects. This
50 type of access is commonly known as consistent access. The allocation
51 will obey the alignment and padding constraints as specified in the
52 limits argument and other limits imposed by the system.
53
54
55 Note that you still must use DMA resource allocation functions (see
56 ddi_dma_setup(9F)) to establish DMA resources for the memory allocated
57 using ddi_iopb_alloc().
58
59
60 In order to make the view of a memory object shared between a CPU and a
61 DMA device consistent, explicit synchronization steps using
62 ddi_dma_sync(9F) or ddi_dma_free(9F) are still required. The DMA
63 resources will be allocated so that these synchronization steps are as
64 efficient as possible.
65
66
67 The ddi_iopb_free() function frees up memory allocated by
68 ddi_iopb_alloc().
69
71 The ddi_iopb_alloc() function returns:
72
73 DDI_SUCCESS Memory successfully allocated.
74
75
76 DDI_FAILURE Allocation failed.
77
78
80 These functions can be called from user, interrupt, or kernel context.
81
83 See attributes(5) for a description of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Stability Level │Obsolete │
92 └─────────────────────────────┴─────────────────────────────┘
93
95 attributes(5), ddi_dma_free(9F), ddi_dma_mem_alloc(9F),
96 ddi_dma_mem_free(9F), ddi_dma_setup(9F), ddi_dma_sync(9F),
97 ddi_mem_alloc(9F), ddi_dma_lim_sparc(9S), ddi_dma_lim_x86(9S),
98 ddi_dma_req(9S)
99
100
101 Writing Device Drivers
102
104 This function uses scarce system resources. Use it selectively.
105
106
107
108SunOS 5.11 04 Apr 2006 ddi_iopb_alloc(9F)