root/drivers/scsi/buslogic.h

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

INCLUDED FROM


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

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