Commit | Line | Data |
---|---|---|
1da177e4 | 1 | #define PSEUDO_DMA |
1da177e4 LT |
2 | #define UNSAFE /* Not unsafe for PAS16 -- use it */ |
3 | ||
4 | /* | |
5 | * This driver adapted from Drew Eckhardt's Trantor T128 driver | |
6 | * | |
7 | * Copyright 1993, Drew Eckhardt | |
8 | * Visionary Computing | |
9 | * (Unix and Linux consulting and custom programming) | |
10 | * drew@colorado.edu | |
11 | * +1 (303) 666-5836 | |
12 | * | |
13 | * ( Based on T128 - DISTRIBUTION RELEASE 3. ) | |
14 | * | |
15 | * Modified to work with the Pro Audio Spectrum/Studio 16 | |
16 | * by John Weidman. | |
17 | * | |
18 | * | |
19 | * For more information, please consult | |
20 | * | |
21 | * Media Vision | |
22 | * (510) 770-8600 | |
23 | * (800) 348-7116 | |
1da177e4 LT |
24 | */ |
25 | ||
26 | /* | |
1da177e4 LT |
27 | * The card is detected and initialized in one of several ways : |
28 | * 1. Autoprobe (default) - There are many different models of | |
29 | * the Pro Audio Spectrum/Studio 16, and I only have one of | |
30 | * them, so this may require a little tweaking. An interrupt | |
31 | * is triggered to autoprobe for the interrupt line. Note: | |
32 | * with the newer model boards, the interrupt is set via | |
33 | * software after reset using the default_irq for the | |
34 | * current board number. | |
35 | * | |
36 | * 2. With command line overrides - pas16=port,irq may be | |
37 | * used on the LILO command line to override the defaults. | |
38 | * | |
39 | * 3. With the PAS16_OVERRIDE compile time define. This is | |
40 | * specified as an array of address, irq tuples. Ie, for | |
41 | * one board at the default 0x388 address, IRQ10, I could say | |
42 | * -DPAS16_OVERRIDE={{0x388, 10}} | |
43 | * NOTE: Untested. | |
44 | * | |
45 | * 4. When included as a module, with arguments passed on the command line: | |
46 | * pas16_irq=xx the interrupt | |
47 | * pas16_addr=xx the port | |
48 | * e.g. "modprobe pas16 pas16_addr=0x388 pas16_irq=5" | |
49 | * | |
50 | * Note that if the override methods are used, place holders must | |
51 | * be specified for other boards in the system. | |
52 | * | |
53 | * | |
54 | * Configuration notes : | |
55 | * The current driver does not support interrupt sharing with the | |
56 | * sound portion of the card. If you use the same irq for the | |
57 | * scsi port and sound you will have problems. Either use | |
58 | * a different irq for the scsi port or don't use interrupts | |
59 | * for the scsi port. | |
60 | * | |
61 | * If you have problems with your card not being recognized, use | |
62 | * the LILO command line override. Try to get it recognized without | |
63 | * interrupts. Ie, for a board at the default 0x388 base port, | |
22f5f10d | 64 | * boot: linux pas16=0x388,0 |
1da177e4 | 65 | * |
22f5f10d | 66 | * NO_IRQ (0) should be specified for no interrupt, |
1da177e4 LT |
67 | * IRQ_AUTO (254) to autoprobe for an IRQ line if overridden |
68 | * on the command line. | |
1da177e4 LT |
69 | */ |
70 | ||
71 | #include <linux/module.h> | |
72 | ||
1da177e4 LT |
73 | #include <linux/signal.h> |
74 | #include <linux/proc_fs.h> | |
1da177e4 LT |
75 | #include <asm/io.h> |
76 | #include <asm/dma.h> | |
77 | #include <linux/blkdev.h> | |
78 | #include <linux/delay.h> | |
79 | #include <linux/interrupt.h> | |
80 | #include <linux/stat.h> | |
81 | #include <linux/init.h> | |
82 | ||
1da177e4 LT |
83 | #include <scsi/scsi_host.h> |
84 | #include "pas16.h" | |
85 | #define AUTOPROBE_IRQ | |
86 | #include "NCR5380.h" | |
87 | ||
88 | ||
d5f7e65d FT |
89 | static unsigned short pas16_addr; |
90 | static int pas16_irq; | |
1da177e4 LT |
91 | |
92 | ||
408b664a | 93 | static const int scsi_irq_translate[] = |
1da177e4 LT |
94 | { 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 0, 10, 11 }; |
95 | ||
96 | /* The default_irqs array contains values used to set the irq into the | |
97 | * board via software (as must be done on newer model boards without | |
98 | * irq jumpers on the board). The first value in the array will be | |
99 | * assigned to logical board 0, the next to board 1, etc. | |
100 | */ | |
408b664a | 101 | static int default_irqs[] __initdata = |
1da177e4 LT |
102 | { PAS16_DEFAULT_BOARD_1_IRQ, |
103 | PAS16_DEFAULT_BOARD_2_IRQ, | |
104 | PAS16_DEFAULT_BOARD_3_IRQ, | |
105 | PAS16_DEFAULT_BOARD_4_IRQ | |
106 | }; | |
107 | ||
108 | static struct override { | |
109 | unsigned short io_port; | |
110 | int irq; | |
6391a113 | 111 | } overrides |
1da177e4 LT |
112 | #ifdef PAS16_OVERRIDE |
113 | [] __initdata = PAS16_OVERRIDE; | |
114 | #else | |
115 | [4] __initdata = {{0,IRQ_AUTO}, {0,IRQ_AUTO}, {0,IRQ_AUTO}, | |
116 | {0,IRQ_AUTO}}; | |
117 | #endif | |
118 | ||
6391a113 | 119 | #define NO_OVERRIDES ARRAY_SIZE(overrides) |
1da177e4 LT |
120 | |
121 | static struct base { | |
122 | unsigned short io_port; | |
123 | int noauto; | |
6391a113 | 124 | } bases[] __initdata = |
1da177e4 LT |
125 | { {PAS16_DEFAULT_BASE_1, 0}, |
126 | {PAS16_DEFAULT_BASE_2, 0}, | |
127 | {PAS16_DEFAULT_BASE_3, 0}, | |
128 | {PAS16_DEFAULT_BASE_4, 0} | |
129 | }; | |
130 | ||
6391a113 | 131 | #define NO_BASES ARRAY_SIZE(bases) |
1da177e4 | 132 | |
408b664a | 133 | static const unsigned short pas16_offset[ 8 ] = |
1da177e4 LT |
134 | { |
135 | 0x1c00, /* OUTPUT_DATA_REG */ | |
136 | 0x1c01, /* INITIATOR_COMMAND_REG */ | |
137 | 0x1c02, /* MODE_REG */ | |
138 | 0x1c03, /* TARGET_COMMAND_REG */ | |
139 | 0x3c00, /* STATUS_REG ro, SELECT_ENABLE_REG wo */ | |
140 | 0x3c01, /* BUS_AND_STATUS_REG ro, START_DMA_SEND_REG wo */ | |
141 | 0x3c02, /* INPUT_DATA_REGISTER ro, (N/A on PAS16 ?) | |
142 | * START_DMA_TARGET_RECEIVE_REG wo | |
143 | */ | |
144 | 0x3c03, /* RESET_PARITY_INTERRUPT_REG ro, | |
145 | * START_DMA_INITIATOR_RECEIVE_REG wo | |
146 | */ | |
147 | }; | |
1da177e4 LT |
148 | |
149 | ||
150 | /* | |
151 | * Function : enable_board( int board_num, unsigned short port ) | |
152 | * | |
153 | * Purpose : set address in new model board | |
154 | * | |
155 | * Inputs : board_num - logical board number 0-3, port - base address | |
156 | * | |
157 | */ | |
158 | ||
159 | static void __init | |
160 | enable_board( int board_num, unsigned short port ) | |
161 | { | |
162 | outb( 0xbc + board_num, MASTER_ADDRESS_PTR ); | |
163 | outb( port >> 2, MASTER_ADDRESS_PTR ); | |
164 | } | |
165 | ||
166 | ||
167 | ||
168 | /* | |
169 | * Function : init_board( unsigned short port, int irq ) | |
170 | * | |
171 | * Purpose : Set the board up to handle the SCSI interface | |
172 | * | |
173 | * Inputs : port - base address of the board, | |
174 | * irq - irq to assign to the SCSI port | |
175 | * force_irq - set it even if it conflicts with sound driver | |
176 | * | |
177 | */ | |
178 | ||
179 | static void __init | |
180 | init_board( unsigned short io_port, int irq, int force_irq ) | |
181 | { | |
182 | unsigned int tmp; | |
183 | unsigned int pas_irq_code; | |
184 | ||
185 | /* Initialize the SCSI part of the board */ | |
186 | ||
187 | outb( 0x30, io_port + P_TIMEOUT_COUNTER_REG ); /* Timeout counter */ | |
188 | outb( 0x01, io_port + P_TIMEOUT_STATUS_REG_OFFSET ); /* Reset TC */ | |
189 | outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */ | |
190 | ||
54d8fe44 | 191 | inb(io_port + pas16_offset[RESET_PARITY_INTERRUPT_REG]); |
1da177e4 LT |
192 | |
193 | /* Set the SCSI interrupt pointer without mucking up the sound | |
194 | * interrupt pointer in the same byte. | |
195 | */ | |
196 | pas_irq_code = ( irq < 16 ) ? scsi_irq_translate[irq] : 0; | |
197 | tmp = inb( io_port + IO_CONFIG_3 ); | |
198 | ||
199 | if( (( tmp & 0x0f ) == pas_irq_code) && pas_irq_code > 0 | |
200 | && !force_irq ) | |
201 | { | |
202 | printk( "pas16: WARNING: Can't use same irq as sound " | |
203 | "driver -- interrupts disabled\n" ); | |
204 | /* Set up the drive parameters, disable 5380 interrupts */ | |
205 | outb( 0x4d, io_port + SYS_CONFIG_4 ); | |
206 | } | |
207 | else | |
208 | { | |
209 | tmp = ( tmp & 0x0f ) | ( pas_irq_code << 4 ); | |
210 | outb( tmp, io_port + IO_CONFIG_3 ); | |
211 | ||
212 | /* Set up the drive parameters and enable 5380 interrupts */ | |
213 | outb( 0x6d, io_port + SYS_CONFIG_4 ); | |
214 | } | |
215 | } | |
216 | ||
217 | ||
218 | /* | |
219 | * Function : pas16_hw_detect( unsigned short board_num ) | |
220 | * | |
221 | * Purpose : determine if a pas16 board is present | |
222 | * | |
223 | * Inputs : board_num - logical board number ( 0 - 3 ) | |
224 | * | |
225 | * Returns : 0 if board not found, 1 if found. | |
226 | */ | |
227 | ||
228 | static int __init | |
229 | pas16_hw_detect( unsigned short board_num ) | |
230 | { | |
231 | unsigned char board_rev, tmp; | |
232 | unsigned short io_port = bases[ board_num ].io_port; | |
233 | ||
234 | /* See if we can find a PAS16 board at the address associated | |
235 | * with this logical board number. | |
236 | */ | |
237 | ||
238 | /* First, attempt to take a newer model board out of reset and | |
239 | * give it a base address. This shouldn't affect older boards. | |
240 | */ | |
241 | enable_board( board_num, io_port ); | |
242 | ||
243 | /* Now see if it looks like a PAS16 board */ | |
244 | board_rev = inb( io_port + PCB_CONFIG ); | |
245 | ||
246 | if( board_rev == 0xff ) | |
247 | return 0; | |
248 | ||
249 | tmp = board_rev ^ 0xe0; | |
250 | ||
251 | outb( tmp, io_port + PCB_CONFIG ); | |
252 | tmp = inb( io_port + PCB_CONFIG ); | |
253 | outb( board_rev, io_port + PCB_CONFIG ); | |
254 | ||
255 | if( board_rev != tmp ) /* Not a PAS-16 */ | |
256 | return 0; | |
257 | ||
258 | if( ( inb( io_port + OPERATION_MODE_1 ) & 0x03 ) != 0x03 ) | |
259 | return 0; /* return if no SCSI interface found */ | |
260 | ||
261 | /* Mediavision has some new model boards that return ID bits | |
262 | * that indicate a SCSI interface, but they're not (LMS). We'll | |
263 | * put in an additional test to try to weed them out. | |
264 | */ | |
265 | ||
54d8fe44 FT |
266 | outb(0x01, io_port + WAIT_STATE); /* 1 Wait state */ |
267 | outb(0x20, io_port + pas16_offset[MODE_REG]); /* Is it really SCSI? */ | |
268 | if (inb(io_port + pas16_offset[MODE_REG]) != 0x20) /* Write to a reg. */ | |
269 | return 0; /* and try to read */ | |
270 | outb(0x00, io_port + pas16_offset[MODE_REG]); /* it back. */ | |
271 | if (inb(io_port + pas16_offset[MODE_REG]) != 0x00) | |
272 | return 0; | |
1da177e4 LT |
273 | |
274 | return 1; | |
275 | } | |
276 | ||
277 | ||
925e4610 | 278 | #ifndef MODULE |
1da177e4 LT |
279 | /* |
280 | * Function : pas16_setup(char *str, int *ints) | |
281 | * | |
282 | * Purpose : LILO command line initialization of the overrides array, | |
283 | * | |
284 | * Inputs : str - unused, ints - array of integer parameters with ints[0] | |
285 | * equal to the number of ints. | |
286 | * | |
287 | */ | |
288 | ||
925e4610 | 289 | static int __init pas16_setup(char *str) |
1da177e4 | 290 | { |
d5f7e65d | 291 | static int commandline_current; |
1da177e4 | 292 | int i; |
925e4610 FT |
293 | int ints[10]; |
294 | ||
295 | get_options(str, ARRAY_SIZE(ints), ints); | |
1da177e4 LT |
296 | if (ints[0] != 2) |
297 | printk("pas16_setup : usage pas16=io_port,irq\n"); | |
298 | else | |
299 | if (commandline_current < NO_OVERRIDES) { | |
300 | overrides[commandline_current].io_port = (unsigned short) ints[1]; | |
301 | overrides[commandline_current].irq = ints[2]; | |
302 | for (i = 0; i < NO_BASES; ++i) | |
303 | if (bases[i].io_port == (unsigned short) ints[1]) { | |
304 | bases[i].noauto = 1; | |
305 | break; | |
306 | } | |
307 | ++commandline_current; | |
308 | } | |
925e4610 | 309 | return 1; |
1da177e4 LT |
310 | } |
311 | ||
925e4610 FT |
312 | __setup("pas16=", pas16_setup); |
313 | #endif | |
314 | ||
1da177e4 | 315 | /* |
d0be4a7d | 316 | * Function : int pas16_detect(struct scsi_host_template * tpnt) |
1da177e4 LT |
317 | * |
318 | * Purpose : detects and initializes PAS16 controllers | |
319 | * that were autoprobed, overridden on the LILO command line, | |
320 | * or specified at compile time. | |
321 | * | |
322 | * Inputs : tpnt - template for this SCSI adapter. | |
323 | * | |
324 | * Returns : 1 if a host adapter was found, 0 if not. | |
325 | * | |
326 | */ | |
327 | ||
ed8b9e7f | 328 | static int __init pas16_detect(struct scsi_host_template *tpnt) |
1da177e4 | 329 | { |
d5f7e65d FT |
330 | static int current_override; |
331 | static unsigned short current_base; | |
1da177e4 LT |
332 | struct Scsi_Host *instance; |
333 | unsigned short io_port; | |
334 | int count; | |
335 | ||
1da177e4 LT |
336 | if (pas16_addr != 0) { |
337 | overrides[0].io_port = pas16_addr; | |
338 | /* | |
339 | * This is how we avoid seeing more than | |
340 | * one host adapter at the same I/O port. | |
341 | * Cribbed shamelessly from pas16_setup(). | |
342 | */ | |
343 | for (count = 0; count < NO_BASES; ++count) | |
344 | if (bases[count].io_port == pas16_addr) { | |
345 | bases[count].noauto = 1; | |
346 | break; | |
347 | } | |
348 | } | |
349 | if (pas16_irq != 0) | |
350 | overrides[0].irq = pas16_irq; | |
351 | ||
352 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { | |
353 | io_port = 0; | |
354 | ||
355 | if (overrides[current_override].io_port) | |
356 | { | |
357 | io_port = overrides[current_override].io_port; | |
358 | enable_board( current_override, io_port ); | |
359 | init_board( io_port, overrides[current_override].irq, 1 ); | |
360 | } | |
361 | else | |
362 | for (; !io_port && (current_base < NO_BASES); ++current_base) { | |
2f7dba9f FT |
363 | dprintk(NDEBUG_INIT, "pas16: probing io_port 0x%04x\n", |
364 | (unsigned int)bases[current_base].io_port); | |
1da177e4 LT |
365 | if ( !bases[current_base].noauto && |
366 | pas16_hw_detect( current_base ) ){ | |
367 | io_port = bases[current_base].io_port; | |
368 | init_board( io_port, default_irqs[ current_base ], 0 ); | |
2f7dba9f | 369 | dprintk(NDEBUG_INIT, "pas16: detected board\n"); |
1da177e4 LT |
370 | } |
371 | } | |
372 | ||
2f7dba9f FT |
373 | dprintk(NDEBUG_INIT, "pas16: io_port = 0x%04x\n", |
374 | (unsigned int)io_port); | |
1da177e4 LT |
375 | |
376 | if (!io_port) | |
377 | break; | |
378 | ||
379 | instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); | |
380 | if(instance == NULL) | |
381 | break; | |
382 | ||
383 | instance->io_port = io_port; | |
384 | ||
385 | NCR5380_init(instance, 0); | |
386 | ||
387 | if (overrides[current_override].irq != IRQ_AUTO) | |
388 | instance->irq = overrides[current_override].irq; | |
389 | else | |
390 | instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); | |
391 | ||
22f5f10d FT |
392 | /* Compatibility with documented NCR5380 kernel parameters */ |
393 | if (instance->irq == 255) | |
394 | instance->irq = NO_IRQ; | |
395 | ||
396 | if (instance->irq != NO_IRQ) | |
4909cc2b | 397 | if (request_irq(instance->irq, pas16_intr, 0, |
1e641664 | 398 | "pas16", instance)) { |
1da177e4 LT |
399 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", |
400 | instance->host_no, instance->irq); | |
22f5f10d | 401 | instance->irq = NO_IRQ; |
1da177e4 LT |
402 | } |
403 | ||
22f5f10d | 404 | if (instance->irq == NO_IRQ) { |
1da177e4 LT |
405 | printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no); |
406 | printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no); | |
407 | /* Disable 5380 interrupts, leave drive params the same */ | |
408 | outb( 0x4d, io_port + SYS_CONFIG_4 ); | |
409 | outb( (inb(io_port + IO_CONFIG_3) & 0x0f), io_port + IO_CONFIG_3 ); | |
410 | } | |
411 | ||
2f7dba9f FT |
412 | dprintk(NDEBUG_INIT, "scsi%d : irq = %d\n", |
413 | instance->host_no, instance->irq); | |
1da177e4 | 414 | |
1da177e4 LT |
415 | ++current_override; |
416 | ++count; | |
417 | } | |
418 | return count; | |
419 | } | |
420 | ||
421 | /* | |
422 | * Function : int pas16_biosparam(Disk *disk, struct block_device *dev, int *ip) | |
423 | * | |
424 | * Purpose : Generates a BIOS / DOS compatible H-C-S mapping for | |
425 | * the specified device / size. | |
426 | * | |
427 | * Inputs : size = size of device in sectors (512 bytes), dev = block device | |
428 | * major / minor, ip[] = {heads, sectors, cylinders} | |
429 | * | |
430 | * Returns : always 0 (success), initializes ip | |
431 | * | |
432 | */ | |
433 | ||
434 | /* | |
435 | * XXX Most SCSI boards use this mapping, I could be incorrect. Some one | |
436 | * using hard disks on a trantor should verify that this mapping corresponds | |
437 | * to that used by the BIOS / ASPI driver by running the linux fdisk program | |
438 | * and matching the H_C_S coordinates to what DOS uses. | |
439 | */ | |
440 | ||
ed8b9e7f FT |
441 | static int pas16_biosparam(struct scsi_device *sdev, struct block_device *dev, |
442 | sector_t capacity, int *ip) | |
1da177e4 LT |
443 | { |
444 | int size = capacity; | |
445 | ip[0] = 64; | |
446 | ip[1] = 32; | |
447 | ip[2] = size >> 11; /* I think I have it as /(32*64) */ | |
448 | if( ip[2] > 1024 ) { /* yes, >, not >= */ | |
449 | ip[0]=255; | |
450 | ip[1]=63; | |
451 | ip[2]=size/(63*255); | |
452 | if( ip[2] > 1023 ) /* yes >1023... */ | |
453 | ip[2] = 1023; | |
454 | } | |
455 | ||
456 | return 0; | |
457 | } | |
458 | ||
459 | /* | |
460 | * Function : int NCR5380_pread (struct Scsi_Host *instance, | |
461 | * unsigned char *dst, int len) | |
462 | * | |
463 | * Purpose : Fast 5380 pseudo-dma read function, transfers len bytes to | |
464 | * dst | |
465 | * | |
466 | * Inputs : dst = destination, len = length in bytes | |
467 | * | |
468 | * Returns : 0 on success, non zero on a failure such as a watchdog | |
469 | * timeout. | |
470 | */ | |
471 | ||
472 | static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, | |
473 | int len) { | |
474 | register unsigned char *d = dst; | |
475 | register unsigned short reg = (unsigned short) (instance->io_port + | |
476 | P_DATA_REG_OFFSET); | |
477 | register int i = len; | |
478 | int ii = 0; | |
a9c2dc43 | 479 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
1da177e4 LT |
480 | |
481 | while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) ) | |
482 | ++ii; | |
483 | ||
484 | insb( reg, d, i ); | |
485 | ||
486 | if ( inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) { | |
487 | outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET); | |
488 | printk("scsi%d : watchdog timer fired in NCR5380_pread()\n", | |
489 | instance->host_no); | |
490 | return -1; | |
491 | } | |
a9c2dc43 FT |
492 | if (ii > hostdata->spin_max_r) |
493 | hostdata->spin_max_r = ii; | |
1da177e4 LT |
494 | return 0; |
495 | } | |
496 | ||
497 | /* | |
498 | * Function : int NCR5380_pwrite (struct Scsi_Host *instance, | |
499 | * unsigned char *src, int len) | |
500 | * | |
501 | * Purpose : Fast 5380 pseudo-dma write function, transfers len bytes from | |
502 | * src | |
503 | * | |
504 | * Inputs : src = source, len = length in bytes | |
505 | * | |
506 | * Returns : 0 on success, non zero on a failure such as a watchdog | |
507 | * timeout. | |
508 | */ | |
509 | ||
510 | static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src, | |
511 | int len) { | |
512 | register unsigned char *s = src; | |
513 | register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET); | |
514 | register int i = len; | |
515 | int ii = 0; | |
a9c2dc43 | 516 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
1da177e4 LT |
517 | |
518 | while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) ) | |
519 | ++ii; | |
520 | ||
521 | outsb( reg, s, i ); | |
522 | ||
523 | if (inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) { | |
524 | outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET); | |
525 | printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n", | |
526 | instance->host_no); | |
527 | return -1; | |
528 | } | |
a9c2dc43 FT |
529 | if (ii > hostdata->spin_max_w) |
530 | hostdata->spin_max_w = ii; | |
1da177e4 LT |
531 | return 0; |
532 | } | |
533 | ||
534 | #include "NCR5380.c" | |
535 | ||
536 | static int pas16_release(struct Scsi_Host *shost) | |
537 | { | |
22f5f10d | 538 | if (shost->irq != NO_IRQ) |
1e641664 | 539 | free_irq(shost->irq, shost); |
1da177e4 | 540 | NCR5380_exit(shost); |
1da177e4 LT |
541 | if (shost->io_port && shost->n_io_port) |
542 | release_region(shost->io_port, shost->n_io_port); | |
543 | scsi_unregister(shost); | |
544 | return 0; | |
545 | } | |
546 | ||
d0be4a7d | 547 | static struct scsi_host_template driver_template = { |
1da177e4 LT |
548 | .name = "Pro Audio Spectrum-16 SCSI", |
549 | .detect = pas16_detect, | |
550 | .release = pas16_release, | |
4d3d2a54 FT |
551 | .proc_name = "pas16", |
552 | .show_info = pas16_show_info, | |
553 | .write_info = pas16_write_info, | |
8c32513b | 554 | .info = pas16_info, |
1da177e4 LT |
555 | .queuecommand = pas16_queue_command, |
556 | .eh_abort_handler = pas16_abort, | |
557 | .eh_bus_reset_handler = pas16_bus_reset, | |
1da177e4 LT |
558 | .bios_param = pas16_biosparam, |
559 | .can_queue = CAN_QUEUE, | |
560 | .this_id = 7, | |
561 | .sg_tablesize = SG_ALL, | |
562 | .cmd_per_lun = CMD_PER_LUN, | |
563 | .use_clustering = DISABLE_CLUSTERING, | |
564 | }; | |
565 | #include "scsi_module.c" | |
566 | ||
567 | #ifdef MODULE | |
568 | module_param(pas16_addr, ushort, 0); | |
569 | module_param(pas16_irq, int, 0); | |
570 | #endif | |
571 | MODULE_LICENSE("GPL"); |