]> git.ozlabs.org Git - yaboot.git/blob - include/prom.h
b217be408c90fd861411020cd97c23260d6979b3
[yaboot.git] / include / prom.h
1 /*
2     Definitions for talking to the Open Firmware PROM on
3     Power Macintosh computers.
4
5     Copyright (C) 1999 Marius Vollmer
6     Copyright (C) 1996 Paul Mackerras.
7
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 */
22
23 #ifndef PROM_H
24 #define PROM_H
25
26 #include "stdarg.h"
27
28 typedef void *prom_handle;
29 typedef void *ihandle;
30 typedef void *phandle;
31
32 #define PROM_INVALID_HANDLE     ((prom_handle)-1UL)
33
34 struct prom_args;
35 typedef int (*prom_entry)(struct prom_args *);
36
37 extern void prom_init (prom_entry pe);
38
39 extern prom_entry prom;
40
41 /* I/O */
42
43 extern prom_handle prom_stdin;
44 extern prom_handle prom_stdout;
45
46 prom_handle prom_open (char *spec);
47 int prom_read (prom_handle file, void *buf, int len);
48 int prom_write (prom_handle file, void *buf, int len);
49 int prom_seek (prom_handle file, int pos);
50 int prom_lseek (prom_handle file, unsigned long long pos);
51 int prom_readblocks (prom_handle file, int blockNum, int blockCount, void *buffer);
52 void prom_close (prom_handle file);
53 int prom_getblksize (prom_handle file);
54 int prom_loadmethod (prom_handle device, void* addr);
55
56 #define K_UP    0x141
57 #define K_DOWN  0x142
58 #define K_LEFT  0x144
59 #define K_RIGHT 0x143
60
61 int prom_getchar ();
62 void prom_putchar (char);
63 int prom_nbgetchar();
64
65 void prom_vprintf (char *fmt, va_list ap);
66 void prom_fprintf (prom_handle dev, char *fmt, ...);
67 void prom_printf (char *fmt, ...);
68 void prom_readline (char *prompt, char *line, int len);
69 int prom_set_color(prom_handle device, int color, int r, int g, int b);
70
71 /* memory */
72
73 void *prom_claim (void *virt, unsigned int size, unsigned int align);
74 void prom_release(void *virt, unsigned int size);
75 void prom_map (void *phys, void *virt, int size);
76
77 /* packages and device nodes */
78
79 prom_handle prom_finddevice (char *name);
80 prom_handle prom_findpackage (char *path);
81 int prom_getprop (prom_handle dev, char *name, void *buf, int len);
82
83 /* misc */
84
85 char *prom_getargs ();
86 void prom_setargs (char *args);
87
88 void prom_exit ();
89 void prom_abort (char *fmt, ...);
90
91 int prom_interpret (char *forth);
92
93 int prom_get_chosen (char *name, void *mem, int len);
94 int prom_get_options (char *name, void *mem, int len);
95
96 extern int prom_getms(void);
97 extern void prom_pause(void);
98
99 extern void *call_prom (const char *service, int nargs, int nret, ...);
100 extern void *call_prom_return (const char *service, int nargs, int nret, ...);
101
102 #endif