xref: /illumos-gate/usr/src/uts/common/sys/raidioctl.h (revision 032624d56c174c5c55126582b32e314a6af15522)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_RAIDIOCTL_H
28 #define	_SYS_RAIDIOCTL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * map ioctls
38  */
39 #define	RAID_IOC (('R' << 16) | ('D' << 8))
40 #define	RAID_GETCONFIG		(RAID_IOC|1)	/* Get raid information */
41 #define	RAID_CREATE		(RAID_IOC|2)	/* Create raid mirror */
42 #define	RAID_DELETE		(RAID_IOC|3)	/* Delete raid mirror */
43 #define	RAID_UPDATEFW		(RAID_IOC|4)	/* Update IOC firmware */
44 #define	RAID_GETDEVID		(RAID_IOC|5)	/* Retrieve devid of chip */
45 
46 /*
47  * define raid status flags
48  */
49 #define	RAID_FLAG_ENABLED				0x01
50 #define	RAID_FLAG_QUIESCED				0x02
51 #define	RAID_FLAG_RESYNCING				0x04
52 #define	RAID_STATE_OPTIMAL				0x00
53 #define	RAID_STATE_DEGRADED				0x01
54 #define	RAID_STATE_FAILED				0x02
55 
56 /*
57  * define disk status flags
58  */
59 #define	RAID_DISKSTATUS_GOOD				0x0
60 #define	RAID_DISKSTATUS_FAILED				0x1
61 #define	RAID_DISKSTATUS_MISSING				0x2
62 
63 /*
64  * maximum number of disks allowed in a raid volume
65  */
66 #define	RAID_MAXDISKS					32
67 
68 typedef struct raid_config {
69 	int targetid;
70 	uint8_t	state;
71 	uint8_t	flags;
72 	int raid_level;
73 	int ndisks;
74 	int disk[RAID_MAXDISKS];
75 	int diskstatus[RAID_MAXDISKS];
76 	diskaddr_t raid_capacity;
77 } raid_config_t;
78 
79 /*
80  * Defines for type
81  */
82 #define	FW_TYPE_UCODE			0x1;
83 #define	FW_TYPE_FCODE			0x2;
84 
85 typedef struct update_flash {
86 	caddr_t ptrbuffer;
87 	uint_t size;
88 	uint8_t type;
89 } update_flash_t;
90 
91 #if defined(_SYSCALL32)
92 typedef struct update_flash_32 {
93 	caddr32_t ptrbuffer;
94 	uint32_t size;
95 	uint8_t type;
96 } update_flash_32_t;
97 #endif
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* _SYS_RAIDIOCTL_H */
104