1 void swap_statistics(u8
*p
)
9 sp
= ((short *)lp
) + 1; /* Convert Header */
10 h_sp
= *sp
= ntohs(*sp
);
14 sp
= (u16
*)lp
; /* Convert SubHeader */
19 for (h_lp
= (u32
)lp
; (u32
)lp
< h_lp
+ ((u32
)*(bp
+ 3)); lp
++)
21 }while ((u32
)lp
< ((u32
)p
) + 4 + h_sp
);
27 * buffer : pointer to the data that has been written to the hostfile
28 * length : number of bytes written to the hostfile
29 * HBA_ptr: pointer to the Scsi_Host struct
31 int eata_set_info(char *buffer
, int length
, struct Scsi_Host
*HBA_ptr
)
33 int orig_length
= length
;
35 if (length
>= 8 && strncmp(buffer
, "eata_dma", 8) == 0) {
38 if(length
>= 8 && strncmp(buffer
, "latency", 7) == 0) {
39 SD(HBA_ptr
)->do_latency
= TRUE
;
43 if(length
>=10 && strncmp(buffer
, "nolatency", 9) == 0) {
44 SD(HBA_ptr
)->do_latency
= FALSE
;
48 printk("Unknown command:%s length: %d\n", buffer
, length
);
50 printk("Wrong Signature:%10s\n", buffer
);
57 * inout : decides on the direction of the dataflow and the meaning of the
59 * buffer: If inout==FALSE data is being written to it else read from it
60 * *start: If inout==FALSE start of the valid data in the buffer
61 * offset: If inout==FALSE offset from the beginning of the imaginary file
62 * from which we start writing into the buffer
63 * length: If inout==FALSE max number of bytes to be written into the buffer
64 * else number of bytes in the buffer
66 int eata_proc_info(char *buffer
, char **start
, off_t offset
, int length
,
67 int hostno
, int inout
)
70 Scsi_Device
*scd
, *SDev
;
71 struct Scsi_Host
*HBA_ptr
;
73 char cmnd
[MAX_COMMAND_SIZE
];
76 hst_cmd_stat
*rhcs
, *whcs
;
95 for (i
= 1; i
<= registered_HBAs
; i
++) {
96 if (HBA_ptr
->host_no
== hostno
)
98 HBA_ptr
= SD(HBA_ptr
)->next
;
101 if(inout
== TRUE
) /* Has data been written to the file ? */
102 return(eata_set_info(buffer
, length
, HBA_ptr
));
105 memset(buff
, 0, sizeof(buff
));
107 cc
= (coco
*) (buff
+ 0x148);
108 st
= (scsitrans
*)(buff
+ 0x164);
109 sm
= (scsimod
*) (buff
+ 0x16c);
110 hb
= (hobu
*) (buff
+ 0x172);
111 sb
= (scbu
*) (buff
+ 0x178);
112 bt
= (boty
*) (buff
+ 0x17e);
113 mc
= (memco
*) (buff
+ 0x186);
114 fm
= (firm
*) (buff
+ 0x18e);
115 si
= (subinf
*) (buff
+ 0x196);
116 pi
= (pcinf
*) (buff
+ 0x19c);
117 al
= (arrlim
*) (buff
+ 0x1a2);
119 size
= sprintf(buffer
+len
, "EATA (Extended Attachment) driver version: "
120 "%d.%d%s\n",VER_MAJOR
, VER_MINOR
, VER_SUB
);
121 len
+= size
; pos
= begin
+ len
;
122 size
= sprintf(buffer
+ len
, "queued commands: %10ld\n"
123 "processed interrupts:%10ld\n", queue_counter
, int_counter
);
124 len
+= size
; pos
= begin
+ len
;
126 size
= sprintf(buffer
+ len
, "\nscsi%-2d: HBA %.10s\n",
127 HBA_ptr
->host_no
, SD(HBA_ptr
)->name
);
130 size
= sprintf(buffer
+ len
, "Firmware revision: v%s\n",
131 SD(HBA_ptr
)->revision
);
134 size
= sprintf(buffer
+ len
, "Hardware Configuration:\n");
138 if(SD(HBA_ptr
)->broken_INQUIRY
== TRUE
) {
139 if (HBA_ptr
->dma_channel
== BUSMASTER
)
140 size
= sprintf(buffer
+ len
, "DMA: BUSMASTER\n");
142 size
= sprintf(buffer
+ len
, "DMA: %d\n", HBA_ptr
->dma_channel
);
146 size
= sprintf(buffer
+ len
, "Base IO : %#.4x\n", (u32
) HBA_ptr
->base
);
150 size
= sprintf(buffer
+ len
, "Host Bus: EISA\n");
155 SDev
= scsi_get_host_dev(HBA_ptr
);
160 scmd
= scsi_allocate_request(SDev
);
164 scsi_free_host_dev(SDev
);
171 cmnd
[2] = 0x33 + (3<<6);
180 scmd
->sr_cmd_len
= 10;
181 scmd
->sr_data_direction
= SCSI_DATA_READ
;
184 * Do the command and wait for it to finish.
186 scsi_wait_req (scmd
, cmnd
, buff
+ 0x144, 0x66,
189 size
= sprintf(buffer
+ len
, "IRQ: %2d, %s triggered\n", cc
->interrupt
,
190 (cc
->intt
== TRUE
)?"level":"edge");
193 if (HBA_ptr
->dma_channel
== 0xff)
194 size
= sprintf(buffer
+ len
, "DMA: BUSMASTER\n");
196 size
= sprintf(buffer
+ len
, "DMA: %d\n", HBA_ptr
->dma_channel
);
199 size
= sprintf(buffer
+ len
, "CPU: MC680%02d %dMHz\n", bt
->cpu_type
,
203 size
= sprintf(buffer
+ len
, "Base IO : %#.4x\n", (u32
) HBA_ptr
->base
);
206 size
= sprintf(buffer
+ len
, "Host Bus: %s\n",
207 (SD(HBA_ptr
)->bustype
== IS_PCI
)?"PCI ":
208 (SD(HBA_ptr
)->bustype
== IS_EISA
)?"EISA":"ISA ");
212 size
= sprintf(buffer
+ len
, "SCSI Bus:%s%s Speed: %sMB/sec. %s\n",
213 (sb
->wide
== TRUE
)?" WIDE":"",
214 (sb
->dif
== TRUE
)?" DIFFERENTIAL":"",
215 (sb
->speed
== 0)?"5":(sb
->speed
== 1)?"10":"20",
216 (sb
->ext
== TRUE
)?"With external cable detection":"");
219 size
= sprintf(buffer
+ len
, "SCSI channel expansion Module: %s present\n",
220 (bt
->sx1
== TRUE
)?"SX1 (one channel)":
221 ((bt
->sx2
== TRUE
)?"SX2 (two channels)":"not"));
224 size
= sprintf(buffer
+ len
, "SmartRAID hardware: %spresent.\n",
225 (cc
->srs
== TRUE
)?"":"not ");
228 size
= sprintf(buffer
+ len
, " Type: %s\n",
229 ((cc
->key
== TRUE
)?((bt
->dmi
== TRUE
)?"integrated"
230 :((bt
->dm4
== TRUE
)?"DM401X"
231 :(bt
->dm4k
== TRUE
)?"DM4000"
237 size
= sprintf(buffer
+ len
, " Max array groups: %d\n",
238 (al
->code
== 0x0e)?al
->max_groups
:7);
241 size
= sprintf(buffer
+ len
, " Max drives per RAID 0 array: %d\n",
242 (al
->code
== 0x0e)?al
->raid0_drv
:7);
245 size
= sprintf(buffer
+ len
, " Max drives per RAID 3/5 array: %d\n",
246 (al
->code
== 0x0e)?al
->raid35_drv
:7);
249 size
= sprintf(buffer
+ len
, "Cache Module: %spresent.\n",
250 (cc
->csh
)?"":"not ");
253 size
= sprintf(buffer
+ len
, " Type: %s\n",
254 ((cc
->csh
== TRUE
)?((bt
->cmi
== TRUE
)?"integrated"
255 :((bt
->cm4
== TRUE
)?"CM401X"
256 :((bt
->cm4k
== TRUE
)?"CM4000"
261 for (x
= 0; x
<= 3; x
++) {
262 size
= sprintf(buffer
+ len
, " Bank%d: %dMB with%s ECC\n",x
,
263 mc
->banksize
[x
] & 0x7f,
264 (mc
->banksize
[x
] & 0x80)?"":"out");
268 size
= sprintf(buffer
+ len
, "Timer Mod.: %spresent\n",
269 (cc
->tmr
== TRUE
)?"":"not ");
272 size
= sprintf(buffer
+ len
, "NVRAM : %spresent\n",
273 (cc
->nvr
== TRUE
)?"":"not ");
276 size
= sprintf(buffer
+ len
, "SmartROM : %sabled\n",
277 (bt
->srom
== TRUE
)?"dis":"en");
280 size
= sprintf(buffer
+ len
, "Alarm : %s\n",
281 (bt
->alrm
== TRUE
)?"on":"off");
289 if (pos
> offset
+ length
)
292 if(SD(HBA_ptr
)->do_latency
== FALSE
) {
296 cmnd
[2] = 0x32 + (3<<6);
305 scmd
->sr_cmd_len
= 10;
306 scmd
->sr_data_direction
= SCSI_DATA_READ
;
309 * Do the command and wait for it to finish.
311 scsi_wait_req (scmd
, cmnd
, buff2
, 0x144,
314 swap_statistics(buff2
);
315 rhcs
= (hst_cmd_stat
*)(buff2
+ 0x2c);
316 whcs
= (hst_cmd_stat
*)(buff2
+ 0x8c);
318 for (x
= 0; x
<= 11; x
++) {
319 SD(HBA_ptr
)->reads
[x
] += rhcs
->sizes
[x
];
320 SD(HBA_ptr
)->writes
[x
] += whcs
->sizes
[x
];
321 SD(HBA_ptr
)->reads
[12] += rhcs
->sizes
[x
];
322 SD(HBA_ptr
)->writes
[12] += whcs
->sizes
[x
];
324 size
= sprintf(buffer
+ len
, "Host<->Disk command statistics:\n"
325 " Reads: Writes:\n");
328 for (x
= 0; x
<= 10; x
++) {
329 size
= sprintf(buffer
+len
,"%5dk:%12u %12u\n", 1 << x
,
330 SD(HBA_ptr
)->reads
[x
],
331 SD(HBA_ptr
)->writes
[x
]);
335 size
= sprintf(buffer
+len
,">1024k:%12u %12u\n",
336 SD(HBA_ptr
)->reads
[11],
337 SD(HBA_ptr
)->writes
[11]);
340 size
= sprintf(buffer
+len
,"Sum :%12u %12u\n",
341 SD(HBA_ptr
)->reads
[12],
342 SD(HBA_ptr
)->writes
[12]);
347 scsi_release_request(scmd
);
348 scsi_free_host_dev(SDev
);
355 if (pos
> offset
+ length
)
358 if(SD(HBA_ptr
)->do_latency
== TRUE
) {
359 int factor
= 1024/HZ
;
360 size
= sprintf(buffer
+ len
, "Host Latency Command Statistics:\n"
361 "Current timer resolution: %2dms\n"
362 " Reads: Min:(ms) Max:(ms) Ave:(ms)\n",
366 for (x
= 0; x
<= 10; x
++) {
367 size
= sprintf(buffer
+len
,"%5dk:%12u %12u %12u %12u\n",
369 SD(HBA_ptr
)->reads_lat
[x
][0],
370 (SD(HBA_ptr
)->reads_lat
[x
][1] == 0xffffffff)
371 ? 0:(SD(HBA_ptr
)->reads_lat
[x
][1] * factor
),
372 SD(HBA_ptr
)->reads_lat
[x
][2] * factor
,
373 SD(HBA_ptr
)->reads_lat
[x
][3] * factor
/
374 ((SD(HBA_ptr
)->reads_lat
[x
][0])
375 ? SD(HBA_ptr
)->reads_lat
[x
][0]:1));
379 size
= sprintf(buffer
+len
,">1024k:%12u %12u %12u %12u\n",
380 SD(HBA_ptr
)->reads_lat
[11][0],
381 (SD(HBA_ptr
)->reads_lat
[11][1] == 0xffffffff)
382 ? 0:(SD(HBA_ptr
)->reads_lat
[11][1] * factor
),
383 SD(HBA_ptr
)->reads_lat
[11][2] * factor
,
384 SD(HBA_ptr
)->reads_lat
[11][3] * factor
/
385 ((SD(HBA_ptr
)->reads_lat
[x
][0])
386 ? SD(HBA_ptr
)->reads_lat
[x
][0]:1));
394 if (pos
> offset
+ length
)
397 size
= sprintf(buffer
+ len
,
398 " Writes: Min:(ms) Max:(ms) Ave:(ms)\n");
401 for (x
= 0; x
<= 10; x
++) {
402 size
= sprintf(buffer
+len
,"%5dk:%12u %12u %12u %12u\n",
404 SD(HBA_ptr
)->writes_lat
[x
][0],
405 (SD(HBA_ptr
)->writes_lat
[x
][1] == 0xffffffff)
406 ? 0:(SD(HBA_ptr
)->writes_lat
[x
][1] * factor
),
407 SD(HBA_ptr
)->writes_lat
[x
][2] * factor
,
408 SD(HBA_ptr
)->writes_lat
[x
][3] * factor
/
409 ((SD(HBA_ptr
)->writes_lat
[x
][0])
410 ? SD(HBA_ptr
)->writes_lat
[x
][0]:1));
414 size
= sprintf(buffer
+len
,">1024k:%12u %12u %12u %12u\n",
415 SD(HBA_ptr
)->writes_lat
[11][0],
416 (SD(HBA_ptr
)->writes_lat
[11][1] == 0xffffffff)
417 ? 0:(SD(HBA_ptr
)->writes_lat
[x
][1] * factor
),
418 SD(HBA_ptr
)->writes_lat
[11][2] * factor
,
419 SD(HBA_ptr
)->writes_lat
[11][3] * factor
/
420 ((SD(HBA_ptr
)->writes_lat
[x
][0])
421 ? SD(HBA_ptr
)->writes_lat
[x
][0]:1));
429 if (pos
> offset
+ length
)
433 size
= sprintf(buffer
+len
,"Attached devices: %s\n",
434 (HBA_ptr
->host_queue
)?"":"none");
438 for(scd
= HBA_ptr
->host_queue
; scd
; scd
= scd
->next
) {
439 proc_print_scsidevice(scd
, buffer
, &size
, len
);
447 if (pos
> offset
+ length
)
452 DBG(DBG_PROC
, printk("2pos: %ld offset: %ld len: %d\n", pos
, offset
, len
));
453 *start
=buffer
+(offset
-begin
); /* Start of wanted data */
454 len
-=(offset
-begin
); /* Start slop */
456 len
= length
; /* Ending slop */
457 DBG(DBG_PROC
, printk("3pos: %ld offset: %ld len: %d\n", pos
, offset
, len
));
463 * Overrides for Emacs so that we follow Linus's tabbing style.
464 * Emacs will notice this stuff at the end of the file and automatically
465 * adjust the settings for this buffer only. This must remain at the end
467 * ---------------------------------------------------------------------------
470 * c-brace-imaginary-offset: 0
472 * c-argdecl-indent: 4
474 * c-continued-statement-offset: 4
475 * c-continued-brace-offset: 0