1 /* $Id: openprom.h,v 1.19 1996/09/25 03:51:08 davem Exp $ */
2 #ifndef __SPARC_OPENPROM_H
3 #define __SPARC_OPENPROM_H
4
5 /* openprom.h: Prom structures and defines for access to the OPENBOOT
6 * prom routines and data areas.
7 *
8 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
9 */
10
11 #include <linux/config.h>
12
13 /* Empirical constants... */
14 #ifdef CONFIG_SUN3
15 #define KADB_DEBUGGER_BEGVM 0x0fee0000 /* There is no kadb yet but...*/
16 #define LINUX_OPPROM_BEGVM 0x0fef0000
17 #define LINUX_OPPROM_ENDVM 0x0ff10000 /* I think this is right - tm */
18 #else
19 #define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
20 #define LINUX_OPPROM_BEGVM 0xffd00000
21 #define LINUX_OPPROM_ENDVM 0xfff00000
22 #define LINUX_OPPROM_MAGIC 0x10010407
23 #endif
24
25 #ifndef __ASSEMBLY__
26 /* V0 prom device operations. */
27 struct linux_dev_v0_funcs {
28 int (*v0_devopen)(char *device_str);
29 int (*v0_devclose)(int dev_desc);
30 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
31 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
32 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
33 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
34 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
35 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
36 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
37 };
38
39 /* V2 and later prom device operations. */
40 struct linux_dev_v2_funcs {
41 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
42 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
43 void (*v2_dumb_mem_free)(char *va, unsigned sz);
44
45 /* To map devices into virtual I/O space. */
46 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
47 void (*v2_dumb_munmap)(char *virta, unsigned size);
48
49 int (*v2_dev_open)(char *devpath);
50 void (*v2_dev_close)(int d);
51 int (*v2_dev_read)(int d, char *buf, int nbytes);
52 int (*v2_dev_write)(int d, char *buf, int nbytes);
53 int (*v2_dev_seek)(int d, int hi, int lo);
54
55 /* Never issued (multistage load support) */
56 void (*v2_wheee2)(void);
57 void (*v2_wheee3)(void);
58 };
59
60 struct linux_mlist_v0 {
61 struct linux_mlist_v0 *theres_more;
62 char *start_adr;
63 unsigned num_bytes;
64 };
65
66 struct linux_mem_v0 {
67 struct linux_mlist_v0 **v0_totphys;
68 struct linux_mlist_v0 **v0_prommap;
69 struct linux_mlist_v0 **v0_available; /* What we can use */
70 };
71
72 /* Arguments sent to the kernel from the boot prompt. */
73 struct linux_arguments_v0 {
74 char *argv[8];
75 char args[100];
76 char boot_dev[2];
77 int boot_dev_ctrl;
78 int boot_dev_unit;
79 int dev_partition;
80 char *kernel_file_name;
81 void *aieee1; /* XXX */
82 };
83
84 /* V2 and up boot things. */
85 struct linux_bootargs_v2 {
86 char **bootpath;
87 char **bootargs;
88 int *fd_stdin;
89 int *fd_stdout;
90 };
91
92 #ifdef CONFIG_SUN3
93 struct linux_romvec {
94 char *pv_initsp;
95 int (*pv_startmon)(void);
96
97 int *diagberr;
98
99 struct linux_arguments_v0 **pv_v0bootargs;
100 unsigned *pv_sun3mem;
101
102 unsigned char (*pv_getchar)(void);
103 int (*pv_putchar)(int ch);
104 int (*pv_nbgetchar)(void);
105 int (*pv_nbputchar)(int ch);
106 unsigned char *pv_echo;
107 unsigned char *pv_insource;
108 unsigned char *pv_outsink;
109
110 int (*pv_getkey)(void);
111 int (*pv_initgetkey)(void);
112 unsigned int *pv_translation;
113 unsigned char *pv_keybid;
114 int *pv_screen_x;
115 int *pv_screen_y;
116 struct keybuf *pv_keybuf;
117
118 char *pv_monid;
119
120 /*
121 * Frame buffer output and terminal emulation
122 */
123
124 int (*pv_fbwritechar)(char);
125 int *pv_fbaddr;
126 char **pv_font;
127 int (*pv_fbwritestr)(char);
128
129 void (*pv_reboot)(char *bootstr);
130
131 /*
132 * Line input and parsing
133 */
134
135 unsigned char *pv_linebuf;
136 unsigned char **pv_lineptr;
137 int *pv_linesize;
138 int (*pv_getline)(void);
139 unsigned char (*pv_getnextchar)(void);
140 unsigned char (*pv_peeknextchar)(void);
141 int *pv_fbthere;
142 int (*pv_getnum)(void);
143
144 void (*pv_printf)(const char *fmt, ...);
145 int (*pv_printhex)(void);
146
147 unsigned char *pv_leds;
148 int (*pv_setleds)(void);
149
150 /*
151 * Non-maskable interrupt (nmi) information
152 */
153
154 int (*pv_nmiaddr)(void);
155 int (*pv_abortentry)(void);
156 int *pv_nmiclock;
157
158 int *pv_fbtype;
159
160 /*
161 * Assorted other things
162 */
163
164 unsigned pv_romvers;
165 struct globram *pv_globram;
166 char *pv_kbdzscc;
167
168 int *pv_keyrinit;
169 unsigned char *pv_keyrtick;
170 unsigned *pv_memoryavail;
171 long *pv_resetaddr;
172 long *pv_resetmap;
173
174 void (*pv_halt)(void);
175 unsigned char *pv_memorybitmap;
176 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
177 void (*pv_vector_cmd)(void);
178 int dummy1z;
179 int dummy2z;
180 int dummy3z;
181 int dummy4z;
182 };
183 #else
184 /* The top level PROM vector. */
185 struct linux_romvec {
186 /* Version numbers. */
187 unsigned int pv_magic_cookie;
188 unsigned int pv_romvers;
189 unsigned int pv_plugin_revision;
190 unsigned int pv_printrev;
191
192 /* Version 0 memory descriptors. */
193 struct linux_mem_v0 pv_v0mem;
194
195 /* Node operations. */
196 struct linux_nodeops *pv_nodeops;
197
198 char **pv_bootstr;
199 struct linux_dev_v0_funcs pv_v0devops;
200
201 char *pv_stdin;
202 char *pv_stdout;
203 #define PROMDEV_KBD 0 /* input from keyboard */
204 #define PROMDEV_SCREEN 0 /* output to screen */
205 #define PROMDEV_TTYA 1 /* in/out to ttya */
206 #define PROMDEV_TTYB 2 /* in/out to ttyb */
207
208 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
209 int (*pv_getchar)(void);
210 void (*pv_putchar)(int ch);
211
212 /* Non-blocking variants. */
213 int (*pv_nbgetchar)(void);
214 int (*pv_nbputchar)(int ch);
215
216 void (*pv_putstr)(char *str, int len);
217
218 /* Miscellany. */
219 void (*pv_reboot)(char *bootstr);
220 void (*pv_printf)(__const__ char *fmt, ...);
221 void (*pv_abort)(void);
222 __volatile__ int *pv_ticks;
223 void (*pv_halt)(void);
224 void (**pv_synchook)(void);
225
226 /* Evaluate a forth string, not different proto for V0 and V2->up. */
227 union {
228 void (*v0_eval)(int len, char *str);
229 void (*v2_eval)(char *str);
230 } pv_fortheval;
231
232 struct linux_arguments_v0 **pv_v0bootargs;
233
234 /* Get ether address. */
235 unsigned int (*pv_enaddr)(int d, char *enaddr);
236
237 struct linux_bootargs_v2 pv_v2bootargs;
238 struct linux_dev_v2_funcs pv_v2devops;
239
240 int filler[15];
241
242 /* This one is sun4c/sun4 only. */
243 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
244
245 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
246 * No joke. Calling these when there is only one cpu probably
247 * crashes the machine, have to test this. :-)
248 */
249
250 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
251 * 'thiscontext' executing at address 'prog_counter'
252 */
253 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
254 int thiscontext, char *prog_counter);
255
256 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
257 * until a resume cpu call is made.
258 */
259 int (*v3_cpustop)(unsigned int whichcpu);
260
261 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
262 * resume cpu call is made.
263 */
264 int (*v3_cpuidle)(unsigned int whichcpu);
265
266 /* v3_cpuresume() will resume processor 'whichcpu' executing
267 * starting with whatever 'pc' and 'npc' were left at the
268 * last 'idle' or 'stop' call.
269 */
270 int (*v3_cpuresume)(unsigned int whichcpu);
271 };
272 #endif
273
274 /* Routines for traversing the prom device tree. */
275 struct linux_nodeops {
276 int (*no_nextnode)(int node);
277 int (*no_child)(int node);
278 int (*no_proplen)(int node, char *name);
279 int (*no_getprop)(int node, char *name, char *val);
280 int (*no_setprop)(int node, char *name, char *val, int len);
281 char * (*no_nextprop)(int node, char *name);
282 };
283
284 /* More fun PROM structures for device probing. */
285 #define PROMREG_MAX 16
286 #define PROMVADDR_MAX 16
287 #define PROMINTR_MAX 15
288
289 struct linux_prom_registers {
290 int which_io; /* is this in OBIO space? */
291 char *phys_addr; /* The physical address of this register */
292 int reg_size; /* How many bytes does this register take up? */
293 };
294
295 struct linux_prom_irqs {
296 int pri; /* IRQ priority */
297 int vector; /* This is foobar, what does it do? */
298 };
299
300 /* Element of the "ranges" vector */
301 struct linux_prom_ranges {
302 unsigned int ot_child_space;
303 unsigned int ot_child_base; /* Bus feels this */
304 unsigned int ot_parent_space;
305 unsigned int ot_parent_base; /* CPU looks from here */
306 unsigned int or_size;
307 };
308
309 #endif /* !(__ASSEMBLY__) */
310
311 #endif /* !(__SPARC_OPENPROM_H) */
312
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.