xref: /netbsd-src/sys/sys/ataio.h (revision f82d7874c259b2a6cc59b714f844919f32bf7b51)
1 /*	$NetBSD: ataio.h,v 1.8 2007/03/04 06:03:40 christos Exp $	*/
2 
3 #ifndef _SYS_ATAIO_H_
4 #define _SYS_ATAIO_H_
5 
6 #include <sys/types.h>
7 #include <sys/ioctl.h>
8 
9 typedef struct	atareq {
10 	u_long	flags;		/* info about the request status and type */
11 	u_char	command;	/* command code */
12 	u_char	features;	/* feature modifier bits for command */
13 	u_char	sec_count;	/* sector count */
14 	u_char	sec_num;	/* sector number */
15 	u_char	head;		/* head number */
16 	u_short	cylinder;	/* cylinder/lba address */
17 
18 	void *	databuf;	/* Pointer to I/O data buffer */
19 	u_long	datalen;	/* length of data buffer */
20 	int	timeout;	/* Command timeout */
21 	u_char	retsts;		/* the return status for the command */
22 	u_char	error;		/* error bits */
23 } atareq_t;
24 
25 /* bit definitions for flags */
26 #define ATACMD_READ		0x00000001
27 #define ATACMD_WRITE		0x00000002
28 #define ATACMD_READREG		0x00000004
29 
30 /* definitions for the return status (retsts) */
31 #define ATACMD_OK	0x00
32 #define ATACMD_TIMEOUT	0x01
33 #define ATACMD_ERROR	0x02
34 #define ATACMD_DF	0x03
35 
36 #define ATAIOCCOMMAND	_IOWR('Q', 8, atareq_t)
37 
38 /*
39  * ATA bus IOCTL
40  */
41 /* Scan bus for new devices. */
42 struct atabusioscan_args {
43 	int	at_dev;		/* device to scan, -1 for wildcard */
44 };
45 #define ATABUSIOSCAN	_IOW('A', 50, struct atabusioscan_args)
46 
47 #define ATABUSIORESET	_IO('A', 51) /* reset ATA bus */
48 
49 struct atabusiodetach_args {
50 	int	at_dev;		/* device to detach; -1 for wildcard */
51 };
52 #define ATABUSIODETACH	_IOW('A', 52, struct atabusiodetach_args)
53 
54 
55 #endif /* _SYS_ATAIO_H_ */
56