Home | History | Annotate | Line # | Download | only in sys
      1 /*	$NetBSD: ataio.h,v 1.9 2012/01/24 20:04:07 jakllsch 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 #define ATACMD_LBA		0x00000008
     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 /*
     40  * ATA bus IOCTL
     41  */
     42 /* Scan bus for new devices. */
     43 struct atabusioscan_args {
     44 	int	at_dev;		/* device to scan, -1 for wildcard */
     45 };
     46 #define ATABUSIOSCAN	_IOW('A', 50, struct atabusioscan_args)
     47 
     48 #define ATABUSIORESET	_IO('A', 51) /* reset ATA bus */
     49 
     50 struct atabusiodetach_args {
     51 	int	at_dev;		/* device to detach; -1 for wildcard */
     52 };
     53 #define ATABUSIODETACH	_IOW('A', 52, struct atabusiodetach_args)
     54 
     55 
     56 #endif /* _SYS_ATAIO_H_ */
     57