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