|
|
1.1 root 1: #include "scsi.h"
2:
3: static shelf();
4:
5: s_status(drive, o)
6: struct scsi_o *o;
7: {
8: struct scsi_o output;
9: register unsigned char *d;
10: int i;
11:
12: if(o == 0)
13: o = &output;
14: if(s_istatus(drive, o))
15: return(1);
16: if(V){
17: d = &o->data[16];
18: for(i = 0; i < 8; i++, d += 4){
19: Fprint(1, "drive %d: %sready,%sdisk in LUN,power %s,", i,
20: (d[0]&1)?"":"not ", (d[0]&0x40)?"":"no ",
21: (d[0]&0x80)?"off":"on");
22: Fprint(1, "disk in %s %d%c (%d)",( d[1]&0x80)? "drive":"shelf", d[1]&0x7f, (d[1]&1)+'a', d[1]&0x7f);
23: if(d[2]&0x80)
24: Fprint(1, ", return shelf %d", d[2]&0x7F);
25: Fprint(1, "\n");
26: }
27: for(i = 0; i < 50; i++, d++)
28: if(*d){
29: Fprint(1, "%d", i);
30: shelf(*d);
31: }
32: Fprint(1, "I/O shelf");
33: shelf(*d);
34: d++;
35: Fprint(1, "carrier: ");
36: i = *d&0x7F;
37: if(*d&0x80)
38: Fprint(1, "disk shelf=%d%c (%d)\n", i/2, 'a'+(i&1), i);
39: else
40: Fprint(1, "no disk\n");
41: d++;
42: if(*d&0x80)
43: Fprint(1, "upper drive: disk, LUN=%d\n", *d&7);
44: else
45: Fprint(1, "upper drive: no disk\n");
46: d++;
47: if(*d&0x80)
48: Fprint(1, "lower drive: disk, LUN=%d\n", *d&7);
49: else
50: Fprint(1, "lower drive: no disk\n");
51: }
52: return(0);
53: }
54:
55: s_istatus(drive, o)
56: struct scsi_o *o;
57: {
58: struct scsi_i input;
59:
60: input.bus_id = scsi_id;
61: input.cmd[0] = 0x1D;
62: input.cmd[1] = drive<<5;
63: input.cmd[2] = 0;
64: input.cmd[3] = 0;
65: input.cmd[4] = 10;
66: input.cmd[5] = 0;
67: input.data[0] = 0xE2; /* internal status */
68: input.data[1] = 0;
69: input.data[2] = 0;
70: input.data[3] = 0;
71: input.data[4] = 0;
72: input.data[5] = 0;
73: input.data[6] = 0;
74: input.data[7] = 0;
75: input.data[8] = 0;
76: input.data[9] = 0;
77: if(scsiio(&input, 10, o, 0, "status") < 0)
78: return(1);
79: if(s_diag(drive, 128, o))
80: return(1);
81: if(CHECK(*o)){
82: prcheck(1, o);
83: return(1);
84: }
85: return(0);
86: }
87:
88: static
89: shelf(i)
90: {
91: Fprint(1, ": ", i&0xFF);
92: if(i&0x80){
93: Fprint(1, "%s,", (i&0x40)? "disk":"temporary");
94: if(i&0x10) Fprint(1, "wait loading,");
95: if(i&0x08) Fprint(1, "wait ejection,");
96: if(i&0x20) Fprint(1, "use shelf instead of drive for LUN %d", i&7);
97: } else
98: Fprint(1, "no disk");
99: Fprint(1, "\n");
100: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.