xref: /titanic_44/usr/src/lib/libraidcfg/common/raidcfg.h (revision 3e4f2897f6618210c2ddb7529d87dc4395159768)
1*3e4f2897Sjc156560 /*
2*3e4f2897Sjc156560  * CDDL HEADER START
3*3e4f2897Sjc156560  *
4*3e4f2897Sjc156560  * The contents of this file are subject to the terms of the
5*3e4f2897Sjc156560  * Common Development and Distribution License (the "License").
6*3e4f2897Sjc156560  * You may not use this file except in compliance with the License.
7*3e4f2897Sjc156560  *
8*3e4f2897Sjc156560  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3e4f2897Sjc156560  * or http://www.opensolaris.org/os/licensing.
10*3e4f2897Sjc156560  * See the License for the specific language governing permissions
11*3e4f2897Sjc156560  * and limitations under the License.
12*3e4f2897Sjc156560  *
13*3e4f2897Sjc156560  * When distributing Covered Code, include this CDDL HEADER in each
14*3e4f2897Sjc156560  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3e4f2897Sjc156560  * If applicable, add the following below this CDDL HEADER, with the
16*3e4f2897Sjc156560  * fields enclosed by brackets "[]" replaced with your own identifying
17*3e4f2897Sjc156560  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3e4f2897Sjc156560  *
19*3e4f2897Sjc156560  * CDDL HEADER END
20*3e4f2897Sjc156560  */
21*3e4f2897Sjc156560 
22*3e4f2897Sjc156560 /*
23*3e4f2897Sjc156560  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*3e4f2897Sjc156560  * Use is subject to license terms.
25*3e4f2897Sjc156560  */
26*3e4f2897Sjc156560 
27*3e4f2897Sjc156560 #ifndef	_RAIDCFG_H
28*3e4f2897Sjc156560 #define	_RAIDCFG_H
29*3e4f2897Sjc156560 
30*3e4f2897Sjc156560 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*3e4f2897Sjc156560 
32*3e4f2897Sjc156560 #include <sys/types.h>
33*3e4f2897Sjc156560 #include <raidcfg_spi.h>
34*3e4f2897Sjc156560 
35*3e4f2897Sjc156560 #ifdef	__cplusplus
36*3e4f2897Sjc156560 extern "C" {
37*3e4f2897Sjc156560 #endif
38*3e4f2897Sjc156560 
39*3e4f2897Sjc156560 /*
40*3e4f2897Sjc156560  * Reserved Raid object IDs;
41*3e4f2897Sjc156560  * ID 0 is reserved for root object;
42*3e4f2897Sjc156560  * ID 0 also stands for NONE OBJECT.
43*3e4f2897Sjc156560  */
44*3e4f2897Sjc156560 #define	OBJ_SYSTEM		0
45*3e4f2897Sjc156560 #define	OBJ_NONE		0
46*3e4f2897Sjc156560 
47*3e4f2897Sjc156560 typedef	int raid_obj_handle_t;
48*3e4f2897Sjc156560 
49*3e4f2897Sjc156560 /*
50*3e4f2897Sjc156560  * API data structure definition
51*3e4f2897Sjc156560  */
52*3e4f2897Sjc156560 typedef	struct {
53*3e4f2897Sjc156560 	int	array_handle;
54*3e4f2897Sjc156560 	int	disk_handle;
55*3e4f2897Sjc156560 } raidcfg_hsp_relation_t;
56*3e4f2897Sjc156560 
57*3e4f2897Sjc156560 typedef	controller_attr_t	raidcfg_controller_t;
58*3e4f2897Sjc156560 typedef	array_attr_t		raidcfg_array_t;
59*3e4f2897Sjc156560 typedef	disk_attr_t		raidcfg_disk_t;
60*3e4f2897Sjc156560 
61*3e4f2897Sjc156560 typedef struct {
62*3e4f2897Sjc156560 	uint32_t	associated_id;
63*3e4f2897Sjc156560 	uint32_t	type;
64*3e4f2897Sjc156560 	array_tag_t	tag;
65*3e4f2897Sjc156560 } raidcfg_hsp_t;
66*3e4f2897Sjc156560 
67*3e4f2897Sjc156560 typedef	struct {
68*3e4f2897Sjc156560 	uint32_t	disk_id;
69*3e4f2897Sjc156560 	uint32_t	state;
70*3e4f2897Sjc156560 	uint64_t	offset;
71*3e4f2897Sjc156560 	uint64_t	size;
72*3e4f2897Sjc156560 	disk_tag_t	tag;
73*3e4f2897Sjc156560 } raidcfg_arraypart_t;
74*3e4f2897Sjc156560 
75*3e4f2897Sjc156560 typedef	diskseg_attr_t		raidcfg_diskseg_t;
76*3e4f2897Sjc156560 typedef	task_attr_t		raidcfg_task_t;
77*3e4f2897Sjc156560 
78*3e4f2897Sjc156560 /*
79*3e4f2897Sjc156560  * raidcfg common library APIs
80*3e4f2897Sjc156560  */
81*3e4f2897Sjc156560 const char *raidcfg_errstr(int);
82*3e4f2897Sjc156560 int raidcfg_get_controller(uint32_t);
83*3e4f2897Sjc156560 int raidcfg_get_array(int, uint64_t, uint64_t);
84*3e4f2897Sjc156560 int raidcfg_get_disk(int, disk_tag_t);
85*3e4f2897Sjc156560 int raidcfg_open_controller(int, char **);
86*3e4f2897Sjc156560 int raidcfg_close_controller(int, char **);
87*3e4f2897Sjc156560 int raidcfg_get_type(int);
88*3e4f2897Sjc156560 int raidcfg_get_attr(int, void *);
89*3e4f2897Sjc156560 int raidcfg_get_container(int);
90*3e4f2897Sjc156560 int raidcfg_list_head(int, raid_obj_type_id_t);
91*3e4f2897Sjc156560 int raidcfg_list_next(int);
92*3e4f2897Sjc156560 int raidcfg_set_attr(int, uint32_t, void *, char **);
93*3e4f2897Sjc156560 int raidcfg_set_hsp(int, raidcfg_hsp_relation_t *, char **);
94*3e4f2897Sjc156560 int raidcfg_unset_hsp(int, raidcfg_hsp_relation_t *, char **);
95*3e4f2897Sjc156560 int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **);
96*3e4f2897Sjc156560 int raidcfg_delete_array(int, char **);
97*3e4f2897Sjc156560 int raidcfg_update_fw(int, char *, char **);
98*3e4f2897Sjc156560 
99*3e4f2897Sjc156560 #ifdef	__cplusplus
100*3e4f2897Sjc156560 }
101*3e4f2897Sjc156560 #endif
102*3e4f2897Sjc156560 
103*3e4f2897Sjc156560 #endif /* _RAIDCFG_H */
104