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

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