xref: /titanic_52/usr/src/lib/libraidcfg/common/raidcfg.h (revision b449fa8aa1f53939091aeb3a5af8a8f3ba9d33dc)
13e4f2897Sjc156560 /*
23e4f2897Sjc156560  * CDDL HEADER START
33e4f2897Sjc156560  *
43e4f2897Sjc156560  * The contents of this file are subject to the terms of the
53e4f2897Sjc156560  * Common Development and Distribution License (the "License").
63e4f2897Sjc156560  * You may not use this file except in compliance with the License.
73e4f2897Sjc156560  *
83e4f2897Sjc156560  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93e4f2897Sjc156560  * or http://www.opensolaris.org/os/licensing.
103e4f2897Sjc156560  * See the License for the specific language governing permissions
113e4f2897Sjc156560  * and limitations under the License.
123e4f2897Sjc156560  *
133e4f2897Sjc156560  * When distributing Covered Code, include this CDDL HEADER in each
143e4f2897Sjc156560  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153e4f2897Sjc156560  * If applicable, add the following below this CDDL HEADER, with the
163e4f2897Sjc156560  * fields enclosed by brackets "[]" replaced with your own identifying
173e4f2897Sjc156560  * information: Portions Copyright [yyyy] [name of copyright owner]
183e4f2897Sjc156560  *
193e4f2897Sjc156560  * CDDL HEADER END
203e4f2897Sjc156560  */
213e4f2897Sjc156560 
223e4f2897Sjc156560 /*
23*b449fa8aSyw161884  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
243e4f2897Sjc156560  * Use is subject to license terms.
253e4f2897Sjc156560  */
263e4f2897Sjc156560 
273e4f2897Sjc156560 #ifndef	_RAIDCFG_H
283e4f2897Sjc156560 #define	_RAIDCFG_H
293e4f2897Sjc156560 
303e4f2897Sjc156560 #pragma ident	"%Z%%M%	%I%	%E% SMI"
313e4f2897Sjc156560 
323e4f2897Sjc156560 #include <sys/types.h>
333e4f2897Sjc156560 #include <raidcfg_spi.h>
343e4f2897Sjc156560 
353e4f2897Sjc156560 #ifdef	__cplusplus
363e4f2897Sjc156560 extern "C" {
373e4f2897Sjc156560 #endif
383e4f2897Sjc156560 
393e4f2897Sjc156560 /*
403e4f2897Sjc156560  * Reserved Raid object IDs;
413e4f2897Sjc156560  * ID 0 is reserved for root object;
423e4f2897Sjc156560  * ID 0 also stands for NONE OBJECT.
433e4f2897Sjc156560  */
443e4f2897Sjc156560 #define	OBJ_SYSTEM		0
453e4f2897Sjc156560 #define	OBJ_NONE		0
463e4f2897Sjc156560 
473e4f2897Sjc156560 typedef	int raid_obj_handle_t;
483e4f2897Sjc156560 
493e4f2897Sjc156560 /*
503e4f2897Sjc156560  * API data structure definition
513e4f2897Sjc156560  */
523e4f2897Sjc156560 typedef	struct {
533e4f2897Sjc156560 	int	array_handle;
543e4f2897Sjc156560 	int	disk_handle;
553e4f2897Sjc156560 } raidcfg_hsp_relation_t;
563e4f2897Sjc156560 
573e4f2897Sjc156560 typedef	controller_attr_t	raidcfg_controller_t;
583e4f2897Sjc156560 typedef	array_attr_t		raidcfg_array_t;
593e4f2897Sjc156560 typedef	disk_attr_t		raidcfg_disk_t;
603e4f2897Sjc156560 
613e4f2897Sjc156560 typedef struct {
623e4f2897Sjc156560 	uint32_t	associated_id;
633e4f2897Sjc156560 	uint32_t	type;
643e4f2897Sjc156560 	array_tag_t	tag;
653e4f2897Sjc156560 } raidcfg_hsp_t;
663e4f2897Sjc156560 
673e4f2897Sjc156560 typedef	struct {
683e4f2897Sjc156560 	uint32_t	disk_id;
693e4f2897Sjc156560 	uint32_t	state;
703e4f2897Sjc156560 	uint64_t	offset;
713e4f2897Sjc156560 	uint64_t	size;
723e4f2897Sjc156560 	disk_tag_t	tag;
733e4f2897Sjc156560 } raidcfg_arraypart_t;
743e4f2897Sjc156560 
753e4f2897Sjc156560 typedef	diskseg_attr_t		raidcfg_diskseg_t;
763e4f2897Sjc156560 typedef	task_attr_t		raidcfg_task_t;
77*b449fa8aSyw161884 typedef	property_attr_t		raidcfg_prop_t;
783e4f2897Sjc156560 
793e4f2897Sjc156560 /*
803e4f2897Sjc156560  * raidcfg common library APIs
813e4f2897Sjc156560  */
823e4f2897Sjc156560 const char *raidcfg_errstr(int);
833e4f2897Sjc156560 int raidcfg_get_controller(uint32_t);
843e4f2897Sjc156560 int raidcfg_get_array(int, uint64_t, uint64_t);
853e4f2897Sjc156560 int raidcfg_get_disk(int, disk_tag_t);
863e4f2897Sjc156560 int raidcfg_open_controller(int, char **);
873e4f2897Sjc156560 int raidcfg_close_controller(int, char **);
883e4f2897Sjc156560 int raidcfg_get_type(int);
893e4f2897Sjc156560 int raidcfg_get_attr(int, void *);
903e4f2897Sjc156560 int raidcfg_get_container(int);
913e4f2897Sjc156560 int raidcfg_list_head(int, raid_obj_type_id_t);
923e4f2897Sjc156560 int raidcfg_list_next(int);
933e4f2897Sjc156560 int raidcfg_set_attr(int, uint32_t, void *, char **);
943e4f2897Sjc156560 int raidcfg_set_hsp(int, raidcfg_hsp_relation_t *, char **);
953e4f2897Sjc156560 int raidcfg_unset_hsp(int, raidcfg_hsp_relation_t *, char **);
963e4f2897Sjc156560 int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **);
973e4f2897Sjc156560 int raidcfg_delete_array(int, char **);
983e4f2897Sjc156560 int raidcfg_update_fw(int, char *, char **);
993e4f2897Sjc156560 
1003e4f2897Sjc156560 #ifdef	__cplusplus
1013e4f2897Sjc156560 }
1023e4f2897Sjc156560 #endif
1033e4f2897Sjc156560 
1043e4f2897Sjc156560 #endif /* _RAIDCFG_H */
105