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

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