linux/drivers/scsi/t128.c
<<
>>
Prefs
   1#define AUTOSENSE
   2#define PSEUDO_DMA
   3
   4/*
   5 * Trantor T128/T128F/T228 driver
   6 *      Note : architecturally, the T100 and T130 are different and won't 
   7 *      work
   8 *
   9 * Copyright 1993, Drew Eckhardt
  10 *      Visionary Computing
  11 *      (Unix and Linux consulting and custom programming)
  12 *      drew@colorado.edu
  13 *      +1 (303) 440-4894
  14 *
  15 * DISTRIBUTION RELEASE 3.
  16 *
  17 * For more information, please consult 
  18 *
  19 * Trantor Systems, Ltd.
  20 * T128/T128F/T228 SCSI Host Adapter
  21 * Hardware Specifications
  22 * 
  23 * Trantor Systems, Ltd. 
  24 * 5415 Randall Place
  25 * Fremont, CA 94538
  26 * 1+ (415) 770-1400, FAX 1+ (415) 770-9910
  27 * 
  28 * and 
  29 *
  30 * NCR 5380 Family
  31 * SCSI Protocol Controller
  32 * Databook
  33 *
  34 * NCR Microelectronics
  35 * 1635 Aeroplaza Drive
  36 * Colorado Springs, CO 80916
  37 * 1+ (719) 578-3400
  38 * 1+ (800) 334-5454
  39 */
  40
  41/*
  42 * Options : 
  43 * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
  44 *      for commands that return with a CHECK CONDITION status. 
  45 *
  46 * PSEUDO_DMA - enables PSEUDO-DMA hardware, should give a 3-4X performance
  47 * increase compared to polled I/O.
  48 *
  49 * PARITY - enable parity checking.  Not supported.
  50 * 
  51 * SCSI2 - enable support for SCSI-II tagged queueing.  Untested.
  52 *
  53 *
  54 * UNSAFE - leave interrupts enabled during pseudo-DMA transfers.  You
  55 *          only really want to use this if you're having a problem with
  56 *          dropped characters during high speed communications, and even
  57 *          then, you're going to be better off twiddling with transfersize.
  58 *
  59 * USLEEP - enable support for devices that don't disconnect.  Untested.
  60 *
  61 * The card is detected and initialized in one of several ways : 
  62 * 1.  Autoprobe (default) - since the board is memory mapped, 
  63 *     a BIOS signature is scanned for to locate the registers.
  64 *     An interrupt is triggered to autoprobe for the interrupt
  65 *     line.
  66 *
  67 * 2.  With command line overrides - t128=address,irq may be 
  68 *     used on the LILO command line to override the defaults.
  69 *
  70 * 3.  With the T128_OVERRIDE compile time define.  This is 
  71 *     specified as an array of address, irq tuples.  Ie, for
  72 *     one board at the default 0xcc000 address, IRQ5, I could say 
  73 *     -DT128_OVERRIDE={{0xcc000, 5}}
  74 *      
  75 *     Note that if the override methods are used, place holders must
  76 *     be specified for other boards in the system.
  77 * 
  78 * T128/T128F jumper/dipswitch settings (note : on my sample, the switches 
  79 * were epoxy'd shut, meaning I couldn't change the 0xcc000 base address) :
  80 *
  81 * T128    Sw7 Sw8 Sw6 = 0ws Sw5 = boot 
  82 * T128F   Sw6 Sw7 Sw5 = 0ws Sw4 = boot Sw8 = floppy disable
  83 * cc000   off off      
  84 * c8000   off on
  85 * dc000   on  off
  86 * d8000   on  on
  87 *
  88 * 
  89 * Interrupts 
  90 * There is a 12 pin jumper block, jp1, numbered as follows : 
  91 *   T128 (JP1)          T128F (J5)
  92 * 2 4 6 8 10 12        11 9  7 5 3 1
  93 * 1 3 5 7 9  11        12 10 8 6 4 2
  94 *
  95 * 3   2-4
  96 * 5   1-3
  97 * 7   3-5
  98 * T128F only 
  99 * 10 8-10
 100 * 12 7-9
 101 * 14 10-12
 102 * 15 9-11
 103 */
 104 
 105/*
 106 * $Log: t128.c,v $
 107 */
 108
 109#include <linux/signal.h>
 110#include <linux/io.h>
 111#include <linux/blkdev.h>
 112#include <linux/interrupt.h>
 113#include <linux/stat.h>
 114#include <linux/init.h>
 115#include <linux/module.h>
 116#include <linux/delay.h>
 117
 118#include "scsi.h"
 119#include <scsi/scsi_host.h>
 120#include "t128.h"
 121#define AUTOPROBE_IRQ
 122#include "NCR5380.h"
 123
 124static struct override {
 125    unsigned long address;
 126    int irq;
 127} overrides
 128#ifdef T128_OVERRIDE
 129    [] __initdata = T128_OVERRIDE;
 130#else
 131    [4] __initdata = {{0, IRQ_AUTO}, {0, IRQ_AUTO},
 132        {0 ,IRQ_AUTO}, {0, IRQ_AUTO}};
 133#endif
 134
 135#define NO_OVERRIDES ARRAY_SIZE(overrides)
 136
 137static struct base {
 138    unsigned int address;
 139    int noauto;
 140} bases[] __initdata = {
 141    { 0xcc000, 0}, { 0xc8000, 0}, { 0xdc000, 0}, { 0xd8000, 0}
 142};
 143
 144#define NO_BASES ARRAY_SIZE(bases)
 145
 146static struct signature {
 147    const char *string;
 148    int offset;
 149} signatures[] __initdata = {
 150{"TSROM: SCSI BIOS, Version 1.12", 0x36},
 151};
 152
 153#define NO_SIGNATURES ARRAY_SIZE(signatures)
 154
 155/*
 156 * Function : t128_setup(char *str, int *ints)
 157 *
 158 * Purpose : LILO command line initialization of the overrides array,
 159 * 
 160 * Inputs : str - unused, ints - array of integer parameters with ints[0]
 161 *      equal to the number of ints.
 162 *
 163 */
 164
 165void __init t128_setup(char *str, int *ints){
 166    static int commandline_current = 0;
 167    int i;
 168    if (ints[0] != 2) 
 169        printk("t128_setup : usage t128=address,irq\n");
 170    else 
 171        if (commandline_current < NO_OVERRIDES) {
 172            overrides[commandline_current].address = ints[1];
 173            overrides[commandline_current].irq = ints[2];
 174            for (i = 0; i < NO_BASES; ++i)
 175                if (bases[i].address == ints[1]) {
 176                    bases[i].noauto = 1;
 177                    break;
 178                }
 179            ++commandline_current;
 180        }
 181}
 182
 183/* 
 184 * Function : int t128_detect(struct scsi_host_template * tpnt)
 185 *
 186 * Purpose : detects and initializes T128,T128F, or T228 controllers
 187 *      that were autoprobed, overridden on the LILO command line, 
 188 *      or specified at compile time.
 189 *
 190 * Inputs : tpnt - template for this SCSI adapter.
 191 * 
 192 * Returns : 1 if a host adapter was found, 0 if not.
 193 *
 194 */
 195
 196int __init t128_detect(struct scsi_host_template * tpnt){
 197    > *  197    > 167 = 0;
    struct =     unsigned long base;
  a>void _omemte=   n class="comment"> unses" class="sref">str++urent;

  * tpnt&g  oc_" narq =("t1\n";
  * tpnt&g  oc_e inrq &g  t12e=oc_e intk" class="sref">t12e=oc_e innt;

    for (urent = 0;  197    >NO_OVERRIDES; ++ 197    >      g base = 0;
      g ;
;
        if (overrides[ 197    >].address          g base  (overrides[ 197    >].address;
            bases[address, 2010n>);
            if!                g base = 0;
      }   else 
            for; !  baseNO_BASES; ++    printk(&quos/sc-i/t1 : a praving>addre %08xrq\n"++bases[address);
#endif
                if (bases[noauto)
                      8 coinue>);
                bases[address, 2010n>);
                if!                        8 coinue>);
                for (str = 0; str < NO_SIGNATURES; ++str                    if (signaturesstr].offset                                      } signaturesstr].string                                      } sleven(signaturesstr].string                      } base  (bases[address);
                        printk(&quos/sc-i/t1 : s detecter boa.rq\n");
#endif
                      goto                     a>}
              =           a>}

