Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / tools / promif / include / sys / promif.h
CommitLineData
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
55extern "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 */
65extern dnode_t prom_childnode(dnode_t nodeid);
66extern dnode_t prom_nextnode(dnode_t nodeid);
67extern dnode_t prom_parentnode(dnode_t nodeid);
68
69extern int prom_getproplen(dnode_t nodeid, caddr_t name);
70extern int prom_getprop(dnode_t nodeid, caddr_t name,
71 caddr_t buf);
72extern int prom_bounded_getprop(dnode_t nodeid, caddr_t name,
73 caddr_t buf, int buflen);
74extern int prom_nextprop(dnode_t nodeid, caddr_t previous,
75 caddr_t next);
76extern int prom_setprop(dnode_t nodeid, caddr_t name,
77 caddr_t buf, int buflen);
78
79extern phandle_t prom_getphandle(ihandle_t instance);
80extern int prom_pathname(char *pathname);
81extern dnode_t prom_finddevice(char *path);
82
83extern int prom_ihandle_to_path(ihandle_t instance, char *buf,
84 uint_t buflen);
85extern int prom_phandle_to_path(phandle_t package, char *buf,
86 uint_t buflen);
87
88/*
89 * Device I/O group
90 */
91extern ihandle_t prom_open(char *name);
92extern int prom_close(ihandle_t fd);
93extern uint32_t prom_read(ihandle_t fd, caddr_t buf, uint32_t len);
94extern uint32_t prom_write(ihandle_t fd, caddr_t buf, uint32_t len);
95extern int prom_seek(ihandle_t fd, u_longlong_t offset);
96
97/*
98 * Control transfer group
99 */
100extern void prom_enter_mon(void);
101extern void prom_exit_to_mon(void);
102extern void prom_reboot(char *bootstr);
103
104/*
105 * Resource allocation group
106 */
107extern caddr_t prom_malloc(caddr_t virt, size_t size, uint_t align);
108extern void prom_free(caddr_t virt, size_t size);
109
110/*
111 * Console I/O group
112 */
113extern uchar_t prom_getchar(void);
114extern void prom_putchar(char c);
115extern int prom_mayget(void);
116extern int prom_mayput(char c);
117
118extern void prom_printf(const char *fmt, ...);
119extern void prom_vprintf(const char *fmt, __va_list adx);
120extern char *prom_sprintf(char *s, const char *fmt, ...);
121extern char *prom_vsprintf(char *s, const char *fmt, __va_list adx);
122
123/*
124 * Standard system nodes
125 */
126extern dnode_t prom_aliasnode(void);
127extern dnode_t prom_chosennode(void);
128extern dnode_t prom_rootnode(void);
129
130/*
131 * Special device nodes
132 */
133extern ihandle_t prom_stdin_ihandle(void);
134extern ihandle_t prom_stdout_ihandle(void);
135extern ihandle_t prom_memory_ihandle(void);
136extern ihandle_t prom_mmu_ihandle(void);
137
138/*
139 * Test for existance of a specific service or method
140 */
141extern int prom_test(char *service);
142extern int prom_test_method(char *method, dnode_t node);
143
144/*
145 * Standard device node properties
146 */
147extern int prom_nodename(dnode_t id, char *name);
148extern int prom_devicetype(dnode_t id, char *type);
149
150/*
151 * promif tree search routines
152 */
153extern dnode_t prom_findnode_byname(dnode_t node, char *name);
154extern dnode_t prom_findnode_bydevtype(dnode_t node, char *type);
155
156/*
157 * User interface group
158 */
159extern void prom_interpret(char *str, uintptr_t arg1,
160 uintptr_t arg2, uintptr_t arg3, uintptr_t arg4,
161 uintptr_t arg5);
162extern void *prom_set_callback(void *handler);
163extern void prom_set_symbol_lookup(void *sym2val, void *val2sym);
164
165/*
166 * Promif support group
167 */
168extern void prom_init(char *progname, void *p1275cif_cookie);
169extern void prom_panic(char *string);
170
171/*
172 * Miscellaneous
173 */
174extern uint_t prom_gettime(void);
175extern char *prom_bootpath(void);
176extern char *prom_bootargs(void);
177
178/*
179 * Utility functions
180 */
181extern 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 */