xref: /illumos-gate/usr/src/uts/common/sys/raidioctl.h (revision 7c478bd9)
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 2002-2003 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 
45 /*
46  * define raid status flags
47  */
48 #define	RAID_FLAG_ENABLED				0x01
49 #define	RAID_FLAG_QUIESCED				0x02
50 #define	RAID_FLAG_RESYNCING				0x04
51 #define	RAID_STATE_OPTIMAL				0x00
52 #define	RAID_STATE_DEGRADED				0x01
53 #define	RAID_STATE_FAILED				0x02
54 
55 /*
56  * define disk status flags
57  */
58 #define	RAID_DISKSTATUS_GOOD				0x0
59 #define	RAID_DISKSTATUS_FAILED				0x1
60 #define	RAID_DISKSTATUS_MISSING				0x2
61 
62 /*
63  * maximum number of disks allowed in a raid volume
64  */
65 #define	RAID_MAXDISKS					32
66 
67 typedef struct raid_config {
68 	int targetid;
69 	uint8_t	state;
70 	uint8_t	flags;
71 	int raid_level;
72 	int ndisks;
73 	int disk[RAID_MAXDISKS];
74 	int diskstatus[RAID_MAXDISKS];
75 	diskaddr_t raid_capacity;
76 } raid_config_t;
77 
78 /*
79  * Defines for type
80  */
81 #define	FW_TYPE_UCODE			0x1;
82 #define	FW_TYPE_FCODE			0x2;
83 
84 typedef struct update_flash {
85 	caddr_t ptrbuffer;
86 	uint_t size;
87 	uint8_t type;
88 } update_flash_t;
89 
90 #if defined(_SYSCALL32)
91 typedef struct update_flash_32 {
92 	caddr32_t ptrbuffer;
93 	uint32_t size;
94 	uint8_t type;
95 } update_flash_32_t;
96 #endif
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* _SYS_RAIDIOCTL_H */
103