xref: /titanic_41/usr/src/lib/fm/topo/libtopo/common/topo_method.h (revision 73e32a377b571c409fcab2227ee156fd52de7e03)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _TOPO_METHOD_H
28 #define	_TOPO_METHOD_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <fm/topo_list.h>
35 
36 typedef struct topo_imethod {
37 	topo_list_t tim_list;		/* next/prev pointers */
38 	pthread_mutex_t tim_lock;	/* method entry lock */
39 	pthread_cond_t  tim_cv;		/* method entry cv */
40 	uint_t tim_busy;		/* method entry busy indicator */
41 	char *tim_name;			/* Method name */
42 	topo_version_t tim_version;	/* Method version */
43 	topo_stability_t tim_stability;	/* SMI stability of method */
44 	char *tim_desc;			/* Method description */
45 	topo_method_f *tim_func;	/* Method function */
46 	struct topo_mod *tim_mod;	/* Ptr to controlling module */
47 } topo_imethod_t;
48 
49 extern int topo_method_call(tnode_t *, const char *, topo_version_t, nvlist_t *,
50     nvlist_t **, int *);
51 extern topo_imethod_t *topo_method_lookup(tnode_t *, const char *);
52 extern int topo_prop_method_version_register(tnode_t *, const char *,
53     const char *, topo_type_t, const char *, topo_version_t, const nvlist_t *,
54     int *);
55 
56 /*
57  * FMRI methods
58  */
59 #define	TOPO_METH_ASRU_COMPUTE		"topo_asru_compute"
60 #define	TOPO_METH_FRU_COMPUTE		"topo_fru_compute"
61 #define	TOPO_METH_FMRI			"topo_fmri"
62 #define	TOPO_METH_NVL2STR		"topo_nvl2str"
63 #define	TOPO_METH_STR2NVL		"topo_str2nvl"
64 #define	TOPO_METH_COMPARE		"topo_compare"
65 #define	TOPO_METH_PROP_GET		"topo_prop_get"
66 #define	TOPO_METH_PGRP_GET		"topo_pgrp_get"
67 #define	TOPO_METH_PROP_SET		"topo_prop_set"
68 #define	TOPO_METH_FACILITY		"topo_facility"
69 
70 #define	TOPO_METH_FMRI_VERSION			0
71 #define	TOPO_METH_FRU_COMPUTE_VERSION		0
72 #define	TOPO_METH_ASRU_COMPUTE_VERSION		0
73 #define	TOPO_METH_NVL2STR_VERSION		0
74 #define	TOPO_METH_STR2NVL_VERSION		0
75 #define	TOPO_METH_COMPARE_VERSION		0
76 #define	TOPO_METH_PROP_GET_VERSION		0
77 #define	TOPO_METH_PGRP_GET_VERSION		0
78 #define	TOPO_METH_PROP_SET_VERSION		0
79 #define	TOPO_METH_FACILITY_VERSION		0
80 
81 #define	TOPO_METH_ASRU_COMPUTE_DESC	"Dynamic ASRU constructor"
82 #define	TOPO_METH_FRU_COMPUTE_DESC	"Dynamic FRU constructor"
83 #define	TOPO_METH_FMRI_DESC		"Dynamic FMRI constructor"
84 #define	TOPO_METH_NVL2STR_DESC		"FMRI to string"
85 #define	TOPO_METH_STR2NVL_DESC		"string to FMRI"
86 #define	TOPO_METH_COMPARE_DESC		"compare two FMRIs"
87 #define	TOPO_METH_PROP_GET_DESC		"get properties for FMRI"
88 #define	TOPO_METH_PGRP_GET_DESC		"get property group for FMRI"
89 #define	TOPO_METH_PROP_SET_DESC		"set properties for FMRI"
90 #define	TOPO_METH_FACILITY_DESC		"get facility for FMRI"
91 
92 #define	TOPO_METH_COMPARE_RET		"compare-return"
93 
94 #define	TOPO_METH_FMRI_ARG_NAME		"child-name"
95 #define	TOPO_METH_FMRI_ARG_INST		"child-inst"
96 #define	TOPO_METH_FMRI_ARG_NVL		"args"
97 #define	TOPO_METH_FMRI_ARG_PARENT	"parent-fmri"
98 #define	TOPO_METH_FMRI_ARG_AUTH		"auth"
99 #define	TOPO_METH_FMRI_ARG_PART		"part"
100 #define	TOPO_METH_FMRI_ARG_REV		"rev"
101 #define	TOPO_METH_FMRI_ARG_SER		"serial"
102 #define	TOPO_METH_FMRI_ARG_HCS		"hc-specific"
103 #define	TOPO_METH_FMRI_ARG_FMRI		"fmri"
104 #define	TOPO_METH_FMRI_ARG_SUBFMRI	"sub-fmri"
105 #define	TOPO_METH_FMRI_ARG_NV1		"nv1"
106 #define	TOPO_METH_FMRI_ARG_NV2		"nv2"
107 
108 #ifdef	__cplusplus
109 }
110 #endif
111 
112 #endif	/* _TOPO_METHOD_H */
113