root/kernel/blk_drv/scsi/hosts.h

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

INCLUDED FROM


   1 /*
   2  *      hosts.h Copyright (C) 1992 Drew Eckhardt 
   3  *      mid to low-level SCSI driver interface header by        
   4  *              Drew Eckhardt 
   5  *
   6  *      <drew@colorado.edu>
   7  *
   8  *       Modified by Eric Youngdale eric@tantalus.nrl.navy.mil to
   9  *       add scatter-gather, multiple outstanding request, and other
  10  *       enhancements.
  11  */
  12 
  13 #ifndef _HOSTS_H
  14         #define _HOSTS_H
  15 
  16 /*
  17         $Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/hosts.h,v 1.1 1992/07/24 06:27:38 root Exp root $
  18 */
  19 
  20 /*
  21         The Scsi_Host type has all that is needed to interface with a SCSI
  22         host in a device independant matter.  
  23 */
  24 
  25 #define SG_NONE 0
  26 #define SG_ALL 0xff
  27 
  28 /* The various choices mean:
  29    NONE: Self evident.  Host adapter is not capable of scatter-gather.
  30    ALL:  Means that the host adapter module can do scatter-gather,
  31          and that there is no limit to the size of the table to which
  32          we scatter/gather data.
  33   Anything else:  Indicates the maximum number of chains that can be
  34         used in one scatter-gather request.
  35 */
  36 
  37 typedef struct     
  38         {
  39         /*
  40                 The name pointer is a pointer to the name of the SCSI
  41                 device detected.
  42         */
  43 
  44         char *name;
  45 
  46         /*
  47                 The detect function shall return non zero on detection,
  48                 and initialize all data necessary for this particular
  49                 SCSI driver.  It is passed the host number, so this host
  50                 knows where it is in the hosts array
  51         */
  52 
  53         int (* detect)(int); 
  54 
  55         /*
  56                 The info function will return whatever useful
  57                 information the developer sees fit.              
  58         */
  59 
  60         const char *(* info)(void);
  61 
  62         /*
  63                 The command function takes a target, a command (this is a SCSI 
  64                 command formatted as per the SCSI spec, nothing strange), a 
  65                 data buffer pointer, and data buffer length pointer.  The return
  66                 is a status int, bit fielded as follows : 
  67                 Byte    What
  68                 0       SCSI status code
  69                 1       SCSI 1 byte message
  70                 2       host error return.
  71                 3       mid level error return
  72         */
  73 
  74         int (* command)(Scsi_Cmnd *);
  75 
  76         /*
  77                 The QueueCommand function works in a similar manner
  78                 to the command function.  It takes an additional parameter,
  79                 void (* done)(int host, int code) which is passed the host 
  80                 # and exit result when the command is complete.  
  81                 Host number is the POSITION IN THE hosts array of THIS
  82                 host adapter.
  83         */
  84 
  85         int (* queuecommand)(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
  86 
  87         /*
  88                 Since the mid level driver handles time outs, etc, we want to 
  89                 be able to abort the current command.  Abort returns 0 if the 
  90                 abortion was successful.  If non-zero, the code passed to it 
  91                 will be used as the return code, otherwise 
  92                 DID_ABORT  should be returned.
  93 
  94                 Note that the scsi driver should "clean up" after itself, 
  95                 resetting the bus, etc.  if necessary. 
  96         */
  97 
  98         int (* abort)(Scsi_Cmnd *, int);
  99 
 100         /*
 101                 The reset function will reset the SCSI bus.  Any executing 
 102                 commands should fail with a DID_RESET in the host byte.
 103         */ 
 104 
 105         int (* reset)(void);
 106         /*
 107                 This function is used to select synchronous communications,
 108                 which will result in a higher data throughput.  Not implemented
 109                 yet.
 110         */ 
 111 
 112         int (* slave_attach)(int, int);
 113         /*
 114                 This function determines the bios parameters for a given
 115                 harddisk.  These tend to be numbers that are made up by
 116                 the host adapter.  Parameters:
 117                 size, device number, list (heads, sectors, cylinders)
 118         */ 
 119 
 120         int (* bios_param)(int, int, int []);
 121         
 122         /*
 123                 This determines if we will use a non-interrupt driven
 124                 or an interrupt driven scheme,  It is set to the maximum number
 125                 of simulataneous commands a given host adapter will accept.
 126         */
 127         int can_queue;
 128 
 129         /*
 130                 In many instances, especially where disconnect / reconnect are 
 131                 supported, our host also has an ID on the SCSI bus.  If this is 
 132                 the case, then it must be reserved.  Please set this_id to -1 if
 133                 your settup is in single initiator mode, and the host lacks an 
 134                 ID.
 135         */
 136         
 137         int this_id;
 138 
 139         /*
 140                 This determines the degree to which the host adapter is capable
 141                 of scatter-gather.
 142         */
 143 
 144         short unsigned int sg_tablesize;
 145 
 146         /*
 147           True if this host adapter can make good use of linked commands.
 148           This will allow more than one command to be queued to a given
 149           unit on a given host.  Set this to the maximum number of command
 150           blocks to be provided for each device.  Set this to 1 for one
 151           command block per lun, 2 for two, etc.  Do not set this to 0.
 152           You should make sure that the host adapter will do the right thing
 153           before you try setting this above 1.
 154          */
 155 
 156         short cmd_per_lun;
 157         /*
 158                 present contains a flag as to weather we are present -
 159                 so we don't have to call detect multiple times.
 160         */
 161 
 162         unsigned present:1;     
 163         /*
 164           true if this host adapter uses unchecked DMA onto an ISA bus.
 165         */
 166         unsigned unchecked_isa_dma:1;
 167         } Scsi_Host;
 168 
 169 /*
 170         The scsi_hosts array is the array containing the data for all 
 171         possible <supported> scsi hosts.   
 172 */
 173 
 174 extern Scsi_Host scsi_hosts[];
 175 
 176 /*
 177         This is our semaphore array, used by scsi.c, sd.c, st.c.
 178         Other routines SHOULD NOT mess with it.  Your driver should NOT mess with it.
 179         This is used to protect against contention by disk and tape drivers.
 180 */
 181 
 182 extern volatile unsigned char host_busy[];
 183 
 184 /*
 185         This is the queue of currently pending commands for a given
 186         SCSI host.
 187 */
 188 
 189 extern Scsi_Cmnd *host_queue[];
 190 
 191 extern struct wait_queue *host_wait[];   /* For waiting until host available*/
 192 
 193 /*
 194         scsi_init initializes the scsi hosts.
 195 */
 196 
 197 
 198 void scsi_init(void);
 199 
 200 #define BLANK_HOST {"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 201 #endif

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