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(int);
  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(int, int, int *);
  21 
  22 #define BUSLOGIC_CMDLUN 1       /* ??? */
  23 
  24 #define BUSLOGIC { "BusLogic",                  \
  25                    buslogic_detect,             \
  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                    BUSLOGIC_CMDLUN,             \
  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_INTERRUPT    0x0008
  60 #define BD_RESET        0x0010
  61 
  62 /* I/O Port interface */
  63 /* READ */
  64 #define STATUS(base) (base)
  65 #define DACT 0x80               /* Diagnostic Active */
  66 #define DFAIL 0x40              /* Diagonostic Failure */
  67 #define INREQ 0x20              /* Initialization Required */
  68 #define HARDY 0x10              /* Host Adapter Ready */
  69 #define CPRBSY 0x08             /* Command/Parameter Register Busy */
  70 #define DIRRDY 0x04             /* Data In Register Ready */
  71 #define CMDINV 0x01             /* Command Invalid */
  72 #define STATMASK 0xFD           /* 0x02 is reserved */
  73 
  74 #define DATA_IN(base) (STATUS(base) + 1)
  75 
  76 #define INTERRUPT(base) (STATUS(base) + 2)
  77 #define INTV 0x80               /* Interrupt Valid */
  78 #define RSTS 0x08               /* SCSI Reset State */
  79 #define CMDC 0x04               /* Command Complete */
  80 #define MBOR 0x02               /* Mailbox Out Ready */
  81 #define IMBL 0x01               /* Incoming Mailbox Loaded */
  82 #define INTRMASK 0x8F           /* 0x70 are reserved */
  83 
  84 /* WRITE */
  85 #define CONTROL(base) STATUS(base)
  86 #define RHARD 0x80              /* Hard Reset */
  87 #define RSOFT 0x40              /* Soft Reset */
  88 #define RINT 0x20               /* Interrupt Reset */
  89 #define RSBUS 0x10              /* SCSI Bus Reset */
  90 
  91 #define COMMAND_PARAMETER(base) (STATUS(base) + 1)
  92 #define CMD_TSTCMDCINT 0x00     /* Test CMDC Interrupt */
  93 #define CMD_INITMB 0x01         /* Initialize Mailbox */
  94 #define CMD_START_SCSI 0x02     /* Start Mailbox */
  95 #define CMD_START_BIOS 0x03     /* Start BIOS */
  96 #define CMD_INQUIRY 0x04        /* Inquire Board ID */
  97 #define CMD_ENBOMBRINT 0x05     /* Enable OMBR Interrupt */
  98 #define CMD_SETSELTIMOUT 0x06   /* Set SCSI Selection Time-Out */
  99 #define CMD_BUSON_TIME 0x07     /* Set Bus-On Time */
 100 #define CMD_BUSOFF_TIME 0x08    /* Set Bus-Off Time */
 101 #define CMD_BUSXFR_RATE 0x09    /* Set Bus Transfer Rate */
 102 #define CMD_INQ_DEVICES 0x0A    /* Inquire Installed Devices */
 103 #define CMD_RETCONF 0x0B        /* Return Configuration */
 104 #define CMD_TARGET_MODE 0x0C    /* Set Target Mode */
 105 #define CMD_INQ_SETUP_INFO 0x0D /* Inquire Set-up Information */
 106 #define CMD_WRITE_LCL_RAM 0x1A  /* Write Adapter Local RAM */
 107 #define CMD_READ_LCL_RAM 0x1B   /* Read Adapter Local RAM */
 108 #define CMD_WRITE_BM_FIFO 0x1C  /* Write Bus Master Chip FIFO */
 109 #define CMD_READ_BM_FIFO 0x1D   /* Read Bus Master Chip FIFO */
 110 #define CMD_ECHO 0x1F           /* Echo Data Byte */
 111 #define CMD_HA_DIAG 0x20        /* Host Adapter Diagnostic */
 112 #define CMD_HA_OPTIONS 0x21     /* Host Adapter Options */
 113 #define CMD_INITEXTMB 0x81      /* Initialize Extended Mailbox */
 114 #define CMD_INQEXTSETUP 0x8D    /* Inquire Extended Set-up Information */
 115 #define CMD_WRITE_INQ_BUF 0x9A  /* Write Inquery Data Buffer
 116                                    (Target Mode Only) */
 117 #define CMD_READ_INQ_BUF 0x9B   /* Read Inquery Data Buffer
 118                                    (Target Mode Only) */
 119 
 120 #define MBX_NOT_IN_USE 0x00
 121 #define MBX_ACTION_START 0x01
 122 #define MBX_ACTION_ABORT 0x02
 123 #define MBX_COMPLETION_OK 0x01
 124 #define MBX_COMPLETION_ABORTED 0x02
 125 #define MBX_COMPLETION_NOT_FOUND 0x03
 126 #define MBX_COMPLETION_ERROR 0x04
 127 
 128 /* Mailbox Definition */
 129 struct mailbox {
 130     void *ccbptr;               /* lsb, ..., msb */
 131     unsigned char btstat;
 132     unsigned char sdstat;
 133     unsigned char reserved;
 134     unsigned char status;       /* Command/Status */
 135 };
 136 
 137 /* This is used with scatter-gather */
 138 struct chain {
 139     unsigned long datalen;      /* Size of this part of chain */
 140     void *dataptr;              /* Location of data */
 141 };
 142 
 143 #define MAX_CDB 12
 144 
 145 struct ccb {                    /* Command Control Block */
 146     unsigned char op;           /* Command Control Block Operation Code */
 147     unsigned char dir;
 148     unsigned char cdblen;       /* SCSI Command Length */
 149     unsigned char rsalen;       /* Request Sense Allocation Length/Disable */
 150     unsigned long datalen;      /* Data Length (msb, ..., lsb) */
 151     void *dataptr;              /* Data Pointer */
 152     unsigned char reserved[2];
 153     unsigned char hastat;       /* Host Adapter Status (HASTAT) */
 154     unsigned char tarstat;      /* Target Device Status */
 155     unsigned char id;
 156     unsigned char lun;
 157     unsigned char cdb[MAX_CDB];
 158     unsigned char ccbcontrol;
 159     unsigned char commlinkid;   /* Command Linking Identifier */
 160     void *linkptr;              /* Link Pointer */
 161     void *senseptr;
 162 };
 163 
 164 #define CCB_OP_INIT 0x00        /* Initiator CCB */
 165 #define CCB_OP_TARG 0x01        /* Target CCB */
 166 #define CCB_OP_INIT_SG 0x02     /* Initiator CCB with scatter-gather */
 167 #define CCB_OP_INIT_R 0x03      /* Initiator CCB with residual data length
 168                                    returned */
 169 #define CCB_OP_INIT_SG_R 0x04   /* Initiator CCB with scatter-gather and
 170                                    residual data length returned */
 171 #define CCB_OP_BUS_RESET 0x81   /* SCSI bus device reset */
 172 
 173 #endif
 174 
 175 #endif

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