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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _TOPO_PROP_H
27 #define	_TOPO_PROP_H
28 
29 #include <fm/libtopo.h>
30 
31 #include <topo_list.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct topo_ipgroup_info {
38 	char *tpi_name;			/* property group name */
39 	topo_stability_t tpi_namestab;	/* stability of group name */
40 	topo_stability_t tpi_datastab;	/* stability of all property values */
41 	topo_version_t  tpi_version;	/* version of pgroup definition */
42 } topo_ipgroup_info_t;
43 
44 typedef struct topo_pgroup {
45 	topo_list_t tpg_list;		/* next/prev pointers */
46 	topo_ipgroup_info_t *tpg_info;	/* name, version, stability */
47 	topo_list_t tpg_pvals;		/* property values */
48 } topo_pgroup_t;
49 
50 typedef struct topo_propmethod {
51 	char *tpm_name;			/* property method name */
52 	topo_version_t tpm_version;	/* method version */
53 	nvlist_t *tpm_args;		/* in args for method */
54 } topo_propmethod_t;
55 
56 typedef struct topo_propval {
57 	char *tp_name;			/* prop name */
58 	topo_type_t tp_type;		/* prop type */
59 	int tp_flag;			/* dynamic property */
60 	int tp_refs;			/* ref count for this prop val */
61 	topo_hdl_t *tp_hdl;		/* handle pointer for allocations */
62 	void (*tp_free)(struct topo_propval *); /* prop value destructor */
63 	nvlist_t *tp_val;
64 	topo_propmethod_t *tp_method;	/* Method for accessing dynamic prop */
65 } topo_propval_t;
66 
67 typedef struct topo_proplist {
68 	topo_list_t tp_list;		/* next/prev pointers */
69 	topo_propval_t *tp_pval;	/* actual value */
70 } topo_proplist_t;
71 
72 extern void topo_prop_hold(topo_propval_t *);
73 extern void topo_prop_rele(topo_propval_t *);
74 extern void topo_pgroup_destroy_all(tnode_t *);
75 extern nvlist_t *topo_prop_get(tnode_t *, const char *, const char *,
76     topo_type_t, nvlist_t *, int *err);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif	/* _TOPO_PROP_H */
83