dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / arch / x86 / include / sys / promif.h
blobee7e138f1eb7299b27a8724448d74ac6af4a6e40
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_PROMIF_H
27 #define _SYS_PROMIF_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/types.h>
32 #include <sys/obpdefs.h>
34 #if defined(_KERNEL) || defined(_KMDB)
35 #include <sys/va_list.h>
36 #endif
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
43 * These are for V0 ops only. We sometimes have to specify
44 * to promif which type of operation we need to perform
45 * and since we can't get such a property from a V0 prom, we
46 * sometimes just assume it. V2 and later proms do the right thing.
48 #define BLOCK 0
49 #define NETWORK 1
50 #define BYTE 2
52 #if defined(_KERNEL) || defined(_KMDB)
54 extern caddr_t prom_map(caddr_t virthint, uint_t space,
55 uint_t phys, uint_t size);
58 * resource allocation group: OBP and IEEE 1275-1994.
59 * prom_alloc is platform dependent on SPARC.
61 extern caddr_t prom_alloc(caddr_t virthint, uint_t size, int align);
62 extern void prom_free(caddr_t virt, uint_t size);
65 * Device tree and property group: OBP and IEEE 1275-1994.
67 extern pnode_t prom_childnode(pnode_t nodeid);
68 extern pnode_t prom_nextnode(pnode_t nodeid);
69 extern pnode_t prom_optionsnode(void);
70 extern pnode_t prom_alias_node(void);
71 extern pnode_t prom_rootnode(void);
73 extern int prom_getproplen(pnode_t nodeid, caddr_t name);
74 extern int prom_getprop(pnode_t nodeid, caddr_t name,
75 caddr_t value);
76 extern caddr_t prom_nextprop(pnode_t nodeid, caddr_t previous,
77 caddr_t next);
79 extern char *prom_decode_composite_string(void *buf,
80 size_t buflen, char *prev);
83 * Device tree and property group: IEEE 1275-1994 Only.
85 extern pnode_t prom_finddevice(char *path);
87 extern int prom_bounded_getprop(pnode_t nodeid,
88 caddr_t name, caddr_t buffer, int buflen);
91 * Device pathnames and pathname conversion: OBP and IEEE 1275-1994.
93 extern int prom_devname_from_pathname(char *path, char *buffer);
94 extern char *prom_path_gettoken(char *from, char *to);
97 * Device pathnames and pathname conversion: IEEE 1275-1994 only.
101 * Special device nodes: OBP and IEEE 1275-1994.
103 extern int prom_stdin_is_keyboard(void);
104 extern int prom_stdout_is_framebuffer(void);
105 extern void prom_framebuffer_getpos(int *row, int *col);
106 extern void prom_framebuffer_getcolors(int *fg, int *bg);
107 extern char *prom_stdinpath(void);
108 extern char *prom_stdoutpath(void);
109 extern void prom_strip_options(char *from, char *to);
110 extern void prom_pathname(char *);
113 * Special device nodes: IEEE 1275-1994 only.
117 * Administrative group: OBP and IEEE 1275-1994.
119 extern void prom_enter_mon(void);
120 extern void prom_exit_to_mon(void)
121 __NORETURN;
122 extern void prom_reboot(char *bootstr)
123 __NORETURN;
124 extern void prom_panic(char *string)
125 __NORETURN;
127 extern int prom_is_openprom(void);
128 extern int prom_is_p1275(void);
129 extern int prom_version_name(char *buf, int buflen);
130 extern int prom_version_boot_syscalls(void);
132 extern uint_t prom_gettime(void);
134 extern char *prom_bootpath(void);
135 extern char *prom_bootargs(void);
138 * Administrative group: OBP only.
142 * Administrative group: IEEE 1275-1994 only.
146 * Administrative group: IEEE 1275 only.
150 * Promif support group: Generic.
152 extern void prom_init(char *progname, void *prom_cookie);
154 typedef uint_t prom_generation_cookie_t;
156 #define prom_tree_access(CALLBACK, ARG, GENP) (CALLBACK)((ARG), 0)
159 * I/O Group: OBP and IEEE 1275.
161 extern uchar_t prom_getchar(void);
162 extern void prom_putchar(char c);
163 extern int prom_mayget(void);
164 extern int prom_mayput(char c);
166 extern int prom_open(char *name);
167 extern int prom_close(int fd);
168 extern int prom_read(int fd, caddr_t buf, uint_t len,
169 uint_t startblk, char type);
170 extern int prom_write(int fd, caddr_t buf, uint_t len,
171 uint_t startblk, char devtype);
172 extern int prom_seek(int fd, unsigned long long offset);
174 extern void prom_writestr(const char *buf, size_t bufsize);
176 /*PRINTFLIKE1*/
177 extern void prom_printf(const char *fmt, ...)
178 __PRINTFLIKE(1);
179 #pragma rarely_called(prom_printf)
180 extern void prom_vprintf(const char *fmt, __va_list adx)
181 __VPRINTFLIKE(1);
182 #pragma rarely_called(prom_vprintf)
184 /*PRINTFLIKE2*/
185 extern char *prom_sprintf(char *s, const char *fmt, ...)
186 __PRINTFLIKE(2);
187 extern char *prom_vsprintf(char *s, const char *fmt, __va_list adx)
188 __VPRINTFLIKE(2);
191 * promif tree searching routines ... OBP and IEEE 1275-1994.
194 extern pnode_t prom_findnode_byname(pnode_t id, char *name);
195 extern char *prom_get_extend_name(void);
197 extern int prom_devreset(int);
198 extern int OpenCount;
199 extern struct ihandle *open_devices[];
201 #define PROM_STOP { \
202 prom_printf("File %s line %d\n", __FILE__, __LINE__); \
203 prom_enter_mon(); \
206 #endif /* _KERNEL || _KMDB */
208 #ifdef _KERNEL
211 * Used by wrappers which bring up console frame buffer before prom_printf()
212 * and other prom calls that may output to the console. Struct is filled in
213 * in prom_env.c and in sunpm.c
216 typedef struct promif_owrap {
217 void (*preout)(void);
218 void (*postout)(void);
219 } promif_owrap_t;
221 extern void prom_suspend_prepost(void);
222 extern void prom_resume_prepost(void);
225 * WAN boot key storage interface
227 int prom_set_security_key(char *keyname, caddr_t buf, int buflen, int *reslen,
228 int *status);
229 int prom_get_security_key(char *keyname, caddr_t buf, int buflen, int *keylen,
230 int *status);
232 #endif /* _KERNEL */
233 #ifdef __cplusplus
235 #endif
237 #endif /* _SYS_PROMIF_H */