|
|
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",( d[1]&0x80)? "drive":"shelf", 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: if(*d&0x80)
37: Fprint(1, "disk shelf=%d\n", *d&0x7F);
38: else
39: Fprint(1, "no disk\n");
40: d++;
41: if(*d&0x80)
42: Fprint(1, "upper drive: disk, LUN=%d\n", *d&7);
43: else
44: Fprint(1, "upper drive: no disk\n");
45: d++;
46: if(*d&0x80)
47: Fprint(1, "lower drive: disk, LUN=%d\n", *d&7);
48: else
49: Fprint(1, "lower drive: no disk\n");
50: }
51: return(0);
52: }
53:
54: s_istatus(drive, o)
55: struct scsi_o *o;
56: {
57: struct scsi_i input;
58:
59: input.bus_id = 1<<scsi_id;
60: input.cmd[0] = 0x1D;
61: input.cmd[1] = drive<<5;
62: input.cmd[2] = 0;
63: input.cmd[3] = 0;
64: input.cmd[4] = 10;
65: input.cmd[5] = 0;
66: input.data[0] = 0xE2; /* internal status */
67: input.data[1] = 0;
68: input.data[2] = 0;
69: input.data[3] = 0;
70: input.data[4] = 0;
71: input.data[5] = 0;
72: input.data[6] = 0;
73: input.data[7] = 0;
74: input.data[8] = 0;
75: input.data[9] = 0;
76: if(scsiio(&input, o, 10, "status") < 0)
77: return(1);
78: s_diag(drive, 128, o);
79: if(CHECK(*o)){
80: scsidump(o);
81: return(1);
82: }
83: return(0);
84: }
85:
86: static
87: shelf(i)
88: {
89: Fprint(1, ": ", i&0xFF);
90: if(i&0x80){
91: Fprint(1, "%s,", (i&0x40)? "disk":"temporary");
92: if(i&0x10) Fprint(1, "wait loading,");
93: if(i&0x08) Fprint(1, "wait ejection,");
94: if(i&0x20) Fprint(1, "use shelf instead of drive for LUN %d", i&7);
95: } else
96: Fprint(1, "no disk");
97: Fprint(1, "\n");
98: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.