* add p cc
[mascara-docs.git] / i386 / linux / linux-0.99 / drivers / scsi / g_NCR5380.c
blob91ebdda4f1d15e16313243e7e43a84aa5d8ad2ea
1 #define AUTOSENSE
3 /*
4 * Generic Generic NCR5380 driver
5 *
6 * Copyright 1993, Drew Eckhardt
7 * Visionary Computing
8 * (Unix and Linux consulting and custom programming)
9 * drew@colorado.edu
10 * +1 (303) 440-4894
12 * ALPHA RELEASE 1.
14 * For more information, please consult
16 * NCR 5380 Family
17 * SCSI Protocol Controller
18 * Databook
20 * NCR Microelectronics
21 * 1635 Aeroplaza Drive
22 * Colorado Springs, CO 80916
23 * 1+ (719) 578-3400
24 * 1+ (800) 334-5454
27 /*
28 * TODO : flesh out DMA support, find some one actually using this (I have
29 * a memory mapped Trantor board that works fine)
33 * Options :
35 * PARITY - enable parity checking. Not supported.
37 * SCSI2 - enable support for SCSI-II tagged queueing. Untested.
39 * USLEEP - enable support for devices that don't disconnect. Untested.
41 * The card is detected and initialized in one of several ways :
42 * 1. With command line overrides - NCR5380=port,irq may be
43 * used on the LILO command line to override the defaults.
45 * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is
46 * specified as an array of address, irq tupples. Ie, for
47 * one board at the default 0xcc000 address, IRQ5, no dma, I could
48 * say -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE}}
50 * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an
51 * IRQ line if overriden on the command line.
55 * $Log: generic_NCR5380.c,v $
58 #include <linux/config.h>
59 #if defined(CONFIG_SCSI_GENERIC_NCR5380)
60 /* Standard option */
61 #define AUTOPROBE_IRQ
63 #include <asm/system.h>
64 #include <asm/io.h>
65 #include <linux/signal.h>
66 #include <linux/sched.h>
67 #include "../block/blk.h"
68 #include "scsi.h"
69 #include "hosts.h"
70 #include "g_NCR5380.h"
71 #include "NCR5380.h"
72 #include "constants.h"
74 static struct override {
75 int port;
76 int irq;
77 int dma;
78 } overrides
79 #ifdef GENERIC_NCR5380_OVERRIDE
80 [] = GENERIC_NCR5380_OVERRIDE
81 #else
82 [1] = {{0,},};
83 #endif
85 #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override))
88 * Function : generic_NCR5380_setup(char *str, int *ints)
90 * Purpose : LILO command line initialization of the overrides array,
92 * Inputs : str - unused, ints - array of integer paramters with ints[0]
93 * equal to the number of ints.
97 void generic_NCR5380_setup(char *str, int *ints) {
98 static int commandline_current = 0;
99 if (ints[0] != 2)
100 printk("generic_NCR5380_setup : usage ncr5380=port,irq,dma\n");
101 else
102 if (commandline_current < NO_OVERRIDES) {
103 overrides[commandline_current].port = ints[1];
104 overrides[commandline_current].irq = ints[2];
105 overrides[commandline_current].dma = ints[3];
106 ++commandline_current;
110 static struct sigaction sa = { generic_NCR5380_intr, 0,
111 SA_INTERRUPT , NULL };
114 * Function : int generic_NCR5380_detect(int hostno)
116 * Purpose : initializes generic NCR5380 driver based on the
117 * command line / compile time port and irq definitions.
119 * Inputs : hostno - id of this SCSI adapter.
121 * Returns : 1 if a host adapter was found, 0 if not.
125 int generic_NCR5380_detect(int hostno) {
126 static int current_override = 0;
127 int count;
128 struct Scsi_Host *instance;
130 for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
131 if (!(overrides[current_override].port))
132 continue;
134 instance = scsi_register (hostno, sizeof(struct NCR5380_hostdata));
135 instance->io_port = overrides[current_override].port;
137 NCR5380_init(instance);
139 if (overrides[current_override].irq != IRQ_AUTO)
140 instance->irq = overrides[current_override].irq;
141 else
142 instance->irq = NCR5380_probe_irq(instance, 0xffff);
144 if (instance->irq != IRQ_NONE)
145 if (irqaction (instance->irq, &sa)) {
146 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
147 hostno, instance->irq);
148 instance->irq = IRQ_NONE;
151 if (instance->irq == IRQ_NONE) {
152 printk("scsi%d : interrupts not enabled. for better interactive performance,\n", hostno);
153 printk("scsi%d : please jumper the board for a free IRQ.\n", hostno);
156 printk("scsi%d : at port %d", instance->host_no, instance->io_port);
157 if (instance->irq == IRQ_NONE)
158 printk (" interrupts disabled");
159 else
160 printk (" irq %d", instance->irq);
161 printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
162 CAN_QUEUE, CMD_PER_LUN, GENERIC_NCR5380_PUBLIC_RELEASE);
163 NCR5380_print_options(instance);
164 printk("\n");
166 ++current_override;
167 ++count;
169 return count;
172 const char * generic_NCR5380_info (void) {
173 static const char string[]="";
174 return string;
177 #include "NCR5380.c"
179 #endif /* defined(CONFIG_SCSI_GENERIC_NCR5380) */