Import 2.2.0pre6
[davej-history.git] / drivers / scsi / eata_pio_proc.c
bloba6c59d7c69feebd3a10e4195055d4dde7598df1c
1 /*
2 * eata_set_info
3 * buffer : pointer to the data that has been written to the hostfile
4 * length : number of bytes written to the hostfile
5 * HBA_ptr: pointer to the Scsi_Host struct
6 */
7 int eata_pio_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr)
9 DBG(DBG_PROC_WRITE, printk("%s\n", buffer));
10 return(-ENOSYS); /* Currently this is a no-op */
14 * eata_proc_info
15 * inout : decides on the direction of the dataflow and the meaning of the
16 * variables
17 * buffer: If inout==FALSE data is being written to it else read from it
18 * *start: If inout==FALSE start of the valid data in the buffer
19 * offset: If inout==FALSE offset from the beginning of the imaginary file
20 * from which we start writing into the buffer
21 * length: If inout==FALSE max number of bytes to be written into the buffer
22 * else number of bytes in the buffer
24 int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length,
25 int hostno, int inout)
27 Scsi_Device *scd;
28 struct Scsi_Host *HBA_ptr;
29 static u8 buff[512];
30 int i;
31 int size, len = 0;
32 off_t begin = 0;
33 off_t pos = 0;
35 HBA_ptr = first_HBA;
36 for (i = 1; i <= registered_HBAs; i++) {
37 if (HBA_ptr->host_no == hostno)
38 break;
39 HBA_ptr = SD(HBA_ptr)->next;
42 if(inout == TRUE) /* Has data been written to the file ? */
43 return(eata_pio_set_info(buffer, length, HBA_ptr));
45 if (offset == 0)
46 memset(buff, 0, sizeof(buff));
48 size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
49 "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
50 len += size; pos = begin + len;
51 size = sprintf(buffer + len, "queued commands: %10ld\n"
52 "processed interrupts:%10ld\n", queue_counter, int_counter);
53 len += size; pos = begin + len;
55 size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
56 HBA_ptr->host_no, SD(HBA_ptr)->name);
57 len += size;
58 pos = begin + len;
59 size = sprintf(buffer + len, "Firmware revision: v%s\n",
60 SD(HBA_ptr)->revision);
61 len += size;
62 pos = begin + len;
63 size = sprintf(buffer + len, "IO: PIO\n");
64 len += size;
65 pos = begin + len;
66 size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
67 len += size;
68 pos = begin + len;
69 size = sprintf(buffer + len, "Host Bus: %s\n",
70 (SD(HBA_ptr)->bustype == 'P')?"PCI ":
71 (SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ");
73 len += size;
74 pos = begin + len;
76 if (pos < offset) {
77 len = 0;
78 begin = pos;
80 if (pos > offset + length)
81 goto stop_output;
83 size = sprintf(buffer+len,"Attached devices: %s\n",
84 (HBA_ptr->host_queue)?"":"none");
85 len += size;
86 pos = begin + len;
88 for(scd = HBA_ptr->host_queue; scd; scd = scd->next) {
89 proc_print_scsidevice(scd, buffer, &size, len);
90 len += size;
91 pos = begin + len;
93 if (pos < offset) {
94 len = 0;
95 begin = pos;
97 if (pos > offset + length)
98 goto stop_output;
101 stop_output:
102 DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
103 *start=buffer+(offset-begin); /* Start of wanted data */
104 len-=(offset-begin); /* Start slop */
105 if(len>length)
106 len = length; /* Ending slop */
107 DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
109 return (len);
113 * Overrides for Emacs so that we follow Linus's tabbing style.
114 * Emacs will notice this stuff at the end of the file and automatically
115 * adjust the settings for this buffer only. This must remain at the end
116 * of the file.
117 * ---------------------------------------------------------------------------
118 * Local variables:
119 * c-indent-level: 4
120 * c-brace-imaginary-offset: 0
121 * c-brace-offset: -4
122 * c-argdecl-indent: 4
123 * c-label-offset: -4
124 * c-continued-statement-offset: 4
125 * c-continued-brace-offset: 0
126 * tab-width: 8
127 * End: