scsiconf.h revision 1.1 1 /*
2 * Written by Julian Elischer (julian (at) tfs.com)
3 * for TRW Financial Systems for use under the MACH(2.5) operating system.
4 *
5 * TRW Financial Systems, in accordance with their agreement with Carnegie
6 * Mellon University, makes this software available to CMU to distribute
7 * or use in any manner that they see fit as long as this message is kept with
8 * the software. For this reason TFS also grants any other persons or
9 * organisations permission to use or modify this software.
10 *
11 * TFS supplies this software to be publicly redistributed
12 * on the understanding that TFS is not responsible for the correct
13 * functioning of this software in any circumstances.
14 *
15 * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
16 * -------------------- ----- ----------------------
17 * CURRENT PATCH LEVEL: 1 00098
18 * -------------------- ----- ----------------------
19 *
20 * 16 Feb 93 Julian Elischer ADDED for SCSI system
21 *
22 */
23
24 /*
25 * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
26 */
27
28 /***********************************************\
29 * these calls are called by the high-end *
30 * drivers to get services from whatever low-end *
31 * drivers they are attached to *
32 \***********************************************/
33 struct scsi_switch
34 {
35 int (*scsi_cmd)();
36 void (*scsi_minphys)();
37 int (*open_target_lu)();
38 int (*close_target_lu)();
39 long int (*adapter_info)(); /* see definitions below */
40 u_long spare[3];
41 };
42 #define AD_INF_MAX_CMDS 0x000000FF /* maximum number of entries
43 queuable to a device by
44 the adapter */
45 /* 24 bits of other adapter charcteristics go here */
46
47 /***********************************************\
48 * The scsi debug control bits *
49 \***********************************************/
50 extern int scsi_debug;
51 #define PRINTROUTINES 0x01
52 #define TRACEOPENS 0x02
53 #define TRACEINTERRUPTS 0x04
54 #define SHOWREQUESTS 0x08
55 #define SHOWSCATGATH 0x10
56 #define SHOWINQUIRY 0x20
57 #define SHOWCOMMANDS 0x40
58
59
60 /********************************/
61 /* return values for scsi_cmd() */
62 /********************************/
63 #define SUCCESSFULLY_QUEUED 0
64 #define TRY_AGAIN_LATER 1
65 #define COMPLETE 2
66 #define HAD_ERROR 3
67
68 struct scsi_xfer
69 {
70 struct scsi_xfer *next; /* when free */
71 int flags;
72 u_char adapter;
73 u_char targ;
74 u_char lu;
75 u_char retries; /* the number of times to retry */
76 long int timeout; /* in miliseconds */
77 struct scsi_generic *cmd;
78 int cmdlen;
79 u_char *data; /* either the dma address OR a uio address */
80 int datalen; /* data len (blank if uio) */
81 int resid;
82 int (*when_done)();
83 int done_arg;
84 int done_arg2;
85 int error;
86 struct buf *bp;
87 struct scsi_sense_data sense;
88 };
89 /********************************/
90 /* Flag values */
91 /********************************/
92 #define SCSI_NOSLEEP 0x01 /* Not a user... don't sleep */
93 #define SCSI_NOMASK 0x02 /* dont allow interrupts.. booting */
94 #define SCSI_NOSTART 0x04 /* left over from ancient history */
95 #define ITSDONE 0x10 /* the transfer is as done as it gets */
96 #define INUSE 0x20 /* The scsi_xfer block is in use */
97 #define SCSI_SILENT 0x40 /* Don't report errors to console */
98 #define SCSI_ERR_OK 0x80 /* An error on this operation is OK. */
99 #define SCSI_RESET 0x100 /* Reset the device in question */
100 #define SCSI_DATA_UIO 0x200 /* The data address refers to a UIO */
101 #define SCSI_DATA_IN 0x400 /* expect data to come INTO memory */
102 #define SCSI_DATA_OUT 0x800 /* expect data to flow OUT of memory */
103 #define SCSI_TARGET 0x1000 /* This defines a TARGET mode op. */
104 /********************************/
105 /* Error values */
106 /********************************/
107 #define XS_NOERROR 0x0 /* there is no error, (sense is invalid) */
108 #define XS_SENSE 0x1 /* Check the returned sense for the error */
109 #define XS_DRIVER_STUFFUP 0x2 /* Driver failed to perform operation */
110 #define XS_TIMEOUT 0x03 /* The device timed out.. turned off? */
111 #define XS_SWTIMEOUT 0x04 /* The Timeout reported was caught by SW */
112 #define XS_BUSY 0x08 /* The device busy, try again later? */
113
114