xref: /titanic_51/usr/src/uts/common/sys/raidioctl.h (revision d193de62b9e1115fd66e2032bbcdb2bd8e1ce51c)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_RAIDIOCTL_H
27 #define	_SYS_RAIDIOCTL_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * map ioctls
35  */
36 #define	RAID_IOC (('R' << 16) | ('D' << 8))
37 #define	RAID_GETCONFIG		(RAID_IOC|1)	/* Get raid information */
38 #define	RAID_UPDATEFW		(RAID_IOC|4)	/* Update IOC firmware */
39 #define	RAID_NUMVOLUMES		(RAID_IOC|6)	/* Retrieve max RAID volumes */
40 
41 /*
42  * define raid status flags
43  */
44 #define	RAID_FLAG_ENABLED				0x01
45 #define	RAID_FLAG_QUIESCED				0x02
46 #define	RAID_FLAG_RESYNCING				0x04
47 #define	RAID_STATE_OPTIMAL				0x00
48 #define	RAID_STATE_DEGRADED				0x01
49 #define	RAID_STATE_FAILED				0x02
50 
51 /*
52  * define disk status flags
53  */
54 #define	RAID_DISKSTATUS_GOOD				0x0
55 #define	RAID_DISKSTATUS_FAILED				0x1
56 #define	RAID_DISKSTATUS_MISSING				0x2
57 
58 /*
59  * maximum number of disks allowed in a raid volume
60  */
61 #define	RAID_MAXDISKS					32
62 
63 typedef struct raid_config {
64 	int targetid;
65 	uint8_t	state;
66 	uint8_t	flags;
67 	int raid_level;
68 	int ndisks;
69 	int disk[RAID_MAXDISKS];
70 	int diskstatus[RAID_MAXDISKS];
71 	diskaddr_t raid_capacity;
72 	int unitid;
73 } raid_config_t;
74 
75 /*
76  * Defines for type
77  */
78 #define	FW_TYPE_UCODE			0x1;
79 #define	FW_TYPE_FCODE			0x2;
80 
81 typedef struct update_flash {
82 	caddr_t ptrbuffer;
83 	uint_t size;
84 	uint8_t type;
85 } update_flash_t;
86 
87 #if defined(_SYSCALL32)
88 typedef struct update_flash_32 {
89 	caddr32_t ptrbuffer;
90 	uint32_t size;
91 	uint8_t type;
92 } update_flash_32_t;
93 #endif
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif	/* _SYS_RAIDIOCTL_H */
100