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