2 .\" Copyright (c) 2002, Sun Microsystems, Inc.
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_PROBE 9F "Feb 26, 2002"
8 scsi_probe \- utility for probing a scsi device
12 #include <sys/scsi/scsi.h>
16 \fBint\fR \fBscsi_probe\fR(\fBstruct scsi_device *\fR\fIdevp\fR, \fBint (*\fR\fIwaitfunc\fR);
22 Solaris DDI specific (Solaris DDI).
30 Pointer to a \fBscsi_device\fR(9S) structure
39 \fBNULL_FUNC\fR or \fBSLEEP_FUNC\fR
45 \fBscsi_probe()\fR determines whether a \fBtarget/lun\fR is present and sets up
46 the \fBscsi_device\fR structure with inquiry data.
49 \fBscsi_probe()\fR uses the SCSI Inquiry command to test if the device exists.
50 It can retry the Inquiry command as appropriate. If \fBscsi_probe()\fR is
51 successful, it will allocate space for the \fBscsi_inquiry\fR structure and
52 assign the address to the \fBsd_inq\fR member of the \fBscsi_device\fR(9S)
53 structure. \fBscsi_probe()\fR will then fill in this \fBscsi_inquiry\fR(9S)
54 structure and return \fBSCSIPROBE_EXISTS\fR. If \fBscsi_probe()\fR is
55 unsuccessful, it returns \fBSCSIPROBE_NOMEM\fR in spite of callback set to
59 \fBscsi_unprobe\fR(9F) is used to undo the effect of \fBscsi_probe()\fR.
62 If the target is a non-CCS device, \fBSCSIPROBE_NONCCS\fR will be returned.
65 \fIwaitfunc\fR indicates what the allocator routines should do when resources
66 are not available; the valid values are:
70 \fB\fBNULL_FUNC\fR \fR
73 Do not wait for resources. Return \fBSCSIPROBE_NOMEM\fR or
74 \fBSCSIPROBE_FAILURE\fR
80 \fB\fBSLEEP_FUNC\fR \fR
83 Wait indefinitely for resources.
89 \fBscsi_probe()\fR returns:
93 \fB\fBSCSIPROBE_BUSY\fR \fR
96 Device exists but is currently busy.
102 \fB\fBSCSIPROBE_EXISTS\fR \fR
105 Device exists and inquiry data is valid.
111 \fB\fBSCSIPROBE_FAILURE\fR \fR
114 Polled command failure.
120 \fB\fBSCSIPROBE_NOMEM\fR \fR
123 No space available for structures.
129 \fB\fBSCSIPROBE_NOMEM_CB\fR \fR
132 No space available for structures but callback request has been queued.
138 \fB\fBSCSIPROBE_NONCCS\fR \fR
141 Device exists but inquiry data is not valid.
147 \fB\fBSCSIPROBE_NORESP\fR \fR
150 Device does not respond to an INQUIRY.
156 \fBscsi_probe()\fR is normally called from the target driver's \fBprobe\fR(9E)
157 or \fBattach\fR(9E) routine. In any case, this routine should not be called
158 from interrupt context, because it can sleep waiting for memory to be
162 \fBExample 1 \fR Using \fBscsi_probe()\fR
166 switch (scsi_probe(devp, NULL_FUNC)) {
168 case SCSIPROBE_NORESP:
169 case SCSIPROBE_NONCCS:
170 case SCSIPROBE_NOMEM:
171 case SCSIPROBE_FAILURE:
174 case SCSIPROBE_EXISTS:
175 switch (devp->sd_inq->inq_dtype) {
177 rval = DDI_PROBE_SUCCESS;
180 rval = DDI_PROBE_SUCCESS;
182 case DTYPE_NOTPRESENT:
194 \fBattach\fR(9E), \fBprobe\fR(9E), \fBscsi_slave\fR(9F),
195 \fBscsi_unprobe\fR(9F), \fBscsi_unslave\fR(9F), \fBscsi_device\fR(9S),
196 \fBscsi_inquiry\fR(9S)
199 \fIANSI Small Computer System Interface-2 (SCSI-2)\fR
202 \fIWriting Device Drivers\fR
206 A \fIwaitfunc\fR function other than \fBNULL_FUNC\fR or \fBSLEEP_FUNC\fR is not
207 supported and may have unexpected results.