1*a4aa671eSarutz /*
2*a4aa671eSarutz  * CDDL HEADER START
3*a4aa671eSarutz  *
4*a4aa671eSarutz  * The contents of this file are subject to the terms of the
5*a4aa671eSarutz  * Common Development and Distribution License (the "License").
6*a4aa671eSarutz  * You may not use this file except in compliance with the License.
7*a4aa671eSarutz  *
8*a4aa671eSarutz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*a4aa671eSarutz  * or http://www.opensolaris.org/os/licensing.
10*a4aa671eSarutz  * See the License for the specific language governing permissions
11*a4aa671eSarutz  * and limitations under the License.
12*a4aa671eSarutz  *
13*a4aa671eSarutz  * When distributing Covered Code, include this CDDL HEADER in each
14*a4aa671eSarutz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*a4aa671eSarutz  * If applicable, add the following below this CDDL HEADER, with the
16*a4aa671eSarutz  * fields enclosed by brackets "[]" replaced with your own identifying
17*a4aa671eSarutz  * information: Portions Copyright [yyyy] [name of copyright owner]
18*a4aa671eSarutz  *
19*a4aa671eSarutz  * CDDL HEADER END
20*a4aa671eSarutz  */
21*a4aa671eSarutz /*
22*a4aa671eSarutz  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*a4aa671eSarutz  * Use is subject to license terms.
24*a4aa671eSarutz  */
25*a4aa671eSarutz 
26*a4aa671eSarutz #ifndef _SYS_DADA_TARGET_DADPRIV_H
27*a4aa671eSarutz #define	_SYS_DADA_TARGET_DADPRIV_H
28*a4aa671eSarutz 
29*a4aa671eSarutz #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*a4aa671eSarutz 
31*a4aa671eSarutz #ifdef	__cplusplus
32*a4aa671eSarutz extern "C" {
33*a4aa671eSarutz #endif
34*a4aa671eSarutz 
35*a4aa671eSarutz #define	DIOCTL_RWCMD		5	/* read/write a disk 		*/
36*a4aa671eSarutz 
37*a4aa671eSarutz /*
38*a4aa671eSarutz  *  dadkio_rwcmd cmd
39*a4aa671eSarutz  */
40*a4aa671eSarutz 
41*a4aa671eSarutz #define	DADKIO_RWCMD_READ		1	/* read command */
42*a4aa671eSarutz #define	DADKIO_RWCMD_WRITE		2	/* write command */
43*a4aa671eSarutz 
44*a4aa671eSarutz /*
45*a4aa671eSarutz  * dadkio_rwcmd flags
46*a4aa671eSarutz  */
47*a4aa671eSarutz #define	DADKIO_FLAG_SILENT		0x01	/* driver should not */
48*a4aa671eSarutz 						/* generate any warning */
49*a4aa671eSarutz 						/* or error console msgs */
50*a4aa671eSarutz #define	DADKIO_FLAG_RESERVED		0x02	/* reserved/not used */
51*a4aa671eSarutz 
52*a4aa671eSarutz 
53*a4aa671eSarutz #define	DADKIO_ERROR_INFO_LEN	128
54*a4aa671eSarutz 
55*a4aa671eSarutz /*
56*a4aa671eSarutz  * dadkio_status status value.
57*a4aa671eSarutz  */
58*a4aa671eSarutz struct dadkio_status {
59*a4aa671eSarutz 	int		status;
60*a4aa671eSarutz 	ulong_t		resid;
61*a4aa671eSarutz 	int		failed_blk_is_valid;
62*a4aa671eSarutz 	daddr_t		failed_blk;
63*a4aa671eSarutz 	int		fru_code_is_valid;
64*a4aa671eSarutz 	int		fru_code;
65*a4aa671eSarutz 	char		add_error_info[DADKIO_ERROR_INFO_LEN];
66*a4aa671eSarutz };
67*a4aa671eSarutz 
68*a4aa671eSarutz struct dadkio_status32 {
69*a4aa671eSarutz 	int		status;
70*a4aa671eSarutz 	uint32_t	resid;
71*a4aa671eSarutz 	int		failed_blk_is_valid;
72*a4aa671eSarutz 	daddr32_t	failed_blk;
73*a4aa671eSarutz 	int		fru_code_is_valid;
74*a4aa671eSarutz 	int		fru_code;
75*a4aa671eSarutz 	char		add_error_info[DADKIO_ERROR_INFO_LEN];
76*a4aa671eSarutz };
77*a4aa671eSarutz 
78*a4aa671eSarutz /*
79*a4aa671eSarutz  * Used by read/write ioctl (DKIOCTL_RWCMD)
80*a4aa671eSarutz  */
81*a4aa671eSarutz struct dadkio_rwcmd {
82*a4aa671eSarutz 	int			cmd;
83*a4aa671eSarutz 	int			flags;
84*a4aa671eSarutz 	daddr_t			blkaddr;
85*a4aa671eSarutz 	uint_t			buflen;
86*a4aa671eSarutz 	caddr_t			bufaddr;
87*a4aa671eSarutz 	struct dadkio_status	status;
88*a4aa671eSarutz };
89*a4aa671eSarutz 
90*a4aa671eSarutz struct dadkio_rwcmd32 {
91*a4aa671eSarutz 	int			cmd;
92*a4aa671eSarutz 	int			flags;
93*a4aa671eSarutz 	daddr32_t		blkaddr;
94*a4aa671eSarutz 	uint_t			buflen;
95*a4aa671eSarutz 	caddr32_t		bufaddr;
96*a4aa671eSarutz 	struct dadkio_status32	status;
97*a4aa671eSarutz };
98*a4aa671eSarutz 
99*a4aa671eSarutz 
100*a4aa671eSarutz /*
101*a4aa671eSarutz  * dadkio_status status values
102*a4aa671eSarutz  */
103*a4aa671eSarutz #define	DADKIO_STAT_NO_ERROR		0	/* cmd was successful */
104*a4aa671eSarutz #define	DADKIO_STAT_NOT_READY		1	/* device not ready */
105*a4aa671eSarutz #define	DADKIO_STAT_MEDIUM_ERROR	2	/* error on medium */
106*a4aa671eSarutz #define	DADKIO_STAT_HARDWARE_ERROR	3	/* other hardware error */
107*a4aa671eSarutz #define	DADKIO_STAT_ILLEGAL_REQUEST	4	/* illegal request */
108*a4aa671eSarutz #define	DADKIO_STAT_ILLEGAL_ADDRESS	5	/* illegal block address */
109*a4aa671eSarutz #define	DADKIO_STAT_WRITE_PROTECTED	6	/* device write-protected */
110*a4aa671eSarutz #define	DADKIO_STAT_TIMED_OUT		7	/* no response from device */
111*a4aa671eSarutz #define	DADKIO_STAT_PARITY		8	/* parity error in data */
112*a4aa671eSarutz #define	DADKIO_STAT_BUS_ERROR		9	/* error on bus */
113*a4aa671eSarutz #define	DADKIO_STAT_SOFT_ERROR		10	/* data recovered via ECC */
114*a4aa671eSarutz #define	DADKIO_STAT_NO_RESOURCES	11	/* no resources for cmd */
115*a4aa671eSarutz #define	DADKIO_STAT_NOT_FORMATTED	12	/* device is not formatted */
116*a4aa671eSarutz #define	DADKIO_STAT_RESERVED		13	/* device is reserved */
117*a4aa671eSarutz #define	DADKIO_STAT_NOT_SUPPORTED	14	/* feature not supported */
118*a4aa671eSarutz 
119*a4aa671eSarutz 
120*a4aa671eSarutz #ifdef	__cplusplus
121*a4aa671eSarutz }
122*a4aa671eSarutz #endif
123*a4aa671eSarutz 
124*a4aa671eSarutz #endif	/* _SYS_DADA_TARGET_DADPRIV_H */
125