root/drivers/scsi/aha1740.h

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

INCLUDED FROM


   1 #ifndef _AHA1740_H
   2 
   3 /* $Id$
   4  *
   5  * Header file for the adaptec 1740 driver for Linux
   6  *
   7  * With minor revisions 3/31/93
   8  * Written and (C) 1992,1993 Brad McLean.  See aha1740.c
   9  * for more info
  10  *
  11  */
  12 
  13 #include <linux/types.h>
  14 
  15 /* Eisa Enhanced mode operation - slot locating and addressing */
  16 #define MINEISA 1   /* I don't have an EISA Spec to know these ranges, so I */
  17 #define MAXEISA 8   /* Just took my machine's specifications.  Adjust to fit.*/
  18                     /* I just saw an ad, and bumped this from 6 to 8 */
  19 #define SLOTBASE(x)     ((x << 12)+ 0xc80 )
  20 #define BASE            (base)
  21 
  22 /* EISA configuration registers & values */
  23 #define HID0    (base + 0x0)
  24 #define HID1    (base + 0x1)
  25 #define HID2    (base + 0x2)
  26 #define HID3    (base + 0x3)
  27 #define EBCNTRL (base + 0x4)
  28 #define PORTADR (base + 0x40)
  29 #define BIOSADR (base + 0x41)
  30 #define INTDEF  (base + 0x42)
  31 #define SCSIDEF (base + 0x43)
  32 #define BUSDEF  (base + 0x44)
  33 #define RESV0   (base + 0x45)
  34 #define RESV1   (base + 0x46)
  35 #define RESV2   (base + 0x47)
  36 
  37 #define HID_MFG "ADP"
  38 #define HID_PRD 0
  39 #define HID_REV 2
  40 #define EBCNTRL_VALUE 1
  41 #define PORTADDR_ENH 0x80
  42 /* READ */
  43 #define G2INTST (BASE + 0x56)
  44 #define G2STAT  (BASE + 0x57)
  45 #define MBOXIN0 (BASE + 0x58)
  46 #define MBOXIN1 (BASE + 0x59)
  47 #define MBOXIN2 (BASE + 0x5a)
  48 #define MBOXIN3 (BASE + 0x5b)
  49 #define G2STAT2 (BASE + 0x5c)
  50 
  51 #define G2INTST_MASK            0xf0    /* isolate the status */
  52 #define G2INTST_CCBGOOD         0x10    /* CCB Completed */
  53 #define G2INTST_CCBRETRY        0x50    /* CCB Completed with a retry */
  54 #define G2INTST_HARDFAIL        0x70    /* Adapter Hardware Failure */
  55 #define G2INTST_CMDGOOD         0xa0    /* Immediate command success */
  56 #define G2INTST_CCBERROR        0xc0    /* CCB Completed with error */
  57 #define G2INTST_ASNEVENT        0xd0    /* Asynchronous Event Notification */
  58 #define G2INTST_CMDERROR        0xe0    /* Immediate command error */
  59 
  60 #define G2STAT_MBXOUT   4       /* Mailbox Out Empty Bit */
  61 #define G2STAT_INTPEND  2       /* Interrupt Pending Bit */
  62 #define G2STAT_BUSY     1       /* Busy Bit (attention pending) */
  63 
  64 #define G2STAT2_READY   0       /* Host Ready Bit */
  65 
  66 /* WRITE (and ReadBack) */
  67 #define MBOXOUT0        (BASE + 0x50)
  68 #define MBOXOUT1        (BASE + 0x51)
  69 #define MBOXOUT2        (BASE + 0x52)
  70 #define MBOXOUT3        (BASE + 0x53)
  71 #define ATTN            (BASE + 0x54)
  72 #define G2CNTRL         (BASE + 0x55)
  73 
  74 #define ATTN_IMMED      0x10    /* Immediate Command */
  75 #define ATTN_START      0x40    /* Start CCB */
  76 #define ATTN_ABORT      0x50    /* Abort CCB */
  77 
  78 #define G2CNTRL_HRST    0x80            /* Hard Reset */
  79 #define G2CNTRL_IRST    0x40            /* Clear EISA Interrupt */
  80 #define G2CNTRL_HRDY    0x20            /* Sets HOST ready */
  81 
  82 /* This is used with scatter-gather */
  83 struct aha1740_chain {
  84   ulong  dataptr;               /* Location of data */
  85   ulong  datalen;               /* Size of this part of chain */
  86 };
  87 
  88 /* These belong in scsi.h */
  89 #define any2scsi(up, p)                         \
  90 (up)[0] = (((unsigned long)(p)) >> 16)  ;       \
  91 (up)[1] = (((unsigned long)(p)) >> 8);          \
  92 (up)[2] = ((unsigned long)(p));
  93 
  94 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
  95 
  96 #define xany2scsi(up, p)        \
  97 (up)[0] = ((long)(p)) >> 24;    \
  98 (up)[1] = ((long)(p)) >> 16;    \
  99 (up)[2] = ((long)(p)) >> 8;     \
 100 (up)[3] = ((long)(p));
 101 
 102 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
 103                       + (((long)(up)[2]) <<  8) +  ((long)(up)[3]) )
 104 
 105 #define MAX_CDB 12
 106 #define MAX_SENSE 14
 107 #define MAX_STATUS 32
 108 
 109 struct ecb {                    /* Enhanced Control Block 6.1 */
 110   ushort cmdw;                  /* Command Word */
 111                         /* Flag Word 1 */
 112   ushort        cne:1,          /* Control Block Chaining */
 113         :6,     di:1,           /* Disable Interrupt */
 114         :2,     ses:1,          /* Suppress Underrun error */
 115         :1,     sg:1,           /* Scatter/Gather */
 116         :1,     dsb:1,          /* Disable Status Block */
 117                 ars:1;          /* Automatic Request Sense */
 118                         /* Flag Word 2 */
 119   ushort        lun:3,          /* Logical Unit */
 120                 tag:1,          /* Tagged Queuing */
 121                 tt:2,           /* Tag Type */
 122                 nd:1,           /* No Disconnect */
 123         :1,     dat:1,          /* Data transfer - check direction */
 124                 dir:1,          /* Direction of transfer 1 = datain */
 125                 st:1,           /* Suppress Transfer */
 126                 chk:1,          /* Calculate Checksum */
 127         :2,     rec:1,  :1;     /* Error Recovery */
 128   ushort nil0;                  /* nothing */
 129   ulong  dataptr;               /* Data or Scatter List ptr */
 130   ulong  datalen;               /* Data or Scatter List len */
 131   ulong  statusptr;             /* Status Block ptr */
 132   ulong  linkptr;               /* Chain Address */
 133   ulong  nil1;                  /* nothing */
 134   ulong  senseptr;              /* Sense Info Pointer */
 135   unchar senselen;              /* Sense Length */
 136   unchar cdblen;                /* CDB Length */
 137   ushort datacheck;             /* Data checksum */
 138   unchar cdb[MAX_CDB];          /* CDB area */
 139   /* Hardware defined portion ends here, rest is driver defined */
 140   unchar sense[MAX_SENSE];      /* Sense area */ 
 141   unchar status[MAX_STATUS];    /* Status area */
 142   Scsi_Cmnd *SCpnt;             /* Link to the SCSI Command Block */
 143   void (*done)(Scsi_Cmnd *);    /* Completion Function */
 144 };
 145 
 146 #define AHA1740CMD_NOP   0x00   /* No OP */
 147 #define AHA1740CMD_INIT  0x01   /* Initiator SCSI Command */
 148 #define AHA1740CMD_DIAG  0x05   /* Run Diagnostic Command */
 149 #define AHA1740CMD_SCSI  0x06   /* Initialize SCSI */
 150 #define AHA1740CMD_SENSE 0x08   /* Read Sense Information */
 151 #define AHA1740CMD_DOWN  0x09   /* Download Firmware (yeah, I bet!) */
 152 #define AHA1740CMD_RINQ  0x0a   /* Read Host Adapter Inquiry Data */
 153 #define AHA1740CMD_TARG  0x10   /* Target SCSI Command */
 154 
 155 int aha1740_detect(Scsi_Host_Template *);
 156 int aha1740_command(Scsi_Cmnd *);
 157 int aha1740_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
 158 int aha1740_abort(Scsi_Cmnd *);
 159 const char *aha1740_info(void);
 160 int aha1740_reset(Scsi_Cmnd *);
 161 int aha1740_biosparam(Disk *, int, int*);
 162 
 163 #define AHA1740_ECBS 32
 164 #define AHA1740_SCATTER 16
 165 
 166 #ifndef NULL
 167 #define NULL 0
 168 #endif
 169 
 170 #define AHA1740 {NULL,                                  \
 171                    "Adaptec 1740",                      \
 172                    aha1740_detect,                      \
 173                    NULL,                                \
 174                    aha1740_info,                        \
 175                    aha1740_command,                     \
 176                    aha1740_queuecommand,                \
 177                    aha1740_abort,                       \
 178                    aha1740_reset,                       \
 179                    NULL,                                \
 180                    aha1740_biosparam,                   \
 181                    AHA1740_ECBS,                        \
 182                    7,                                   \
 183                    AHA1740_SCATTER,                     \
 184                    1,                                   \
 185                    0,                                   \
 186                    0,                                   \
 187                    ENABLE_CLUSTERING}
 188 
 189 #endif
 190 

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