root/kernel/blk_drv/scsi/aha1740.h

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

INCLUDED FROM


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

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