root/drivers/scsi/g_NCR5380.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. generic_NCR5380_detect
  2. generic_NCR5380_info

   1 #define AUTOSENSE
   2 
   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
  11  *
  12  * ALPHA RELEASE 1. 
  13  *
  14  * For more information, please consult 
  15  *
  16  * NCR 5380 Family
  17  * SCSI Protocol Controller
  18  * Databook
  19  *
  20  * NCR Microelectronics
  21  * 1635 Aeroplaza Drive
  22  * Colorado Springs, CO 80916
  23  * 1+ (719) 578-3400
  24  * 1+ (800) 334-5454
  25  */
  26 
  27 /* 
  28  * TODO : flesh out DMA support, find some one actually using this (I have
  29  *      a memory mapped Trantor board that works fine)
  30  */
  31 
  32 /*
  33  * Options :
  34  *
  35  * PARITY - enable parity checking.  Not supported.
  36  *
  37  * SCSI2 - enable support for SCSI-II tagged queueing.  Untested.
  38  *
  39  * USLEEP - enable support for devices that don't disconnect.  Untested.
  40  *
  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.
  44  *
  45  * 2.  With the GENERIC_NCR5380_OVERRIDE compile time define.  This is 
  46  *     specified as an array of address, irq tuples.  Ie, for
  47  *     one board at the default 0xcc000 address, IRQ5, no dma, I could 
  48  *     say  -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE}}
  49  * 
  50  * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an 
  51  *      IRQ line if overridden on the command line.
  52  */
  53  
  54 /*
  55  * $Log: generic_NCR5380.c,v $
  56  */
  57 
  58 #define AUTOPROBE_IRQ
  59 
  60 #include <asm/system.h>
  61 #include <asm/io.h>
  62 #include <linux/signal.h>
  63 #include <linux/sched.h>
  64 #include <linux/blk.h>
  65 #include "scsi.h"
  66 #include "hosts.h"
  67 #include "g_NCR5380.h"
  68 #include "NCR5380.h"
  69 #include "constants.h"
  70 #include<linux/stat.h>
  71 
  72 struct proc_dir_entry proc_scsi_g_ncr5380 = {
  73     PROC_SCSI_GENERIC_NCR5380, 9, "g_NCR5380",
  74     S_IFDIR | S_IRUGO | S_IXUGO, 2
  75 };
  76 
  77 static struct override {
  78     int port;
  79     int irq;
  80     int dma;
  81 } overrides 
  82 #ifdef GENERIC_NCR5380_OVERRIDE 
  83     [] = GENERIC_NCR5380_OVERRIDE
  84 #else
  85     [1] = {{0,},};
  86 #endif
  87 
  88 #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override))
  89 
  90 /*
  91  * Function : generic_NCR5380_setup(char *str, int *ints)
  92  *
  93  * Purpose : LILO command line initialization of the overrides array,
  94  * 
  95  * Inputs : str - unused, ints - array of integer parameters with ints[0]
  96  *      equal to the number of ints.
  97  *
  98  */
  99 
 100 void generic_NCR5380_setup(char *str, int *ints) {
 101     static int commandline_current = 0;
 102     if (ints[0] != 2) 
 103         printk("generic_NCR5380_setup : usage ncr5380=port,irq,dma\n");
 104     else 
 105         if (commandline_current < NO_OVERRIDES) {
 106             overrides[commandline_current].port = ints[1];
 107             overrides[commandline_current].irq = ints[2];
 108             overrides[commandline_current].dma = ints[3];
 109             ++commandline_current;
 110         }
 111 }
 112 
 113 /* 
 114  * Function : int generic_NCR5380_detect(Scsi_Host_Template * tpnt)
 115  *
 116  * Purpose : initializes generic NCR5380 driver based on the 
 117  *      command line / compile time port and irq definitions.
 118  *
 119  * Inputs : tpnt - template for this SCSI adapter.
 120  * 
 121  * Returns : 1 if a host adapter was found, 0 if not.
 122  *
 123  */
 124 
 125 int generic_NCR5380_detect(Scsi_Host_Template * tpnt) {
     /* [previous][next][first][last][top][bottom][index][help] */
 126     static int current_override = 0;
 127     int count;
 128     struct Scsi_Host *instance;
 129 
 130     tpnt->proc_dir = &proc_scsi_g_ncr5380;
 131 
 132     for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
 133         if (!(overrides[current_override].port))
 134             continue;
 135 
 136         instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
 137         instance->io_port = overrides[current_override].port;
 138 
 139         NCR5380_init(instance, 0);
 140 
 141         if (overrides[current_override].irq != IRQ_AUTO)
 142             instance->irq = overrides[current_override].irq;
 143         else 
 144             instance->irq = NCR5380_probe_irq(instance, 0xffff);
 145 
 146         if (instance->irq != IRQ_NONE) 
 147             if (request_irq(instance->irq, generic_NCR5380_intr, SA_INTERRUPT, "NCR5380")) {
 148                 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 
 149                     instance->host_no, instance->irq);
 150                 instance->irq = IRQ_NONE;
 151             } 
 152 
 153         if (instance->irq == IRQ_NONE) {
 154             printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
 155             printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
 156         }
 157 
 158         printk("scsi%d : at port %d", instance->host_no, instance->io_port);
 159         if (instance->irq == IRQ_NONE)
 160             printk (" interrupts disabled");
 161         else 
 162             printk (" irq %d", instance->irq);
 163         printk(" options CAN_QUEUE=%d  CMD_PER_LUN=%d release=%d",
 164             CAN_QUEUE, CMD_PER_LUN, GENERIC_NCR5380_PUBLIC_RELEASE);
 165         NCR5380_print_options(instance);
 166         printk("\n");
 167 
 168         ++current_override;
 169         ++count;
 170     }
 171     return count;
 172 }
 173 
 174 const char * generic_NCR5380_info (void) {
     /* [previous][next][first][last][top][bottom][index][help] */
 175     static const char string[]="";
 176     return string;
 177 }
 178 
 179 #include "NCR5380.c"
 180 #ifdef MODULE
 181 /* Eventually this will go into an include file, but this will be later */
 182 Scsi_Host_Template driver_template = GENERIC_NCR5380;
 183 
 184 #include <linux/module.h>
 185 #include "scsi_module.c"
 186 #endif

/* [previous][next][first][last][top][bottom][index][help] */