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