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