1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1996-2000 by Sun Microsystems Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_DADA_IMPL_UDCD_H
28*0Sstevel@tonic-gate #define	_SYS_DADA_IMPL_UDCD_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * definition for user dcd command  structure
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate struct udcd_cmd {
41*0Sstevel@tonic-gate 	uchar_t	udcd_error_reg;	/* The error register value */
42*0Sstevel@tonic-gate 	uchar_t	udcd_status_reg; /* The status register */
43*0Sstevel@tonic-gate 	ushort_t	udcd_status;	/* The resulting status */
44*0Sstevel@tonic-gate 	ushort_t	udcd_timeout;	/* Timeout value for completion */
45*0Sstevel@tonic-gate 	int	udcd_flags;	/* Flags for specifying  read,write etc. */
46*0Sstevel@tonic-gate 	uint_t	udcd_resid;	/* This is the resid */
47*0Sstevel@tonic-gate 	uint_t	udcd_buflen;	/* Size of the io request */
48*0Sstevel@tonic-gate 	caddr_t	udcd_bufaddr;	/* Place to take the data or put the data in */
49*0Sstevel@tonic-gate 	struct  dcd_cmd *udcd_cmd; /* Command to be sent out */
50*0Sstevel@tonic-gate 	caddr_t	udcd_reserved;	/* reserved for future use */
51*0Sstevel@tonic-gate 	uint_t	version_no;	/* Version number for this struct */
52*0Sstevel@tonic-gate };
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate #if defined(_SYSCALL32)
55*0Sstevel@tonic-gate struct udcd_cmd32 {
56*0Sstevel@tonic-gate 	uchar_t   udcd_error_reg;	/* The error register value */
57*0Sstevel@tonic-gate 	uchar_t   udcd_status_reg; /* The status register */
58*0Sstevel@tonic-gate 	ushort_t  udcd_status;	/* The resulting status */
59*0Sstevel@tonic-gate 	ushort_t  udcd_timeout;	/* Timeout value for completion */
60*0Sstevel@tonic-gate 	int	  udcd_flags;	/* Flags for specifying  read,write etc. */
61*0Sstevel@tonic-gate 	uint_t    udcd_resid;	/* This is the resid */
62*0Sstevel@tonic-gate 	uint_t    udcd_buflen;	/* Size of the io request */
63*0Sstevel@tonic-gate 	caddr32_t udcd_bufaddr; /* Place to take the data or put the data in */
64*0Sstevel@tonic-gate 	caddr32_t udcd_cmd; /* Command to be sent out */
65*0Sstevel@tonic-gate 	caddr32_t udcd_reserved;	/* reserved for future use */
66*0Sstevel@tonic-gate 	uint_t    version_no;	/* Version number for this struct */
67*0Sstevel@tonic-gate };
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #define	udcd_cmd32toudcd_cmd(u32, ucmd)					\
70*0Sstevel@tonic-gate 	ucmd->udcd_error_reg	= u32->udcd_error_reg;			\
71*0Sstevel@tonic-gate 	ucmd->udcd_status_reg	= u32->udcd_status_reg;			\
72*0Sstevel@tonic-gate 	ucmd->udcd_status	= u32->udcd_status;			\
73*0Sstevel@tonic-gate 	ucmd->udcd_timeout	= u32->udcd_timeout;			\
74*0Sstevel@tonic-gate 	ucmd->udcd_flags	= u32->udcd_flags;			\
75*0Sstevel@tonic-gate 	ucmd->udcd_resid	= u32->udcd_resid;			\
76*0Sstevel@tonic-gate 	ucmd->udcd_buflen	= u32->udcd_buflen;			\
77*0Sstevel@tonic-gate 	ucmd->udcd_bufaddr	= (caddr_t)u32->udcd_bufaddr;		\
78*0Sstevel@tonic-gate 	ucmd->udcd_cmd		= (struct  dcd_cmd *)u32->udcd_cmd;	\
79*0Sstevel@tonic-gate 	ucmd->udcd_reserved	= (caddr_t)u32->udcd_reserved;		\
80*0Sstevel@tonic-gate 	ucmd->version_no	= u32->version_no;
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate #define	udcd_cmdtoudcd_cmd32(ucmd, u32)					\
83*0Sstevel@tonic-gate 	u32->udcd_error_reg	= ucmd->udcd_error_reg;			\
84*0Sstevel@tonic-gate 	u32->udcd_status_reg	= ucmd->udcd_status_reg;		\
85*0Sstevel@tonic-gate 	u32->udcd_status	= ucmd->udcd_status;			\
86*0Sstevel@tonic-gate 	u32->udcd_timeout	= ucmd->udcd_timeout;			\
87*0Sstevel@tonic-gate 	u32->udcd_flags		= ucmd->udcd_flags;			\
88*0Sstevel@tonic-gate 	u32->udcd_resid		= ucmd->udcd_resid;			\
89*0Sstevel@tonic-gate 	u32->udcd_buflen	= ucmd->udcd_buflen;			\
90*0Sstevel@tonic-gate 	u32->udcd_bufaddr	= (caddr32_t)ucmd->udcd_bufaddr;	\
91*0Sstevel@tonic-gate 	u32->udcd_cmd		= (caddr32_t)ucmd->udcd_cmd;		\
92*0Sstevel@tonic-gate 	u32->udcd_reserved	= (caddr32_t)ucmd->udcd_reserved;	\
93*0Sstevel@tonic-gate 	u32->version_no		= ucmd->version_no;
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate /*
99*0Sstevel@tonic-gate  * Flags for the Udcd_flags field
100*0Sstevel@tonic-gate  */
101*0Sstevel@tonic-gate #define	UDCD_WRITE	0x00000 /* Send data to device */
102*0Sstevel@tonic-gate #define	UDCD_SILENT	0x00001	/* no error messages */
103*0Sstevel@tonic-gate #define	UDCD_DIAGNOSE	0x00002 /* Fail of any error occurs */
104*0Sstevel@tonic-gate #define	UDCD_ISOLATE	0x00004	/* isolate from normal command */
105*0Sstevel@tonic-gate #define	UDCD_READ	0x00008	/* Read data from device */
106*0Sstevel@tonic-gate #define	UDCD_NOINTR	0x00040 /*  No interrupts */
107*0Sstevel@tonic-gate #define	UDCD_RESET	0x04000 /* Reset the target */
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /*
111*0Sstevel@tonic-gate  * User ATA io control command
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate #define	UDCDIOC	(0x05 << 8)
114*0Sstevel@tonic-gate #define	UDCDCMD	(UDCDIOC|201) /* User dcd command */
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate #ifdef	__cplusplus
117*0Sstevel@tonic-gate }
118*0Sstevel@tonic-gate #endif
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate #endif /* _SYS_DADA_IMPL_UDCD_H */
121