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