xref: /onnv-gate/usr/src/uts/common/sys/raidioctl.h (revision 10513:a9bd8a91e79e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*10513SLing.Ke@Sun.COM  * Common Development and Distribution License (the "License").
6*10513SLing.Ke@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*10513SLing.Ke@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_RAIDIOCTL_H
270Sstevel@tonic-gate #define	_SYS_RAIDIOCTL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * map ioctls
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate #define	RAID_IOC (('R' << 16) | ('D' << 8))
370Sstevel@tonic-gate #define	RAID_GETCONFIG		(RAID_IOC|1)	/* Get raid information */
380Sstevel@tonic-gate #define	RAID_UPDATEFW		(RAID_IOC|4)	/* Update IOC firmware */
39840Sjesseb #define	RAID_NUMVOLUMES		(RAID_IOC|6)	/* Retrieve max RAID volumes */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /*
420Sstevel@tonic-gate  * define raid status flags
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate #define	RAID_FLAG_ENABLED				0x01
450Sstevel@tonic-gate #define	RAID_FLAG_QUIESCED				0x02
460Sstevel@tonic-gate #define	RAID_FLAG_RESYNCING				0x04
470Sstevel@tonic-gate #define	RAID_STATE_OPTIMAL				0x00
480Sstevel@tonic-gate #define	RAID_STATE_DEGRADED				0x01
490Sstevel@tonic-gate #define	RAID_STATE_FAILED				0x02
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate  * define disk status flags
530Sstevel@tonic-gate  */
540Sstevel@tonic-gate #define	RAID_DISKSTATUS_GOOD				0x0
550Sstevel@tonic-gate #define	RAID_DISKSTATUS_FAILED				0x1
560Sstevel@tonic-gate #define	RAID_DISKSTATUS_MISSING				0x2
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * maximum number of disks allowed in a raid volume
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate #define	RAID_MAXDISKS					32
620Sstevel@tonic-gate 
630Sstevel@tonic-gate typedef struct raid_config {
640Sstevel@tonic-gate 	int targetid;
650Sstevel@tonic-gate 	uint8_t	state;
660Sstevel@tonic-gate 	uint8_t	flags;
670Sstevel@tonic-gate 	int raid_level;
680Sstevel@tonic-gate 	int ndisks;
690Sstevel@tonic-gate 	int disk[RAID_MAXDISKS];
700Sstevel@tonic-gate 	int diskstatus[RAID_MAXDISKS];
710Sstevel@tonic-gate 	diskaddr_t raid_capacity;
72840Sjesseb 	int unitid;
730Sstevel@tonic-gate } raid_config_t;
740Sstevel@tonic-gate 
750Sstevel@tonic-gate /*
760Sstevel@tonic-gate  * Defines for type
770Sstevel@tonic-gate  */
780Sstevel@tonic-gate #define	FW_TYPE_UCODE			0x1;
790Sstevel@tonic-gate #define	FW_TYPE_FCODE			0x2;
800Sstevel@tonic-gate 
810Sstevel@tonic-gate typedef struct update_flash {
820Sstevel@tonic-gate 	caddr_t ptrbuffer;
830Sstevel@tonic-gate 	uint_t size;
840Sstevel@tonic-gate 	uint8_t type;
850Sstevel@tonic-gate } update_flash_t;
860Sstevel@tonic-gate 
870Sstevel@tonic-gate #if defined(_SYSCALL32)
880Sstevel@tonic-gate typedef struct update_flash_32 {
890Sstevel@tonic-gate 	caddr32_t ptrbuffer;
900Sstevel@tonic-gate 	uint32_t size;
910Sstevel@tonic-gate 	uint8_t type;
920Sstevel@tonic-gate } update_flash_32_t;
930Sstevel@tonic-gate #endif
940Sstevel@tonic-gate 
950Sstevel@tonic-gate #ifdef	__cplusplus
960Sstevel@tonic-gate }
970Sstevel@tonic-gate #endif
980Sstevel@tonic-gate 
990Sstevel@tonic-gate #endif	/* _SYS_RAIDIOCTL_H */
100