2 * Generic Generic NCR5380 driver
4 * Copyright 1993, Drew Eckhardt
6 * (Unix and Linux consulting and custom programming)
10 * NCR53C400 extensions (c) 1994,1995,1996, Kevin Lentin
11 * K.Lentin@cs.monash.edu.au
13 * NCR53C400A extensions (c) 1996, Ingmar Baumgart
14 * ingmar@gonzo.schwaben.de
16 * DTC3181E extensions (c) 1997, Ronald van Cuijlenborg
17 * ronald.van.cuijlenborg@tip.nl or nutty@dds.nl
19 * Added ISAPNP support for DTC436 adapters,
20 * Thomas Sailer, sailer@ife.ee.ethz.ch
26 * TODO : flesh out DMA support, find some one actually using this (I have
27 * a memory mapped Trantor board that works fine)
31 * The card is detected and initialized in one of several ways :
32 * 1. With command line overrides - NCR5380=port,irq may be
33 * used on the LILO command line to override the defaults.
35 * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is
36 * specified as an array of address, irq, dma, board tuples. Ie, for
37 * one board at 0x350, IRQ5, no dma, I could say
38 * -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE, BOARD_NCR5380}}
40 * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an
41 * IRQ line if overridden on the command line.
43 * 3. When included as a module, with arguments passed on the command line:
44 * ncr_irq=xx the interrupt
45 * ncr_addr=xx the port or base address (for port or memory
48 * ncr_5380=1 to set up for a NCR5380 board
49 * ncr_53c400=1 to set up for a NCR53C400 board
51 * modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
52 * for a port mapped NCR5380 board or
53 * modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
54 * for a memory mapped NCR53C400 board with interrupts disabled.
56 * 255 should be specified for no or DMA interrupt, 254 to autoprobe for an
57 * IRQ line if overridden on the command line.
61 /* settings for DTC3181E card with only Mustek scanner attached */
63 #define USLEEP_SLEEP 20
64 #define USLEEP_WAITLONG 500
68 #ifdef CONFIG_SCSI_GENERIC_NCR53C400
69 #define NCR53C400_PSEUDO_DMA 1
75 #include <linux/signal.h>
76 #include <linux/blkdev.h>
78 #include <scsi/scsi_host.h>
79 #include "g_NCR5380.h"
81 #include <linux/stat.h>
82 #include <linux/init.h>
83 #include <linux/ioport.h>
84 #include <linux/isapnp.h>
85 #include <linux/delay.h>
86 #include <linux/interrupt.h>
89 static int ncr_irq
= NCR_NOT_SET
;
90 static int ncr_dma
= NCR_NOT_SET
;
91 static int ncr_addr
= NCR_NOT_SET
;
92 static int ncr_5380
= NCR_NOT_SET
;
93 static int ncr_53c400
= NCR_NOT_SET
;
94 static int ncr_53c400a
= NCR_NOT_SET
;
95 static int dtc_3181e
= NCR_NOT_SET
;
97 static struct override
{
98 NCR5380_map_type NCR5380_map_name
;
101 int board
; /* Use NCR53c400, Ricoh, etc. extensions ? */
103 #ifdef GENERIC_NCR5380_OVERRIDE
104 [] __initdata
= GENERIC_NCR5380_OVERRIDE
;
106 [1] __initdata
= { { 0,},};
109 #define NO_OVERRIDES ARRAY_SIZE(overrides)
114 * internal_setup - handle lilo command string override
115 * @board: BOARD_* identifier for the board
117 * @ints: numeric parameters
119 * Do LILO command line initialization of the overrides array. Display
125 static void __init
internal_setup(int board
, char *str
, int *ints
)
127 static int commandline_current
= 0;
130 if (ints
[0] != 2 && ints
[0] != 3) {
131 printk(KERN_ERR
"generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name
) ",irq,dma\n");
135 case BOARD_NCR53C400
:
137 printk(KERN_ERR
"generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name
) ",irq\n");
141 case BOARD_NCR53C400A
:
143 printk(KERN_ERR
"generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name
) ",irq\n");
149 printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name
) ",irq\n");
155 if (commandline_current
< NO_OVERRIDES
) {
156 overrides
[commandline_current
].NCR5380_map_name
= (NCR5380_map_type
) ints
[1];
157 overrides
[commandline_current
].irq
= ints
[2];
159 overrides
[commandline_current
].dma
= ints
[3];
161 overrides
[commandline_current
].dma
= DMA_NONE
;
162 overrides
[commandline_current
].board
= board
;
163 ++commandline_current
;
169 * do_NCR53C80_setup - set up entry point
172 * Setup function invoked at boot to parse the ncr5380= command
176 static int __init
do_NCR5380_setup(char *str
)
180 get_options(str
, ARRAY_SIZE(ints
), ints
);
181 internal_setup(BOARD_NCR5380
, str
, ints
);
186 * do_NCR53C400_setup - set up entry point
188 * @ints: integer parameters from kernel setup code
190 * Setup function invoked at boot to parse the ncr53c400= command
194 static int __init
do_NCR53C400_setup(char *str
)
198 get_options(str
, ARRAY_SIZE(ints
), ints
);
199 internal_setup(BOARD_NCR53C400
, str
, ints
);
204 * do_NCR53C400A_setup - set up entry point
206 * @ints: integer parameters from kernel setup code
208 * Setup function invoked at boot to parse the ncr53c400a= command
212 static int __init
do_NCR53C400A_setup(char *str
)
216 get_options(str
, ARRAY_SIZE(ints
), ints
);
217 internal_setup(BOARD_NCR53C400A
, str
, ints
);
222 * do_DTC3181E_setup - set up entry point
224 * @ints: integer parameters from kernel setup code
226 * Setup function invoked at boot to parse the dtc3181e= command
230 static int __init
do_DTC3181E_setup(char *str
)
234 get_options(str
, ARRAY_SIZE(ints
), ints
);
235 internal_setup(BOARD_DTC3181E
, str
, ints
);
242 * generic_NCR5380_detect - look for NCR5380 controllers
243 * @tpnt: the scsi template
245 * Scan for the present of NCR5380, NCR53C400, NCR53C400A, DTC3181E
246 * and DTC436(ISAPnP) controllers. If overrides have been set we use
249 * The caller supplied NCR5380_init function is invoked from here, before
250 * the interrupt line is taken.
255 static int __init
generic_NCR5380_detect(struct scsi_host_template
*tpnt
)
257 static int current_override
= 0;
260 #ifndef SCSI_G_NCR5380_MEM
262 unsigned long region_size
= 16;
264 static unsigned int __initdata ncr_53c400a_ports
[] = {
265 0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
267 static unsigned int __initdata dtc_3181e_ports
[] = {
268 0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
271 struct Scsi_Host
*instance
;
272 #ifdef SCSI_G_NCR5380_MEM
277 if (ncr_irq
!= NCR_NOT_SET
)
278 overrides
[0].irq
= ncr_irq
;
279 if (ncr_dma
!= NCR_NOT_SET
)
280 overrides
[0].dma
= ncr_dma
;
281 if (ncr_addr
!= NCR_NOT_SET
)
282 overrides
[0].NCR5380_map_name
= (NCR5380_map_type
) ncr_addr
;
283 if (ncr_5380
!= NCR_NOT_SET
)
284 overrides
[0].board
= BOARD_NCR5380
;
285 else if (ncr_53c400
!= NCR_NOT_SET
)
286 overrides
[0].board
= BOARD_NCR53C400
;
287 else if (ncr_53c400a
!= NCR_NOT_SET
)
288 overrides
[0].board
= BOARD_NCR53C400A
;
289 else if (dtc_3181e
!= NCR_NOT_SET
)
290 overrides
[0].board
= BOARD_DTC3181E
;
291 #ifndef SCSI_G_NCR5380_MEM
292 if (!current_override
&& isapnp_present()) {
293 struct pnp_dev
*dev
= NULL
;
295 while ((dev
= pnp_find_dev(NULL
, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev
))) {
296 if (count
>= NO_OVERRIDES
)
298 if (pnp_device_attach(dev
) < 0)
300 if (pnp_activate_dev(dev
) < 0) {
301 printk(KERN_ERR
"dtc436e probe: activate failed\n");
302 pnp_device_detach(dev
);
305 if (!pnp_port_valid(dev
, 0)) {
306 printk(KERN_ERR
"dtc436e probe: no valid port\n");
307 pnp_device_detach(dev
);
310 if (pnp_irq_valid(dev
, 0))
311 overrides
[count
].irq
= pnp_irq(dev
, 0);
313 overrides
[count
].irq
= NO_IRQ
;
314 if (pnp_dma_valid(dev
, 0))
315 overrides
[count
].dma
= pnp_dma(dev
, 0);
317 overrides
[count
].dma
= DMA_NONE
;
318 overrides
[count
].NCR5380_map_name
= (NCR5380_map_type
) pnp_port_start(dev
, 0);
319 overrides
[count
].board
= BOARD_DTC3181E
;
324 tpnt
->proc_name
= "g_NCR5380";
326 for (count
= 0; current_override
< NO_OVERRIDES
; ++current_override
) {
327 if (!(overrides
[current_override
].NCR5380_map_name
))
331 switch (overrides
[current_override
].board
) {
333 flags
= FLAG_NO_PSEUDO_DMA
;
335 case BOARD_NCR53C400
:
336 flags
= FLAG_NCR53C400
;
338 case BOARD_NCR53C400A
:
339 flags
= FLAG_NO_PSEUDO_DMA
;
340 ports
= ncr_53c400a_ports
;
343 flags
= FLAG_NO_PSEUDO_DMA
| FLAG_DTC3181E
;
344 ports
= dtc_3181e_ports
;
348 #ifndef SCSI_G_NCR5380_MEM
350 /* wakeup sequence for the NCR53C400A and DTC3181E */
352 /* Disable the adapter and look for a free io port */
360 if (overrides
[current_override
].NCR5380_map_name
!= PORT_AUTO
)
361 for (i
= 0; ports
[i
]; i
++) {
362 if (!request_region(ports
[i
], 16, "ncr53c80"))
364 if (overrides
[current_override
].NCR5380_map_name
== ports
[i
])
366 release_region(ports
[i
], 16);
368 for (i
= 0; ports
[i
]; i
++) {
369 if (!request_region(ports
[i
], 16, "ncr53c80"))
371 if (inb(ports
[i
]) == 0xff)
373 release_region(ports
[i
], 16);
376 /* At this point we have our region reserved */
382 outb(0x80 | i
, 0x379); /* set io port to be used */
383 outb(0xc0, ports
[i
] + 9);
384 if (inb(ports
[i
] + 9) != 0x80)
387 overrides
[current_override
].NCR5380_map_name
= ports
[i
];
393 /* Not a 53C400A style setup - just grab */
394 if(!(request_region(overrides
[current_override
].NCR5380_map_name
, NCR5380_region_size
, "ncr5380")))
396 region_size
= NCR5380_region_size
;
399 base
= overrides
[current_override
].NCR5380_map_name
;
400 if (!request_mem_region(base
, NCR5380_region_size
, "ncr5380"))
402 iomem
= ioremap(base
, NCR5380_region_size
);
404 release_mem_region(base
, NCR5380_region_size
);
408 instance
= scsi_register(tpnt
, sizeof(struct NCR5380_hostdata
));
409 if (instance
== NULL
) {
410 #ifndef SCSI_G_NCR5380_MEM
411 release_region(overrides
[current_override
].NCR5380_map_name
, region_size
);
414 release_mem_region(base
, NCR5380_region_size
);
419 instance
->NCR5380_instance_name
= overrides
[current_override
].NCR5380_map_name
;
420 #ifndef SCSI_G_NCR5380_MEM
421 instance
->n_io_port
= region_size
;
423 ((struct NCR5380_hostdata
*)instance
->hostdata
)->iomem
= iomem
;
426 NCR5380_init(instance
, flags
);
428 if (overrides
[current_override
].irq
!= IRQ_AUTO
)
429 instance
->irq
= overrides
[current_override
].irq
;
431 instance
->irq
= NCR5380_probe_irq(instance
, 0xffff);
433 /* Compatibility with documented NCR5380 kernel parameters */
434 if (instance
->irq
== 255)
435 instance
->irq
= NO_IRQ
;
437 if (instance
->irq
!= NO_IRQ
)
438 if (request_irq(instance
->irq
, generic_NCR5380_intr
,
439 0, "NCR5380", instance
)) {
440 printk(KERN_WARNING
"scsi%d : IRQ%d not free, interrupts disabled\n", instance
->host_no
, instance
->irq
);
441 instance
->irq
= NO_IRQ
;
444 if (instance
->irq
== NO_IRQ
) {
445 printk(KERN_INFO
"scsi%d : interrupts not enabled. for better interactive performance,\n", instance
->host_no
);
446 printk(KERN_INFO
"scsi%d : please jumper the board for a free IRQ.\n", instance
->host_no
);
449 printk(KERN_INFO
"scsi%d : at " STRVAL(NCR5380_map_name
) " 0x%x", instance
->host_no
, (unsigned int) instance
->NCR5380_instance_name
);
450 if (instance
->irq
== NO_IRQ
)
451 printk(" interrupts disabled");
453 printk(" irq %d", instance
->irq
);
454 printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", CAN_QUEUE
, CMD_PER_LUN
, GENERIC_NCR5380_PUBLIC_RELEASE
);
455 NCR5380_print_options(instance
);
465 * generic_NCR5380_info - reporting string
466 * @host: NCR5380 to report on
468 * Report driver information for the NCR5380
471 static const char *generic_NCR5380_info(struct Scsi_Host
*host
)
473 static const char string
[] = "Generic NCR5380/53C400 Driver";
478 * generic_NCR5380_release_resources - free resources
479 * @instance: host adapter to clean up
481 * Free the generic interface resources from this adapter.
486 static int generic_NCR5380_release_resources(struct Scsi_Host
*instance
)
488 NCR5380_local_declare();
489 NCR5380_setup(instance
);
491 if (instance
->irq
!= NO_IRQ
)
492 free_irq(instance
->irq
, instance
);
493 NCR5380_exit(instance
);
495 #ifndef SCSI_G_NCR5380_MEM
496 release_region(instance
->NCR5380_instance_name
, instance
->n_io_port
);
498 iounmap(((struct NCR5380_hostdata
*)instance
->hostdata
)->iomem
);
499 release_mem_region(instance
->NCR5380_instance_name
, NCR5380_region_size
);
508 * generic_NCR5380_biosparam
509 * @disk: disk to compute geometry for
510 * @dev: device identifier for this disk
511 * @ip: sizes to fill in
513 * Generates a BIOS / DOS compatible H-C-S mapping for the specified
516 * XXX Most SCSI boards use this mapping, I could be incorrect. Someone
517 * using hard disks on a trantor should verify that this mapping
518 * corresponds to that used by the BIOS / ASPI driver by running the linux
519 * fdisk program and matching the H_C_S coordinates to what DOS uses.
525 generic_NCR5380_biosparam(struct scsi_device
*sdev
, struct block_device
*bdev
,
526 sector_t capacity
, int *ip
)
530 ip
[2] = capacity
>> 11;
535 #ifdef NCR53C400_PSEUDO_DMA
538 * NCR5380_pread - pseudo DMA read
539 * @instance: adapter to read from
540 * @dst: buffer to read into
541 * @len: buffer length
543 * Perform a pseudo DMA mode read from an NCR53C400 or equivalent
547 static inline int NCR5380_pread(struct Scsi_Host
*instance
, unsigned char *dst
, int len
)
549 int blocks
= len
/ 128;
553 NCR5380_local_declare();
554 NCR5380_setup(instance
);
556 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
| CSR_TRANS_DIR
);
557 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
559 if ((bl
= NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
562 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
563 printk(KERN_ERR
"53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
566 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
);
568 #ifndef SCSI_G_NCR5380_MEM
571 for (i
= 0; i
< 128; i
++)
572 dst
[start
+ i
] = NCR5380_read(C400_HOST_BUFFER
);
575 /* implies SCSI_G_NCR5380_MEM */
576 memcpy_fromio(dst
+ start
, iomem
+ NCR53C400_host_buffer
, 128);
583 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
585 // FIXME - no timeout
588 #ifndef SCSI_G_NCR5380_MEM
591 for (i
= 0; i
< 128; i
++)
592 dst
[start
+ i
] = NCR5380_read(C400_HOST_BUFFER
);
595 /* implies SCSI_G_NCR5380_MEM */
596 memcpy_fromio(dst
+ start
, iomem
+ NCR53C400_host_buffer
, 128);
602 if (!(NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
603 printk("53C400r: no 53C80 gated irq after transfer");
607 * DON'T DO THIS - THEY NEVER ARRIVE!
609 printk("53C400r: Waiting for 53C80 registers\n");
610 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_53C80_REG
)
613 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
))
614 printk(KERN_ERR
"53C400r: no end dma signal\n");
616 NCR5380_write(MODE_REG
, MR_BASE
);
617 NCR5380_read(RESET_PARITY_INTERRUPT_REG
);
622 * NCR5380_write - pseudo DMA write
623 * @instance: adapter to read from
624 * @dst: buffer to read into
625 * @len: buffer length
627 * Perform a pseudo DMA mode read from an NCR53C400 or equivalent
631 static inline int NCR5380_pwrite(struct Scsi_Host
*instance
, unsigned char *src
, int len
)
633 int blocks
= len
/ 128;
638 NCR5380_local_declare();
639 NCR5380_setup(instance
);
641 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
);
642 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
644 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
645 printk(KERN_ERR
"53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
649 if ((bl
= NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
652 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
654 #ifndef SCSI_G_NCR5380_MEM
656 for (i
= 0; i
< 128; i
++)
657 NCR5380_write(C400_HOST_BUFFER
, src
[start
+ i
]);
660 /* implies SCSI_G_NCR5380_MEM */
661 memcpy_toio(iomem
+ NCR53C400_host_buffer
, src
+ start
, 128);
667 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
668 ; // FIXME - no timeout
670 #ifndef SCSI_G_NCR5380_MEM
672 for (i
= 0; i
< 128; i
++)
673 NCR5380_write(C400_HOST_BUFFER
, src
[start
+ i
]);
676 /* implies SCSI_G_NCR5380_MEM */
677 memcpy_toio(iomem
+ NCR53C400_host_buffer
, src
+ start
, 128);
684 printk("53C400w: waiting for registers to be available\n");
685 THEY NEVER DO
! while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_53C80_REG
);
686 printk("53C400w: Got em\n");
689 /* Let's wait for this instead - could be ugly */
690 /* All documentation says to check for this. Maybe my hardware is too
691 * fast. Waiting for it seems to work fine! KLL
693 while (!(i
= NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
694 ; // FIXME - no timeout
697 * I know. i is certainly != 0 here but the loop is new. See previous
701 if (!((i
= NCR5380_read(BUS_AND_STATUS_REG
)) & BASR_END_DMA_TRANSFER
))
702 printk(KERN_ERR
"53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i
);
704 printk(KERN_ERR
"53C400w: no 53C80 gated irq after transfer (last block)\n");
707 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
)) {
708 printk(KERN_ERR
"53C400w: no end dma signal\n");
711 while (!(NCR5380_read(TARGET_COMMAND_REG
) & TCR_LAST_BYTE_SENT
))
715 #endif /* PSEUDO_DMA */
718 * Include the NCR5380 core code that we build our driver around
723 #define PRINTP(x) seq_printf(m, x)
726 static void sprint_opcode(struct seq_file
*m
, int opcode
)
728 PRINTP("0x%02x " ANDP opcode
);
731 static void sprint_command(struct seq_file
*m
, unsigned char *command
)
734 sprint_opcode(m
, command
[0]);
735 for (i
= 1, s
= COMMAND_SIZE(command
[0]); i
< s
; ++i
)
736 PRINTP("%02x " ANDP command
[i
]);
741 * sprintf_Scsi_Cmnd - print a scsi command
742 * @m: seq_fil to print into
743 * @cmd: SCSI command block
745 * Print out the target and command data in hex
748 static void sprint_Scsi_Cmnd(struct seq_file
*m
, Scsi_Cmnd
* cmd
)
750 PRINTP("host number %d destination target %d, lun %llu\n" ANDP cmd
->device
->host
->host_no ANDP cmd
->device
->id ANDP cmd
->device
->lun
);
751 PRINTP(" command = ");
752 sprint_command(m
, cmd
->cmnd
);
756 * generic_NCR5380_proc_info - /proc for NCR5380 driver
757 * @buffer: buffer to print into
758 * @start: start position
759 * @offset: offset into buffer
761 * @hostno: instance to affect
764 * Provide the procfs information for the 5380 controller. We fill
765 * this with useful debugging information including the commands
766 * being executed, disconnected command queue and the statistical
769 * Locks: global cli/lock for queue walk
772 static int generic_NCR5380_show_info(struct seq_file
*m
, struct Scsi_Host
*scsi_ptr
)
774 NCR5380_local_declare();
776 unsigned char status
;
779 struct NCR5380_hostdata
*hostdata
;
781 NCR5380_setup(scsi_ptr
);
782 hostdata
= (struct NCR5380_hostdata
*) scsi_ptr
->hostdata
;
784 spin_lock_irqsave(scsi_ptr
->host_lock
, flags
);
785 PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr
->host_no ANDP scsi_ptr
->hostt
->name
);
786 PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE
);
787 PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE
);
789 PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE
);
790 PRINTP("NCR53C400 card%s detected\n" ANDP(((struct NCR5380_hostdata
*) scsi_ptr
->hostdata
)->flags
& FLAG_NCR53C400
) ? "" : " not");
791 # if NCR53C400_PSEUDO_DMA
792 PRINTP("NCR53C400 pseudo DMA used\n");
795 PRINTP("NO NCR53C400 driver extensions\n");
797 PRINTP("Using %s mapping at %s 0x%lx, " ANDP
STRVAL(NCR5380_map_config
) ANDP
STRVAL(NCR5380_map_name
) ANDP scsi_ptr
->NCR5380_instance_name
);
798 if (scsi_ptr
->irq
== NO_IRQ
)
799 PRINTP("no interrupt\n");
801 PRINTP("on interrupt %d\n" ANDP scsi_ptr
->irq
);
803 status
= NCR5380_read(STATUS_REG
);
804 if (!(status
& SR_REQ
))
805 PRINTP("REQ not asserted, phase unknown.\n");
807 for (i
= 0; (phases
[i
].value
!= PHASE_UNKNOWN
) && (phases
[i
].value
!= (status
& PHASE_MASK
)); ++i
);
808 PRINTP("Phase %s\n" ANDP phases
[i
].name
);
811 if (!hostdata
->connected
) {
812 PRINTP("No currently connected command\n");
814 sprint_Scsi_Cmnd(m
, (Scsi_Cmnd
*) hostdata
->connected
);
817 PRINTP("issue_queue\n");
819 for (ptr
= (Scsi_Cmnd
*) hostdata
->issue_queue
; ptr
; ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
820 sprint_Scsi_Cmnd(m
, ptr
);
822 PRINTP("disconnected_queue\n");
824 for (ptr
= (Scsi_Cmnd
*) hostdata
->disconnected_queue
; ptr
; ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
825 sprint_Scsi_Cmnd(m
, ptr
);
827 spin_unlock_irqrestore(scsi_ptr
->host_lock
, flags
);
834 static struct scsi_host_template driver_template
= {
835 .show_info
= generic_NCR5380_show_info
,
836 .name
= "Generic NCR5380/NCR53C400 Scsi Driver",
837 .detect
= generic_NCR5380_detect
,
838 .release
= generic_NCR5380_release_resources
,
839 .info
= generic_NCR5380_info
,
840 .queuecommand
= generic_NCR5380_queue_command
,
841 .eh_abort_handler
= generic_NCR5380_abort
,
842 .eh_bus_reset_handler
= generic_NCR5380_bus_reset
,
843 .bios_param
= NCR5380_BIOSPARAM
,
844 .can_queue
= CAN_QUEUE
,
846 .sg_tablesize
= SG_ALL
,
847 .cmd_per_lun
= CMD_PER_LUN
,
848 .use_clustering
= DISABLE_CLUSTERING
,
850 #include <linux/module.h>
851 #include "scsi_module.c"
853 module_param(ncr_irq
, int, 0);
854 module_param(ncr_dma
, int, 0);
855 module_param(ncr_addr
, int, 0);
856 module_param(ncr_5380
, int, 0);
857 module_param(ncr_53c400
, int, 0);
858 module_param(ncr_53c400a
, int, 0);
859 module_param(dtc_3181e
, int, 0);
860 MODULE_LICENSE("GPL");
862 #ifndef SCSI_G_NCR5380_MEM
863 static struct isapnp_device_id id_table
[] = {
865 ISAPNP_ANY_ID
, ISAPNP_ANY_ID
,
866 ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e),
871 MODULE_DEVICE_TABLE(isapnp
, id_table
);
874 __setup("ncr5380=", do_NCR5380_setup
);
875 __setup("ncr53c400=", do_NCR53C400_setup
);
876 __setup("ncr53c400a=", do_NCR53C400A_setup
);
877 __setup("dtc3181e=", do_DTC3181E_setup
);