Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Generic Generic NCR5380 driver |
| 3 | * |
| 4 | * Copyright 1993, Drew Eckhardt |
| 5 | * Visionary Computing |
| 6 | * (Unix and Linux consulting and custom programming) |
| 7 | * drew@colorado.edu |
| 8 | * +1 (303) 440-4894 |
| 9 | * |
| 10 | * NCR53C400 extensions (c) 1994,1995,1996, Kevin Lentin |
| 11 | * K.Lentin@cs.monash.edu.au |
| 12 | * |
| 13 | * NCR53C400A extensions (c) 1996, Ingmar Baumgart |
| 14 | * ingmar@gonzo.schwaben.de |
| 15 | * |
| 16 | * DTC3181E extensions (c) 1997, Ronald van Cuijlenborg |
| 17 | * ronald.van.cuijlenborg@tip.nl or nutty@dds.nl |
| 18 | * |
| 19 | * Added ISAPNP support for DTC436 adapters, |
| 20 | * Thomas Sailer, sailer@ife.ee.ethz.ch |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * TODO : flesh out DMA support, find some one actually using this (I have |
| 25 | * a memory mapped Trantor board that works fine) |
| 26 | */ |
| 27 | |
| 28 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | * The card is detected and initialized in one of several ways : |
| 30 | * 1. With command line overrides - NCR5380=port,irq may be |
| 31 | * used on the LILO command line to override the defaults. |
| 32 | * |
| 33 | * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is |
| 34 | * specified as an array of address, irq, dma, board tuples. Ie, for |
| 35 | * one board at 0x350, IRQ5, no dma, I could say |
| 36 | * -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE, BOARD_NCR5380}} |
| 37 | * |
| 38 | * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an |
| 39 | * IRQ line if overridden on the command line. |
| 40 | * |
| 41 | * 3. When included as a module, with arguments passed on the command line: |
| 42 | * ncr_irq=xx the interrupt |
| 43 | * ncr_addr=xx the port or base address (for port or memory |
| 44 | * mapped, resp.) |
| 45 | * ncr_dma=xx the DMA |
| 46 | * ncr_5380=1 to set up for a NCR5380 board |
| 47 | * ncr_53c400=1 to set up for a NCR53C400 board |
| 48 | * e.g. |
| 49 | * modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1 |
| 50 | * for a port mapped NCR5380 board or |
| 51 | * modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1 |
| 52 | * for a memory mapped NCR53C400 board with interrupts disabled. |
| 53 | * |
| 54 | * 255 should be specified for no or DMA interrupt, 254 to autoprobe for an |
| 55 | * IRQ line if overridden on the command line. |
| 56 | * |
| 57 | */ |
| 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #define AUTOPROBE_IRQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
| 61 | #ifdef CONFIG_SCSI_GENERIC_NCR53C400 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | #define PSEUDO_DMA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #endif |
| 64 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | #include <asm/io.h> |
| 66 | #include <linux/signal.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #include <linux/blkdev.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | #include <scsi/scsi_host.h> |
| 69 | #include "g_NCR5380.h" |
| 70 | #include "NCR5380.h" |
| 71 | #include <linux/stat.h> |
| 72 | #include <linux/init.h> |
| 73 | #include <linux/ioport.h> |
| 74 | #include <linux/isapnp.h> |
| 75 | #include <linux/delay.h> |
| 76 | #include <linux/interrupt.h> |
| 77 | |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 78 | static int ncr_irq; |
| 79 | static int ncr_dma; |
| 80 | static int ncr_addr; |
| 81 | static int ncr_5380; |
| 82 | static int ncr_53c400; |
| 83 | static int ncr_53c400a; |
| 84 | static int dtc_3181e; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | static struct override { |
Al Viro | c818cb6 | 2006-03-24 03:15:37 -0800 | [diff] [blame] | 87 | NCR5380_map_type NCR5380_map_name; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | int irq; |
| 89 | int dma; |
| 90 | int board; /* Use NCR53c400, Ricoh, etc. extensions ? */ |
| 91 | } overrides |
| 92 | #ifdef GENERIC_NCR5380_OVERRIDE |
| 93 | [] __initdata = GENERIC_NCR5380_OVERRIDE; |
| 94 | #else |
| 95 | [1] __initdata = { { 0,},}; |
| 96 | #endif |
| 97 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 98 | #define NO_OVERRIDES ARRAY_SIZE(overrides) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 100 | #ifndef MODULE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * internal_setup - handle lilo command string override |
| 104 | * @board: BOARD_* identifier for the board |
| 105 | * @str: unused |
| 106 | * @ints: numeric parameters |
| 107 | * |
| 108 | * Do LILO command line initialization of the overrides array. Display |
| 109 | * errors when needed |
| 110 | * |
| 111 | * Locks: none |
| 112 | */ |
| 113 | |
| 114 | static void __init internal_setup(int board, char *str, int *ints) |
| 115 | { |
Finn Thain | d5f7e65 | 2016-01-03 16:05:03 +1100 | [diff] [blame] | 116 | static int commandline_current; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | switch (board) { |
| 118 | case BOARD_NCR5380: |
| 119 | if (ints[0] != 2 && ints[0] != 3) { |
| 120 | printk(KERN_ERR "generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name) ",irq,dma\n"); |
| 121 | return; |
| 122 | } |
| 123 | break; |
| 124 | case BOARD_NCR53C400: |
| 125 | if (ints[0] != 2) { |
| 126 | printk(KERN_ERR "generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name) ",irq\n"); |
| 127 | return; |
| 128 | } |
| 129 | break; |
| 130 | case BOARD_NCR53C400A: |
| 131 | if (ints[0] != 2) { |
| 132 | printk(KERN_ERR "generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name) ",irq\n"); |
| 133 | return; |
| 134 | } |
| 135 | break; |
| 136 | case BOARD_DTC3181E: |
| 137 | if (ints[0] != 2) { |
| 138 | printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name) ",irq\n"); |
| 139 | return; |
| 140 | } |
| 141 | break; |
| 142 | } |
| 143 | |
| 144 | if (commandline_current < NO_OVERRIDES) { |
| 145 | overrides[commandline_current].NCR5380_map_name = (NCR5380_map_type) ints[1]; |
| 146 | overrides[commandline_current].irq = ints[2]; |
| 147 | if (ints[0] == 3) |
| 148 | overrides[commandline_current].dma = ints[3]; |
| 149 | else |
| 150 | overrides[commandline_current].dma = DMA_NONE; |
| 151 | overrides[commandline_current].board = board; |
| 152 | ++commandline_current; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | |
| 157 | /** |
| 158 | * do_NCR53C80_setup - set up entry point |
| 159 | * @str: unused |
| 160 | * |
| 161 | * Setup function invoked at boot to parse the ncr5380= command |
| 162 | * line. |
| 163 | */ |
| 164 | |
| 165 | static int __init do_NCR5380_setup(char *str) |
| 166 | { |
| 167 | int ints[10]; |
| 168 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 169 | get_options(str, ARRAY_SIZE(ints), ints); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | internal_setup(BOARD_NCR5380, str, ints); |
| 171 | return 1; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * do_NCR53C400_setup - set up entry point |
| 176 | * @str: unused |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 177 | * @ints: integer parameters from kernel setup code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | * |
| 179 | * Setup function invoked at boot to parse the ncr53c400= command |
| 180 | * line. |
| 181 | */ |
| 182 | |
| 183 | static int __init do_NCR53C400_setup(char *str) |
| 184 | { |
| 185 | int ints[10]; |
| 186 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 187 | get_options(str, ARRAY_SIZE(ints), ints); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | internal_setup(BOARD_NCR53C400, str, ints); |
| 189 | return 1; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * do_NCR53C400A_setup - set up entry point |
| 194 | * @str: unused |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 195 | * @ints: integer parameters from kernel setup code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | * |
| 197 | * Setup function invoked at boot to parse the ncr53c400a= command |
| 198 | * line. |
| 199 | */ |
| 200 | |
| 201 | static int __init do_NCR53C400A_setup(char *str) |
| 202 | { |
| 203 | int ints[10]; |
| 204 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 205 | get_options(str, ARRAY_SIZE(ints), ints); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | internal_setup(BOARD_NCR53C400A, str, ints); |
| 207 | return 1; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * do_DTC3181E_setup - set up entry point |
| 212 | * @str: unused |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 213 | * @ints: integer parameters from kernel setup code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | * |
| 215 | * Setup function invoked at boot to parse the dtc3181e= command |
| 216 | * line. |
| 217 | */ |
| 218 | |
| 219 | static int __init do_DTC3181E_setup(char *str) |
| 220 | { |
| 221 | int ints[10]; |
| 222 | |
Tobias Klauser | 6391a11 | 2006-06-08 22:23:48 -0700 | [diff] [blame] | 223 | get_options(str, ARRAY_SIZE(ints), ints); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | internal_setup(BOARD_DTC3181E, str, ints); |
| 225 | return 1; |
| 226 | } |
| 227 | |
| 228 | #endif |
| 229 | |
| 230 | /** |
| 231 | * generic_NCR5380_detect - look for NCR5380 controllers |
| 232 | * @tpnt: the scsi template |
| 233 | * |
| 234 | * Scan for the present of NCR5380, NCR53C400, NCR53C400A, DTC3181E |
| 235 | * and DTC436(ISAPnP) controllers. If overrides have been set we use |
| 236 | * them. |
| 237 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | * Locks: none |
| 239 | */ |
| 240 | |
Finn Thain | ed8b9e7 | 2014-11-12 16:11:51 +1100 | [diff] [blame] | 241 | static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | { |
Finn Thain | d5f7e65 | 2016-01-03 16:05:03 +1100 | [diff] [blame] | 243 | static int current_override; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 244 | int count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | unsigned int *ports; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 246 | #ifndef SCSI_G_NCR5380_MEM |
| 247 | int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | unsigned long region_size = 16; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 249 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | static unsigned int __initdata ncr_53c400a_ports[] = { |
| 251 | 0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0 |
| 252 | }; |
| 253 | static unsigned int __initdata dtc_3181e_ports[] = { |
| 254 | 0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0 |
| 255 | }; |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 256 | int flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | struct Scsi_Host *instance; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 258 | #ifdef SCSI_G_NCR5380_MEM |
Al Viro | c818cb6 | 2006-03-24 03:15:37 -0800 | [diff] [blame] | 259 | unsigned long base; |
| 260 | void __iomem *iomem; |
| 261 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 263 | if (ncr_irq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | overrides[0].irq = ncr_irq; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 265 | if (ncr_dma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | overrides[0].dma = ncr_dma; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 267 | if (ncr_addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | overrides[0].NCR5380_map_name = (NCR5380_map_type) ncr_addr; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 269 | if (ncr_5380) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | overrides[0].board = BOARD_NCR5380; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 271 | else if (ncr_53c400) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | overrides[0].board = BOARD_NCR53C400; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 273 | else if (ncr_53c400a) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | overrides[0].board = BOARD_NCR53C400A; |
Finn Thain | c0965e6 | 2016-01-03 16:05:05 +1100 | [diff] [blame] | 275 | else if (dtc_3181e) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | overrides[0].board = BOARD_DTC3181E; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 277 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | if (!current_override && isapnp_present()) { |
| 279 | struct pnp_dev *dev = NULL; |
| 280 | count = 0; |
| 281 | while ((dev = pnp_find_dev(NULL, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev))) { |
| 282 | if (count >= NO_OVERRIDES) |
| 283 | break; |
Ondrej Zary | c94babb | 2010-08-10 18:01:15 -0700 | [diff] [blame] | 284 | if (pnp_device_attach(dev) < 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | if (pnp_activate_dev(dev) < 0) { |
| 287 | printk(KERN_ERR "dtc436e probe: activate failed\n"); |
| 288 | pnp_device_detach(dev); |
| 289 | continue; |
| 290 | } |
| 291 | if (!pnp_port_valid(dev, 0)) { |
| 292 | printk(KERN_ERR "dtc436e probe: no valid port\n"); |
| 293 | pnp_device_detach(dev); |
| 294 | continue; |
| 295 | } |
| 296 | if (pnp_irq_valid(dev, 0)) |
| 297 | overrides[count].irq = pnp_irq(dev, 0); |
| 298 | else |
Finn Thain | 22f5f10 | 2014-11-12 16:11:56 +1100 | [diff] [blame] | 299 | overrides[count].irq = NO_IRQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | if (pnp_dma_valid(dev, 0)) |
| 301 | overrides[count].dma = pnp_dma(dev, 0); |
| 302 | else |
| 303 | overrides[count].dma = DMA_NONE; |
| 304 | overrides[count].NCR5380_map_name = (NCR5380_map_type) pnp_port_start(dev, 0); |
| 305 | overrides[count].board = BOARD_DTC3181E; |
| 306 | count++; |
| 307 | } |
| 308 | } |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 309 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | tpnt->proc_name = "g_NCR5380"; |
| 311 | |
| 312 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { |
| 313 | if (!(overrides[current_override].NCR5380_map_name)) |
| 314 | continue; |
| 315 | |
| 316 | ports = NULL; |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 317 | flags = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | switch (overrides[current_override].board) { |
| 319 | case BOARD_NCR5380: |
| 320 | flags = FLAG_NO_PSEUDO_DMA; |
| 321 | break; |
| 322 | case BOARD_NCR53C400: |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 323 | #ifdef PSEUDO_DMA |
Finn Thain | 55181be | 2016-01-03 16:05:42 +1100 | [diff] [blame^] | 324 | flags = FLAG_NO_DMA_FIXUP; |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 325 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | break; |
| 327 | case BOARD_NCR53C400A: |
| 328 | flags = FLAG_NO_PSEUDO_DMA; |
| 329 | ports = ncr_53c400a_ports; |
| 330 | break; |
| 331 | case BOARD_DTC3181E: |
| 332 | flags = FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E; |
| 333 | ports = dtc_3181e_ports; |
| 334 | break; |
| 335 | } |
| 336 | |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 337 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | if (ports) { |
| 339 | /* wakeup sequence for the NCR53C400A and DTC3181E */ |
| 340 | |
| 341 | /* Disable the adapter and look for a free io port */ |
| 342 | outb(0x59, 0x779); |
| 343 | outb(0xb9, 0x379); |
| 344 | outb(0xc5, 0x379); |
| 345 | outb(0xae, 0x379); |
| 346 | outb(0xa6, 0x379); |
| 347 | outb(0x00, 0x379); |
| 348 | |
| 349 | if (overrides[current_override].NCR5380_map_name != PORT_AUTO) |
| 350 | for (i = 0; ports[i]; i++) { |
| 351 | if (!request_region(ports[i], 16, "ncr53c80")) |
| 352 | continue; |
| 353 | if (overrides[current_override].NCR5380_map_name == ports[i]) |
| 354 | break; |
| 355 | release_region(ports[i], 16); |
| 356 | } else |
| 357 | for (i = 0; ports[i]; i++) { |
| 358 | if (!request_region(ports[i], 16, "ncr53c80")) |
| 359 | continue; |
| 360 | if (inb(ports[i]) == 0xff) |
| 361 | break; |
| 362 | release_region(ports[i], 16); |
| 363 | } |
| 364 | if (ports[i]) { |
| 365 | /* At this point we have our region reserved */ |
| 366 | outb(0x59, 0x779); |
| 367 | outb(0xb9, 0x379); |
| 368 | outb(0xc5, 0x379); |
| 369 | outb(0xae, 0x379); |
| 370 | outb(0xa6, 0x379); |
| 371 | outb(0x80 | i, 0x379); /* set io port to be used */ |
| 372 | outb(0xc0, ports[i] + 9); |
| 373 | if (inb(ports[i] + 9) != 0x80) |
| 374 | continue; |
| 375 | else |
| 376 | overrides[current_override].NCR5380_map_name = ports[i]; |
| 377 | } else |
| 378 | continue; |
| 379 | } |
| 380 | else |
| 381 | { |
| 382 | /* Not a 53C400A style setup - just grab */ |
| 383 | if(!(request_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380"))) |
| 384 | continue; |
| 385 | region_size = NCR5380_region_size; |
| 386 | } |
| 387 | #else |
Al Viro | c818cb6 | 2006-03-24 03:15:37 -0800 | [diff] [blame] | 388 | base = overrides[current_override].NCR5380_map_name; |
| 389 | if (!request_mem_region(base, NCR5380_region_size, "ncr5380")) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | continue; |
Al Viro | c818cb6 | 2006-03-24 03:15:37 -0800 | [diff] [blame] | 391 | iomem = ioremap(base, NCR5380_region_size); |
| 392 | if (!iomem) { |
| 393 | release_mem_region(base, NCR5380_region_size); |
| 394 | continue; |
| 395 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | #endif |
| 397 | instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata)); |
Finn Thain | 0ad0eff | 2016-01-03 16:05:21 +1100 | [diff] [blame] | 398 | if (instance == NULL) |
| 399 | goto out_release; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 401 | #ifndef SCSI_G_NCR5380_MEM |
Finn Thain | b01ec34 | 2016-01-03 16:05:07 +1100 | [diff] [blame] | 402 | instance->io_port = overrides[current_override].NCR5380_map_name; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | instance->n_io_port = region_size; |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 404 | |
| 405 | /* |
| 406 | * On NCR53C400 boards, NCR5380 registers are mapped 8 past |
| 407 | * the base address. |
| 408 | */ |
| 409 | if (overrides[current_override].board == BOARD_NCR53C400) |
| 410 | instance->io_port += 8; |
Al Viro | c818cb6 | 2006-03-24 03:15:37 -0800 | [diff] [blame] | 411 | #else |
Finn Thain | b01ec34 | 2016-01-03 16:05:07 +1100 | [diff] [blame] | 412 | instance->base = overrides[current_override].NCR5380_map_name; |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 413 | ((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | #endif |
| 415 | |
Finn Thain | 0ad0eff | 2016-01-03 16:05:21 +1100 | [diff] [blame] | 416 | if (NCR5380_init(instance, flags)) |
| 417 | goto out_unregister; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 419 | if (overrides[current_override].board == BOARD_NCR53C400) |
| 420 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE); |
| 421 | |
Finn Thain | b6488f9 | 2016-01-03 16:05:08 +1100 | [diff] [blame] | 422 | NCR5380_maybe_reset_bus(instance); |
| 423 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | if (overrides[current_override].irq != IRQ_AUTO) |
| 425 | instance->irq = overrides[current_override].irq; |
| 426 | else |
| 427 | instance->irq = NCR5380_probe_irq(instance, 0xffff); |
| 428 | |
Finn Thain | 22f5f10 | 2014-11-12 16:11:56 +1100 | [diff] [blame] | 429 | /* Compatibility with documented NCR5380 kernel parameters */ |
| 430 | if (instance->irq == 255) |
| 431 | instance->irq = NO_IRQ; |
| 432 | |
| 433 | if (instance->irq != NO_IRQ) |
Jeff Garzik | 1e64166 | 2007-11-11 19:52:05 -0500 | [diff] [blame] | 434 | if (request_irq(instance->irq, generic_NCR5380_intr, |
Michael Opdenacker | 4909cc2 | 2014-03-05 06:09:41 +0100 | [diff] [blame] | 435 | 0, "NCR5380", instance)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); |
Finn Thain | 22f5f10 | 2014-11-12 16:11:56 +1100 | [diff] [blame] | 437 | instance->irq = NO_IRQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | } |
| 439 | |
Finn Thain | 22f5f10 | 2014-11-12 16:11:56 +1100 | [diff] [blame] | 440 | if (instance->irq == NO_IRQ) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | printk(KERN_INFO "scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no); |
| 442 | printk(KERN_INFO "scsi%d : please jumper the board for a free IRQ.\n", instance->host_no); |
| 443 | } |
| 444 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | ++current_override; |
| 446 | ++count; |
| 447 | } |
| 448 | return count; |
Finn Thain | 0ad0eff | 2016-01-03 16:05:21 +1100 | [diff] [blame] | 449 | |
| 450 | out_unregister: |
| 451 | scsi_unregister(instance); |
| 452 | out_release: |
| 453 | #ifndef SCSI_G_NCR5380_MEM |
| 454 | release_region(overrides[current_override].NCR5380_map_name, region_size); |
| 455 | #else |
| 456 | iounmap(iomem); |
| 457 | release_mem_region(base, NCR5380_region_size); |
| 458 | #endif |
| 459 | return count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | /** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | * generic_NCR5380_release_resources - free resources |
| 464 | * @instance: host adapter to clean up |
| 465 | * |
| 466 | * Free the generic interface resources from this adapter. |
| 467 | * |
| 468 | * Locks: none |
| 469 | */ |
| 470 | |
Finn Thain | ed8b9e7 | 2014-11-12 16:11:51 +1100 | [diff] [blame] | 471 | static int generic_NCR5380_release_resources(struct Scsi_Host *instance) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
Finn Thain | 22f5f10 | 2014-11-12 16:11:56 +1100 | [diff] [blame] | 473 | if (instance->irq != NO_IRQ) |
Jeff Garzik | 1e64166 | 2007-11-11 19:52:05 -0500 | [diff] [blame] | 474 | free_irq(instance->irq, instance); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | NCR5380_exit(instance); |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 476 | #ifndef SCSI_G_NCR5380_MEM |
Finn Thain | b01ec34 | 2016-01-03 16:05:07 +1100 | [diff] [blame] | 477 | release_region(instance->io_port, instance->n_io_port); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | #else |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 479 | iounmap(((struct NCR5380_hostdata *)instance->hostdata)->iomem); |
Finn Thain | b01ec34 | 2016-01-03 16:05:07 +1100 | [diff] [blame] | 480 | release_mem_region(instance->base, NCR5380_region_size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | return 0; |
| 483 | } |
| 484 | |
| 485 | #ifdef BIOSPARAM |
| 486 | /** |
| 487 | * generic_NCR5380_biosparam |
| 488 | * @disk: disk to compute geometry for |
| 489 | * @dev: device identifier for this disk |
| 490 | * @ip: sizes to fill in |
| 491 | * |
| 492 | * Generates a BIOS / DOS compatible H-C-S mapping for the specified |
| 493 | * device / size. |
| 494 | * |
| 495 | * XXX Most SCSI boards use this mapping, I could be incorrect. Someone |
| 496 | * using hard disks on a trantor should verify that this mapping |
| 497 | * corresponds to that used by the BIOS / ASPI driver by running the linux |
| 498 | * fdisk program and matching the H_C_S coordinates to what DOS uses. |
| 499 | * |
| 500 | * Locks: none |
| 501 | */ |
| 502 | |
| 503 | static int |
| 504 | generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
| 505 | sector_t capacity, int *ip) |
| 506 | { |
| 507 | ip[0] = 64; |
| 508 | ip[1] = 32; |
| 509 | ip[2] = capacity >> 11; |
| 510 | return 0; |
| 511 | } |
| 512 | #endif |
| 513 | |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 514 | #ifdef PSEUDO_DMA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | |
| 516 | /** |
| 517 | * NCR5380_pread - pseudo DMA read |
| 518 | * @instance: adapter to read from |
| 519 | * @dst: buffer to read into |
| 520 | * @len: buffer length |
| 521 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 522 | * Perform a pseudo DMA mode read from an NCR53C400 or equivalent |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | * controller |
| 524 | */ |
| 525 | |
| 526 | static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) |
| 527 | { |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 528 | #ifdef SCSI_G_NCR5380_MEM |
| 529 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
| 530 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | int blocks = len / 128; |
| 532 | int start = 0; |
| 533 | int bl; |
| 534 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR); |
| 536 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); |
| 537 | while (1) { |
| 538 | if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) { |
| 539 | break; |
| 540 | } |
| 541 | if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) { |
| 542 | printk(KERN_ERR "53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks); |
| 543 | return -1; |
| 544 | } |
| 545 | while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY); |
| 546 | |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 547 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | { |
| 549 | int i; |
| 550 | for (i = 0; i < 128; i++) |
| 551 | dst[start + i] = NCR5380_read(C400_HOST_BUFFER); |
| 552 | } |
| 553 | #else |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 554 | /* implies SCSI_G_NCR5380_MEM */ |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 555 | memcpy_fromio(dst + start, |
| 556 | hostdata->iomem + NCR53C400_host_buffer, 128); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | #endif |
| 558 | start += 128; |
| 559 | blocks--; |
| 560 | } |
| 561 | |
| 562 | if (blocks) { |
| 563 | while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY) |
| 564 | { |
| 565 | // FIXME - no timeout |
| 566 | } |
| 567 | |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 568 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | { |
| 570 | int i; |
| 571 | for (i = 0; i < 128; i++) |
| 572 | dst[start + i] = NCR5380_read(C400_HOST_BUFFER); |
| 573 | } |
| 574 | #else |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 575 | /* implies SCSI_G_NCR5380_MEM */ |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 576 | memcpy_fromio(dst + start, |
| 577 | hostdata->iomem + NCR53C400_host_buffer, 128); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | #endif |
| 579 | start += 128; |
| 580 | blocks--; |
| 581 | } |
| 582 | |
| 583 | if (!(NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ)) |
| 584 | printk("53C400r: no 53C80 gated irq after transfer"); |
| 585 | |
| 586 | #if 0 |
| 587 | /* |
| 588 | * DON'T DO THIS - THEY NEVER ARRIVE! |
| 589 | */ |
| 590 | printk("53C400r: Waiting for 53C80 registers\n"); |
| 591 | while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG) |
| 592 | ; |
| 593 | #endif |
| 594 | if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) |
| 595 | printk(KERN_ERR "53C400r: no end dma signal\n"); |
| 596 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | return 0; |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * NCR5380_write - pseudo DMA write |
| 602 | * @instance: adapter to read from |
| 603 | * @dst: buffer to read into |
| 604 | * @len: buffer length |
| 605 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 606 | * Perform a pseudo DMA mode read from an NCR53C400 or equivalent |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 607 | * controller |
| 608 | */ |
| 609 | |
| 610 | static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) |
| 611 | { |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 612 | #ifdef SCSI_G_NCR5380_MEM |
| 613 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
| 614 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | int blocks = len / 128; |
| 616 | int start = 0; |
| 617 | int bl; |
| 618 | int i; |
| 619 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 620 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE); |
| 621 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); |
| 622 | while (1) { |
| 623 | if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) { |
| 624 | printk(KERN_ERR "53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks); |
| 625 | return -1; |
| 626 | } |
| 627 | |
| 628 | if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) { |
| 629 | break; |
| 630 | } |
| 631 | while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY) |
| 632 | ; // FIXME - timeout |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 633 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | { |
| 635 | for (i = 0; i < 128; i++) |
| 636 | NCR5380_write(C400_HOST_BUFFER, src[start + i]); |
| 637 | } |
| 638 | #else |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 639 | /* implies SCSI_G_NCR5380_MEM */ |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 640 | memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, |
| 641 | src + start, 128); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | #endif |
| 643 | start += 128; |
| 644 | blocks--; |
| 645 | } |
| 646 | if (blocks) { |
| 647 | while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY) |
| 648 | ; // FIXME - no timeout |
| 649 | |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 650 | #ifndef SCSI_G_NCR5380_MEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | { |
| 652 | for (i = 0; i < 128; i++) |
| 653 | NCR5380_write(C400_HOST_BUFFER, src[start + i]); |
| 654 | } |
| 655 | #else |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 656 | /* implies SCSI_G_NCR5380_MEM */ |
Finn Thain | 54d8fe4 | 2016-01-03 16:05:06 +1100 | [diff] [blame] | 657 | memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, |
| 658 | src + start, 128); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | #endif |
| 660 | start += 128; |
| 661 | blocks--; |
| 662 | } |
| 663 | |
| 664 | #if 0 |
| 665 | printk("53C400w: waiting for registers to be available\n"); |
| 666 | THEY NEVER DO ! while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG); |
| 667 | printk("53C400w: Got em\n"); |
| 668 | #endif |
| 669 | |
| 670 | /* Let's wait for this instead - could be ugly */ |
| 671 | /* All documentation says to check for this. Maybe my hardware is too |
| 672 | * fast. Waiting for it seems to work fine! KLL |
| 673 | */ |
| 674 | while (!(i = NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ)) |
| 675 | ; // FIXME - no timeout |
| 676 | |
| 677 | /* |
| 678 | * I know. i is certainly != 0 here but the loop is new. See previous |
| 679 | * comment. |
| 680 | */ |
| 681 | if (i) { |
| 682 | if (!((i = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_END_DMA_TRANSFER)) |
| 683 | printk(KERN_ERR "53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i); |
| 684 | } else |
| 685 | printk(KERN_ERR "53C400w: no 53C80 gated irq after transfer (last block)\n"); |
| 686 | |
| 687 | #if 0 |
| 688 | if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) { |
| 689 | printk(KERN_ERR "53C400w: no end dma signal\n"); |
| 690 | } |
| 691 | #endif |
| 692 | while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT)) |
| 693 | ; // TIMEOUT |
| 694 | return 0; |
| 695 | } |
Finn Thain | ff3d457 | 2016-01-03 16:05:25 +1100 | [diff] [blame] | 696 | |
| 697 | static int generic_NCR5380_dma_xfer_len(struct scsi_cmnd *cmd) |
| 698 | { |
| 699 | int transfersize = cmd->transfersize; |
| 700 | |
| 701 | /* Limit transfers to 32K, for xx400 & xx406 |
| 702 | * pseudoDMA that transfers in 128 bytes blocks. |
| 703 | */ |
| 704 | if (transfersize > 32 * 1024 && cmd->SCp.this_residual && |
| 705 | !(cmd->SCp.this_residual % transfersize)) |
| 706 | transfersize = 32 * 1024; |
| 707 | |
| 708 | return transfersize; |
| 709 | } |
| 710 | |
Finn Thain | 4d8c08c | 2016-01-03 16:05:09 +1100 | [diff] [blame] | 711 | #endif /* PSEUDO_DMA */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | |
| 713 | /* |
| 714 | * Include the NCR5380 core code that we build our driver around |
| 715 | */ |
| 716 | |
| 717 | #include "NCR5380.c" |
| 718 | |
Christoph Hellwig | d0be4a7d | 2005-10-31 18:31:40 +0100 | [diff] [blame] | 719 | static struct scsi_host_template driver_template = { |
Al Viro | dd7ab71 | 2013-03-31 01:15:54 -0400 | [diff] [blame] | 720 | .show_info = generic_NCR5380_show_info, |
Finn Thain | 8c32513 | 2014-11-12 16:11:58 +1100 | [diff] [blame] | 721 | .name = "Generic NCR5380/NCR53C400 SCSI", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | .detect = generic_NCR5380_detect, |
| 723 | .release = generic_NCR5380_release_resources, |
| 724 | .info = generic_NCR5380_info, |
| 725 | .queuecommand = generic_NCR5380_queue_command, |
| 726 | .eh_abort_handler = generic_NCR5380_abort, |
| 727 | .eh_bus_reset_handler = generic_NCR5380_bus_reset, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | .bios_param = NCR5380_BIOSPARAM, |
| 729 | .can_queue = CAN_QUEUE, |
| 730 | .this_id = 7, |
| 731 | .sg_tablesize = SG_ALL, |
| 732 | .cmd_per_lun = CMD_PER_LUN, |
| 733 | .use_clustering = DISABLE_CLUSTERING, |
| 734 | }; |
| 735 | #include <linux/module.h> |
| 736 | #include "scsi_module.c" |
| 737 | |
| 738 | module_param(ncr_irq, int, 0); |
| 739 | module_param(ncr_dma, int, 0); |
| 740 | module_param(ncr_addr, int, 0); |
| 741 | module_param(ncr_5380, int, 0); |
| 742 | module_param(ncr_53c400, int, 0); |
| 743 | module_param(ncr_53c400a, int, 0); |
| 744 | module_param(dtc_3181e, int, 0); |
| 745 | MODULE_LICENSE("GPL"); |
| 746 | |
Geert Uytterhoeven | b026e8e | 2015-01-03 23:00:16 +0100 | [diff] [blame] | 747 | #if !defined(SCSI_G_NCR5380_MEM) && defined(MODULE) |
Greg Kroah-Hartman | 6f03979 | 2012-12-21 13:08:55 -0800 | [diff] [blame] | 748 | static struct isapnp_device_id id_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | { |
| 750 | ISAPNP_ANY_ID, ISAPNP_ANY_ID, |
| 751 | ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), |
| 752 | 0}, |
| 753 | {0} |
| 754 | }; |
| 755 | |
| 756 | MODULE_DEVICE_TABLE(isapnp, id_table); |
Ondrej Zary | 702a98c | 2010-08-10 18:01:16 -0700 | [diff] [blame] | 757 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 758 | |
| 759 | __setup("ncr5380=", do_NCR5380_setup); |
| 760 | __setup("ncr53c400=", do_NCR53C400_setup); |
| 761 | __setup("ncr53c400a=", do_NCR53C400A_setup); |
| 762 | __setup("dtc3181e=", do_DTC3181E_setup); |