# =         printk(&quos/sc-i/t1 : 0 bas= %08xrq\n"(  unsigned i) } base);
#endif
        if!  base            break;

        scse registng" class="sref">scse registnttpnt(struct NCR53si_hoitdata" class="sref">NCR53si_hoitdang        f (                break;
              k;
        base  (base      (a>(struct NCR53si_hoitdata" class="sref">NCR53si_hoitdangncase" class="srefe=  >ncant&g  base  (
        NCR53s__init" class="sref">NCR53s__inZE(
        if (overrides[ 197    >].irq  (IRQ_AUTO            irq = overrides[ 197    >].irq);
        else 
            irq = NCR53stopro_e=irq" class="sref">NCR53stopro_e=iZE(t12">IRES" class="srefe>t12">IRse);
;
        if (irq  (I_NONErq" class="srefs SC2">I_NONEtr            if (ncase" class="srefe=  >ncant&g  irqt12d itng" class="sref">t12d itrqIF_DISABLEDTO" class="sref">IF_DISABLEDrq"t1\n"              a>                            printk(&quos/sc%d :s, I%d not free,he interruspy disabdrq\n" {
                    ncase" class="srefe=  >ncant&g  irq);
              = irq = I_NONErq" class="srefs SC2">I_NONEtr);
          a> {

        if (irq> = I_NONErq" class="srefs SC2">I_NONEtr            printk(&quos/sc%d :se interruspnot enisabd.   fobetaptee intactdri per  fm>nca,rq\n"++            printk(&quos/sc%d :sple basn jumpen thr boa   foa frees, I.rq\n"++      a>}

# =         printk(&quos/sc%d :serqs= %drq\n"  ncase" class="srefe=  >ncant&g  irq);
#endif

      g printk(&quos/sc%d :sat 0x%08lx\n"  ncase" class="srefe=  >ncant&g  base);
        if (irq> = I_NONErq" class="srefs SC2">I_NONEtr          g printk(&quohe interruspy disabd\n");
        else 
          g printk(&quoherqs%d\n"  irq);
      g printk(&quo opnctis CAN_QUEUE=%d  CMD_PER_LUN=%d rele ba=%d\n"            t12PUBLIC_RELEASEtk" class="srefe>t12PUBLIC_RELEASErq);
        NCR53stoi128.pnctisrq" class="sref">NCR53stoi128.pnctisZE(      g printk(&quorq\n");

      ; ++ 197    >);
      ; ++urent;
  a>}
  r Retu>++urent;
}

 ">t12rele bang" class="sref">t12rele batk=       g NCR53slocal_de" cture" class="sref">NCR53slocal_de" ctutk);
        NCR53s8_setup" class="sref">NCR53s8_setZE();
        or (&g  irq                &g  irq);
        NCR53sexinit" class="sref">NCR53sexinZE();
        if (&g  &g                 (&g  &g        g scsune registng" class="sref">scsune registZE();
        base);
      r Retu>= 0;
}

/*
 * Function : int t12biosr par(Disk"> disk,   strucblock_device *devtr, int pnt)
 *
 * Purpose GeneratidesSI BI / DBI t co>
 *    n thr specifiedevice / ersiot.
 t.
 * Inputs :rsi = :rsi ofedevice in sectors (512 bytid),edev = blockedevicet.
      maj fo/ minostr,p[]a> =heads, sectors, cy="ldive}  t.
 *
 * Returns always 0 (succesd),ed initializeip *
 *     *
 */
;
/* 
 XXX M hoss SCSr boas uposr thimatpavi, I t uld be incorrect.  Somi onet.
 usavinhboa disksen oa trant  orh uld rivify   thar thimatpavi corresponders
 l to thaunus by n thI BI / ASPI ="driv by runnavi n th="lux fdisk a pgparrs
 mmanmatchavi n thH_C_I t ordinatidel tw thaDBI ununts.
 */

 ">t12biosr parng" class="sref">t12biosr partkscsdeviceng" class="sref">scsdevicet.= =               =       &ga>&g 1= 1;
r Retu>= 0;
}

/*
 * Function : in">NCR53stoead a  strucS>scsH"pont *  >ncane, 
 *      unsigne>(chardst, , inlennt)
 *
 * Purpose FaponCR53 pseudo-dma oead f Functi, transfivenlen bytidel t *
 *    dpotr
 t.
 * Inputs dpoa> destinatcti, len = lengwith  bytidt.
t.
 * Returns 0en osuccesd, nn ozeroen oa failureosuch adesSwatchdog t.
 *    nimeounot.
 */

( ">NCR53stoeadrq" class="sref">NCR53stoeadtkscsH"post" class="srefS>scsH"pote=   n class="comment"> lenng" class="srefleven  g NCR53slocal_de" cture" class="sref">NCR53slocal_de" ctutk);
  a>void _omemte=     unsigne>(char=   e regist n class="comment"> e=i" class="sref">i ass="comment"> lenng" class="srefleven;

    NCR53s8_setup" class="sref">NCR53s8_setZE(  = base} 
# 0n>
    for; ass="comment"> e=i" class="sref">i e=i" class="sref">i      whmpil(!f (baseii);
lse);
  whmpil(!f (baseii);
    for; ass="comment"> e=i" class="sref">i e=i" class="sref">i#endif
      r=   a>}

    if (base}         unsigne>(chaass="comment"> "mtup" class="sref"mten;
      a>void _omemte= base}       g   (        }         (      g printk(&quos/sc%d :swatchdog nimer firgned n">NCR53stoead()rq\n"                  r Retu>-= 1;
  }   el1;
      r Retu>= 0;
}
/*
 * Function : in">NCR53stwrite a  strucS>scsH"pont *  >ncane, 
        unsigne>(charsrc, , inlennt)
 *
 * Purpose FaponCR53 pseudo-dma write f Functi, transfivenlen bytidefrorrs
 *    srcrs
 rs
 * Inputs :rc = :ourcanelen = lengwith  bytidt.
t.
 * Returns 0en osuccesd, nn ozeroen oa failureosuch adesSwatchdog t.
 *    nimeounot.
 */

( ">NCR53stwriterq" class="sref">NCR53stwritetkscsH"post" class="srefS>scsH"pote=   n class="comment"> lenng" class="srefleven  = NCR53slocal_de" cture" class="sref">NCR53slocal_de" ctutk);
  a>void _omemte= (char=     ncant(char= (ch>u);
<3
T2scsi/rs/scsi/65" clascsi/65" clascslass="line" name=3L171"3 171      a>voss="line[0= 6ass="1/a>  baseii);
lse);
  whmpil(!f (baseii);
lse);
  whmpil(!f (        );
i4      r Retu>-= 1;4112" id=34112" class="line" name=34112"341hredriv839178Hme=3omment">T2scsi/rs/sass="comm4nt"> * Inputs :rsi = :rs4 ofed41n>);
(  a>}

base} ii        unsigne>(chaass="comment"> "mtup" class="sref"mten;
void _omemte= base}           t128.c3L162" id=3L172" class="line" name=3L172"37277      g   (        }         (ncant&g128.c3L135" id=3L175" class="line" name=3L175"37577      g printk(&quos4 XXX M ho4s SCSr boas uposr thimat4avi, 42;
 l to thaunus by4n thI425/a>;
);
      r Retu>-= 1;4s="commen4"> mmanmatchavi n thH_C_4 t or42="srefe=  >ncant&g  t12biosr4partk4/a  st      g     GPL    NCR53stoi128.pnctisrq" clas4lass="sre4bdevse
              4  * "L25" class="line" name=3L1"sreftempla name=3L193"39193e=3L1"sreftempla n/a>;
lass="line" nampse  ncant&=1"26171            if ((;
urent
urent;
;
= (;
(;

(;
=     7(;
(;
;
= 4;
;
= printk((;
pruse_elucodr   emte= }
(


n/div>


The original LXR softwarehref="drrivers/schttp://line" forge.net/projecds/lxcl>LXR ent"unuct  *al t128a hrrefrivers/scmailto:lxc@llass.no">lxc@llass.no 

lxc.llass.no kinmly "srea hrefrivers/schttp://www.redpill-llapro.no">Redpill Llapro AS &qusers/scqusince 1995.
n/div>