xref: /openbmc/qemu/linux-user/syscall_defs.h (revision 7854b05654b49c2197faef358e3ec1a7559797b9)
131e31b8aSbellard 
231e31b8aSbellard /* common syscall defines for all architectures */
331e31b8aSbellard 
431e31b8aSbellard #define SOCKOP_socket           1
531e31b8aSbellard #define SOCKOP_bind             2
631e31b8aSbellard #define SOCKOP_connect          3
731e31b8aSbellard #define SOCKOP_listen           4
831e31b8aSbellard #define SOCKOP_accept           5
931e31b8aSbellard #define SOCKOP_getsockname      6
1031e31b8aSbellard #define SOCKOP_getpeername      7
1131e31b8aSbellard #define SOCKOP_socketpair       8
1231e31b8aSbellard #define SOCKOP_send             9
1331e31b8aSbellard #define SOCKOP_recv             10
1431e31b8aSbellard #define SOCKOP_sendto           11
1531e31b8aSbellard #define SOCKOP_recvfrom         12
1631e31b8aSbellard #define SOCKOP_shutdown         13
1731e31b8aSbellard #define SOCKOP_setsockopt       14
1831e31b8aSbellard #define SOCKOP_getsockopt       15
1931e31b8aSbellard #define SOCKOP_sendmsg          16
2031e31b8aSbellard #define SOCKOP_recvmsg          17
2131e31b8aSbellard 
22*7854b056Sbellard struct target_sockaddr {
23*7854b056Sbellard     uint16_t sa_family;
24*7854b056Sbellard     uint8_t sa_data[14];
25*7854b056Sbellard };
26*7854b056Sbellard 
2731e31b8aSbellard struct target_timeval {
2831e31b8aSbellard     target_long tv_sec;
2931e31b8aSbellard     target_long tv_usec;
3031e31b8aSbellard };
3131e31b8aSbellard 
321b6b029eSbellard struct target_timespec {
331b6b029eSbellard     target_long tv_sec;
341b6b029eSbellard     target_long tv_nsec;
351b6b029eSbellard };
361b6b029eSbellard 
3766fb9763Sbellard struct target_itimerval {
3866fb9763Sbellard     struct target_timeval it_interval;
3966fb9763Sbellard     struct target_timeval it_value;
4066fb9763Sbellard };
4166fb9763Sbellard 
4231e31b8aSbellard struct target_iovec {
4331e31b8aSbellard     target_long iov_base;   /* Starting address */
4431e31b8aSbellard     target_long iov_len;   /* Number of bytes */
4531e31b8aSbellard };
4631e31b8aSbellard 
471a9353d2Sbellard struct target_msghdr {
481a9353d2Sbellard     target_long	 msg_name;	/* Socket name			*/
491a9353d2Sbellard     int		 msg_namelen;	/* Length of name		*/
501a9353d2Sbellard     target_long	 msg_iov;	/* Data blocks			*/
511a9353d2Sbellard     target_long	 msg_iovlen;	/* Number of blocks		*/
521a9353d2Sbellard     target_long  msg_control;	/* Per protocol magic (eg BSD file descriptor passing) */
531a9353d2Sbellard     target_long	 msg_controllen;	/* Length of cmsg list */
541a9353d2Sbellard     unsigned int msg_flags;
551a9353d2Sbellard };
561a9353d2Sbellard 
57*7854b056Sbellard struct target_cmsghdr {
58*7854b056Sbellard     target_long  cmsg_len;
59*7854b056Sbellard     int          cmsg_level;
60*7854b056Sbellard     int          cmsg_type;
61*7854b056Sbellard };
62*7854b056Sbellard 
63*7854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
64*7854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
65*7854b056Sbellard #define TARGET_CMSG_FIRSTHDR(mhdr) \
66*7854b056Sbellard   ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \
67*7854b056Sbellard    ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL)
68*7854b056Sbellard #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \
69*7854b056Sbellard                                & (size_t) ~(sizeof (target_long) - 1))
70*7854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
71*7854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
72*7854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
73*7854b056Sbellard 
74*7854b056Sbellard static __inline__ struct target_cmsghdr *
75*7854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
76*7854b056Sbellard {
77*7854b056Sbellard   if (tswapl(__cmsg->cmsg_len) < sizeof (struct target_cmsghdr))
78*7854b056Sbellard     /* The kernel header does this so there may be a reason.  */
79*7854b056Sbellard     return 0;
80*7854b056Sbellard 
81*7854b056Sbellard   __cmsg = (struct target_cmsghdr *) ((unsigned char *) __cmsg
82*7854b056Sbellard                                + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)));
83*7854b056Sbellard   if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) tswapl(__mhdr->msg_control)
84*7854b056Sbellard                                         + tswapl(__mhdr->msg_controllen))
85*7854b056Sbellard       || ((unsigned char *) __cmsg + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))
86*7854b056Sbellard           > ((unsigned char *) tswapl(__mhdr->msg_control)
87*7854b056Sbellard              + tswapl(__mhdr->msg_controllen))))
88*7854b056Sbellard     /* No more entries.  */
89*7854b056Sbellard     return 0;
90*7854b056Sbellard   return __cmsg;
91*7854b056Sbellard }
92*7854b056Sbellard 
93*7854b056Sbellard 
9431e31b8aSbellard struct  target_rusage {
9531e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
9631e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
9731e31b8aSbellard         target_long    ru_maxrss;              /* maximum resident set size */
9831e31b8aSbellard         target_long    ru_ixrss;               /* integral shared memory size */
9931e31b8aSbellard         target_long    ru_idrss;               /* integral unshared data size */
10031e31b8aSbellard         target_long    ru_isrss;               /* integral unshared stack size */
10131e31b8aSbellard         target_long    ru_minflt;              /* page reclaims */
10231e31b8aSbellard         target_long    ru_majflt;              /* page faults */
10331e31b8aSbellard         target_long    ru_nswap;               /* swaps */
10431e31b8aSbellard         target_long    ru_inblock;             /* block input operations */
10531e31b8aSbellard         target_long    ru_oublock;             /* block output operations */
10631e31b8aSbellard         target_long    ru_msgsnd;              /* messages sent */
10731e31b8aSbellard         target_long    ru_msgrcv;              /* messages received */
10831e31b8aSbellard         target_long    ru_nsignals;            /* signals received */
10931e31b8aSbellard         target_long    ru_nvcsw;               /* voluntary context switches */
11031e31b8aSbellard         target_long    ru_nivcsw;              /* involuntary " */
11131e31b8aSbellard };
11231e31b8aSbellard 
11331e31b8aSbellard typedef struct {
11431e31b8aSbellard         int     val[2];
11531e31b8aSbellard } kernel_fsid_t;
11631e31b8aSbellard 
11772f03900Sbellard struct kernel_statfs {
11831e31b8aSbellard 	int f_type;
11931e31b8aSbellard 	int f_bsize;
12031e31b8aSbellard 	int f_blocks;
12131e31b8aSbellard 	int f_bfree;
12231e31b8aSbellard 	int f_bavail;
12331e31b8aSbellard 	int f_files;
12431e31b8aSbellard 	int f_ffree;
12531e31b8aSbellard         kernel_fsid_t f_fsid;
12631e31b8aSbellard 	int f_namelen;
12731e31b8aSbellard 	int f_spare[6];
12831e31b8aSbellard };
12931e31b8aSbellard 
130dab2ed99Sbellard struct target_dirent {
131dab2ed99Sbellard 	target_long	d_ino;
132dab2ed99Sbellard 	target_long	d_off;
133dab2ed99Sbellard 	unsigned short	d_reclen;
134dab2ed99Sbellard 	char		d_name[256]; /* We must not include limits.h! */
135dab2ed99Sbellard };
136dab2ed99Sbellard 
137dab2ed99Sbellard struct target_dirent64 {
138dab2ed99Sbellard 	uint64_t	d_ino;
139dab2ed99Sbellard 	int64_t		d_off;
140dab2ed99Sbellard 	unsigned short	d_reclen;
141dab2ed99Sbellard 	unsigned char	d_type;
142dab2ed99Sbellard 	char		d_name[256];
143dab2ed99Sbellard };
144dab2ed99Sbellard 
145dab2ed99Sbellard 
14631e31b8aSbellard /* mostly generic signal stuff */
14731e31b8aSbellard #define TARGET_SIG_DFL	((target_long)0)	/* default signal handling */
14831e31b8aSbellard #define TARGET_SIG_IGN	((target_long)1)	/* ignore signal */
14931e31b8aSbellard #define TARGET_SIG_ERR	((target_long)-1)	/* error return from signal */
15031e31b8aSbellard 
15131e31b8aSbellard #ifdef TARGET_MIPS
15231e31b8aSbellard #define TARGET_NSIG	   128
15331e31b8aSbellard #else
15431e31b8aSbellard #define TARGET_NSIG	   64
15531e31b8aSbellard #endif
15631e31b8aSbellard #define TARGET_NSIG_BPW	   TARGET_LONG_BITS
15731e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
15831e31b8aSbellard 
15931e31b8aSbellard typedef struct {
16031e31b8aSbellard     target_ulong sig[TARGET_NSIG_WORDS];
16131e31b8aSbellard } target_sigset_t;
16231e31b8aSbellard 
16366fb9763Sbellard #ifdef BSWAP_NEEDED
16466fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
16566fb9763Sbellard {
16666fb9763Sbellard     int i;
16766fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
16866fb9763Sbellard         d->sig[i] = tswapl(s->sig[i]);
16966fb9763Sbellard }
17066fb9763Sbellard #else
17166fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
17266fb9763Sbellard {
17366fb9763Sbellard     *d = *s;
17466fb9763Sbellard }
17566fb9763Sbellard #endif
17666fb9763Sbellard 
17766fb9763Sbellard static inline void target_siginitset(target_sigset_t *d, target_ulong set)
17866fb9763Sbellard {
17966fb9763Sbellard     int i;
18066fb9763Sbellard     d->sig[0] = set;
18166fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
18266fb9763Sbellard         d->sig[i] = 0;
18366fb9763Sbellard }
18466fb9763Sbellard 
18566fb9763Sbellard void host_to_target_sigset(target_sigset_t *d, sigset_t *s);
18666fb9763Sbellard void target_to_host_sigset(sigset_t *d, target_sigset_t *s);
18766fb9763Sbellard void host_to_target_old_sigset(target_ulong *old_sigset,
18866fb9763Sbellard                                const sigset_t *sigset);
18966fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
19066fb9763Sbellard                                const target_ulong *old_sigset);
19166fb9763Sbellard struct target_sigaction;
19266fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
19366fb9763Sbellard                  struct target_sigaction *oact);
19466fb9763Sbellard 
1959de5e440Sbellard struct target_rlimit {
1969de5e440Sbellard         target_ulong   rlim_cur;
1979de5e440Sbellard         target_ulong   rlim_max;
1989de5e440Sbellard };
1999de5e440Sbellard 
2009de5e440Sbellard struct target_pollfd {
2019de5e440Sbellard     int fd;           /* file descriptor */
2029de5e440Sbellard     short events;     /* requested events */
2039de5e440Sbellard     short revents;    /* returned events */
2049de5e440Sbellard };
2059de5e440Sbellard 
20631e31b8aSbellard /* Networking ioctls */
20731e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
20831e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
20931e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
21031e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
21131e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
21231e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
21331e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
21431e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
21531e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
21631e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
21731e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
21831e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
21931e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
22031e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
22131e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
22231e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
22331e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
22431e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
22531e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
22631e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
22731e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
22831e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
22931e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
23031e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
23131e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
23231e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
23331e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
23431e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
23531e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
23631e31b8aSbellard 
23731e31b8aSbellard /* Bridging control calls */
23831e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
23931e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
24031e31b8aSbellard 
24131e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
24231e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
24331e31b8aSbellard 
24431e31b8aSbellard /* ARP cache control calls. */
24531e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
24631e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
24731e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
24831e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
24931e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
25031e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
25131e31b8aSbellard 
25231e31b8aSbellard /* RARP cache control calls. */
25331e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
25431e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
25531e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
25631e31b8aSbellard 
25731e31b8aSbellard /* Driver configuration calls */
25831e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
25931e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
26031e31b8aSbellard 
26131e31b8aSbellard /* DLCI configuration calls */
26231e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
26331e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
26431e31b8aSbellard 
26531e31b8aSbellard 
26631e31b8aSbellard /* From <linux/fs.h> */
26731e31b8aSbellard 
26831e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
26931e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
27031e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
27131e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
27231e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
27331e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
27431e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
27531e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
27631e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
27731e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
27831e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
27931e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
28031e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
28131e31b8aSbellard #define TARGET_BLKBSZGET  TARGET_IOR(0x12,112,sizeof(int))
28231e31b8aSbellard #define TARGET_BLKBSZSET  TARGET_IOW(0x12,113,sizeof(int))
28331e31b8aSbellard #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
28431e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
28531e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
28631e31b8aSbellard 
28731e31b8aSbellard /* cdrom commands */
28831e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
28931e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
29031e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
29131e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
29231e31b8aSbellard                                            (struct cdrom_ti) */
29331e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
29431e31b8aSbellard                                            (struct cdrom_tochdr) */
29531e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
29631e31b8aSbellard                                            (struct cdrom_tocentry) */
29731e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
29831e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
29931e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
30031e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
30131e31b8aSbellard                                            (struct cdrom_volctrl) */
30231e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
30331e31b8aSbellard                                            (struct cdrom_subchnl) */
30431e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
30531e31b8aSbellard                                            (struct cdrom_read) */
30631e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
30731e31b8aSbellard                                            (struct cdrom_read) */
30831e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
30931e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
31031e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
31131e31b8aSbellard                                            address of multi session disks
31231e31b8aSbellard                                            (struct cdrom_multisession) */
31331e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
31431e31b8aSbellard                                            if available (struct cdrom_mcn) */
31531e31b8aSbellard #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is depricated,
31631e31b8aSbellard                                           but here anyway for compatability */
31731e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
31831e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
31931e31b8aSbellard                                           (struct cdrom_volctrl) */
32031e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
32131e31b8aSbellard                                            (struct cdrom_read) */
32231e31b8aSbellard /*
32331e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
32431e31b8aSbellard  */
32531e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
32631e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
32731e31b8aSbellard 
32831e31b8aSbellard /*
32931e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
33031e31b8aSbellard    It is for playing audio in logical block addressing mode.
33131e31b8aSbellard  */
33231e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
33331e31b8aSbellard 
33431e31b8aSbellard /*
33531e31b8aSbellard  * These ioctls are only used in optcd.c
33631e31b8aSbellard  */
33731e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
33831e31b8aSbellard 
33931e31b8aSbellard /*
34031e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
34131e31b8aSbellard  * drive spindown time.  They should be implemented in the
34231e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
34331e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
34431e31b8aSbellard  *  -Erik
34531e31b8aSbellard  */
34631e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
34731e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
34831e31b8aSbellard 
34931e31b8aSbellard /*
35031e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
35131e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
35231e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
35331e31b8aSbellard  */
35431e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
35531e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
35631e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
35731e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
35831e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
35931e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
36031e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
36131e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
36231e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
36331e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
36431e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
36531e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
36631e31b8aSbellard 
36731e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
36831e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
36931e31b8aSbellard  */
37031e31b8aSbellard 
37131e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
37231e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
37331e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
37431e31b8aSbellard 
37531e31b8aSbellard /* DVD-ROM Specific ioctls */
37631e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
37731e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
37831e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
37931e31b8aSbellard 
38031e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
38131e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
38231e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
38331e31b8aSbellard 
38431e31b8aSbellard /* HD commands */
38531e31b8aSbellard 
38631e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
38731e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
38831e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
38931e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
39031e31b8aSbellard #define TARGET_HDIO_GET_IDENTITY      0x0307  /* get IDE identification info */
39131e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
39231e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
39331e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
39431e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
39531e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
39631e31b8aSbellard 
39731e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
39831e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
39931e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
40031e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
40131e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
40231e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
40331e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
40431e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
405