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