xref: /openbsd/sys/sys/scsiio.h (revision db3296cf)
1 /*	$OpenBSD: scsiio.h,v 1.6 2002/05/27 23:40:31 tdeval Exp $	*/
2 /*	$NetBSD: scsiio.h,v 1.3 1994/06/29 06:45:09 cgd Exp $	*/
3 
4 #ifndef _SYS_SCSIIO_H_
5 #define _SYS_SCSIIO_H_
6 
7 
8 #include <sys/types.h>
9 #include <sys/ioctl.h>
10 
11 #define	SENSEBUFLEN 48
12 
13 typedef struct	scsireq {
14 	u_long	flags;		/* info about the request status and type */
15 	u_long	timeout;
16 	u_char	cmd[16];	/* 12 is actually the max */
17 	u_char	cmdlen;
18 	caddr_t	databuf;	/* address in user space of buffer */
19 	u_long	datalen;	/* size of user buffer (request) */
20 	u_long	datalen_used;	/* size of user buffer (used)*/
21 	u_char	sense[SENSEBUFLEN]; /* returned sense will be in here */
22 	u_char	senselen;	/* sensedata request size (MAX of SENSEBUFLEN)*/
23 	u_char	senselen_used;	/* return value only */
24 	u_char	status;		/* what the scsi status was from the adapter */
25 	u_char	retsts;		/* the return status for the command */
26 	int	error;		/* error bits */
27 } scsireq_t;
28 
29 /* bit definitions for flags */
30 #define SCCMD_READ		0x00000001
31 #define SCCMD_WRITE		0x00000002
32 #define SCCMD_IOV		0x00000004
33 #define SCCMD_ESCAPE		0x00000010
34 #define SCCMD_TARGET		0x00000020
35 
36 
37 /* definitions for the return status (retsts) */
38 #define SCCMD_OK	0x00
39 #define SCCMD_TIMEOUT	0x01
40 #define SCCMD_BUSY	0x02
41 #define SCCMD_SENSE	0x03
42 #define SCCMD_UNKNOWN	0x04
43 
44 #define SCIOCCOMMAND	_IOWR('Q', 1, scsireq_t)
45 
46 #define SC_DB_CMDS	0x00000001	/* show all scsi cmds and errors */
47 #define SC_DB_FLOW	0x00000002	/* show routines entered	*/
48 #define SC_DB_FLOW2	0x00000004	/* show path INSIDE routines	*/
49 #define SC_DB_DMA	0x00000008	/* show DMA segments etc	*/
50 #define SCIOCDEBUG	_IOW('Q', 2, int)	/* from 0 to 15 */
51 
52 struct	oscsi_addr {
53 	int	scbus;		/* -1 if wildcard */
54 	int	target;		/* -1 if wildcard */
55 	int	lun;		/* -1 if wildcard */
56 } ;
57 
58 struct scsi_addr {
59 	int     type;
60 #define TYPE_SCSI 0
61 #define TYPE_ATAPI 1
62 	int	scbus;		/* -1 if wildcard */
63 	int	target;		/* -1 if wildcard */
64 	int	lun;		/* -1 if wildcard */
65 };
66 
67 #define OSCIOCREPROBE	_IOW('Q', 3, struct oscsi_addr) /* look for new devs */
68 #define OSCIOCIDENTIFY  _IOR('Q', 4, struct oscsi_addr)
69 #define SCIOCDECONFIG	_IO('Q', 5)	/* please disappear */
70 #define SCIOCRECONFIG	_IO('Q', 6)	/* please check again */
71 #define SCIOCRESET	_IO('Q', 7)	/* reset the device */
72 #define	SCIOCREASSIGN	_IOW('Q', 8, int)	/* reassign block */
73 #define SCIOCIDENTIFY	_IOR('Q', 9, struct scsi_addr)
74 #define SCIOCREPROBE    _IOW('Q', 10, struct scsi_addr)
75 
76 #endif /* _SYS_SCSIIO_H_ */
77