1get_pktiopb(9F) Kernel Functions for Drivers get_pktiopb(9F)
2
3
4
6 get_pktiopb, free_pktiopb - allocate/free a SCSI packet in the iopb map
7
9 #include <sys/scsi/scsi.h>
10
11
12
13 struct scsi_pkt *get_pktiopb(struct scsi_address *ap,
14 caddr_t *datap, int cdblen, int statuslen, int datalen,
15 int readflag, int (*callback);
16
17
18 void free_pktiopb(struct scsi_pkt *pkt, caddr_t datap, int datalen);
19
20
22 These interfaces are obsolete. Use scsi_alloc_consistent_buf(9F)
23 instead of get_pktiopb(). Use scsi_free_consistent_buf(9F) instead of
24 free_pktiopb().
25
27 ap Pointer to the target's scsi_address structure.
28
29
30 datap Pointer to the address of the packet, set by this func‐
31 tion.
32
33
34 cdblen Number of bytes required for the SCSI command descriptor
35 block (CDB).
36
37
38 statuslen Number of bytes required for the SCSI status area.
39
40
41 datalen Number of bytes required for the data area of the SCSI
42 command.
43
44
45 readflag If non-zero, data will be transferred from the SCSI tar‐
46 get.
47
48
49 callback Pointer to a callback function, or NULL_FUNC or SLEEP_FUNC
50
51
52 pkt Pointer to a scsi_pkt(9S) structure.
53
54
56 The get_pktiopb() function allocates a scsi_pkt structure that has a
57 small data area allocated. It is used by some SCSI commands such as
58 REQUEST_SENSE, which involve a small amount of data and require cache-
59 consistent memory for proper operation. It uses ddi_iopb_alloc(9F) for
60 allocating the data area and scsi_resalloc(9F) to allocate the packet
61 and DMA resources.
62
63
64 callback indicates what get_pktiopb() should do when resources are not
65 available:
66
67 NULL_FUNC Do not wait for resources. Return a NULL pointer.
68
69
70 SLEEP_FUNC Wait indefinitely for resources.
71
72
73 Other Values callback points to a function which is called when
74 resources may have become available. callback must
75 return either 0 (indicating that it attempted to allo‐
76 cate resources but failed to do so again), in which
77 case it is put back on a list to be called again later,
78 or 1 indicating either success in allocating resources
79 or indicating that it no longer cares for a retry.
80
81
82
83 The free_pktiopb() function is used for freeing the packet and its
84 associated resources.
85
87 The get_pktiopb() function returns a pointer to the newly allocated
88 scsi_pkt or a NULL pointer.
89
91 If callback is SLEEP_FUNC, then this routine can be called only from
92 user or kernel context. Otherwise, it can be called from user, inter‐
93 rupt, or kernel context. The callback function should not block or call
94 routines that block.
95
96
97 The free_pktiopb() function can be called from user, interrupt, or ker‐
98 nel context.
99
101 See attributes(5) for a description of the following attributes:
102
103
104
105
106 ┌─────────────────────────────┬─────────────────────────────┐
107 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │Stability Level │Obsolete │
110 └─────────────────────────────┴─────────────────────────────┘
111
113 attributes(5), ddi_iopb_alloc(9F), scsi_alloc_consistent_buf(9F),
114 scsi_free_consistent_buf(9F), scsi_pktalloc(9F), scsi_resalloc(9F),
115 scsi_pkt(9S)
116
117
118 Writing Device Drivers
119
121 The get_pktiopb() and free_pktiopb() functions are obsolete and will be
122 discontinued in a future release. These functions have been replaced
123 by, respectively, scsi_alloc_consistent_buf(9F) and scsi_free_consis‐
124 tent_buf(9F).
125
126
127 The get_pktiopb() function uses scarce resources. For this reason and
128 its obsolescence (see above), its use is discouraged.
129
130
131
132SunOS 5.11 16 Jan 2006 get_pktiopb(9F)