xref: /openbsd/sys/sys/ataio.h (revision a209c929)
1 /*	$OpenBSD: ataio.h,v 1.5 2003/09/26 21:43:32 miod Exp $	*/
2 /*	$NetBSD: ataio.h,v 1.2 1998/11/23 22:58:23 kenh Exp $	*/
3 
4 #ifndef _SYS_ATAIO_H_
5 #define _SYS_ATAIO_H_
6 
7 #include <sys/types.h>
8 #include <sys/ioctl.h>
9 
10 typedef struct	atareq {
11 	u_long	flags;		/* info about the request status and type */
12 	u_char	command;	/* command code */
13 	u_char	features;	/* feature modifier bits for command */
14 	u_char	sec_count;	/* sector count */
15 	u_char	sec_num;	/* sector number */
16 	u_char	head;		/* head number */
17 	u_short	cylinder;	/* cylinder/lba address */
18 
19 	caddr_t	databuf;	/* pointer to I/O data buffer */
20 	u_long	datalen;	/* length of data buffer */
21 	int	timeout;	/* command timeout */
22 	u_char	retsts;		/* return status for the command */
23 	u_char	error;		/* error bits */
24 } atareq_t;
25 
26 /* bit definitions for flags */
27 #define ATACMD_READ		0x00000001
28 #define ATACMD_WRITE		0x00000002
29 #define ATACMD_READREG		0x00000004
30 
31 /* definitions for the return status (retsts) */
32 #define ATACMD_OK	0x00
33 #define ATACMD_TIMEOUT	0x01
34 #define ATACMD_ERROR	0x02
35 #define ATACMD_DF	0x03
36 
37 #define ATAIOCCOMMAND	_IOWR('Q', 8, atareq_t)
38 
39 typedef struct atagettrace {
40 	unsigned int	buf_size;	/* length of data buffer */
41 	void		*buf;		/* pointer to data buffer */
42 	unsigned int	bytes_copied;	/* number of bytes copied to buffer */
43 	unsigned int	bytes_left;	/* number of bytes left */
44 } atagettrace_t;
45 
46 #define ATAIOGETTRACE	_IOWR('Q', 27, struct atagettrace)
47 
48 #endif /* _SYS_ATAIO_H_ */
49