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