hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl
[linux/fpc-iii.git] / drivers / scsi / aic7xxx_old / aic7xxx_proc.c
blob976f45ccf2cf46dc949ce99ebefe14668822a768
1 /*+M*************************************************************************
2 * Adaptec AIC7xxx device driver proc support for Linux.
4 * Copyright (c) 1995, 1996 Dean W. Gehnert
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 * ----------------------------------------------------------------
21 * o Modified from the EATA-DMA /proc support.
22 * o Additional support for device block statistics provided by
23 * Matthew Jacob.
24 * o Correction of overflow by Heinz Mauelshagen
25 * o Adittional corrections by Doug Ledford
27 * Dean W. Gehnert, deang@teleport.com, 05/01/96
29 * $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $
30 *-M*************************************************************************/
33 #define HDRB \
34 " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+"
37 /*+F*************************************************************************
38 * Function:
39 * aic7xxx_show_info
41 * Description:
42 * Return information to handle /proc support for the driver.
43 *-F*************************************************************************/
44 int
45 aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
47 struct aic7xxx_host *p;
48 struct aic_dev_data *aic_dev;
49 struct scsi_device *sdptr;
50 unsigned char i;
51 unsigned char tindex;
53 for(p=first_aic7xxx; p && p->host != HBAptr; p=p->next)
56 if (!p)
58 seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no);
59 return 0;
62 p = (struct aic7xxx_host *) HBAptr->hostdata;
64 seq_printf(m, "Adaptec AIC7xxx driver version: ");
65 seq_printf(m, "%s/", AIC7XXX_C_VERSION);
66 seq_printf(m, "%s", AIC7XXX_H_VERSION);
67 seq_printf(m, "\n");
68 seq_printf(m, "Adapter Configuration:\n");
69 seq_printf(m, " SCSI Adapter: %s\n",
70 board_names[p->board_name_index]);
71 if (p->flags & AHC_TWIN)
72 seq_printf(m, " Twin Channel Controller ");
73 else
75 char *channel = "";
76 char *ultra = "";
77 char *wide = "Narrow ";
78 if (p->flags & AHC_MULTI_CHANNEL)
80 channel = " Channel A";
81 if (p->flags & (AHC_CHNLB|AHC_CHNLC))
82 channel = (p->flags & AHC_CHNLB) ? " Channel B" : " Channel C";
84 if (p->features & AHC_WIDE)
85 wide = "Wide ";
86 if (p->features & AHC_ULTRA3)
88 switch(p->chip & AHC_CHIPID_MASK)
90 case AHC_AIC7892:
91 case AHC_AIC7899:
92 ultra = "Ultra-160/m LVD/SE ";
93 break;
94 default:
95 ultra = "Ultra-3 LVD/SE ";
96 break;
99 else if (p->features & AHC_ULTRA2)
100 ultra = "Ultra-2 LVD/SE ";
101 else if (p->features & AHC_ULTRA)
102 ultra = "Ultra ";
103 seq_printf(m, " %s%sController%s ",
104 ultra, wide, channel);
106 switch(p->chip & ~AHC_CHIPID_MASK)
108 case AHC_VL:
109 seq_printf(m, "at VLB slot %d\n", p->pci_device_fn);
110 break;
111 case AHC_EISA:
112 seq_printf(m, "at EISA slot %d\n", p->pci_device_fn);
113 break;
114 default:
115 seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus,
116 PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn));
117 break;
119 if( !(p->maddr) )
121 seq_printf(m, " Programmed I/O Base: %lx\n", p->base);
123 else
125 seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase);
127 if( (p->chip & (AHC_VL | AHC_EISA)) )
129 seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address);
131 seq_printf(m, " Adapter SEEPROM Config: %s\n",
132 (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." :
133 ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." :
134 "SEEPROM not found, using leftover BIOS values.") );
135 seq_printf(m, " Adaptec SCSI BIOS: %s\n",
136 (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled");
137 seq_printf(m, " IRQ: %d\n", HBAptr->irq);
138 seq_printf(m, " SCBs: Active %d, Max Active %d,\n",
139 p->activescbs, p->max_activescbs);
140 seq_printf(m, " Allocated %d, HW %d, "
141 "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs,
142 p->scb_data->maxscbs);
143 if (p->flags & AHC_EXTERNAL_SRAM)
144 seq_printf(m, " Using External SCB SRAM\n");
145 seq_printf(m, " Interrupts: %ld", p->isr_count);
146 if (p->chip & AHC_EISA)
148 seq_printf(m, " %s\n",
149 (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)");
151 else
153 seq_printf(m, "\n");
155 seq_printf(m, " BIOS Control Word: 0x%04x\n",
156 p->bios_control);
157 seq_printf(m, " Adapter Control Word: 0x%04x\n",
158 p->adapter_control);
159 seq_printf(m, " Extended Translation: %sabled\n",
160 (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis");
161 seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable);
162 if (p->features & (AHC_ULTRA | AHC_ULTRA2))
164 seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb);
166 seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth);
167 seq_printf(m, " Tagged Queue By Device array for aic7xxx host "
168 "instance %d:\n", p->instance);
169 seq_printf(m, " {");
170 for(i=0; i < (MAX_TARGETS - 1); i++)
171 seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]);
172 seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]);
174 seq_printf(m, "\n");
175 seq_printf(m, "Statistics:\n\n");
176 list_for_each_entry(aic_dev, &p->aic_devs, list)
178 sdptr = aic_dev->SDptr;
179 tindex = sdptr->channel << 3 | sdptr->id;
180 seq_printf(m, "(scsi%d:%d:%d:%d)\n",
181 p->host_no, sdptr->channel, sdptr->id, sdptr->lun);
182 seq_printf(m, " Device using %s/%s",
183 (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
184 "Wide" : "Narrow",
185 (aic_dev->cur.offset != 0) ?
186 "Sync transfers at " : "Async transfers.\n" );
187 if (aic_dev->cur.offset != 0)
189 struct aic7xxx_syncrate *sync_rate;
190 unsigned char options = aic_dev->cur.options;
191 int period = aic_dev->cur.period;
192 int rate = (aic_dev->cur.width ==
193 MSG_EXT_WDTR_BUS_16_BIT) ? 1 : 0;
195 sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options);
196 if (sync_rate != NULL)
198 seq_printf(m, "%s MByte/sec, offset %d\n",
199 sync_rate->rate[rate],
200 aic_dev->cur.offset );
202 else
204 seq_printf(m, "3.3 MByte/sec, offset %d\n",
205 aic_dev->cur.offset );
208 seq_printf(m, " Transinfo settings: ");
209 seq_printf(m, "current(%d/%d/%d/%d), ",
210 aic_dev->cur.period,
211 aic_dev->cur.offset,
212 aic_dev->cur.width,
213 aic_dev->cur.options);
214 seq_printf(m, "goal(%d/%d/%d/%d), ",
215 aic_dev->goal.period,
216 aic_dev->goal.offset,
217 aic_dev->goal.width,
218 aic_dev->goal.options);
219 seq_printf(m, "user(%d/%d/%d/%d)\n",
220 p->user[tindex].period,
221 p->user[tindex].offset,
222 p->user[tindex].width,
223 p->user[tindex].options);
224 if(sdptr->simple_tags)
226 seq_printf(m, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth);
228 if(aic_dev->barrier_total)
229 seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n",
230 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total,
231 aic_dev->barrier_total, aic_dev->ordered_total);
232 else
233 seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n",
234 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total);
235 seq_printf(m, "%s\n", HDRB);
236 seq_printf(m, " Reads:");
237 for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++)
239 seq_printf(m, " %10ld", aic_dev->r_bins[i]);
241 seq_printf(m, "\n");
242 seq_printf(m, " Writes:");
243 for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++)
245 seq_printf(m, " %10ld", aic_dev->w_bins[i]);
247 seq_printf(m, "\n");
248 seq_printf(m, "\n\n");
250 return 0;
254 * Overrides for Emacs so that we follow Linus's tabbing style.
255 * Emacs will notice this stuff at the end of the file and automatically
256 * adjust the settings for this buffer only. This must remain at the end
257 * of the file.
258 * ---------------------------------------------------------------------------
259 * Local variables:
260 * c-indent-level: 2
261 * c-brace-imaginary-offset: 0
262 * c-brace-offset: -2
263 * c-argdecl-indent: 2
264 * c-label-offset: -2
265 * c-continued-statement-offset: 2
266 * c-continued-brace-offset: 0
267 * indent-tabs-mode: nil
268 * tab-width: 8
269 * End: