|
|
1.1 root 1: .TH SCSI 4
2: .CT 2 sa
3: .SH NAME
4: scsi \- SCSI interface
5: .SH SYNOPSIS
6: .B "#include <scsi.h>"
7: .SH DESCRIPTION
8: The special file
9: .F /dev/scsi
10: provides a low level interface to a SCSI bus.
11: Commands are transmitted to the bus by
12: .IR write ;
13: the response to each command is received with
14: .IR read (2).
15: The format of a command is
16: .IP
17: .EX
18: .ta \w'unsigned char scsistatus; 'u
19: unsigned long tran_id; /* transaction id */
20: unsigned char target; /* SCSI id of target device */
21: unsigned char flags; /* flags for this transaction */
22: unsigned long nreturn; /* number of bytes to be read back */
23: char cmd[10]; /* SCSI command */
24: char data[]; /* optional data */
25: .EE
26: .LP
27: Thus, to send
28: .I n
29: bytes of data, the byte count for
30: .I write
31: should be
32: .IR n +20.
33: Possible flags are
34: .B SCSI_WR
35: (data goes from host to SCSI),
36: .B SCSI_RD
37: (data goes from SCSI to host),
38: .B SCSI_BRESET
39: (reset the SCSI bus),
40: .B SCSI_RESET
41: (reset the controller),
42: and
43: .B SCSI_SENSE
44: (return extended sense data on error).
45: For most controllers,
46: .B SCSI_BRESET
47: implies
48: .BR SCSI_RESET .
49: Flags are OR'ed together, and there must be exactly one of
50: .B SCSI_WR
51: and
52: .BR SCSI_RD .
53: The SCSI command should terminate within a small time
54: (currently 10 seconds);
55: a longer limit (300 seconds) can be specified by using
56: .BR SCSI_LTMOUT .
57: .LP
58: The data read is structured as
59: .IP
60: .EX
61: unsigned long tran_id; /* transaction id */
62: unsigned char status; /* scsi status byte */
63: unsigned char message; /* scsi message byte */
64: unsigned char flags; /* flags for this transaction */
65: unsigned char c_type; /* 1=td 2=us */
66: unsigned short c_reg1; /* td=sa, us=csr */
67: unsigned short c_reg2; /* td=mscp, us=per */
68: unsigned char sense[22]; /* extended sense data */
69: char pad[2];
70: char data[]; /* any data */
71: .EE
72: .LP
73: Thus, to read
74: .I n
75: bytes of data. the byte count to
76: .I read
77: should be
78: .IR n +36.
79: If
80: .I flags
81: has the
82: .B SCSI_CERR
83: bit set,
84: there was a controller error, which is described by the
85: .B c_
86: fields.
87: The values of
88: .B csr
89: (or
90: .BR sa )
91: and
92: .B per
93: (or
94: .BR mscp )
95: are documented in the interface manual for the U.S. Design 1158
96: Unibus controller (or T.D. Systems Viking controller).
97: If the
98: .B SCSI_SENSE
99: bit was set in the
100: .I write,
101: and the status byte shows a check condition,
102: an attempt is made to get extended sense information.
103: If the attempt succeeds the
104: .B SCSI_SENSE
105: is set in
106: .I flags.
107: Otherwise, the status and message bytes for the failed
108: attempt are placed in
109: .B sense[0]
110: and
111: .B sense[1]
112: respectively.
113: .PP
114: The transaction id identifies which
115: .I write
116: caused the results for this
117: .IR read .
118: This will become more important when multiple simultaneous transactions
119: are allowed.
120: .SH FILES
121: .F /dev/scsi
122: .SH "SEE ALSO"
123: .IR scsish (8)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.