This source file includes following definitions.
- eata_pio_set_info
- eata_pio_proc_info
1
2 #define MAX_SCSI_DEVICE_CODE 10
3 const char *const pio_scsi_dev_types[MAX_SCSI_DEVICE_CODE] =
4 {
5 "Direct-Access ",
6 "Sequential-Access",
7 "Printer ",
8 "Processor ",
9 "WORM ",
10 "CD-ROM ",
11 "Scanner ",
12 "Optical Device ",
13 "Medium Changer ",
14 "Communications "
15 };
16
17
18
19
20
21
22
23 int eata_pio_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr)
24 {
25 DBG(DBG_PROC_WRITE, printk("%s\n", buffer));
26 return(-ENOSYS);
27 }
28
29
30
31
32
33
34
35
36
37 int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout)
38 {
39
40 Scsi_Device *scd;
41 struct Scsi_Host *HBA_ptr;
42 static u8 buff[512];
43 int i, x;
44 int size, len = 0;
45 off_t begin = 0;
46 off_t pos = 0;
47
48 HBA_ptr = first_HBA;
49 for (i = 1; i <= registered_HBAs; i++) {
50 if (HBA_ptr->host_no == hostno)
51 break;
52 HBA_ptr = SD(HBA_ptr)->next;
53 }
54
55 if(inout == TRUE)
56 return(eata_pio_set_info(buffer, length, HBA_ptr));
57
58 if (offset == 0)
59 memset(buff, 0, sizeof(buff));
60
61 size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
62 "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
63 len += size; pos = begin + len;
64 size = sprintf(buffer + len, "queued commands: %10ld\n"
65 "processed interrupts:%10ld\n", queue_counter, int_counter);
66 len += size; pos = begin + len;
67
68 size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
69 HBA_ptr->host_no, SD(HBA_ptr)->name);
70 len += size;
71 pos = begin + len;
72 size = sprintf(buffer + len, "Firmware revision: v%s\n",
73 SD(HBA_ptr)->revision);
74 len += size;
75 pos = begin + len;
76 size = sprintf(buffer + len, "IO: PIO\n");
77 len += size;
78 pos = begin + len;
79 size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
80 len += size;
81 pos = begin + len;
82 size = sprintf(buffer + len, "Host Bus: %s\n",
83 (SD(HBA_ptr)->bustype == 'P')?"PCI ":
84 (SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ");
85
86 len += size;
87 pos = begin + len;
88
89 if (pos < offset) {
90 len = 0;
91 begin = pos;
92 }
93 if (pos > offset + length)
94 goto stop_output;
95
96 scd = scsi_devices;
97
98 size = sprintf(buffer+len,"Attached devices: %s\n", (scd)?"":"none");
99 len += size;
100 pos = begin + len;
101
102 while (scd) {
103 if (scd->host == HBA_ptr) {
104
105 size = sprintf(buffer + len, "Channel: %02d Id: %02d Lun: %02d\n Vendor: ",
106 scd->channel, scd->id, scd->lun);
107 for (x = 0; x < 8; x++) {
108 if (scd->vendor[x] >= 0x20)
109 size += sprintf(buffer + len + size, "%c", scd->vendor[x]);
110 else
111 size += sprintf(buffer + len + size," ");
112 }
113 size += sprintf(buffer + len + size, " Model: ");
114 for (x = 0; x < 16; x++) {
115 if (scd->model[x] >= 0x20)
116 size += sprintf(buffer + len + size, "%c", scd->model[x]);
117 else
118 size += sprintf(buffer + len + size, " ");
119 }
120 size += sprintf(buffer + len + size, " Rev: ");
121 for (x = 0; x < 4; x++) {
122 if (scd->rev[x] >= 0x20)
123 size += sprintf(buffer + len + size, "%c", scd->rev[x]);
124 else
125 size += sprintf(buffer + len + size, " ");
126 }
127 size += sprintf(buffer + len + size, "\n");
128
129 size += sprintf(buffer + len + size, " Type: %s ",
130 scd->type < MAX_SCSI_DEVICE_CODE ?
131 pio_scsi_dev_types[(int)scd->type] : "Unknown " );
132 size += sprintf(buffer + len + size, " ANSI"
133 " SCSI revision: %02x", (scd->scsi_level < 3)?1:2);
134 if (scd->scsi_level == 2)
135 size += sprintf(buffer + len + size, " CCS\n");
136 else
137 size += sprintf(buffer + len + size, "\n");
138 len += size;
139 pos = begin + len;
140
141 if (pos < offset) {
142 len = 0;
143 begin = pos;
144 }
145 if (pos > offset + length)
146 goto stop_output;
147 }
148 scd = scd->next;
149 }
150
151 stop_output:
152 DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
153 *start=buffer+(offset-begin);
154 len-=(offset-begin);
155 if(len>length)
156 len = length;
157 DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
158
159 return (len);
160 }
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179