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 
   9 #ifndef _HOSTS_H
  10         #define _HOSTS_H
  11 
  12 #ifndef MAX_SCSI_HOSTS
  13         #include "max_hosts.h"
  14 #endif
  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_Cmnd structure is used by scsi.c internally, and for communication with
  22         low level drivers that support multiple outstanding commands.
  23 */
  24 
  25 typedef struct scsi_cmnd {
  26         int host;
  27         unsigned char target, lun;
  28         unsigned char cmnd[10];
  29         unsigned bufflen;
  30         void *buffer;
  31         
  32         unsigned char sense_cmnd[6];
  33         unsigned char *sense_buffer;    
  34 
  35         unsigned flags;
  36                 
  37         int retries;
  38         int allowed;
  39         int timeout_per_command, timeout_total, timeout;
  40         
  41         void (*done)(int,int);
  42         struct scsi_cmnd *next, *prev;  
  43         } Scsi_Cmnd;             
  44 
  45 /*
  46         The Scsi_Host type has all that is needed to interface with a SCSI
  47         host in a device independant matter.  
  48 */
  49 
  50 typedef struct     
  51         {
  52         /*
  53                 The name pointer is a pointer to the name of the SCSI
  54                 device detected.
  55         */
  56 
  57         char *name;
  58 
  59         /*
  60                 The detect function shall return non zero on detection,
  61                 and initialize all data necessary for this particular
  62                 SCSI driver.  It is passed the host number, so this host
  63                 knows where it is in the hosts array
  64         */
  65 
  66         int (* detect)(int); 
  67 
  68         /*
  69                 The info function will return whatever useful
  70                 information the developer sees fit.              
  71         */
  72 
  73         char *(* info)(void);
  74 
  75         /*
  76                 The command function takes a target, a command (this is a SCSI 
  77                 command formatted as per the SCSI spec, nothing strange), a 
  78                 data buffer pointer, and data buffer length pointer.  The return
  79                 is a status int, bit fielded as follows : 
  80                 Byte    What
  81                 0       SCSI status code
  82                 1       SCSI 1 byte message
  83                 2       host error return.
  84                 3       mid level error return
  85         */
  86 
  87         int (* command)(unsigned char target, const void *cmnd, 
  88                              void *buff, int bufflen);
  89 
  90         /*
  91                 The QueueCommand function works in a similar manner
  92                 to the command function.  It takes an additional parameter,
  93                 void (* done)(int host, int code) which is passed the host 
  94                 # and exit result when the command is complete.  
  95                 Host number is the POSITION IN THE hosts array of THIS
  96                 host adapter.
  97         */
  98 
  99         int (* queuecommand)(unsigned char target, const void *cmnd,
 100                              void *buff, int bufflen, void (*done)(int,int));
 101 
 102         
 103         /*
 104                 Since the mid level driver handles time outs, etc, we want to 
 105                 be able to abort the current command.  Abort returns 0 if the 
 106                 abortion was successful.  If non-zero, the code passed to it 
 107                 will be used as the return code, otherwise 
 108                 DID_ABORT  should be returned.
 109 
 110                 Note that the scsi driver should "clean up" after itself, 
 111                 resetting the bus, etc.  if necessary. 
 112         */
 113 
 114         int (* abort)(int);
 115 
 116         /*
 117                 The reset function will reset the SCSI bus.  Any executing 
 118                 commands should fail with a DID_RESET in the host byte.
 119         */ 
 120 
 121         int (* reset)(void);
 122         
 123         /*
 124                 This determines if we will use a non-interrupt driven
 125                 or an interrupt driven scheme,  It is set to the maximum number
 126                 of simulataneous commands a given host adapter will accept.
 127         */
 128 
 129         int can_queue;
 130 
 131         /*
 132                 In many instances, especially where disconnect / reconnect are 
 133                 supported, our host also has an ID on the SCSI bus.  If this is 
 134                 the case, then it must be reserved.  Please set this_id to -1 if                your settup is in single initiator mode, and the host lacks an 
 135                 ID.
 136         */
 137         
 138         int this_id;
 139 
 140         /*
 141                 present contains a flag as to weather we are present -
 142                 so we don't have to call detect multiple times.
 143         */
 144 
 145         unsigned present:1;     
 146         } Scsi_Host;
 147 
 148 /*
 149         The scsi_hosts array is the array containing the data for all 
 150         possible <supported> scsi hosts.   
 151 */
 152 
 153 extern Scsi_Host scsi_hosts[];
 154 
 155 /*
 156         This is our semaphore array, used by scsi.c, sd.c, st.c.
 157         Other routines SHOULD NOT mess with it.  Your driver should NOT mess with it.
 158         This is used to protect against contention by disk and tape drivers.
 159 */
 160 
 161 extern volatile unsigned char host_busy[];
 162 extern volatile int host_timeout[];
 163 
 164 /*
 165         This is the queue of currently pending commands for a given
 166         SCSI host.
 167 */
 168 
 169 extern volatile Scsi_Cmnd *host_queue[];
 170 
 171 /*
 172         scsi_init initializes the scsi hosts.
 173 */
 174 
 175 
 176 void scsi_init(void);
 177 
 178 #define BLANK_HOST {"", 0, 0, 0, 0, 0, 0, 0, 0, 0}
 179 #endif

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