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
21 * For more information, please consult
24 * SCSI Protocol Controller
27 * NCR Microelectronics
28 * 1635 Aeroplaza Drive
29 * Colorado Springs, CO 80916
35 * TODO : flesh out DMA support, find some one actually using this (I have
36 * a memory mapped Trantor board that works fine)
42 * PARITY - enable parity checking. Not supported.
44 * SCSI2 - enable support for SCSI-II tagged queueing. Untested.
46 * USLEEP - enable support for devices that don't disconnect. Untested.
48 * The card is detected and initialized in one of several ways :
49 * 1. With command line overrides - NCR5380=port,irq may be
50 * used on the LILO command line to override the defaults.
52 * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is
53 * specified as an array of address, irq, dma, board tuples. Ie, for
54 * one board at 0x350, IRQ5, no dma, I could say
55 * -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE, BOARD_NCR5380}}
57 * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an
58 * IRQ line if overridden on the command line.
60 * 3. When included as a module, with arguments passed on the command line:
61 * ncr_irq=xx the interrupt
62 * ncr_addr=xx the port or base address (for port or memory
65 * ncr_5380=1 to set up for a NCR5380 board
66 * ncr_53c400=1 to set up for a NCR53C400 board
68 * modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
69 * for a port mapped NCR5380 board or
70 * modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
71 * for a memory mapped NCR53C400 board with interrupts disabled.
73 * 255 should be specified for no or DMA interrupt, 254 to autoprobe for an
74 * IRQ line if overridden on the command line.
79 * $Log: generic_NCR5380.c,v $
82 /* settings for DTC3181E card with only Mustek scanner attached */
85 #define USLEEP_SLEEP 20
86 #define USLEEP_WAITLONG 500
91 #include <linux/config.h>
93 #ifdef CONFIG_SCSI_GENERIC_NCR53C400
94 #define NCR53C400_PSEUDO_DMA 1
98 #undef NCR5380_STAT_LIMIT
100 #if defined(CONFIG_SCSI_G_NCR5380_PORT) && defined(CONFIG_SCSI_G_NCR5380_MEM)
101 #error You can not configure the Generic NCR 5380 SCSI Driver for memory mapped I/O and port mapped I/O at the same time (yet)
103 #if !defined(CONFIG_SCSI_G_NCR5380_PORT) && !defined(CONFIG_SCSI_G_NCR5380_MEM)
104 #error You must configure the Generic NCR 5380 SCSI Driver for one of memory mapped I/O and port mapped I/O.
107 #include <asm/system.h>
109 #include <linux/signal.h>
110 #include <linux/sched.h>
111 #include <linux/blk.h>
114 #include "g_NCR5380.h"
116 #include "constants.h"
118 #include <linux/stat.h>
119 #include <linux/init.h>
120 #include<linux/ioport.h>
122 struct proc_dir_entry proc_scsi_g_ncr5380
= {
123 PROC_SCSI_GENERIC_NCR5380
, 9, "g_NCR5380",
124 S_IFDIR
| S_IRUGO
| S_IXUGO
, 2
127 #define NCR_NOT_SET 0
128 static int ncr_irq
=NCR_NOT_SET
;
129 static int ncr_dma
=NCR_NOT_SET
;
130 static int ncr_addr
=NCR_NOT_SET
;
131 static int ncr_5380
=NCR_NOT_SET
;
132 static int ncr_53c400
=NCR_NOT_SET
;
133 static int ncr_53c400a
=NCR_NOT_SET
;
134 static int dtc_3181e
=NCR_NOT_SET
;
136 static struct override
{
137 NCR5380_implementation_fields
;
140 int board
; /* Use NCR53c400, Ricoh, etc. extensions ? */
142 #ifdef GENERIC_NCR5380_OVERRIDE
143 [] __initdata
= GENERIC_NCR5380_OVERRIDE
145 [1] __initdata
= {{0,},};
148 #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override))
151 * Function : static internal_setup(int board, char *str, int *ints)
153 * Purpose : LILO command line initialization of the overrides array,
155 * Inputs : board - either BOARD_NCR5380 for a normal NCR5380 board,
156 * or BOARD_NCR53C400 for a NCR53C400 board. str - unused, ints -
157 * array of integer parameters with ints[0] equal to the number of ints.
161 static void __init
internal_setup(int board
, char *str
, int *ints
){
162 static int commandline_current
= 0;
165 if (ints
[0] != 2 && ints
[0] != 3) {
166 printk("generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name
) ",irq,dma\n");
169 case BOARD_NCR53C400
:
171 printk("generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name
) ",irq\n");
174 case BOARD_NCR53C400A
:
176 printk("generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name
) ",irq\n");
181 printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name
) ",irq\n");
186 if (commandline_current
< NO_OVERRIDES
) {
187 overrides
[commandline_current
].NCR5380_map_name
= (NCR5380_map_type
)ints
[1];
188 overrides
[commandline_current
].irq
= ints
[2];
190 overrides
[commandline_current
].dma
= ints
[3];
192 overrides
[commandline_current
].dma
= DMA_NONE
;
193 overrides
[commandline_current
].board
= board
;
194 ++commandline_current
;
199 * Function : generic_NCR5380_setup (char *str, int *ints)
201 * Purpose : LILO command line initialization of the overrides array,
203 * Inputs : str - unused, ints - array of integer parameters with ints[0]
204 * equal to the number of ints.
207 void __init
generic_NCR5380_setup (char *str
, int *ints
){
208 internal_setup (BOARD_NCR5380
, str
, ints
);
212 * Function : generic_NCR53C400_setup (char *str, int *ints)
214 * Purpose : LILO command line initialization of the overrides array,
216 * Inputs : str - unused, ints - array of integer parameters with ints[0]
217 * equal to the number of ints.
220 void __init
generic_NCR53C400_setup (char *str
, int *ints
){
221 internal_setup (BOARD_NCR53C400
, str
, ints
);
225 * Function : generic_NCR53C400A_setup (char *str, int *ints)
227 * Purpose : LILO command line initialization of the overrides array,
229 * Inputs : str - unused, ints - array of integer parameters with ints[0]
230 * equal to the number of ints.
233 void generic_NCR53C400A_setup (char *str
, int *ints
) {
234 internal_setup (BOARD_NCR53C400A
, str
, ints
);
238 * Function : generic_DTC3181E_setup (char *str, int *ints)
240 * Purpose : LILO command line initialization of the overrides array,
242 * Inputs : str - unused, ints - array of integer parameters with ints[0]
243 * equal to the number of ints.
246 void generic_DTC3181E_setup (char *str
, int *ints
) {
247 internal_setup (BOARD_DTC3181E
, str
, ints
);
251 * Function : int generic_NCR5380_detect(Scsi_Host_Template * tpnt)
253 * Purpose : initializes generic NCR5380 driver based on the
254 * command line / compile time port and irq definitions.
256 * Inputs : tpnt - template for this SCSI adapter.
258 * Returns : 1 if a host adapter was found, 0 if not.
262 int __init
generic_NCR5380_detect(Scsi_Host_Template
* tpnt
){
263 static int current_override
= 0;
266 u_int ncr_53c400a_ports
[] = {0x280, 0x290, 0x300, 0x310, 0x330,
267 0x340, 0x348, 0x350, 0};
268 u_int dtc_3181e_ports
[] = {0x220, 0x240, 0x280, 0x2a0, 0x2c0,
269 0x300, 0x320, 0x340, 0};
271 struct Scsi_Host
*instance
;
273 if (ncr_irq
!= NCR_NOT_SET
)
274 overrides
[0].irq
=ncr_irq
;
275 if (ncr_dma
!= NCR_NOT_SET
)
276 overrides
[0].dma
=ncr_dma
;
277 if (ncr_addr
!= NCR_NOT_SET
)
278 overrides
[0].NCR5380_map_name
=(NCR5380_map_type
)ncr_addr
;
279 if (ncr_5380
!= NCR_NOT_SET
)
280 overrides
[0].board
=BOARD_NCR5380
;
281 else if (ncr_53c400
!= NCR_NOT_SET
)
282 overrides
[0].board
=BOARD_NCR53C400
;
283 else if (ncr_53c400a
!= NCR_NOT_SET
)
284 overrides
[0].board
=BOARD_NCR53C400A
;
285 else if (dtc_3181e
!= NCR_NOT_SET
)
286 overrides
[0].board
=BOARD_DTC3181E
;
288 tpnt
->proc_dir
= &proc_scsi_g_ncr5380
;
290 for (count
= 0; current_override
< NO_OVERRIDES
; ++current_override
) {
291 if (!(overrides
[current_override
].NCR5380_map_name
))
295 switch (overrides
[current_override
].board
) {
297 flags
= FLAG_NO_PSEUDO_DMA
;
299 case BOARD_NCR53C400
:
300 flags
= FLAG_NCR53C400
;
302 case BOARD_NCR53C400A
:
303 flags
= FLAG_NO_PSEUDO_DMA
;
304 ports
= ncr_53c400a_ports
;
307 flags
= FLAG_NO_PSEUDO_DMA
| FLAG_DTC3181E
;
308 ports
= dtc_3181e_ports
;
313 /* wakeup sequence for the NCR53C400A and DTC3181E*/
315 /* Disable the adapter and look for a free io port */
323 if (overrides
[current_override
].NCR5380_map_name
!= PORT_AUTO
)
324 for(i
=0; ports
[i
]; i
++) {
325 if (overrides
[current_override
].NCR5380_map_name
== ports
[i
])
329 for(i
=0; ports
[i
]; i
++) {
330 if ((!check_region(ports
[i
], 16)) && (inb(ports
[i
]) == 0xff))
339 outb(0x80 | i
, 0x379); /* set io port to be used */
340 outb(0xc0, ports
[i
] + 9);
341 if (inb(ports
[i
] + 9) != 0x80)
344 overrides
[current_override
].NCR5380_map_name
=ports
[i
];
349 request_region(overrides
[current_override
].NCR5380_map_name
,
350 NCR5380_region_size
, "ncr5380");
352 instance
= scsi_register (tpnt
, sizeof(struct NCR5380_hostdata
));
353 instance
->NCR5380_instance_name
= overrides
[current_override
].NCR5380_map_name
;
355 NCR5380_init(instance
, flags
);
357 if (overrides
[current_override
].irq
!= IRQ_AUTO
)
358 instance
->irq
= overrides
[current_override
].irq
;
360 instance
->irq
= NCR5380_probe_irq(instance
, 0xffff);
362 if (instance
->irq
!= IRQ_NONE
)
363 if (request_irq(instance
->irq
, do_generic_NCR5380_intr
, SA_INTERRUPT
, "NCR5380", NULL
)) {
364 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
365 instance
->host_no
, instance
->irq
);
366 instance
->irq
= IRQ_NONE
;
369 if (instance
->irq
== IRQ_NONE
) {
370 printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance
->host_no
);
371 printk("scsi%d : please jumper the board for a free IRQ.\n", instance
->host_no
);
374 printk("scsi%d : at " STRVAL(NCR5380_map_name
) " 0x%x", instance
->host_no
, (unsigned int)instance
->NCR5380_instance_name
);
375 if (instance
->irq
== IRQ_NONE
)
376 printk (" interrupts disabled");
378 printk (" irq %d", instance
->irq
);
379 printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
380 CAN_QUEUE
, CMD_PER_LUN
, GENERIC_NCR5380_PUBLIC_RELEASE
);
381 NCR5380_print_options(instance
);
390 const char * generic_NCR5380_info (struct Scsi_Host
* host
) {
391 static const char string
[]="Generic NCR5380/53C400 Driver";
395 int generic_NCR5380_release_resources(struct Scsi_Host
* instance
)
397 NCR5380_local_declare();
399 NCR5380_setup(instance
);
401 release_region(instance
->NCR5380_instance_name
, NCR5380_region_size
);
403 if (instance
->irq
!= IRQ_NONE
)
404 free_irq(instance
->irq
, NULL
);
411 * Function : int generic_NCR5380_biosparam(Disk * disk, kdev_t dev, int *ip)
413 * Purpose : Generates a BIOS / DOS compatible H-C-S mapping for
414 * the specified device / size.
416 * Inputs : size = size of device in sectors (512 bytes), dev = block device
417 * major / minor, ip[] = {heads, sectors, cylinders}
419 * Returns : always 0 (success), initializes ip
424 * XXX Most SCSI boards use this mapping, I could be incorrect. Some one
425 * using hard disks on a trantor should verify that this mapping corresponds
426 * to that used by the BIOS / ASPI driver by running the linux fdisk program
427 * and matching the H_C_S coordinates to what DOS uses.
430 int generic_NCR5380_biosparam(Disk
* disk
, kdev_t dev
, int *ip
)
432 int size
= disk
->capacity
;
440 #if NCR53C400_PSEUDO_DMA
441 static inline int NCR5380_pread (struct Scsi_Host
*instance
, unsigned char *dst
, int len
)
443 int blocks
= len
/ 128;
446 #ifdef CONFIG_SCSI_G_NCR5380_PORT
450 NCR5380_local_declare();
452 NCR5380_setup(instance
);
454 #if (NDEBUG & NDEBUG_C400_PREAD)
455 printk("53C400r: About to read %d blocks for %d bytes\n", blocks
, len
);
458 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
| CSR_TRANS_DIR
);
459 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
462 #if (NDEBUG & NDEBUG_C400_PREAD)
463 printk("53C400r: %d blocks left\n", blocks
);
466 if ((bl
=NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
467 #if (NDEBUG & NDEBUG_C400_PREAD)
469 printk("53C400r: blocks still == %d\n", blocks
);
471 printk("53C400r: Exiting loop\n");
477 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
478 printk("53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
483 #if (NDEBUG & NDEBUG_C400_PREAD)
484 printk("53C400r: Waiting for buffer, bl=%d\n", bl
);
487 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
489 #if (NDEBUG & NDEBUG_C400_PREAD)
490 printk("53C400r: Transferring 128 bytes\n");
493 #ifdef CONFIG_SCSI_G_NCR5380_PORT
494 for (i
=0; i
<128; i
++)
495 dst
[start
+i
] = NCR5380_read(C400_HOST_BUFFER
);
497 /* implies CONFIG_SCSI_G_NCR5380_MEM */
498 memcpy(dst
+start
,NCR53C400_host_buffer
+NCR5380_map_name
,128);
505 #if (NDEBUG & NDEBUG_C400_PREAD)
506 printk("53C400r: EXTRA: Waiting for buffer\n");
508 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
511 #if (NDEBUG & NDEBUG_C400_PREAD)
512 printk("53C400r: Transferring EXTRA 128 bytes\n");
514 #ifdef CONFIG_SCSI_G_NCR5380_PORT
515 for (i
=0; i
<128; i
++)
516 dst
[start
+i
] = NCR5380_read(C400_HOST_BUFFER
);
518 /* implies CONFIG_SCSI_G_NCR5380_MEM */
519 memcpy(dst
+start
,NCR53C400_host_buffer
+NCR5380_map_name
,128);
524 #if (NDEBUG & NDEBUG_C400_PREAD)
526 printk("53C400r: No EXTRA required\n");
529 #if (NDEBUG & NDEBUG_C400_PREAD)
530 printk("53C400r: Final values: blocks=%d start=%d\n", blocks
, start
);
533 if (!(NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
534 printk("53C400r: no 53C80 gated irq after transfer");
535 #if (NDEBUG & NDEBUG_C400_PREAD)
537 printk("53C400r: Got 53C80 interrupt and tried to clear it\n");
540 /* DON'T DO THIS - THEY NEVER ARRIVE!
541 printk("53C400r: Waiting for 53C80 registers\n");
542 while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG)
546 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
))
547 printk("53C400r: no end dma signal\n");
548 #if (NDEBUG & NDEBUG_C400_PREAD)
550 printk("53C400r: end dma as expected\n");
553 NCR5380_write(MODE_REG
, MR_BASE
);
554 NCR5380_read(RESET_PARITY_INTERRUPT_REG
);
558 static inline int NCR5380_pwrite (struct Scsi_Host
*instance
, unsigned char *src
, int len
)
560 int blocks
= len
/ 128;
564 NCR5380_local_declare();
566 NCR5380_setup(instance
);
568 #if (NDEBUG & NDEBUG_C400_PWRITE)
569 printk("53C400w: About to write %d blocks for %d bytes\n", blocks
, len
);
572 NCR5380_write(C400_CONTROL_STATUS_REG
, CSR_BASE
);
573 NCR5380_write(C400_BLOCK_COUNTER_REG
, blocks
);
575 if (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
) {
576 printk("53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start
, blocks
);
580 if ((bl
=NCR5380_read(C400_BLOCK_COUNTER_REG
)) == 0) {
581 #if (NDEBUG & NDEBUG_C400_PWRITE)
583 printk("53C400w: exiting loop, blocks still == %d\n", blocks
);
585 printk("53C400w: exiting loop\n");
590 #if (NDEBUG & NDEBUG_C400_PWRITE)
591 printk("53C400w: %d blocks left\n", blocks
);
593 printk("53C400w: waiting for buffer, bl=%d\n", bl
);
595 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
598 #if (NDEBUG & NDEBUG_C400_PWRITE)
599 printk("53C400w: transferring 128 bytes\n");
601 #ifdef CONFIG_SCSI_G_NCR5380_PORT
602 for (i
=0; i
<128; i
++)
603 NCR5380_write(C400_HOST_BUFFER
, src
[start
+i
]);
605 /* implies CONFIG_SCSI_G_NCR5380_MEM */
606 memcpy(NCR53C400_host_buffer
+NCR5380_map_name
,src
+start
,128);
612 #if (NDEBUG & NDEBUG_C400_PWRITE)
613 printk("53C400w: EXTRA waiting for buffer\n");
615 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_HOST_BUF_NOT_RDY
)
618 #if (NDEBUG & NDEBUG_C400_PWRITE)
619 printk("53C400w: transferring EXTRA 128 bytes\n");
621 #ifdef CONFIG_SCSI_G_NCR5380_PORT
622 for (i
=0; i
<128; i
++)
623 NCR5380_write(C400_HOST_BUFFER
, src
[start
+i
]);
625 /* implies CONFIG_SCSI_G_NCR5380_MEM */
626 memcpy(NCR53C400_host_buffer
+NCR5380_map_name
,src
+start
,128);
631 #if (NDEBUG & NDEBUG_C400_PWRITE)
633 printk("53C400w: No EXTRA required\n");
636 #if (NDEBUG & NDEBUG_C400_PWRITE)
637 printk("53C400w: Final values: blocks=%d start=%d\n", blocks
, start
);
641 printk("53C400w: waiting for registers to be available\n");
643 while (NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_53C80_REG
)
645 printk("53C400w: Got em\n");
648 /* Let's wait for this instead - could be ugly */
649 /* All documentation says to check for this. Maybe my hardware is too
650 * fast. Waiting for it seems to work fine! KLL
652 while (!(i
= NCR5380_read(C400_CONTROL_STATUS_REG
) & CSR_GATED_53C80_IRQ
))
656 * I know. i is certainly != 0 here but the loop is new. See previous
660 #if (NDEBUG & NDEBUG_C400_PWRITE)
661 printk("53C400w: got 53C80 gated irq (last block)\n");
663 if (!((i
=NCR5380_read(BUS_AND_STATUS_REG
)) & BASR_END_DMA_TRANSFER
))
664 printk("53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n",i
);
665 #if (NDEBUG & NDEBUG_C400_PWRITE)
667 printk("53C400w: Got END OF DMA\n");
671 printk("53C400w: no 53C80 gated irq after transfer (last block)\n");
674 if (!(NCR5380_read(BUS_AND_STATUS_REG
) & BASR_END_DMA_TRANSFER
)) {
675 printk("53C400w: no end dma signal\n");
679 #if (NDEBUG & NDEBUG_C400_PWRITE)
680 printk("53C400w: waiting for last byte...\n");
682 while (!(NCR5380_read(TARGET_COMMAND_REG
) & TCR_LAST_BYTE_SENT
))
685 #if (NDEBUG & NDEBUG_C400_PWRITE)
686 printk("53C400w: got last byte.\n");
687 printk("53C400w: pwrite exiting with status 0, whoopee!\n");
691 #endif /* PSEUDO_DMA */
695 #define PRINTP(x) len += sprintf(buffer+len, x)
698 static int sprint_opcode(char* buffer
, int len
, int opcode
) {
700 PRINTP("0x%02x " ANDP opcode
);
704 static int sprint_command (char* buffer
, int len
, unsigned char *command
) {
706 len
+= sprint_opcode(buffer
, len
, command
[0]);
707 for ( i
= 1, s
= COMMAND_SIZE(command
[0]); i
< s
; ++i
)
708 PRINTP("%02x " ANDP command
[i
]);
713 static int sprint_Scsi_Cmnd (char* buffer
, int len
, Scsi_Cmnd
*cmd
) {
715 PRINTP("host number %d destination target %d, lun %d\n" ANDP
716 cmd
->host
->host_no ANDP
719 PRINTP(" command = ");
720 len
+= sprint_command (buffer
, len
, cmd
->cmnd
);
724 int generic_NCR5380_proc_info(char* buffer
, char** start
, off_t offset
, int length
, int hostno
, int inout
)
727 NCR5380_local_declare();
729 unsigned char status
;
731 struct Scsi_Host
*scsi_ptr
;
733 struct NCR5380_hostdata
*hostdata
;
736 extern const char *const scsi_device_types
[MAX_SCSI_DEVICE_CODE
];
741 for (scsi_ptr
= first_instance
; scsi_ptr
; scsi_ptr
=scsi_ptr
->next
)
742 if (scsi_ptr
->host_no
== hostno
)
744 NCR5380_setup(scsi_ptr
);
745 hostdata
= (struct NCR5380_hostdata
*)scsi_ptr
->hostdata
;
747 PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr
->host_no ANDP scsi_ptr
->hostt
->name
);
748 PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE
);
749 PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE
);
751 PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE
);
752 PRINTP("NCR53C400 card%s detected\n" ANDP (((struct NCR5380_hostdata
*)scsi_ptr
->hostdata
)->flags
& FLAG_NCR53C400
)?"":" not");
753 # if NCR53C400_PSEUDO_DMA
754 PRINTP("NCR53C400 pseudo DMA used\n");
757 PRINTP("NO NCR53C400 driver extensions\n");
759 PRINTP("Using %s mapping at %s 0x%lx, " ANDP
STRVAL(NCR5380_map_config
) ANDP
STRVAL(NCR5380_map_name
) ANDP scsi_ptr
->NCR5380_instance_name
);
760 if (scsi_ptr
->irq
== IRQ_NONE
)
761 PRINTP("no interrupt\n");
763 PRINTP("on interrupt %d\n" ANDP scsi_ptr
->irq
);
766 if (hostdata
->connected
|| hostdata
->issue_queue
|| hostdata
->disconnected_queue
)
767 PRINTP("There are commands pending, transfer rates may be crud\n");
768 if (hostdata
->pendingr
)
769 PRINTP(" %d pending reads" ANDP hostdata
->pendingr
);
770 if (hostdata
->pendingw
)
771 PRINTP(" %d pending writes" ANDP hostdata
->pendingw
);
772 if (hostdata
->pendingr
|| hostdata
->pendingw
)
774 for (dev
= scsi_ptr
->host_queue
; dev
; dev
=dev
->next
) {
775 unsigned long br
= hostdata
->bytes_read
[dev
->id
];
776 unsigned long bw
= hostdata
->bytes_write
[dev
->id
];
777 long tr
= hostdata
->time_read
[dev
->id
] / HZ
;
778 long tw
= hostdata
->time_write
[dev
->id
] / HZ
;
780 PRINTP(" T:%d %s " ANDP dev
->id
ANDP (dev
->type
< MAX_SCSI_DEVICE_CODE
) ? scsi_device_types
[(int)dev
->type
] : "Unknown");
782 if (dev
->vendor
[i
] >= 0x20)
783 *(buffer
+(len
++)) = dev
->vendor
[i
];
784 *(buffer
+(len
++)) = ' ';
786 if (dev
->model
[i
] >= 0x20)
787 *(buffer
+(len
++)) = dev
->model
[i
];
788 *(buffer
+(len
++)) = ' ';
790 if (dev
->rev
[i
] >= 0x20)
791 *(buffer
+(len
++)) = dev
->rev
[i
];
792 *(buffer
+(len
++)) = ' ';
794 PRINTP("\n%10ld kb read in %5ld secs" ANDP br
/1024 ANDP tr
);
796 PRINTP(" @ %5ld bps" ANDP br
/ tr
);
798 PRINTP("\n%10ld kb written in %5ld secs" ANDP bw
/1024 ANDP tw
);
800 PRINTP(" @ %5ld bps" ANDP bw
/ tw
);
805 status
= NCR5380_read(STATUS_REG
);
806 if (!(status
& SR_REQ
))
807 PRINTP("REQ not asserted, phase unknown.\n");
809 for (i
= 0; (phases
[i
].value
!= PHASE_UNKNOWN
) &&
810 (phases
[i
].value
!= (status
& PHASE_MASK
)); ++i
)
812 PRINTP("Phase %s\n" ANDP phases
[i
].name
);
815 if (!hostdata
->connected
) {
816 PRINTP("No currently connected command\n");
818 len
+= sprint_Scsi_Cmnd (buffer
, len
, (Scsi_Cmnd
*) hostdata
->connected
);
821 PRINTP("issue_queue\n");
823 for (ptr
= (Scsi_Cmnd
*) hostdata
->issue_queue
; ptr
;
824 ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
825 len
+= sprint_Scsi_Cmnd (buffer
, len
, ptr
);
827 PRINTP("disconnected_queue\n");
829 for (ptr
= (Scsi_Cmnd
*) hostdata
->disconnected_queue
; ptr
;
830 ptr
= (Scsi_Cmnd
*) ptr
->host_scribble
)
831 len
+= sprint_Scsi_Cmnd (buffer
, len
, ptr
);
833 *start
= buffer
+ offset
;
837 restore_flags(flags
);
845 /* Eventually this will go into an include file, but this will be later */
846 Scsi_Host_Template driver_template
= GENERIC_NCR5380
;
848 #include <linux/module.h>
849 #include "scsi_module.c"
851 MODULE_PARM(ncr_irq
, "i");
852 MODULE_PARM(ncr_dma
, "i");
853 MODULE_PARM(ncr_addr
, "i");
854 MODULE_PARM(ncr_5380
, "i");
855 MODULE_PARM(ncr_53c400
, "i");
856 MODULE_PARM(ncr_53c400a
, "i");
857 MODULE_PARM(dtc_3181e
, "i");