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
24 * For more information, please consult
27 * SCSI Protocol Controller
30 * NCR Microelectronics
31 * 1635 Aeroplaza Drive
32 * Colorado Springs, CO 80916
38 * TODO : flesh out DMA support, find some one actually using this (I have
39 * a memory mapped Trantor board that works fine)
45 * PARITY - enable parity checking. Not supported.
47 * The card is detected and initialized in one of several ways :
48 * 1. With command line overrides - NCR5380=port,irq may be
49 * used on the LILO command line to override the defaults.
51 * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is
52 * specified as an array of address, irq, dma, board tuples. Ie, for
53 * one board at 0x350, IRQ5, no dma, I could say
54 * -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE, BOARD_NCR5380}}
56 * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an
57 * IRQ line if overridden on the command line.
59 * 3. When included as a module, with arguments passed on the command line:
60 * ncr_irq=xx the interrupt
61 * ncr_addr=xx the port or base address (for port or memory
64 * ncr_5380=1 to set up for a NCR5380 board
65 * ncr_53c400=1 to set up for a NCR53C400 board
67 * modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
68 * for a port mapped NCR5380 board or
69 * modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
70 * for a memory mapped NCR53C400 board with interrupts disabled.
72 * 255 should be specified for no or DMA interrupt, 254 to autoprobe for an
73 * IRQ line if overridden on the command line.
77 /* settings for DTC3181E card with only Mustek scanner attached */
79 #define USLEEP_SLEEP 20
80 #define USLEEP_WAITLONG 500
86 #ifdef CONFIG_SCSI_GENERIC_NCR53C400
87 #define NCR53C400_PSEUDO_DMA 1
91 #undef NCR5380_STAT_LIMIT
95 #include <linux/signal.h>
96 #include <linux/blkdev.h>
98 #include <scsi/scsi_host.h>
99 #include "g_NCR5380.h"
101 #include <linux/stat.h>
102 #include <linux/init.h>
103 #include <linux/ioport.h>
104 #include <linux/isapnp.h>
105 #include <linux/delay.h>
106 #include <linux/interrupt.h>
108 #define NCR_NOT_SET 0
109 static int ncr_irq
= NCR_NOT_SET
;
110 static int ncr_dma
= NCR_NOT_SET
;
111 static int ncr_addr
= NCR_NOT_SET
;
112 static int ncr_5380
= NCR_NOT_SET
;
113 static int ncr_53c400
= NCR_NOT_SET
;
114 static int ncr_53c400a
= NCR_NOT_SET
;
115 static int dtc_3181e
= NCR_NOT_SET
;
117 static struct override
{
118 NCR5380_map_type NCR5380_map_name
;
121 int board
; /* Use NCR53c400, Ricoh, etc. extensions ? */
123 #ifdef GENERIC_NCR5380_OVERRIDE
124 [] __initdata
= GENERIC_NCR5380_OVERRIDE
;
126 [1] __initdata
= { { 0,},};
129 #define NO_OVERRIDES ARRAY_SIZE(overrides)
134 * internal_setup - handle lilo command string override
135 * @board: BOARD_* identifier for the board
137 * @ints: numeric parameters
139 * Do LILO command line initialization of the overrides array. Display
145 static void __init
internal_setup(int board
, char *str
, int *ints
)
147 static int commandline_current
= 0;
150 if (ints
[0] != 2 && ints
[0] != 3) {
151 printk(KERN_ERR
"generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name
) ",irq,dma\n");
155 case BOARD_NCR53C400
:
157 printk(KERN_ERR
"generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name
) ",irq\n");
161 case BOARD_NCR53C400A
:
163 printk(KERN_ERR
"generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name
) ",irq\n");
169 printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name
) ",irq\n");
175 if (commandline_current
< NO_OVERRIDES
) {
176 overrides
[commandline_current
].NCR5380_map_name
= (NCR5380_map_type
) ints
[1];
177 overrides
[commandline_current
].irq
= ints
[2];
179 overrides
[commandline_current
].dma
= ints
[3];
181 overrides
[commandline_current
].dma
= DMA_NONE
;
182 overrides
[commandline_current
].board
= board
;
183 ++commandline_current
;
189 * do_NCR53C80_setup - set up entry point
192 * Setup function invoked at boot to parse the ncr5380= command
196 static int __init
do_NCR5380_setup(char *str
)
200 get_options(str
, ARRAY_SIZE(ints
), ints
);
201 internal_setup(BOARD_NCR5380
, str
, ints
);
206 * do_NCR53C400_setup - set up entry point
208 * @ints: integer parameters from kernel setup code
210 * Setup function invoked at boot to parse the ncr53c400= command
214 static int __init
do_NCR53C400_setup(char *str
)
218 get_options(str
, ARRAY_SIZE(ints
), ints
);
219 internal_setup(BOARD_NCR53C400
, str
, ints
);
224 * do_NCR53C400A_setup - set up entry point
226 * @ints: integer parameters from kernel setup code
228 * Setup function invoked at boot to parse the ncr53c400a= command
232 static int __init
do_NCR53C400A_setup(char *str
)
236 get_options(str
, ARRAY_SIZE(ints
), ints
);
237 internal_setup(BOARD_NCR53C400A
, str
, ints
);
242 * do_DTC3181E_setup - set up entry point
244 * @ints: integer parameters from kernel setup code
246 * Setup function invoked at boot to parse the dtc3181e= command
250 static int __init
do_DTC3181E_setup(char *str
)
254 get_options(str
, ARRAY_SIZE(ints
), ints
);
255 internal_setup(BOARD_DTC3181E
, str
, ints
);
262 * generic_NCR5380_detect - look for NCR5380 controllers
263 * @tpnt: the scsi template
265 * Scan for the present of NCR5380, NCR53C400, NCR53C400A, DTC3181E
266 * and DTC436(ISAPnP) controllers. If overrides have been set we use
269 * The caller supplied NCR5380_init function is invoked from here, before
270 * the interrupt line is taken.
275 int __init
generic_NCR5380_detect(struct scsi_host_template
* tpnt
)
277 static int current_override
= 0;
280 #ifndef SCSI_G_NCR5380_MEM
282 unsigned long region_size
= 16;
284 static unsigned int __initdata ncr_53c400a_ports
[] = {
285 0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
287 static unsigned int __initdata dtc_3181e_ports
[] = {
288 0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
291 struct Scsi_Host
*instance
;
292 #ifdef SCSI_G_NCR5380_MEM
297 if (ncr_irq
!= NCR_NOT_SET
)
298 overrides
[0].irq
= ncr_irq
;
299 if (ncr_dma
!= NCR_NOT_SET
)
300 overrides
[0].dma
= ncr_dma
;
301 if (ncr_addr
!= NCR_NOT_SET
)
302 overrides
[0].NCR5380_map_name
= (NCR5380_map_type
) ncr_addr
;
303 if (ncr_5380
!= NCR_NOT_SET
)
304 overrides
[0].board
= BOARD_NCR5380
;
305 else if (ncr_53c400
!= NCR_NOT_SET
)
306 overrides
[0].board
= BOARD_NCR53C400
;
307 else if (ncr_53c400a
!= NCR_NOT_SET
)
308 overrides
[0].board
= BOARD_NCR53C400A
;
309 else if (dtc_3181e
!= NCR_NOT_SET
)
310 overrides
[0].board
= BOARD_DTC3181E
;
311 #ifndef SCSI_G_NCR5380_MEM
312 if (!current_override
&& isapnp_present()) {
313 struct pnp_dev
*dev
= NULL
;
315 while ((dev
= pnp_find_dev(NULL
, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev
))) {
316 if (count
>= NO_OVERRIDES
)
318 if (pnp_device_attach(dev
) < 0)
320 if (pnp_activate_dev(dev
) < 0) {
321 printk(KERN_ERR
"dtc436e probe: activate failed\n");
322 pnp_device_detach(dev
);
325 if (!pnp_port_valid(dev
, 0)) {
326 printk(KERN_ERR
"dtc436e probe: no valid port\n");
327 pnp_device_detach(dev
);
330 if (pnp_irq_valid(dev
, 0))
331 overrides
[count
].irq
= pnp_irq(dev
, 0);
333 overrides
[count
].irq
= SCSI_IRQ_NONE
;
334 if (pnp_dma_valid(dev
, 0))
335 overrides
[count
].dma
= pnp_dma(dev
, 0);
337 overrides
[count
].dma
= DMA_NONE
;
338 overrides
[count
].NCR5380_map_name
= (NCR5380_map_type
) pnp_port_start(dev
, 0);
339 overrides
[count
].board
= BOARD_DTC3181E
;
344 tpnt
->proc_name
= "g_NCR5380";
346 for (count
= 0; current_override
< NO_OVERRIDES
; ++current_override
) {
347 if (!(overrides
[current_override
].NCR5380_map_name
))
351 switch (overrides
[current_override
].board
) {
353 flags
= FLAG_NO_PSEUDO_DMA
;
355 case BOARD_NCR53C400
:
356 flags
= FLAG_NCR53C400
;
358 case BOARD_NCR53C400A
:
359 flags
= FLAG_NO_PSEUDO_DMA
;
360 ports
= ncr_53c400a_ports
;
363 flags
= FLAG_NO_PSEUDO_DMA
| FLAG_DTC3181E
;
364 ports
= dtc_3181e_ports
;
368 #ifndef SCSI_G_NCR5380_MEM
370 /* wakeup sequence for the NCR53C400A and DTC3181E */
372 /* Disable the adapter and look for a free io port */
380 if (overrides
[current_override
].NCR5380_map_name
!= PORT_AUTO
)
381 for (i
= 0; ports
[i
]; i
++) {
382 if (!request_region(ports
[i
], 16, "ncr53c80"))
384 if (overrides
[current_override
].NCR5380_map_name
== ports
[i
])
386 release_region(ports
[i
], 16);
388 for (i
= 0; ports
[i
]; i
++) {
389 if (!request_region(ports
[i
], 16, "ncr53c80"))
391 if (inb(ports
[i
]) == 0xff)
393 release_region(ports
[i
], 16);
396 /* At this point we have our region reserved */
402 outb(0x80 | i
, 0x379); /* set io port to be used */
403 outb(0xc0, ports
[i
] + 9);
404 if (inb(ports
[i
] + 9) != 0x80)
407 overrides
[current_override
].NCR5380_map_name
= ports
[i
];
413 /* Not a 53C400A style setup - just grab */
414 if(!(request_region(overrides
[current_override
].NCR5380_map_name
, NCR5380_region_size
, "ncr5380")))
416 region_size
= NCR5380_region_size
;
419 base
= overrides
[current_override
].NCR5380_map_name
;
420 if (!request_mem_region(base
, NCR5380_region_size
, "ncr5380"))
422 iomem
= ioremap(base
, NCR5380_region_size
);
424 release_mem_region(base
, NCR5380_region_size
);
428 instance
= scsi_register(tpnt
, sizeof(struct NCR5380_hostdata
));
429 if (instance
== NULL
) {
430 #ifndef SCSI_G_NCR5380_MEM
431 release_region(overrides
[current_override
].NCR5380_map_name
, region_size
);
434 release_mem_region(base
, NCR5380_region_size
);
439 instance
->NCR5380_instance_name
= overrides
[current_override
].NCR5380_map_name
;
440 #ifndef SCSI_G_NCR5380_MEM
441 instance
->n_io_port
= region_size
;
443 ((struct NCR5380_hostdata
*)instance
->hostdata
)->iomem
= iomem
;
446 NCR5380_init(instance
, flags
);
448 if (overrides
[current_override
].irq
!= IRQ_AUTO
)
449 instance
->irq
= overrides
[current_override
].irq
;
451 instance
->irq
= NCR5380_probe_irq(instance
, 0xffff);
453 if (instance
->irq
!= SCSI_IRQ_NONE
)
454 if (request_irq(instance
->irq
, generic_NCR5380_intr
,
455 0, "NCR5380", instance
)) {
456 printk(KERN_WARNING
"scsi%d : IRQ%d not free, interrupts disabled\n", instance
->host_no
, instance
->irq
);
457 instance
->irq
= SCSI_IRQ_NONE
;
460 if (instance
->irq
== SCSI_IRQ_NONE
) {
461 printk(KERN_INFO
"scsi%d : interrupts not enabled. for better interactive performance,\n", instance
->host_no
);
462 printk(KERN_INFO
"scsi%d : please jumper the board for a free IRQ.\n", instance
->host_no
);
465 printk(KERN_INFO
"scsi%d : at " STRVAL(NCR5380_map_name
) " 0x%x", instance
->host_no
, (unsigned int) instance
->NCR5380_instance_name
);
466 if (instance
->irq
== SCSI_IRQ_NONE
)
467 printk(" interrupts disabled");
469 printk(" irq %d", instance
->irq
);
470 printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", CAN_QUEUE
, CMD_PER_LUN
, GENERIC_NCR5380_PUBLIC_RELEASE
);
471 NCR5380_print_options(instance
);
481 * generic_NCR5380_info - reporting string
482 * @host: NCR5380 to report on
484 * Report driver information for the NCR5380
487 const char *generic_NCR5380_info(struct Scsi_Host
*host
)
489 static const char string
[] = "Generic NCR5380/53C400 Driver";
494 * generic_NCR5380_release_resources - free resources
495 * @instance: host adapter to clean up
497 * Free the generic interface resources from this adapter.
502 int generic_NCR5380_release_resources(struct Scsi_Host
*instance
)
504 NCR5380_local_declare();
505 NCR5380_setup(instance
);
507 if (instance
->irq
!= SCSI_IRQ_NONE
)
508 free_irq(instance
->irq
, instance
);
509 NCR5380_exit(instance
);
511 #ifndef SCSI_G_NCR5380_MEM
512 release_region(instance
->NCR5380_instance_name
, instance
->n_io_port
);
514 iounmap(((struct NCR5380_hostdata
*)instance
->hostdata
)->iomem
);
515 release_mem_region(instance
->NCR5380_instance_name
, NCR5380_region_size
);
524 * generic_NCR5380_biosparam
525 * @disk: disk to compute geometry for
526 * @dev: device identifier for this disk
527 * @ip: sizes to fill in
529 * Generates a BIOS / DOS compatible H-C-S mapping for the specified
532 * XXX Most SCSI boards use this mapping, I could be incorrect. Someone
533 * using hard disks on a trantor should verify that this mapping
534 * corresponds to that used by the BIOS / ASPI driver by running the linux
535 * fdisk program and matching the H_C_S coordinates to what DOS uses.
541 generic_NCR5380_biosparam(struct scsi_device
*sdev
, struct block_device
*bdev
,
542 sector_t capacity
, int *ip
)
546 ip
[2] = capacity
>> 11;
551 #ifdef NCR53C400_PSEUDO_DMA
554 * NCR5380_pread - pseudo DMA read
555 * @instance: adapter to read from
556 * @dst: buffer to read into
557 * @len: buffer length
559 * Perform a pseudo DMA mode read from an NCR53C400 or equivalent
563 static inline int NCR5380_pread(struct Scsi_Host
*instance
, unsigned char *dst
, int len
)
565 int blocks
= len
/ 128;
569 NCR5380_local_declare();
570 NCR5380_setup(instance
);
572 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
| CSR_TRANS_DIR
);
573 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
575 if ((bl
= NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
578 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
579 printk(KERN_ERR
"53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
582 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
);
584 #ifndef SCSI_G_NCR5380_MEM
587 for (i
= 0; i
< 128; i
++)
588 dst
[start
+ i
] = NCR5380_read(C400_HOST_BUFFER
);
591 /* implies SCSI_G_NCR5380_MEM */
592 memcpy_fromio(dst
+ start
, iomem
+ NCR53C400_host_buffer
, 128);
599 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
601 // FIXME - no timeout
604 #ifndef SCSI_G_NCR5380_MEM
607 for (i
= 0; i
< 128; i
++)
608 dst
[start
+ i
] = NCR5380_read(C400_HOST_BUFFER
);
611 /* implies SCSI_G_NCR5380_MEM */
612 memcpy_fromio(dst
+ start
, iomem
+ NCR53C400_host_buffer
, 128);
618 if (!(NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
619 printk("53C400r: no 53C80 gated irq after transfer");
623 * DON'T DO THIS - THEY NEVER ARRIVE!
625 printk("53C400r: Waiting for 53C80 registers\n");
626 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_53C80_REG
)
629 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
))
630 printk(KERN_ERR
"53C400r: no end dma signal\n");
632 NCR5380_write(MODE_REG
, MR_BASE
);
633 NCR5380_read(RESET_PARITY_INTERRUPT_REG
);
638 * NCR5380_write - pseudo DMA write
639 * @instance: adapter to read from
640 * @dst: buffer to read into
641 * @len: buffer length
643 * Perform a pseudo DMA mode read from an NCR53C400 or equivalent
647 static inline int NCR5380_pwrite(struct Scsi_Host
*instance
, unsigned char *src
, int len
)
649 int blocks
= len
/ 128;
654 NCR5380_local_declare();
655 NCR5380_setup(instance
);
657 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
);
658 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
660 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
661 printk(KERN_ERR
"53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
665 if ((bl
= NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
668 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
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);
683 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
684 ; // FIXME - no timeout
686 #ifndef SCSI_G_NCR5380_MEM
688 for (i
= 0; i
< 128; i
++)
689 NCR5380_write(C400_HOST_BUFFER
, src
[start
+ i
]);
692 /* implies SCSI_G_NCR5380_MEM */
693 memcpy_toio(iomem
+ NCR53C400_host_buffer
, src
+ start
, 128);
700 printk("53C400w: waiting for registers to be available\n");
701 THEY NEVER DO
! while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_53C80_REG
);
702 printk("53C400w: Got em\n");
705 /* Let's wait for this instead - could be ugly */
706 /* All documentation says to check for this. Maybe my hardware is too
707 * fast. Waiting for it seems to work fine! KLL
709 while (!(i
= NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
710 ; // FIXME - no timeout
713 * I know. i is certainly != 0 here but the loop is new. See previous
717 if (!((i
= NCR5380_read(BUS_AND_STATUS_REG
)) & BASR_END_DMA_TRANSFER
))
718 printk(KERN_ERR
"53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i
);
720 printk(KERN_ERR
"53C400w: no 53C80 gated irq after transfer (last block)\n");
723 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
)) {
724 printk(KERN_ERR
"53C400w: no end dma signal\n");
727 while (!(NCR5380_read(TARGET_COMMAND_REG
) & TCR_LAST_BYTE_SENT
))
731 #endif /* PSEUDO_DMA */
734 * Include the NCR5380 core code that we build our driver around
739 #define PRINTP(x) seq_printf(m, x)
742 static void sprint_opcode(struct seq_file
*m
, int opcode
)
744 PRINTP("0x%02x " ANDP opcode
);
747 static void sprint_command(struct seq_file
*m
, unsigned char *command
)
750 sprint_opcode(m
, command
[0]);
751 for (i
= 1, s
= COMMAND_SIZE(command
[0]); i
< s
; ++i
)
752 PRINTP("%02x " ANDP command
[i
]);
757 * sprintf_Scsi_Cmnd - print a scsi command
758 * @m: seq_fil to print into
759 * @cmd: SCSI command block
761 * Print out the target and command data in hex
764 static void sprint_Scsi_Cmnd(struct seq_file
*m
, Scsi_Cmnd
* cmd
)
766 PRINTP("host number %d destination target %d, lun %llu\n" ANDP cmd
->device
->host
->host_no ANDP cmd
->device
->id ANDP cmd
->device
->lun
);
767 PRINTP(" command = ");
768 sprint_command(m
, cmd
->cmnd
);
772 * generic_NCR5380_proc_info - /proc for NCR5380 driver
773 * @buffer: buffer to print into
774 * @start: start position
775 * @offset: offset into buffer
777 * @hostno: instance to affect
780 * Provide the procfs information for the 5380 controller. We fill
781 * this with useful debugging information including the commands
782 * being executed, disconnected command queue and the statistical
785 * Locks: global cli/lock for queue walk
788 static int generic_NCR5380_show_info(struct seq_file
*m
, struct Scsi_Host
*scsi_ptr
)
790 NCR5380_local_declare();
792 unsigned char status
;
795 struct NCR5380_hostdata
*hostdata
;
797 struct scsi_device
*dev
;
800 NCR5380_setup(scsi_ptr
);
801 hostdata
= (struct NCR5380_hostdata
*) scsi_ptr
->hostdata
;
803 spin_lock_irqsave(scsi_ptr
->host_lock
, flags
);
804 PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr
->host_no ANDP scsi_ptr
->hostt
->name
);
805 PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE
);
806 PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE
);
808 PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE
);
809 PRINTP("NCR53C400 card%s detected\n" ANDP(((struct NCR5380_hostdata
*) scsi_ptr
->hostdata
)->flags
& FLAG_NCR53C400
) ? "" : " not");
810 # if NCR53C400_PSEUDO_DMA
811 PRINTP("NCR53C400 pseudo DMA used\n");
814 PRINTP("NO NCR53C400 driver extensions\n");
816 PRINTP("Using %s mapping at %s 0x%lx, " ANDP
STRVAL(NCR5380_map_config
) ANDP
STRVAL(NCR5380_map_name
) ANDP scsi_ptr
->NCR5380_instance_name
);
817 if (scsi_ptr
->irq
== SCSI_IRQ_NONE
)
818 PRINTP("no interrupt\n");
820 PRINTP("on interrupt %d\n" ANDP scsi_ptr
->irq
);
823 if (hostdata
->connected
|| hostdata
->issue_queue
|| hostdata
->disconnected_queue
)
824 PRINTP("There are commands pending, transfer rates may be crud\n");
825 if (hostdata
->pendingr
)
826 PRINTP(" %d pending reads" ANDP hostdata
->pendingr
);
827 if (hostdata
->pendingw
)
828 PRINTP(" %d pending writes" ANDP hostdata
->pendingw
);
829 if (hostdata
->pendingr
|| hostdata
->pendingw
)
831 shost_for_each_device(dev
, scsi_ptr
) {
832 unsigned long br
= hostdata
->bytes_read
[dev
->id
];
833 unsigned long bw
= hostdata
->bytes_write
[dev
->id
];
834 long tr
= hostdata
->time_read
[dev
->id
] / HZ
;
835 long tw
= hostdata
->time_write
[dev
->id
] / HZ
;
837 PRINTP(" T:%d %s " ANDP dev
->id ANDP
scsi_device_type(dev
->type
));
838 for (i
= 0; i
< 8; i
++)
839 if (dev
->vendor
[i
] >= 0x20)
840 seq_putc(m
, dev
->vendor
[i
]);
842 for (i
= 0; i
< 16; i
++)
843 if (dev
->model
[i
] >= 0x20)
844 seq_putc(m
, dev
->model
[i
]);
846 for (i
= 0; i
< 4; i
++)
847 if (dev
->rev
[i
] >= 0x20)
848 seq_putc(m
, dev
->rev
[i
]);
851 PRINTP("\n%10ld kb read in %5ld secs" ANDP br
/ 1024 ANDP tr
);
853 PRINTP(" @ %5ld bps" ANDP br
/ tr
);
855 PRINTP("\n%10ld kb written in %5ld secs" ANDP bw
/ 1024 ANDP tw
);
857 PRINTP(" @ %5ld bps" ANDP bw
/ tw
);
862 status
= NCR5380_read(STATUS_REG
);
863 if (!(status
& SR_REQ
))
864 PRINTP("REQ not asserted, phase unknown.\n");
866 for (i
= 0; (phases
[i
].value
!= PHASE_UNKNOWN
) && (phases
[i
].value
!= (status
& PHASE_MASK
)); ++i
);
867 PRINTP("Phase %s\n" ANDP phases
[i
].name
);
870 if (!hostdata
->connected
) {
871 PRINTP("No currently connected command\n");
873 sprint_Scsi_Cmnd(m
, (Scsi_Cmnd
*) hostdata
->connected
);
876 PRINTP("issue_queue\n");
878 for (ptr
= (Scsi_Cmnd
*) hostdata
->issue_queue
; ptr
; ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
879 sprint_Scsi_Cmnd(m
, ptr
);
881 PRINTP("disconnected_queue\n");
883 for (ptr
= (Scsi_Cmnd
*) hostdata
->disconnected_queue
; ptr
; ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
884 sprint_Scsi_Cmnd(m
, ptr
);
886 spin_unlock_irqrestore(scsi_ptr
->host_lock
, flags
);
893 static struct scsi_host_template driver_template
= {
894 .show_info
= generic_NCR5380_show_info
,
895 .name
= "Generic NCR5380/NCR53C400 Scsi Driver",
896 .detect
= generic_NCR5380_detect
,
897 .release
= generic_NCR5380_release_resources
,
898 .info
= generic_NCR5380_info
,
899 .queuecommand
= generic_NCR5380_queue_command
,
900 .eh_abort_handler
= generic_NCR5380_abort
,
901 .eh_bus_reset_handler
= generic_NCR5380_bus_reset
,
902 .bios_param
= NCR5380_BIOSPARAM
,
903 .can_queue
= CAN_QUEUE
,
905 .sg_tablesize
= SG_ALL
,
906 .cmd_per_lun
= CMD_PER_LUN
,
907 .use_clustering
= DISABLE_CLUSTERING
,
909 #include <linux/module.h>
910 #include "scsi_module.c"
912 module_param(ncr_irq
, int, 0);
913 module_param(ncr_dma
, int, 0);
914 module_param(ncr_addr
, int, 0);
915 module_param(ncr_5380
, int, 0);
916 module_param(ncr_53c400
, int, 0);
917 module_param(ncr_53c400a
, int, 0);
918 module_param(dtc_3181e
, int, 0);
919 MODULE_LICENSE("GPL");
921 #ifndef SCSI_G_NCR5380_MEM
922 static struct isapnp_device_id id_table
[] = {
924 ISAPNP_ANY_ID
, ISAPNP_ANY_ID
,
925 ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e),
930 MODULE_DEVICE_TABLE(isapnp
, id_table
);
933 __setup("ncr5380=", do_NCR5380_setup
);
934 __setup("ncr53c400=", do_NCR53C400_setup
);
935 __setup("ncr53c400a=", do_NCR53C400A_setup
);
936 __setup("dtc3181e=", do_DTC3181E_setup
);