Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ scsi_probe(9F) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

probe(9E)

scsi_slave(9F)

scsi_unprobe(9F)

scsi_unslave(9F)

scsi_probe(9F)

NAME

scsi_probe − utility for probing a scsi device

SYNOPSIS

#include <sys/scsi/scsi.h>

int scsi_probe(struct scsi_device ∗devp, int (∗callback)(void ∗));

ARGUMENTS

devp Pointer to a scsi_device(9S) structure. 

callback Pointer to a callback function, or NULL_FUNC or SLEEP_FUNC. 

INTERFACE LEVEL

Solaris architecture specific (SunDDI). 

DESCRIPTION

scsi_probe() determines whether a target/lun is present and sets up the scsi_device structure with inquiry data. 

scsi_probe() uses the SCSI Inquiry command to test if the device exists.  It may retry the Inquiry command as appropriate.  If scsi_probe() is successful, it will fill in the scsi_inquiry structure, which is the sd_inq member of the scsi_device(9S) structure, and return SCSI_PROBE_EXISTS. 

If the target is a non-CCS device, SCSIPROBE_NONCCS will be returned. 

callback indicates what the allocator routines should do when resources are not available; the valid values are:

NULL_FUNC Do not wait for resources.  Return a NULL pointer. 

SLEEP_FUNC
Wait indefinitely for resources.

Other Values callback points to a function which is called when resources may have become available.  callback must return either 0 (indicating that it attempted to allocate resources but again failed to do so), in which case it is put back on a list to be called again later, or 1 indicating either success in allocating resources or indicating that it no longer cares for a retry. 

RETURN VALUES

scsi_probe() returns:

SCSIPROBE_NOMEM
No space available for structures.

SCSIPROBE_EXISTS
Device exists and inquiry data is valid.

SCSIPROBE_NONCCS
Device exists but inquiry data is not valid.

SCSIPROBE_FAILURE
Polled command failure.

SCSIPROBE_BUSY
Device exists but is currently busy.

SCSIPROBE_NORESP
Device does not respond to an INQUIRY.

CONTEXT

scsi_probe() is normally called from the target driver’s probe(9E) or attach(9E) routine.  If callback is SLEEP_FUNC, then this routine may only be called from user-level code.  Otherwise, it may be called from either user or interrupt level.  The callback function may not block or call routines that block. 

EXAMPLE

    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);

SEE ALSO

probe(9E), scsi_slave(9F), scsi_unprobe(9F), scsi_unslave(9F)

ANSI Small Computer System Interface-2 (SCSI-2)

SunOS 5.1 Writing Device Drivers

SunOS 5.2  —  Last change: 21 Dec 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026