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