Kernel Functions for Drivers scsihbapktalloc(9F)
NAME
scsihbapktalloc, scsihbapktfree - allocate and free a
scsipkt structure
SYNOPSIS
#include
struct scsipkt *scsihbapktalloc(devinfot *dip,
struct scsiaddress *ap, int cmdlen, int statuslen,
int tgtlen, int hbalen,
int (*callback)(caddrt arg), caddrt arg);
void scsihbapktfree(struct scsiaddress *ap, struct scsipkt *pkt);
INTERFACE LEVEL
Solaris architecture specific (Solaris DI).
PARAMETERS
dip Pointer to a devinfot structure, defining the
HBA driver instance.
ap Pointer to a scsiaddress(9S) structure, defin-
ing the target instance.
cmdlen Length in bytes to be allocated for the SCSI
command descriptor block (CDB).
statuslen Length in bytes to be allocated for the SCSI
status completion block (SCB).
tgtlen Length in bytes to be allocated for a private
data area for the target driver's exclusive
use.
hbalen Length in bytes to be allocated for a private
data area for the HBA driver's exclusive use.
callback Indicates what scsihbapktalloc() should do
when resources are not available:
NULFUNC Do not wait for resources.
Return a NUL pointer.
SunOS 5.11 Last change: 11 Dec 2006 1
Kernel Functions for Drivers scsihbapktalloc(9F)
SLEPFUNC Wait indefinitely for resources.
arg Must be NUL.
pkt A pointer to a scsipkt(9S) structure.
DESCRIPTION
For scsihbapktalloc():
The scsihbapktalloc() function allocates space for a
scsipkt structure. HBA drivers must use this interface when
allocating a scsipkt from their traninitpkt(9E) entry
point.
If callback is NULFUNC, scsihbapktalloc() may not sleep
when allocating resources, and callers should be prepared to
deal with allocation failures.
The scsihbapktalloc() function copies the
scsiaddress(9S) structure pointed to by ap to the
pktaddress field in the scsipkt(9S).
The scsihbapktalloc() function also allocates memory for
these scsipkt(9S) data areas, and sets these fields to
point to the allocated memory:
pkthaprivate HBA private data area.
pktprivate Target driver private data area.
pktscbp SCSI status completion block.
pktcdbp SCSI command descriptor block.
For scsihbapktfree():
The scsihbapktfree() function frees the space allocated
for the scsipkt(9S) structure.
SunOS 5.11 Last change: 11 Dec 2006 2
Kernel Functions for Drivers scsihbapktalloc(9F)
RETURN VALUES
The scsihbapktalloc() function returns a pointer to the
scsipkt structure, or NUL if no space is available.
CONTEXT
The scsihbapktalloc() function can be called from user,
interrupt, or kernel context. Drivers must not allow
scsihbapktalloc() to sleep if called from an interrupt
routine.
The scsihbapktfree() function can be called from user,
interrupt, or kernel context.
SEE ALSO
traninitpkt(9E), scsiaddress(9S), scsipkt(9S)
Writing Device Drivers
SunOS 5.11 Last change: 11 Dec 2006 3
|