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