1 '\" te
   2 .\" Copyright (c) 2002, Sun Microsystems, Inc., All Rights Reserved
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH SCSI_SLAVE 9F "Sep 27, 2002"
   7 .SH NAME
   8 scsi_slave \- utility for SCSI target drivers to establish the presence of a
   9 target
  10 .SH SYNOPSIS
  11 .LP
  12 .nf
  13 #include <sys/scsi/scsi.h>
  14 
  15 
  16 
  17 \fBint\fR \fBscsi_slave\fR(\fBstruct scsi_device *\fR\fIdevp\fR, \fBint\fR \fB(*\fRcallback\fB)(void)\fR);
  18 .fi
  19 
  20 .SH INTERFACE LEVEL
  21 .sp
  22 .LP
  23 The \fBscsi_slave()\fR function is obsolete. This function has been replaced by
  24 \fBscsi_probe\fR(9F).
  25 .SH PARAMETERS
  26 .sp
  27 .ne 2
  28 .na
  29 \fB\fIdevp\fR \fR
  30 .ad
  31 .RS 13n
  32 Pointer to a \fBscsi_device\fR(9S) structure.
  33 .RE
  34 
  35 .sp
  36 .ne 2
  37 .na
  38 \fB\fIcallback\fR \fR
  39 .ad
  40 .RS 13n
  41 Pointer to a callback function, \fBNULL_FUNC\fR or \fBSLEEP_FUNC\fR.
  42 .RE
  43 
  44 .SH DESCRIPTION
  45 .sp
  46 .LP
  47 \fBscsi_slave()\fR checks for the presence of a \fBSCSI\fR device. Target
  48 drivers may use this function in their \fBprobe\fR(9E) routines.
  49 \fBscsi_slave()\fR determines if the device is present by using a Test Unit
  50 Ready command followed by an Inquiry command. If \fBscsi_slave()\fR is
  51 successful, it will fill in the \fBscsi_inquiry\fR structure, which is the
  52 \fBsd_inq\fR member of the \fBscsi_device\fR(9S) structure, and return
  53 \fBSCSI_PROBE_EXISTS\fR. This information can be used to determine if the
  54 target driver has probed the correct SCSI device type. \fIcallback\fR indicates
  55 what the allocator routines should do when \fBDMA \fRresources are not
  56 available:
  57 .sp
  58 .ne 2
  59 .na
  60 \fB\fBNULL_FUNC\fR \fR
  61 .ad
  62 .RS 16n
  63 Do not wait for resources. Return a \fINULL\fR pointer.
  64 .RE
  65 
  66 .sp
  67 .ne 2
  68 .na
  69 \fB\fBSLEEP_FUNC\fR \fR
  70 .ad
  71 .RS 16n
  72 Wait indefinitely for resources.
  73 .RE
  74 
  75 .sp
  76 .ne 2
  77 .na
  78 \fBOther Values\fR
  79 .ad
  80 .RS 16n
  81 \fIcallback\fR points to a function which is called when resources may have
  82 become available. \fIcallback\fR \fBmust\fR return either \fB0\fR (indicating
  83 that it attempted to allocate resources but again failed to do so), in which
  84 case it is put back on a list to be called again later, or \fB1\fR indicating
  85 either success in allocating resources or indicating that it no longer cares
  86 for a retry.
  87 .RE
  88 
  89 .SH RETURN VALUES
  90 .sp
  91 .LP
  92 \fBscsi_slave()\fR returns:
  93 .sp
  94 .ne 2
  95 .na
  96 \fB\fBSCSIPROBE_NOMEM\fR \fR
  97 .ad
  98 .RS 22n
  99 No space available for structures.
 100 .RE
 101 
 102 .sp
 103 .ne 2
 104 .na
 105 \fB\fBSCSIPROBE_EXISTS\fR \fR
 106 .ad
 107 .RS 22n
 108 Device exists and inquiry data is valid.
 109 .RE
 110 
 111 .sp
 112 .ne 2
 113 .na
 114 \fB\fBSCSIPROBE_NONCCS\fR \fR
 115 .ad
 116 .RS 22n
 117 Device exists but inquiry data is not valid.
 118 .RE
 119 
 120 .sp
 121 .ne 2
 122 .na
 123 \fB\fBSCSIPROBE_FAILURE\fR \fR
 124 .ad
 125 .RS 22n
 126 Polled command failure.
 127 .RE
 128 
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fBSCSIPROBE_NORESP\fR \fR
 133 .ad
 134 .RS 22n
 135 No response to \fBTEST UNIT READY\fR.
 136 .RE
 137 
 138 .SH CONTEXT
 139 .sp
 140 .LP
 141 \fBscsi_slave()\fR is normally called from the target driver's \fBprobe\fR(9E)
 142 or \fBattach\fR(9E) routine. In any case, this routine should not be called
 143 from interrupt context, because it can sleep waiting for memory to be
 144 allocated.
 145 .SH ATTRIBUTES
 146 .sp
 147 .LP
 148 See \fBattributes\fR(5) for a description of the following attributes:
 149 .sp
 150 
 151 .sp
 152 .TS
 153 box;
 154 c | c
 155 l | l .
 156 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 157 _
 158 Stability Level Obsolete
 159 .TE
 160 
 161 .SH SEE ALSO
 162 .sp
 163 .LP
 164 \fBattributes\fR(5), \fBattach\fR(9E), \fBprobe\fR(9E),
 165 \fBddi_iopb_alloc\fR(9F), \fBmakecom\fR(9F), \fBscsi_dmaget\fR(9F),
 166 \fBscsi_ifgetcap\fR(9F), \fBscsi_pktalloc\fR(9F), \fBscsi_poll\fR(9F),
 167 \fBscsi_probe\fR(9F), \fBscsi_device\fR(9S)
 168 .sp
 169 .LP
 170  \fIANSI Small Computer System Interface-2 (SCSI-2)\fR
 171 .sp
 172 .LP
 173 \fIWriting Device Drivers\fR
 174 .SH NOTES
 175 .sp
 176 .LP
 177 The \fBscsi_slave()\fR function is obsolete and will be discontinued in a
 178 future release. This function has been replaced by \fBscsi_probe\fR(9F).