1scsi_hba_pkt_alloc(9F)   Kernel Functions for Drivers   scsi_hba_pkt_alloc(9F)
2
3
4

NAME

6       scsi_hba_pkt_alloc,  scsi_hba_pkt_free  -  allocate and free a scsi_pkt
7       structure
8

SYNOPSIS

10       #include <sys/scsi/scsi.h>
11
12
13
14       struct scsi_pkt *scsi_hba_pkt_alloc(dev_info_t *dip,
15            struct scsi_address *ap, int cmdlen, int statuslen,
16            int tgtlen, int hbalen,
17            int (*callback)(caddr_t arg), caddr_t arg);
18
19
20       void scsi_hba_pkt_free(struct scsi_address *ap, struct scsi_pkt *pkt);
21
22

INTERFACE LEVEL

24       Solaris architecture specific (Solaris DDI).
25

PARAMETERS

27       dip          Pointer to a dev_info_t structure, defining the HBA driver
28                    instance.
29
30
31       ap           Pointer to a scsi_address(9S) structure, defining the tar‐
32                    get instance.
33
34
35       cmdlen       Length in bytes to  be  allocated  for  the  SCSI  command
36                    descriptor block (CDB).
37
38
39       statuslen    Length  in  bytes to be allocated for the SCSI status com‐
40                    pletion block (SCB).
41
42
43       tgtlen       Length in bytes to be allocated for a  private  data  area
44                    for the target driver's exclusive use.
45
46
47       hbalen       Length  in  bytes  to be allocated for a private data area
48                    for the HBA driver's exclusive use.
49
50
51       callback     Indicates  what  scsi_hba_pkt_alloc()   should   do   when
52                    resources are not available:
53
54                    NULL_FUNC     Do  not  wait  for resources.  Return a NULL
55                                  pointer.
56
57
58                    SLEEP_FUNC    Wait indefinitely for resources.
59
60
61
62       arg          Must be NULL.
63
64
65       pkt          A pointer to a scsi_pkt(9S) structure.
66
67

DESCRIPTION

69       For scsi_hba_pkt_alloc():
70
71
72       The scsi_hba_pkt_alloc() function allocates space for a scsi_pkt struc‐
73       ture.  HBA  drivers  must use this interface when allocating a scsi_pkt
74       from their tran_init_pkt(9E) entry point.
75
76
77       If callback is NULL_FUNC, scsi_hba_pkt_alloc() may not sleep when allo‐
78       cating  resources,  and callers should be prepared to deal with alloca‐
79       tion failures.
80
81
82       The scsi_hba_pkt_alloc() function copies the scsi_address(9S) structure
83       pointed to by ap to the pkt_address field in the scsi_pkt(9S).
84
85
86       The  scsi_hba_pkt_alloc()  function  also  allocates  memory  for these
87       scsi_pkt(9S) data areas, and sets these fields to point  to  the  allo‐
88       cated memory:
89
90       pkt_ha_private    HBA private data area.
91
92
93       pkt_private       Target driver private data area.
94
95
96       pkt_scbp          SCSI status completion block.
97
98
99       pkt_cdbp          SCSI command descriptor block.
100
101
102
103       For scsi_hba_pkt_free():
104
105
106       The  scsi_hba_pkt_free()  function  frees  the  space allocated for the
107       scsi_pkt(9S) structure.
108

RETURN VALUES

110       The scsi_hba_pkt_alloc() function returns a  pointer  to  the  scsi_pkt
111       structure, or NULL if no space is available.
112

CONTEXT

114       The  scsi_hba_pkt_alloc()  function can be called from user, interrupt,
115       or kernel context. Drivers must not allow scsi_hba_pkt_alloc() to sleep
116       if called from an interrupt routine.
117
118
119       The scsi_hba_pkt_free() function can be called from user, interrupt, or
120       kernel context.
121

SEE ALSO

123       tran_init_pkt(9E), scsi_address(9S), scsi_pkt(9S)
124
125
126       Writing Device Drivers
127
128
129
130SunOS 5.11                        11 Dec 2006           scsi_hba_pkt_alloc(9F)
Impressum