root/drivers/scsi/buslogic.h

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

INCLUDED FROM


   1 /*
   2  *      buslogic.h      (C) 1993 David B. Gentzel
   3  *      Low-level scsi driver for BusLogic adapters
   4  *      by David B. Gentzel, Whitfield Software Services, Carnegie, PA
   5  *          (gentzel@nova.enet.dec.com)
   6  *      Thanks to BusLogic for providing the necessary documentation
   7  *
   8  *      The original version of this driver was derived from aha1542.[ch] which
   9  *      is Copyright (C) 1992 Tommy Thorn.  Much has been reworked, but most of
  10  *      basic structure and substantial chunks of code still remain.
  11  */
  12 
  13 #ifndef _BUSLOGIC_H
  14 
  15 int buslogic_detect(Scsi_Host_Template *);
  16 int buslogic_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
  17 int buslogic_abort(Scsi_Cmnd *);
  18 const char *buslogic_info(void);
  19 int buslogic_reset(Scsi_Cmnd *);
  20 int buslogic_biosparam(Disk *, int, int *);
  21 
  22 #define BUSLOGIC_CMDLUN 1       /* Do not set this too high.  It sucks
  23                                    up lots of memory on ISA machines
  24                                    with > 16MB because of the huge number of
  25                                    bounce buffers that need to be allocated.
  26                                    For boards that use non-ISA bus, we can
  27                                    bump this in the board detect routine.  
  28                                                         10/8/94 ERY */
  29 
  30 #define BUSLOGIC { NULL,                        \
  31                    "BusLogic",                  \
  32                    buslogic_detect,             \
  33                    NULL,                        \
  34                    buslogic_info,               \
  35                    0,   /* no command func */   \
  36                    buslogic_queuecommand,       \
  37                    buslogic_abort,              \
  38                    buslogic_reset,              \
  39                    0,   /* slave_attach NYI */  \
  40                    buslogic_biosparam,          \
  41                    0,   /* set by driver */     \
  42                    0,   /* set by driver */     \
  43                    0,   /* set by driver */     \
  44                    BUSLOGIC_CMDLUN,             \
  45                    0,                           \
  46                    0,   /* set by driver */     \
  47                    ENABLE_CLUSTERING            \
  48                  }
  49 
  50 #ifdef BUSLOGIC_PRIVATE_H
  51 
  52 /* ??? These don't really belong here */
  53 #ifndef TRUE
  54 # define TRUE 1
  55 #endif
  56 #ifndef FALSE
  57 # define FALSE 0
  58 #endif
  59 
  60 #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr)[0])
  61 
  62 #define PACKED __attribute__((packed))
  63 
  64 #define BD_ABORT        0x0001
  65 #define BD_COMMAND      0x0002
  66 #define BD_DETECT       0x0004
  67 #define BD_ERRORS       0x0008
  68 #define BD_INTERRUPT    0x0010
  69 #define BD_IO           0x0020
  70 #define BD_RESET        0x0040
  71 #define BD_UNDOCUMENTED 0x0080
  72 
  73 /* I/O Port interface */
  74 /* READ */
  75 #define STATUS(base) (base)
  76 #define DACT 0x80               /* Diagnostic Active */
  77 #define DFAIL 0x40              /* Diagnostic Failure */
  78 #define INREQ 0x20              /* Initialization Required */
  79 #define HARDY 0x10              /* Host Adapter Ready */
  80 #define CPRBSY 0x08             /* Command/Parameter Register Busy */
  81 #define DIRRDY 0x04             /* Data In Register Ready */
  82                                 /* 0x02 is reserved */
  83 #define CMDINV 0x01             /* Command Invalid */
  84 
  85 #define DATA_IN(base) (STATUS(base) + 1)
  86 
  87 #define INTERRUPT(base) (STATUS(base) + 2)
  88 #define INTV 0x80               /* Interrupt Valid */
  89                                 /* 0x70 are reserved */
  90 #define RSTS 0x08               /* SCSI Reset State */
  91 #define CMDC 0x04               /* Command Complete */
  92 #define MBOR 0x02               /* Mailbox Out Ready */
  93 #define IMBL 0x01               /* Incoming Mailbox Loaded */
  94 #define INTRMASK 0x8F
  95 
  96 /* This undocumented port returns a bitmask indicating geometry translation. */
  97 #define GEOMETRY(base) (STATUS(base) + 3)
  98 #define GEO_GT_1GB 0x80         /* > 1GB under DOS geometry mapping */
  99                                 /* 0x70 are unknown */
 100 #define GEO_XLATION_S_D1 0x0C   /* Disk 1 geometry ("S" models only) */
 101 #define GEO_XLATION_S_D0 0x03   /* Disk 0 geometry ("S" models only) */
 102 
 103 
 104 /* WRITE */
 105 #define CONTROL(base) STATUS(base)
 106 #define RHARD 0x80              /* Hard Reset */
 107 #define RSOFT 0x40              /* Soft Reset */
 108 #define RINT 0x20               /* Interrupt Reset */
 109 #define RSBUS 0x10              /* SCSI Bus Reset */
 110                                 /* 0x0F are reserved */
 111 
 112 #define COMMAND_PARAMETER(base) (STATUS(base) + 1)
 113 #define CMD_TSTCMDCINT 0x00     /* Test CMDC Interrupt */
 114 #define CMD_INITMB 0x01         /* Initialize Mailbox */
 115 #define CMD_START_SCSI 0x02     /* Start Mailbox */
 116 #define CMD_START_BIOS 0x03     /* Start BIOS */
 117 #define CMD_INQUIRY 0x04        /* Inquire Board ID */
 118 #define CMD_ENBOMBRINT 0x05     /* Enable OMBR Interrupt */
 119 #define CMD_SETSELTIMOUT 0x06   /* Set SCSI Selection Time-Out */
 120 #define CMD_BUSON_TIME 0x07     /* Set Bus-On Time */
 121 #define CMD_BUSOFF_TIME 0x08    /* Set Bus-Off Time */
 122 #define CMD_BUSXFR_RATE 0x09    /* Set Bus Transfer Rate */
 123 #define CMD_INQ_DEVICES 0x0A    /* Inquire Installed Devices */
 124 #define CMD_RETCONF 0x0B        /* Return Configuration */
 125 #define CMD_TARGET_MODE 0x0C    /* Set Target Mode */
 126 #define CMD_INQ_SETUP_INFO 0x0D /* Inquire Set-up Information */
 127 #define CMD_WRITE_LCL_RAM 0x1A  /* Write Adapter Local RAM */
 128 #define CMD_READ_LCL_RAM 0x1B   /* Read Adapter Local RAM */
 129 #define CMD_WRITE_BM_FIFO 0x1C  /* Write Bus Master Chip FIFO */
 130 #define CMD_READ_BM_FIFO 0x1D   /* Read Bus Master Chip FIFO */
 131 #define CMD_ECHO 0x1F           /* Echo Data Byte */
 132 #define CMD_HA_DIAG 0x20        /* Host Adapter Diagnostic */
 133 #define CMD_HA_OPTIONS 0x21     /* Host Adapter Options */
 134 #define CMD_INITEXTMB 0x81      /* Initialize Extended Mailbox */
 135 #define CMD_VER_NO_LAST 0x84    /* Version Number Last Byte (undocumented) */
 136 #define CMD_VER_NO_LETTER 0x85  /* Version Number One Letter (undocumented) */
 137 #define CMD_RET_MODEL_NO 0x8B   /* Return Model Number (undocumented) */
 138 #define CMD_INQEXTSETUP 0x8D    /* Inquire Extended Set-up Information */
 139 #define CMD_ROUND_ROBIN 0x8F    /* Enable strict vs. half-assed round-robin
 140                                    mailbox filling (undocumented) */
 141 #define CMD_READ_FW_LCL_RAM 0x91/* Read Firmware Local RAM (undocumented) */
 142 #define CMD_WRITE_INQ_BUF 0x9A  /* Write Inquiry Data Buffer
 143                                    (Target Mode Only) */
 144 #define CMD_READ_INQ_BUF 0x9B   /* Read Inquiry Data Buffer
 145                                    (Target Mode Only) */
 146 
 147 #define MBX_NOT_IN_USE 0x00
 148 #define MBX_ACTION_START 0x01
 149 #define MBX_ACTION_ABORT 0x02
 150 #define MBX_COMPLETION_OK 0x01
 151 #define MBX_COMPLETION_ABORTED 0x02
 152 #define MBX_COMPLETION_NOT_FOUND 0x03
 153 #define MBX_COMPLETION_ERROR 0x04
 154 
 155 /* Mailbox Definition */
 156 struct mailbox {
 157     void *ccbptr;               /* lsb, ..., msb */
 158     unsigned char btstat;
 159     unsigned char sdstat;
 160     unsigned char reserved;
 161     unsigned char status;       /* Command/Status */
 162 };
 163 
 164 /* This is used with scatter-gather */
 165 struct chain {
 166     unsigned long datalen;      /* Size of this part of chain */
 167     void *dataptr;              /* Location of data */
 168 };
 169 
 170 #define MAX_CDB 12
 171 
 172 struct ccb {                    /* Command Control Block */
 173     unsigned char op;           /* Command Control Block Operation Code */
 174     unsigned char dir;
 175     unsigned char cdblen;       /* SCSI Command Length */
 176     unsigned char rsalen;       /* Request Sense Allocation Length/Disable */
 177     unsigned long datalen;      /* Data Length (msb, ..., lsb) */
 178     void *dataptr;              /* Data Pointer */
 179     unsigned char reserved[2];
 180     unsigned char hastat;       /* Host Adapter Status (HASTAT) */
 181     unsigned char tarstat;      /* Target Device Status */
 182     unsigned char id;
 183     unsigned char lun;
 184     unsigned char cdb[MAX_CDB];
 185     unsigned char ccbcontrol;
 186     unsigned char commlinkid;   /* Command Linking Identifier */
 187     void *linkptr;              /* Link Pointer */
 188     void *senseptr;
 189 };
 190 
 191 #define CCB_OP_INIT 0x00        /* Initiator CCB */
 192 #define CCB_OP_TARG 0x01        /* Target CCB */
 193 #define CCB_OP_INIT_SG 0x02     /* Initiator CCB with scatter-gather */
 194 #define CCB_OP_INIT_R 0x03      /* Initiator CCB with residual data length
 195                                    returned */
 196 #define CCB_OP_INIT_SG_R 0x04   /* Initiator CCB with scatter-gather and
 197                                    residual data length returned */
 198 #define CCB_OP_BUS_RESET 0x81   /* SCSI bus device reset */
 199 
 200 #endif
 201 
 202 #endif

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