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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <fm/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_COMPARE		"topo_compare"
67 #define	TOPO_METH_PROP_GET		"topo_prop_get"
68 #define	TOPO_METH_PGRP_GET		"topo_pgrp_get"
69 #define	TOPO_METH_PROP_SET		"topo_prop_set"
70 
71 #define	TOPO_METH_FMRI_VERSION			0
72 #define	TOPO_METH_FRU_COMPUTE_VERSION		0
73 #define	TOPO_METH_ASRU_COMPUTE_VERSION		0
74 #define	TOPO_METH_NVL2STR_VERSION		0
75 #define	TOPO_METH_STR2NVL_VERSION		0
76 #define	TOPO_METH_COMPARE_VERSION		0
77 #define	TOPO_METH_PROP_GET_VERSION		0
78 #define	TOPO_METH_PGRP_GET_VERSION		0
79 #define	TOPO_METH_PROP_SET_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 
91 #define	TOPO_METH_COMPARE_RET		"contains-return"
92 
93 #define	TOPO_METH_FMRI_ARG_NAME		"child-name"
94 #define	TOPO_METH_FMRI_ARG_INST		"child-inst"
95 #define	TOPO_METH_FMRI_ARG_NVL		"args"
96 #define	TOPO_METH_FMRI_ARG_PARENT	"parent-fmri"
97 #define	TOPO_METH_FMRI_ARG_AUTH		"auth"
98 #define	TOPO_METH_FMRI_ARG_PART		"part"
99 #define	TOPO_METH_FMRI_ARG_REV		"rev"
100 #define	TOPO_METH_FMRI_ARG_SER		"serial"
101 #define	TOPO_METH_FMRI_ARG_HCS		"hc-specific"
102 #define	TOPO_METH_FMRI_ARG_FMRI		"fmri"
103 #define	TOPO_METH_FMRI_ARG_SUBFMRI	"sub-fmri"
104 #define	TOPO_METH_FMRI_ARG_NV1		"nv1"
105 #define	TOPO_METH_FMRI_ARG_NV2		"nv2"
106 
107 #ifdef	__cplusplus
108 }
109 #endif
110 
111 #endif	/* _TOPO_METHOD_H */
112