92 lines
3.0 KiB
Plaintext
92 lines
3.0 KiB
Plaintext
.TH scsi_alloc D3X
|
|
.SH NAME
|
|
scsi_alloc \- allocate communication channel to host adapter driver
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.ft 3
|
|
#include <sys/types.h>
|
|
#include <sys/scsi.h>
|
|
.sp .8v
|
|
int
|
|
(*scsi_alloc)( vertex_hdl_t \f2lun_vhdl\fP,
|
|
int \f2option\fP,
|
|
void (*\f2callback_function\fP)(vertex_hdl_t, char *));
|
|
.ft 1
|
|
.fi
|
|
.SH DESCRIPTION
|
|
A kernel level SCSI device driver calls the host adapter
|
|
.I scsi_alloc
|
|
function
|
|
to initialize a communication connection between itself
|
|
and a host adapter driver, in preparation for issuing SCSI commands.
|
|
.P
|
|
There is no kernel object called scsi_alloc; rather,
|
|
there is a pointer to each host adapter's scsi_alloc function
|
|
in the sci_alloc field of the scsi_ctlr_info structure, which
|
|
is attached to the vertex corresponding to the host adapter.
|
|
.P
|
|
The
|
|
.I lun_vhdl
|
|
argument specifies the hwgraph vertex for the device.
|
|
The
|
|
.I option
|
|
argument currently has two fields:
|
|
.IP \(bu 4n
|
|
SCSIALLOC_EXCLUSIVE indicates that the driver needs exclusive
|
|
use with the device.
|
|
.IP \(bu 4n
|
|
SCSIALLOC_QDEPTH is an 8-bit mask specifying the maximum number of
|
|
commands that the device driver will want to queue.
|
|
It is advisory only and may be ignored by the host adapter driver.
|
|
.P
|
|
The
|
|
.I callback_function
|
|
may be useful for drivers that don't use the
|
|
SCSIALLOC_EXCLUSIVE option.
|
|
When
|
|
.I callback_function
|
|
is NULL, it is ignored.
|
|
When non-NULL,
|
|
it specifies a function to call whenever there is sense data from device.
|
|
It can be useful when more than one device driver will talk to a SCSI device,
|
|
but one of the drivers needs to know about things like media removals.
|
|
Only one device driver may specify a callback_function for a given device.
|
|
The callback function is called with two arguments, the vertex handle
|
|
corresponding to the SCSI lun and the sense data. The vertex handle
|
|
allows a driver to know which device the callback pertains to.
|
|
.SH DIAGNOSTICS
|
|
.I scsi_alloc
|
|
returns 0 if a communication connection could not be established,
|
|
or if the arguments are invalid,
|
|
or if the device was already allocated in exclusive use mode,
|
|
or if this request was for exclusive use and the device is already
|
|
allocated (including possibly earlier requests by the same driver).
|
|
Otherwise, it returns a positive value.
|
|
.SH NOTES
|
|
.I scsi_alloc
|
|
is stored as a function pointer in the scsi_ctlr_info_t structure,
|
|
which is associated with the scsi host adapter vertex in the hwgraph. The
|
|
information structure in the scsi target vertex also has a pointer
|
|
to the scsi_ctlr_info_t of the host adapter that the target is
|
|
connected to.
|
|
Given a
|
|
.I lun_vhdl
|
|
(vertex handle of the device) the
|
|
.I scsi_alloc
|
|
function can be called as follows:
|
|
.Ex
|
|
scsi_lun_info_t *scsi_lun_info;
|
|
...
|
|
scsi_lun_info = scsi_lun_info_get(lun_vhdl);
|
|
SLI_ALLOC(scsi_lun_info)(lun_vhdl,option,callback_function);
|
|
.Ee
|
|
.SH SEE ALSO
|
|
comments in /usr/include/sys/scsi.h,
|
|
hwgraph.intro(D4X),
|
|
scsi_free(D3X),
|
|
scsi_info(D3X),
|
|
scsi_command(D3X),
|
|
scsi_ioctl(D3X),
|
|
scsi_abort(D3X),
|
|
SCSI chapter of the IRIX Device Driver Programmer's Guide.
|