xref: /illumos-gate/usr/src/uts/sun4v/sys/promif_impl.h (revision 9dd828891378a0a6a509ab601b4c5c20ca5562ec)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PROMIF_IMPL_H
28 #define	_SYS_PROMIF_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #ifdef _KERNEL
38 #include <sys/promimpl.h>
39 #endif
40 #include <sys/obpdefs.h>
41 #include <sys/cmn_err.h>
42 #include <sys/note.h>
43 
44 /*
45  * CIF handler functions
46  */
47 typedef int (*cif_func_t) (void *);
48 extern int promif_getprop(void *p);
49 extern int promif_getproplen(void *p);
50 extern int promif_nextprop(void *p);
51 extern int promif_nextnode(void *p);
52 extern int promif_childnode(void *p);
53 extern int promif_parentnode(void *p);
54 extern int promif_enter_mon(void *p);
55 extern int promif_exit_to_mon(void *p);
56 extern int promif_reboot(void *p);
57 extern int promif_write(void *p);
58 extern int promif_read(void *p);
59 extern int promif_interpret(void *p);
60 extern int promif_finddevice(void *p);
61 extern int promif_instance_to_package(void *p);
62 #ifndef _KMDB
63 extern int promif_setprop(void *p);
64 extern int promif_test(void *p);
65 extern int promif_instance_to_path(void *p);
66 extern int promif_power_off(void *p);
67 extern int promif_asr_list_keys_len(void *p);
68 extern int promif_asr_list_keys(void *p);
69 extern int promif_asr_export_len(void *p);
70 extern int promif_asr_export(void *p);
71 extern int promif_set_security_key(void *p);
72 extern int promif_get_security_key(void *p);
73 extern int promif_start_cpu(void *p);
74 extern int promif_set_mmfsa_traptable(void *p);
75 extern int promif_set_sun4v_api_version(void *p);
76 extern int promif_get_sun4v_api_version(void *p);
77 #endif
78 
79 /*
80  * Shadow device tree access functions
81  */
82 extern pnode_t promif_stree_nextnode(pnode_t nodeid);
83 extern pnode_t promif_stree_childnode(pnode_t nodeid);
84 extern pnode_t promif_stree_parentnode(pnode_t nodeid);
85 extern int promif_stree_getproplen(pnode_t, char *name);
86 extern int promif_stree_getprop(pnode_t, char *name, void *value);
87 extern int promif_stree_setprop(pnode_t, char *name, void *value, int len);
88 extern char *promif_stree_nextprop(pnode_t nodeid, char *name, char *next);
89 
90 /*
91  * Hooks for kmdb to get and set a pointer to the PROM shadow tree
92  */
93 #ifdef _KMDB
94 extern void promif_stree_setroot(void *root);
95 extern caddr_t promif_stree_getroot(void);
96 #endif
97 
98 /*
99  * Miscellaneous functions
100  */
101 extern cif_func_t promif_find_cif_callback(char *opname);
102 extern int promif_ldom_setprop(char *name, void *value, int valuelen);
103 
104 /*
105  * Initialization functions
106  */
107 #ifdef _KMDB
108 extern void cif_init(char *, caddr_t, ihandle_t, ihandle_t,
109     phandle_t, phandle_t, pnode_t, pnode_t);
110 extern void promif_io_init(ihandle_t, ihandle_t, phandle_t, phandle_t);
111 extern void promif_set_nodes(pnode_t, pnode_t);
112 #else
113 extern void promif_io_init(void);
114 extern void promif_stree_init(void);
115 extern void promif_prop_init(void);
116 #endif
117 
118 /*
119  * Debugging support
120  */
121 #ifdef DEBUG
122 
123 extern uint_t cif_debug;
124 
125 #define	CIF_DBG_FLAG_NODE		0x01
126 #define	CIF_DBG_FLAG_REBOOT		0x02
127 
128 #define	CIF_DBG_ALL	if (cif_debug)				prom_printf
129 #define	CIF_DBG_NODE	if (cif_debug & CIF_DBG_FLAG_NODE)	prom_printf
130 #define	CIF_DBG_REBOOT	if (cif_debug & CIF_DBG_FLAG_REBOOT)	prom_printf
131 
132 #else /* DEBUG */
133 
134 #define	CIF_DBG_ALL	_NOTE(CONSTCOND) if (0)	prom_printf
135 #define	CIF_DBG_NODE	CIF_DBG_ALL
136 #define	CIF_DBG_REBOOT	CIF_DBG_ALL
137 
138 #endif /* DEBUG */
139 
140 #ifdef	__cplusplus
141 }
142 #endif
143 
144 #endif /* _SYS_PROMIF_IMPL_H */
145