aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx_old
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 12:53:53 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:28 -0400
commitf0002e95a43e05260310eca5522db44549f62069 (patch)
tree007f3ad10ead2ed9fe3aae9e11133e1a3f897ba9 /drivers/scsi/aic7xxx_old
parent3f02567750c302637dedbb4fb90682999a770122 (diff)
aix7xxx_old: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/aic7xxx_old')
-rw-r--r--drivers/scsi/aic7xxx_old/aic7xxx_proc.c221
1 files changed, 59 insertions, 162 deletions
diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
index b07e4f04fd00..976f45ccf2cf 100644
--- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
@@ -30,62 +30,23 @@
30 *-M*************************************************************************/ 30 *-M*************************************************************************/
31 31
32 32
33#define BLS (&aic7xxx_buffer[size])
34#define HDRB \ 33#define HDRB \
35" 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" 34" 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+"
36 35
37#ifdef PROC_DEBUG
38extern int vsprintf(char *, const char *, va_list);
39
40static void
41proc_debug(const char *fmt, ...)
42{
43 va_list ap;
44 char buf[256];
45
46 va_start(ap, fmt);
47 vsprintf(buf, fmt, ap);
48 printk(buf);
49 va_end(ap);
50}
51#else /* PROC_DEBUG */
52# define proc_debug(fmt, args...)
53#endif /* PROC_DEBUG */
54
55static int aic7xxx_buffer_size = 0;
56static char *aic7xxx_buffer = NULL;
57
58 36
59/*+F************************************************************************* 37/*+F*************************************************************************
60 * Function: 38 * Function:
61 * aic7xxx_set_info 39 * aic7xxx_show_info
62 *
63 * Description:
64 * Set parameters for the driver from the /proc filesystem.
65 *-F*************************************************************************/
66static int
67aic7xxx_set_info(char *buffer, int length, struct Scsi_Host *HBAptr)
68{
69 proc_debug("aic7xxx_set_info(): %s\n", buffer);
70 return (-ENOSYS); /* Currently this is a no-op */
71}
72
73
74/*+F*************************************************************************
75 * Function:
76 * aic7xxx_proc_info
77 * 40 *
78 * Description: 41 * Description:
79 * Return information to handle /proc support for the driver. 42 * Return information to handle /proc support for the driver.
80 *-F*************************************************************************/ 43 *-F*************************************************************************/
81int 44int
82aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, 45aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
83 int inout)
84{ 46{
85 struct aic7xxx_host *p; 47 struct aic7xxx_host *p;
86 struct aic_dev_data *aic_dev; 48 struct aic_dev_data *aic_dev;
87 struct scsi_device *sdptr; 49 struct scsi_device *sdptr;
88 int size = 0;
89 unsigned char i; 50 unsigned char i;
90 unsigned char tindex; 51 unsigned char tindex;
91 52
@@ -94,66 +55,21 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t
94 55
95 if (!p) 56 if (!p)
96 { 57 {
97 size += sprintf(buffer, "Can't find adapter for host number %d\n", HBAptr->host_no); 58 seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no);
98 if (size > length) 59 return 0;
99 {
100 return (size);
101 }
102 else
103 {
104 return (length);
105 }
106 }
107
108 if (inout == TRUE) /* Has data been written to the file? */
109 {
110 return (aic7xxx_set_info(buffer, length, HBAptr));
111 } 60 }
112 61
113 p = (struct aic7xxx_host *) HBAptr->hostdata; 62 p = (struct aic7xxx_host *) HBAptr->hostdata;
114 63
115 /* 64 seq_printf(m, "Adaptec AIC7xxx driver version: ");
116 * It takes roughly 1K of space to hold all relevant card info, not 65 seq_printf(m, "%s/", AIC7XXX_C_VERSION);
117 * counting any proc stats, so we start out with a 1.5k buffer size and 66 seq_printf(m, "%s", AIC7XXX_H_VERSION);
118 * if proc_stats is defined, then we sweep the stats structure to see 67 seq_printf(m, "\n");
119 * how many drives we will be printing out for and add 384 bytes per 68 seq_printf(m, "Adapter Configuration:\n");
120 * device with active stats. 69 seq_printf(m, " SCSI Adapter: %s\n",
121 *
122 * Hmmmm...that 1.5k seems to keep growing as items get added so they
123 * can be easily viewed for debugging purposes. So, we bumped that
124 * 1.5k to 4k so we can quit having to bump it all the time.
125 */
126
127 size = 4096;
128 list_for_each_entry(aic_dev, &p->aic_devs, list)
129 size += 512;
130 if (aic7xxx_buffer_size != size)
131 {
132 if (aic7xxx_buffer != NULL)
133 {
134 kfree(aic7xxx_buffer);
135 aic7xxx_buffer_size = 0;
136 }
137 aic7xxx_buffer = kmalloc(size, GFP_KERNEL);
138 }
139 if (aic7xxx_buffer == NULL)
140 {
141 size = sprintf(buffer, "AIC7xxx - kmalloc error at line %d\n",
142 __LINE__);
143 return size;
144 }
145 aic7xxx_buffer_size = size;
146
147 size = 0;
148 size += sprintf(BLS, "Adaptec AIC7xxx driver version: ");
149 size += sprintf(BLS, "%s/", AIC7XXX_C_VERSION);
150 size += sprintf(BLS, "%s", AIC7XXX_H_VERSION);
151 size += sprintf(BLS, "\n");
152 size += sprintf(BLS, "Adapter Configuration:\n");
153 size += sprintf(BLS, " SCSI Adapter: %s\n",
154 board_names[p->board_name_index]); 70 board_names[p->board_name_index]);
155 if (p->flags & AHC_TWIN) 71 if (p->flags & AHC_TWIN)
156 size += sprintf(BLS, " Twin Channel Controller "); 72 seq_printf(m, " Twin Channel Controller ");
157 else 73 else
158 { 74 {
159 char *channel = ""; 75 char *channel = "";
@@ -184,86 +100,86 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t
184 ultra = "Ultra-2 LVD/SE "; 100 ultra = "Ultra-2 LVD/SE ";
185 else if (p->features & AHC_ULTRA) 101 else if (p->features & AHC_ULTRA)
186 ultra = "Ultra "; 102 ultra = "Ultra ";
187 size += sprintf(BLS, " %s%sController%s ", 103 seq_printf(m, " %s%sController%s ",
188 ultra, wide, channel); 104 ultra, wide, channel);
189 } 105 }
190 switch(p->chip & ~AHC_CHIPID_MASK) 106 switch(p->chip & ~AHC_CHIPID_MASK)
191 { 107 {
192 case AHC_VL: 108 case AHC_VL:
193 size += sprintf(BLS, "at VLB slot %d\n", p->pci_device_fn); 109 seq_printf(m, "at VLB slot %d\n", p->pci_device_fn);
194 break; 110 break;
195 case AHC_EISA: 111 case AHC_EISA:
196 size += sprintf(BLS, "at EISA slot %d\n", p->pci_device_fn); 112 seq_printf(m, "at EISA slot %d\n", p->pci_device_fn);
197 break; 113 break;
198 default: 114 default:
199 size += sprintf(BLS, "at PCI %d/%d/%d\n", p->pci_bus, 115 seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus,
200 PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); 116 PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn));
201 break; 117 break;
202 } 118 }
203 if( !(p->maddr) ) 119 if( !(p->maddr) )
204 { 120 {
205 size += sprintf(BLS, " Programmed I/O Base: %lx\n", p->base); 121 seq_printf(m, " Programmed I/O Base: %lx\n", p->base);
206 } 122 }
207 else 123 else
208 { 124 {
209 size += sprintf(BLS, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); 125 seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase);
210 } 126 }
211 if( (p->chip & (AHC_VL | AHC_EISA)) ) 127 if( (p->chip & (AHC_VL | AHC_EISA)) )
212 { 128 {
213 size += sprintf(BLS, " BIOS Memory Address: 0x%08x\n", p->bios_address); 129 seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address);
214 } 130 }
215 size += sprintf(BLS, " Adapter SEEPROM Config: %s\n", 131 seq_printf(m, " Adapter SEEPROM Config: %s\n",
216 (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : 132 (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." :
217 ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : 133 ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." :
218 "SEEPROM not found, using leftover BIOS values.") ); 134 "SEEPROM not found, using leftover BIOS values.") );
219 size += sprintf(BLS, " Adaptec SCSI BIOS: %s\n", 135 seq_printf(m, " Adaptec SCSI BIOS: %s\n",
220 (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); 136 (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled");
221 size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); 137 seq_printf(m, " IRQ: %d\n", HBAptr->irq);
222 size += sprintf(BLS, " SCBs: Active %d, Max Active %d,\n", 138 seq_printf(m, " SCBs: Active %d, Max Active %d,\n",
223 p->activescbs, p->max_activescbs); 139 p->activescbs, p->max_activescbs);
224 size += sprintf(BLS, " Allocated %d, HW %d, " 140 seq_printf(m, " Allocated %d, HW %d, "
225 "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, 141 "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs,
226 p->scb_data->maxscbs); 142 p->scb_data->maxscbs);
227 if (p->flags & AHC_EXTERNAL_SRAM) 143 if (p->flags & AHC_EXTERNAL_SRAM)
228 size += sprintf(BLS, " Using External SCB SRAM\n"); 144 seq_printf(m, " Using External SCB SRAM\n");
229 size += sprintf(BLS, " Interrupts: %ld", p->isr_count); 145 seq_printf(m, " Interrupts: %ld", p->isr_count);
230 if (p->chip & AHC_EISA) 146 if (p->chip & AHC_EISA)
231 { 147 {
232 size += sprintf(BLS, " %s\n", 148 seq_printf(m, " %s\n",
233 (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); 149 (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)");
234 } 150 }
235 else 151 else
236 { 152 {
237 size += sprintf(BLS, "\n"); 153 seq_printf(m, "\n");
238 } 154 }
239 size += sprintf(BLS, " BIOS Control Word: 0x%04x\n", 155 seq_printf(m, " BIOS Control Word: 0x%04x\n",
240 p->bios_control); 156 p->bios_control);
241 size += sprintf(BLS, " Adapter Control Word: 0x%04x\n", 157 seq_printf(m, " Adapter Control Word: 0x%04x\n",
242 p->adapter_control); 158 p->adapter_control);
243 size += sprintf(BLS, " Extended Translation: %sabled\n", 159 seq_printf(m, " Extended Translation: %sabled\n",
244 (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); 160 (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis");
245 size += sprintf(BLS, "Disconnect Enable Flags: 0x%04x\n", p->discenable); 161 seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable);
246 if (p->features & (AHC_ULTRA | AHC_ULTRA2)) 162 if (p->features & (AHC_ULTRA | AHC_ULTRA2))
247 { 163 {
248 size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); 164 seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb);
249 } 165 }
250 size += sprintf(BLS, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); 166 seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth);
251 size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host " 167 seq_printf(m, " Tagged Queue By Device array for aic7xxx host "
252 "instance %d:\n", p->instance); 168 "instance %d:\n", p->instance);
253 size += sprintf(BLS, " {"); 169 seq_printf(m, " {");
254 for(i=0; i < (MAX_TARGETS - 1); i++) 170 for(i=0; i < (MAX_TARGETS - 1); i++)
255 size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); 171 seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]);
256 size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); 172 seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]);
257 173
258 size += sprintf(BLS, "\n"); 174 seq_printf(m, "\n");
259 size += sprintf(BLS, "Statistics:\n\n"); 175 seq_printf(m, "Statistics:\n\n");
260 list_for_each_entry(aic_dev, &p->aic_devs, list) 176 list_for_each_entry(aic_dev, &p->aic_devs, list)
261 { 177 {
262 sdptr = aic_dev->SDptr; 178 sdptr = aic_dev->SDptr;
263 tindex = sdptr->channel << 3 | sdptr->id; 179 tindex = sdptr->channel << 3 | sdptr->id;
264 size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n", 180 seq_printf(m, "(scsi%d:%d:%d:%d)\n",
265 p->host_no, sdptr->channel, sdptr->id, sdptr->lun); 181 p->host_no, sdptr->channel, sdptr->id, sdptr->lun);
266 size += sprintf(BLS, " Device using %s/%s", 182 seq_printf(m, " Device using %s/%s",
267 (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? 183 (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
268 "Wide" : "Narrow", 184 "Wide" : "Narrow",
269 (aic_dev->cur.offset != 0) ? 185 (aic_dev->cur.offset != 0) ?
@@ -279,78 +195,59 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t
279 sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); 195 sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options);
280 if (sync_rate != NULL) 196 if (sync_rate != NULL)
281 { 197 {
282 size += sprintf(BLS, "%s MByte/sec, offset %d\n", 198 seq_printf(m, "%s MByte/sec, offset %d\n",
283 sync_rate->rate[rate], 199 sync_rate->rate[rate],
284 aic_dev->cur.offset ); 200 aic_dev->cur.offset );
285 } 201 }
286 else 202 else
287 { 203 {
288 size += sprintf(BLS, "3.3 MByte/sec, offset %d\n", 204 seq_printf(m, "3.3 MByte/sec, offset %d\n",
289 aic_dev->cur.offset ); 205 aic_dev->cur.offset );
290 } 206 }
291 } 207 }
292 size += sprintf(BLS, " Transinfo settings: "); 208 seq_printf(m, " Transinfo settings: ");
293 size += sprintf(BLS, "current(%d/%d/%d/%d), ", 209 seq_printf(m, "current(%d/%d/%d/%d), ",
294 aic_dev->cur.period, 210 aic_dev->cur.period,
295 aic_dev->cur.offset, 211 aic_dev->cur.offset,
296 aic_dev->cur.width, 212 aic_dev->cur.width,
297 aic_dev->cur.options); 213 aic_dev->cur.options);
298 size += sprintf(BLS, "goal(%d/%d/%d/%d), ", 214 seq_printf(m, "goal(%d/%d/%d/%d), ",
299 aic_dev->goal.period, 215 aic_dev->goal.period,
300 aic_dev->goal.offset, 216 aic_dev->goal.offset,
301 aic_dev->goal.width, 217 aic_dev->goal.width,
302 aic_dev->goal.options); 218 aic_dev->goal.options);
303 size += sprintf(BLS, "user(%d/%d/%d/%d)\n", 219 seq_printf(m, "user(%d/%d/%d/%d)\n",
304 p->user[tindex].period, 220 p->user[tindex].period,
305 p->user[tindex].offset, 221 p->user[tindex].offset,
306 p->user[tindex].width, 222 p->user[tindex].width,
307 p->user[tindex].options); 223 p->user[tindex].options);
308 if(sdptr->simple_tags) 224 if(sdptr->simple_tags)
309 { 225 {
310 size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); 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);
311 } 227 }
312 if(aic_dev->barrier_total) 228 if(aic_dev->barrier_total)
313 size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", 229 seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n",
314 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, 230 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total,
315 aic_dev->barrier_total, aic_dev->ordered_total); 231 aic_dev->barrier_total, aic_dev->ordered_total);
316 else 232 else
317 size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", 233 seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n",
318 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); 234 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total);
319 size += sprintf(BLS, "%s\n", HDRB); 235 seq_printf(m, "%s\n", HDRB);
320 size += sprintf(BLS, " Reads:"); 236 seq_printf(m, " Reads:");
321 for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) 237 for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++)
322 { 238 {
323 size += sprintf(BLS, " %10ld", aic_dev->r_bins[i]); 239 seq_printf(m, " %10ld", aic_dev->r_bins[i]);
324 } 240 }
325 size += sprintf(BLS, "\n"); 241 seq_printf(m, "\n");
326 size += sprintf(BLS, " Writes:"); 242 seq_printf(m, " Writes:");
327 for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) 243 for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++)
328 { 244 {
329 size += sprintf(BLS, " %10ld", aic_dev->w_bins[i]); 245 seq_printf(m, " %10ld", aic_dev->w_bins[i]);
330 } 246 }
331 size += sprintf(BLS, "\n"); 247 seq_printf(m, "\n");
332 size += sprintf(BLS, "\n\n"); 248 seq_printf(m, "\n\n");
333 }
334 if (size >= aic7xxx_buffer_size)
335 {
336 printk(KERN_WARNING "aic7xxx: Overflow in aic7xxx_proc.c\n");
337 }
338
339 if (offset > size - 1)
340 {
341 kfree(aic7xxx_buffer);
342 aic7xxx_buffer = NULL;
343 aic7xxx_buffer_size = length = 0;
344 *start = NULL;
345 } 249 }
346 else 250 return 0;
347 {
348 *start = buffer;
349 length = min_t(int, length, size - offset);
350 memcpy(buffer, &aic7xxx_buffer[offset], length);
351 }
352
353 return (length);
354} 251}
355 252
356/* 253/*