1scsi_probe(9F) Kernel Functions for Drivers scsi_probe(9F)
2
3
4
6 scsi_probe - utility for probing a scsi device
7
9 #include <sys/scsi/scsi.h>
10
11
12
13 int scsi_probe(struct scsi_device *devp, int (*waitfunc);
14
15
17 Solaris DDI specific (Solaris DDI).
18
20 devp Pointer to a scsi_device(9S) structure
21
22
23 waitfunc NULL_FUNC or SLEEP_FUNC
24
25
27 scsi_probe() determines whether a target/lun is present and sets up the
28 scsi_device structure with inquiry data.
29
30
31 scsi_probe() uses the SCSI Inquiry command to test if the device
32 exists. It can retry the Inquiry command as appropriate. If
33 scsi_probe() is successful, it will allocate space for the scsi_inquiry
34 structure and assign the address to the sd_inq member of the
35 scsi_device(9S) structure. scsi_probe() will then fill in this
36 scsi_inquiry(9S) structure and return SCSIPROBE_EXISTS. If scsi_probe()
37 is unsuccessful, it returns SCSIPROBE_NOMEM in spite of callback set to
38 SLEEP_FUNC.
39
40
41 scsi_unprobe(9F) is used to undo the effect of scsi_probe().
42
43
44 If the target is a non-CCS device, SCSIPROBE_NONCCS will be returned.
45
46
47 waitfunc indicates what the allocator routines should do when resources
48 are not available; the valid values are:
49
50 NULL_FUNC Do not wait for resources. Return SCSIPROBE_NOMEM or
51 SCSIPROBE_FAILURE
52
53
54 SLEEP_FUNC Wait indefinitely for resources.
55
56
58 scsi_probe() returns:
59
60 SCSIPROBE_BUSY Device exists but is currently busy.
61
62
63 SCSIPROBE_EXISTS Device exists and inquiry data is valid.
64
65
66 SCSIPROBE_FAILURE Polled command failure.
67
68
69 SCSIPROBE_NOMEM No space available for structures.
70
71
72 SCSIPROBE_NOMEM_CB No space available for structures but callback
73 request has been queued.
74
75
76 SCSIPROBE_NONCCS Device exists but inquiry data is not valid.
77
78
79 SCSIPROBE_NORESP Device does not respond to an INQUIRY.
80
81
83 scsi_probe() is normally called from the target driver's probe(9E) or
84 attach(9E) routine. In any case, this routine should not be called from
85 interrupt context, because it can sleep waiting for memory to be allo‐
86 cated.
87
89 Example 1 Using scsi_probe()
90
91 switch (scsi_probe(devp, NULL_FUNC)) {
92 default:
93 case SCSIPROBE_NORESP:
94 case SCSIPROBE_NONCCS:
95 case SCSIPROBE_NOMEM:
96 case SCSIPROBE_FAILURE:
97 case SCSIPROBE_BUSY:
98 break;
99 case SCSIPROBE_EXISTS:
100 switch (devp->sd_inq->inq_dtype) {
101 case DTYPE_DIRECT:
102 rval = DDI_PROBE_SUCCESS;
103 break;
104 case DTYPE_RODIRECT:
105 rval = DDI_PROBE_SUCCESS;
106 break;
107 case DTYPE_NOTPRESENT:
108 default:
109 break;
110 }
111 }
112 scsi_unprobe(devp);
113
114
116 attach(9E), probe(9E), scsi_slave(9F), scsi_unprobe(9F),
117 scsi_unslave(9F), scsi_device(9S), scsi_inquiry(9S)
118
119
120 ANSI Small Computer System Interface-2 (SCSI-2)
121
122
123 Writing Device Drivers
124
126 A waitfunc function other than NULL_FUNC or SLEEP_FUNC is not supported
127 and may have unexpected results.
128
129
130
131SunOS 5.11 26 Feb 2002 scsi_probe(9F)