Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * Hypervisor Software File: promif.h | |
5 | * | |
6 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
7 | * | |
8 | * - Do no alter or remove copyright notices | |
9 | * | |
10 | * - Redistribution and use of this software in source and binary forms, with | |
11 | * or without modification, are permitted provided that the following | |
12 | * conditions are met: | |
13 | * | |
14 | * - Redistribution of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * | |
17 | * - Redistribution in binary form must reproduce the above copyright notice, | |
18 | * this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | |
20 | * | |
21 | * Neither the name of Sun Microsystems, Inc. or the names of contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * This software is provided "AS IS," without a warranty of any kind. | |
26 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
27 | * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
28 | * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
29 | * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
30 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
31 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
32 | * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
33 | * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
34 | * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
35 | * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
36 | * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
37 | * | |
38 | * You acknowledge that this software is not designed, licensed or | |
39 | * intended for use in the design, construction, operation or maintenance of | |
40 | * any nuclear facility. | |
41 | * | |
42 | * ========== Copyright Header End ============================================ | |
43 | */ | |
44 | /* | |
45 | * Copyright (c) 2000, 2003 Sun Microsystems, Inc. All rights reserved. | |
46 | * Use is subject to license terms. | |
47 | */ | |
48 | ||
49 | #ifndef _SYS_PROMIF_H | |
50 | #define _SYS_PROMIF_H | |
51 | ||
52 | #pragma ident "@(#)promif.h 1.1 00/08/07 SMI" | |
53 | ||
54 | #ifdef __cplusplus | |
55 | extern "C" { | |
56 | #endif | |
57 | ||
58 | #include <sys/types.h> | |
59 | #include <sys/obpdefs.h> | |
60 | #include <sys/va_list.h> | |
61 | ||
62 | /* | |
63 | * Device tree and property group | |
64 | */ | |
65 | extern dnode_t prom_childnode(dnode_t nodeid); | |
66 | extern dnode_t prom_nextnode(dnode_t nodeid); | |
67 | extern dnode_t prom_parentnode(dnode_t nodeid); | |
68 | ||
69 | extern int prom_getproplen(dnode_t nodeid, caddr_t name); | |
70 | extern int prom_getprop(dnode_t nodeid, caddr_t name, | |
71 | caddr_t buf); | |
72 | extern int prom_bounded_getprop(dnode_t nodeid, caddr_t name, | |
73 | caddr_t buf, int buflen); | |
74 | extern int prom_nextprop(dnode_t nodeid, caddr_t previous, | |
75 | caddr_t next); | |
76 | extern int prom_setprop(dnode_t nodeid, caddr_t name, | |
77 | caddr_t buf, int buflen); | |
78 | ||
79 | extern phandle_t prom_getphandle(ihandle_t instance); | |
80 | extern int prom_pathname(char *pathname); | |
81 | extern dnode_t prom_finddevice(char *path); | |
82 | ||
83 | extern int prom_ihandle_to_path(ihandle_t instance, char *buf, | |
84 | uint_t buflen); | |
85 | extern int prom_phandle_to_path(phandle_t package, char *buf, | |
86 | uint_t buflen); | |
87 | ||
88 | /* | |
89 | * Device I/O group | |
90 | */ | |
91 | extern ihandle_t prom_open(char *name); | |
92 | extern int prom_close(ihandle_t fd); | |
93 | extern uint32_t prom_read(ihandle_t fd, caddr_t buf, uint32_t len); | |
94 | extern uint32_t prom_write(ihandle_t fd, caddr_t buf, uint32_t len); | |
95 | extern int prom_seek(ihandle_t fd, u_longlong_t offset); | |
96 | ||
97 | /* | |
98 | * Control transfer group | |
99 | */ | |
100 | extern void prom_enter_mon(void); | |
101 | extern void prom_exit_to_mon(void); | |
102 | extern void prom_reboot(char *bootstr); | |
103 | ||
104 | /* | |
105 | * Resource allocation group | |
106 | */ | |
107 | extern caddr_t prom_malloc(caddr_t virt, size_t size, uint_t align); | |
108 | extern void prom_free(caddr_t virt, size_t size); | |
109 | ||
110 | /* | |
111 | * Console I/O group | |
112 | */ | |
113 | extern uchar_t prom_getchar(void); | |
114 | extern void prom_putchar(char c); | |
115 | extern int prom_mayget(void); | |
116 | extern int prom_mayput(char c); | |
117 | ||
118 | extern void prom_printf(const char *fmt, ...); | |
119 | extern void prom_vprintf(const char *fmt, __va_list adx); | |
120 | extern char *prom_sprintf(char *s, const char *fmt, ...); | |
121 | extern char *prom_vsprintf(char *s, const char *fmt, __va_list adx); | |
122 | ||
123 | /* | |
124 | * Standard system nodes | |
125 | */ | |
126 | extern dnode_t prom_aliasnode(void); | |
127 | extern dnode_t prom_chosennode(void); | |
128 | extern dnode_t prom_rootnode(void); | |
129 | ||
130 | /* | |
131 | * Special device nodes | |
132 | */ | |
133 | extern ihandle_t prom_stdin_ihandle(void); | |
134 | extern ihandle_t prom_stdout_ihandle(void); | |
135 | extern ihandle_t prom_memory_ihandle(void); | |
136 | extern ihandle_t prom_mmu_ihandle(void); | |
137 | ||
138 | /* | |
139 | * Test for existance of a specific service or method | |
140 | */ | |
141 | extern int prom_test(char *service); | |
142 | extern int prom_test_method(char *method, dnode_t node); | |
143 | ||
144 | /* | |
145 | * Standard device node properties | |
146 | */ | |
147 | extern int prom_nodename(dnode_t id, char *name); | |
148 | extern int prom_devicetype(dnode_t id, char *type); | |
149 | ||
150 | /* | |
151 | * promif tree search routines | |
152 | */ | |
153 | extern dnode_t prom_findnode_byname(dnode_t node, char *name); | |
154 | extern dnode_t prom_findnode_bydevtype(dnode_t node, char *type); | |
155 | ||
156 | /* | |
157 | * User interface group | |
158 | */ | |
159 | extern void prom_interpret(char *str, uintptr_t arg1, | |
160 | uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, | |
161 | uintptr_t arg5); | |
162 | extern void *prom_set_callback(void *handler); | |
163 | extern void prom_set_symbol_lookup(void *sym2val, void *val2sym); | |
164 | ||
165 | /* | |
166 | * Promif support group | |
167 | */ | |
168 | extern void prom_init(char *progname, void *p1275cif_cookie); | |
169 | extern void prom_panic(char *string); | |
170 | ||
171 | /* | |
172 | * Miscellaneous | |
173 | */ | |
174 | extern uint_t prom_gettime(void); | |
175 | extern char *prom_bootpath(void); | |
176 | extern char *prom_bootargs(void); | |
177 | ||
178 | /* | |
179 | * Utility functions | |
180 | */ | |
181 | extern char *prom_decode_composite_string(void *buf, | |
182 | size_t buflen, char *prev); | |
183 | ||
184 | #ifdef __cplusplus | |
185 | } | |
186 | #endif | |
187 | ||
188 | #endif /* _SYS_PROMIF_H */ |