Copyright (c) 2002, Sun Microsystems, Inc.
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.
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.
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]
#include <sys/scsi/scsi.h> int scsi_probe(struct scsi_device *devp, int (*waitfunc);
Pointer to a scsi_device(9S) structure
NULL_FUNC or SLEEP_FUNC
scsi_probe() uses the SCSI Inquiry command to test if the device exists. It can retry the Inquiry command as appropriate. If scsi_probe() is successful, it will allocate space for the scsi_inquiry structure and assign the address to the sd_inq member of the scsi_device(9S) structure. scsi_probe() will then fill in this scsi_inquiry(9S) structure and return SCSIPROBE_EXISTS. If scsi_probe() is unsuccessful, it returns SCSIPROBE_NOMEM in spite of callback set to SLEEP_FUNC.
scsi_unprobe(9F) is used to undo the effect of scsi_probe().
If the target is a non-CCS device, SCSIPROBE_NONCCS will be returned.
waitfunc indicates what the allocator routines should do when resources are not available; the valid values are: NULL_FUNC
Do not wait for resources. Return SCSIPROBE_NOMEM or SCSIPROBE_FAILURE
Wait indefinitely for resources.
Device exists but is currently busy.
Device exists and inquiry data is valid.
Polled command failure.
No space available for structures.
No space available for structures but callback request has been queued.
Device exists but inquiry data is not valid.
Device does not respond to an INQUIRY.
switch (scsi_probe(devp, NULL_FUNC)) { default: case SCSIPROBE_NORESP: case SCSIPROBE_NONCCS: case SCSIPROBE_NOMEM: case SCSIPROBE_FAILURE: case SCSIPROBE_BUSY: break; case SCSIPROBE_EXISTS: switch (devp->sd_inq->inq_dtype) { case DTYPE_DIRECT: rval = DDI_PROBE_SUCCESS; break; case DTYPE_RODIRECT: rval = DDI_PROBE_SUCCESS; break; case DTYPE_NOTPRESENT: default: break; } } scsi_unprobe(devp);
ANSI Small Computer System Interface-2 (SCSI-2)
Writing Device Drivers