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
;
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 memset(&SDev
, 0, sizeof(Scsi_Device
));
156 memset(&scmd
, 0, sizeof(Scsi_Cmnd
));
159 SDev
.id
= HBA_ptr
->this_id
;
165 cmnd
[2] = 0x33 + (3<<6);
178 scmd
.target
= HBA_ptr
->this_id
;
184 * Do the command and wait for it to finish.
187 DECLARE_MUTEX_LOCKED(sem
);
188 scmd
.request
.rq_status
= RQ_SCSI_BUSY
;
189 scmd
.request
.sem
= &sem
;
190 scsi_do_cmd (&scmd
, cmnd
, buff
+ 0x144, 0x66,
191 eata_scsi_done
, 1 * HZ
, 1);
195 size
= sprintf(buffer
+ len
, "IRQ: %2d, %s triggered\n", cc
->interrupt
,
196 (cc
->intt
== TRUE
)?"level":"edge");
199 if (HBA_ptr
->dma_channel
== 0xff)
200 size
= sprintf(buffer
+ len
, "DMA: BUSMASTER\n");
202 size
= sprintf(buffer
+ len
, "DMA: %d\n", HBA_ptr
->dma_channel
);
205 size
= sprintf(buffer
+ len
, "CPU: MC680%02d %dMHz\n", bt
->cpu_type
,
209 size
= sprintf(buffer
+ len
, "Base IO : %#.4x\n", (u32
) HBA_ptr
->base
);
212 size
= sprintf(buffer
+ len
, "Host Bus: %s\n",
213 (SD(HBA_ptr
)->bustype
== IS_PCI
)?"PCI ":
214 (SD(HBA_ptr
)->bustype
== IS_EISA
)?"EISA":"ISA ");
218 size
= sprintf(buffer
+ len
, "SCSI Bus:%s%s Speed: %sMB/sec. %s\n",
219 (sb
->wide
== TRUE
)?" WIDE":"",
220 (sb
->dif
== TRUE
)?" DIFFERENTIAL":"",
221 (sb
->speed
== 0)?"5":(sb
->speed
== 1)?"10":"20",
222 (sb
->ext
== TRUE
)?"With external cable detection":"");
225 size
= sprintf(buffer
+ len
, "SCSI channel expansion Module: %s present\n",
226 (bt
->sx1
== TRUE
)?"SX1 (one channel)":
227 ((bt
->sx2
== TRUE
)?"SX2 (two channels)":"not"));
230 size
= sprintf(buffer
+ len
, "SmartRAID hardware: %spresent.\n",
231 (cc
->srs
== TRUE
)?"":"not ");
234 size
= sprintf(buffer
+ len
, " Type: %s\n",
235 ((cc
->key
== TRUE
)?((bt
->dmi
== TRUE
)?"integrated"
236 :((bt
->dm4
== TRUE
)?"DM401X"
237 :(bt
->dm4k
== TRUE
)?"DM4000"
243 size
= sprintf(buffer
+ len
, " Max array groups: %d\n",
244 (al
->code
== 0x0e)?al
->max_groups
:7);
247 size
= sprintf(buffer
+ len
, " Max drives per RAID 0 array: %d\n",
248 (al
->code
== 0x0e)?al
->raid0_drv
:7);
251 size
= sprintf(buffer
+ len
, " Max drives per RAID 3/5 array: %d\n",
252 (al
->code
== 0x0e)?al
->raid35_drv
:7);
255 size
= sprintf(buffer
+ len
, "Cache Module: %spresent.\n",
256 (cc
->csh
)?"":"not ");
259 size
= sprintf(buffer
+ len
, " Type: %s\n",
260 ((cc
->csh
== TRUE
)?((bt
->cmi
== TRUE
)?"integrated"
261 :((bt
->cm4
== TRUE
)?"CM401X"
262 :((bt
->cm4k
== TRUE
)?"CM4000"
267 for (x
= 0; x
<= 3; x
++) {
268 size
= sprintf(buffer
+ len
, " Bank%d: %dMB with%s ECC\n",x
,
269 mc
->banksize
[x
] & 0x7f,
270 (mc
->banksize
[x
] & 0x80)?"":"out");
274 size
= sprintf(buffer
+ len
, "Timer Mod.: %spresent\n",
275 (cc
->tmr
== TRUE
)?"":"not ");
278 size
= sprintf(buffer
+ len
, "NVRAM : %spresent\n",
279 (cc
->nvr
== TRUE
)?"":"not ");
282 size
= sprintf(buffer
+ len
, "SmartROM : %sabled\n",
283 (bt
->srom
== TRUE
)?"dis":"en");
286 size
= sprintf(buffer
+ len
, "Alarm : %s\n",
287 (bt
->alrm
== TRUE
)?"on":"off");
295 if (pos
> offset
+ length
)
298 if(SD(HBA_ptr
)->do_latency
== FALSE
) {
302 cmnd
[2] = 0x32 + (3<<6);
314 * Do the command and wait for it to finish.
317 DECLARE_MUTEX_LOCKED(sem
);
318 scmd
.request
.rq_status
= RQ_SCSI_BUSY
;
319 scmd
.request
.sem
= &sem
;
320 scsi_do_cmd (&scmd
, cmnd
, buff2
, 0x144,
321 eata_scsi_done
, 1 * HZ
, 1);
325 swap_statistics(buff2
);
326 rhcs
= (hst_cmd_stat
*)(buff2
+ 0x2c);
327 whcs
= (hst_cmd_stat
*)(buff2
+ 0x8c);
329 for (x
= 0; x
<= 11; x
++) {
330 SD(HBA_ptr
)->reads
[x
] += rhcs
->sizes
[x
];
331 SD(HBA_ptr
)->writes
[x
] += whcs
->sizes
[x
];
332 SD(HBA_ptr
)->reads
[12] += rhcs
->sizes
[x
];
333 SD(HBA_ptr
)->writes
[12] += whcs
->sizes
[x
];
335 size
= sprintf(buffer
+ len
, "Host<->Disk command statistics:\n"
336 " Reads: Writes:\n");
339 for (x
= 0; x
<= 10; x
++) {
340 size
= sprintf(buffer
+len
,"%5dk:%12u %12u\n", 1 << x
,
341 SD(HBA_ptr
)->reads
[x
],
342 SD(HBA_ptr
)->writes
[x
]);
346 size
= sprintf(buffer
+len
,">1024k:%12u %12u\n",
347 SD(HBA_ptr
)->reads
[11],
348 SD(HBA_ptr
)->writes
[11]);
351 size
= sprintf(buffer
+len
,"Sum :%12u %12u\n",
352 SD(HBA_ptr
)->reads
[12],
353 SD(HBA_ptr
)->writes
[12]);
363 if (pos
> offset
+ length
)
366 if(SD(HBA_ptr
)->do_latency
== TRUE
) {
367 int factor
= 1024/HZ
;
368 size
= sprintf(buffer
+ len
, "Host Latency Command Statistics:\n"
369 "Current timer resolution: %2dms\n"
370 " Reads: Min:(ms) Max:(ms) Ave:(ms)\n",
374 for (x
= 0; x
<= 10; x
++) {
375 size
= sprintf(buffer
+len
,"%5dk:%12u %12u %12u %12u\n",
377 SD(HBA_ptr
)->reads_lat
[x
][0],
378 (SD(HBA_ptr
)->reads_lat
[x
][1] == 0xffffffff)
379 ? 0:(SD(HBA_ptr
)->reads_lat
[x
][1] * factor
),
380 SD(HBA_ptr
)->reads_lat
[x
][2] * factor
,
381 SD(HBA_ptr
)->reads_lat
[x
][3] * factor
/
382 ((SD(HBA_ptr
)->reads_lat
[x
][0])
383 ? SD(HBA_ptr
)->reads_lat
[x
][0]:1));
387 size
= sprintf(buffer
+len
,">1024k:%12u %12u %12u %12u\n",
388 SD(HBA_ptr
)->reads_lat
[11][0],
389 (SD(HBA_ptr
)->reads_lat
[11][1] == 0xffffffff)
390 ? 0:(SD(HBA_ptr
)->reads_lat
[11][1] * factor
),
391 SD(HBA_ptr
)->reads_lat
[11][2] * factor
,
392 SD(HBA_ptr
)->reads_lat
[11][3] * factor
/
393 ((SD(HBA_ptr
)->reads_lat
[x
][0])
394 ? SD(HBA_ptr
)->reads_lat
[x
][0]:1));
402 if (pos
> offset
+ length
)
405 size
= sprintf(buffer
+ len
,
406 " Writes: Min:(ms) Max:(ms) Ave:(ms)\n");
409 for (x
= 0; x
<= 10; x
++) {
410 size
= sprintf(buffer
+len
,"%5dk:%12u %12u %12u %12u\n",
412 SD(HBA_ptr
)->writes_lat
[x
][0],
413 (SD(HBA_ptr
)->writes_lat
[x
][1] == 0xffffffff)
414 ? 0:(SD(HBA_ptr
)->writes_lat
[x
][1] * factor
),
415 SD(HBA_ptr
)->writes_lat
[x
][2] * factor
,
416 SD(HBA_ptr
)->writes_lat
[x
][3] * factor
/
417 ((SD(HBA_ptr
)->writes_lat
[x
][0])
418 ? SD(HBA_ptr
)->writes_lat
[x
][0]:1));
422 size
= sprintf(buffer
+len
,">1024k:%12u %12u %12u %12u\n",
423 SD(HBA_ptr
)->writes_lat
[11][0],
424 (SD(HBA_ptr
)->writes_lat
[11][1] == 0xffffffff)
425 ? 0:(SD(HBA_ptr
)->writes_lat
[x
][1] * factor
),
426 SD(HBA_ptr
)->writes_lat
[11][2] * factor
,
427 SD(HBA_ptr
)->writes_lat
[11][3] * factor
/
428 ((SD(HBA_ptr
)->writes_lat
[x
][0])
429 ? SD(HBA_ptr
)->writes_lat
[x
][0]:1));
437 if (pos
> offset
+ length
)
441 size
= sprintf(buffer
+len
,"Attached devices: %s\n",
442 (HBA_ptr
->host_queue
)?"":"none");
446 for(scd
= HBA_ptr
->host_queue
; scd
; scd
= scd
->next
) {
447 proc_print_scsidevice(scd
, buffer
, &size
, len
);
455 if (pos
> offset
+ length
)
460 DBG(DBG_PROC
, printk("2pos: %ld offset: %ld len: %d\n", pos
, offset
, len
));
461 *start
=buffer
+(offset
-begin
); /* Start of wanted data */
462 len
-=(offset
-begin
); /* Start slop */
464 len
= length
; /* Ending slop */
465 DBG(DBG_PROC
, printk("3pos: %ld offset: %ld len: %d\n", pos
, offset
, len
));
471 * Overrides for Emacs so that we follow Linus's tabbing style.
472 * Emacs will notice this stuff at the end of the file and automatically
473 * adjust the settings for this buffer only. This must remain at the end
475 * ---------------------------------------------------------------------------
478 * c-brace-imaginary-offset: 0
480 * c-argdecl-indent: 4
482 * c-continued-statement-offset: 4
483 * c-continued-brace-offset: 0