1 #ifndef __SPARC_OPENPROM_H
2 #define __SPARC_OPENPROM_H
4 /* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
11 /* Empirical constants... */
13 #define KADB_DEBUGGER_BEGVM 0x0fee0000 /* There is no kadb yet but...*/
14 #define LINUX_OPPROM_BEGVM 0x0fef0000
15 #define LINUX_OPPROM_ENDVM 0x0ff10000 /* I think this is right - tm */
17 #define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
18 #define LINUX_OPPROM_BEGVM 0xffd00000
19 #define LINUX_OPPROM_ENDVM 0xfff00000
20 #define LINUX_OPPROM_MAGIC 0x10010407
24 /* V0 prom device operations. */
25 struct linux_dev_v0_funcs
{
26 int (*v0_devopen
)(char *device_str
);
27 int (*v0_devclose
)(int dev_desc
);
28 int (*v0_rdblkdev
)(int dev_desc
, int num_blks
, int blk_st
, char *buf
);
29 int (*v0_wrblkdev
)(int dev_desc
, int num_blks
, int blk_st
, char *buf
);
30 int (*v0_wrnetdev
)(int dev_desc
, int num_bytes
, char *buf
);
31 int (*v0_rdnetdev
)(int dev_desc
, int num_bytes
, char *buf
);
32 int (*v0_rdchardev
)(int dev_desc
, int num_bytes
, int dummy
, char *buf
);
33 int (*v0_wrchardev
)(int dev_desc
, int num_bytes
, int dummy
, char *buf
);
34 int (*v0_seekdev
)(int dev_desc
, long logical_offst
, int from
);
37 /* V2 and later prom device operations. */
38 struct linux_dev_v2_funcs
{
39 int (*v2_inst2pkg
)(int d
); /* Convert ihandle to phandle */
40 char * (*v2_dumb_mem_alloc
)(char *va
, unsigned sz
);
41 void (*v2_dumb_mem_free
)(char *va
, unsigned sz
);
43 /* To map devices into virtual I/O space. */
44 char * (*v2_dumb_mmap
)(char *virta
, int which_io
, unsigned paddr
, unsigned sz
);
45 void (*v2_dumb_munmap
)(char *virta
, unsigned size
);
47 int (*v2_dev_open
)(char *devpath
);
48 void (*v2_dev_close
)(int d
);
49 int (*v2_dev_read
)(int d
, char *buf
, int nbytes
);
50 int (*v2_dev_write
)(int d
, char *buf
, int nbytes
);
51 int (*v2_dev_seek
)(int d
, int hi
, int lo
);
53 /* Never issued (multistage load support) */
54 void (*v2_wheee2
)(void);
55 void (*v2_wheee3
)(void);
58 struct linux_mlist_v0
{
59 struct linux_mlist_v0
*theres_more
;
65 struct linux_mlist_v0
**v0_totphys
;
66 struct linux_mlist_v0
**v0_prommap
;
67 struct linux_mlist_v0
**v0_available
; /* What we can use */
70 /* Arguments sent to the kernel from the boot prompt. */
71 struct linux_arguments_v0
{
78 char *kernel_file_name
;
79 void *aieee1
; /* XXX */
82 /* V2 and up boot things. */
83 struct linux_bootargs_v2
{
90 #if defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
93 int (*pv_startmon
)(void);
97 struct linux_arguments_v0
**pv_v0bootargs
;
100 unsigned char (*pv_getchar
)(void);
101 int (*pv_putchar
)(int ch
);
102 int (*pv_nbgetchar
)(void);
103 int (*pv_nbputchar
)(int ch
);
104 unsigned char *pv_echo
;
105 unsigned char *pv_insource
;
106 unsigned char *pv_outsink
;
108 int (*pv_getkey
)(void);
109 int (*pv_initgetkey
)(void);
110 unsigned int *pv_translation
;
111 unsigned char *pv_keybid
;
114 struct keybuf
*pv_keybuf
;
119 * Frame buffer output and terminal emulation
122 int (*pv_fbwritechar
)(char);
125 int (*pv_fbwritestr
)(char);
127 void (*pv_reboot
)(char *bootstr
);
130 * Line input and parsing
133 unsigned char *pv_linebuf
;
134 unsigned char **pv_lineptr
;
136 int (*pv_getline
)(void);
137 unsigned char (*pv_getnextchar
)(void);
138 unsigned char (*pv_peeknextchar
)(void);
140 int (*pv_getnum
)(void);
142 void (*pv_printf
)(const char *fmt
, ...);
143 int (*pv_printhex
)(void);
145 unsigned char *pv_leds
;
146 int (*pv_setleds
)(void);
149 * Non-maskable interrupt (nmi) information
152 int (*pv_nmiaddr
)(void);
153 int (*pv_abortentry
)(void);
159 * Assorted other things
163 struct globram
*pv_globram
;
167 unsigned char *pv_keyrtick
;
168 unsigned *pv_memoryavail
;
172 void (*pv_halt
)(void);
173 unsigned char *pv_memorybitmap
;
176 void (*pv_setctxt
)(int ctxt
, char *va
, int pmeg
);
177 void (*pv_vector_cmd
)(void);
185 /* The top level PROM vector. */
186 struct linux_romvec
{
187 /* Version numbers. */
188 unsigned int pv_magic_cookie
;
189 unsigned int pv_romvers
;
190 unsigned int pv_plugin_revision
;
191 unsigned int pv_printrev
;
193 /* Version 0 memory descriptors. */
194 struct linux_mem_v0 pv_v0mem
;
196 /* Node operations. */
197 struct linux_nodeops
*pv_nodeops
;
200 struct linux_dev_v0_funcs pv_v0devops
;
204 #define PROMDEV_KBD 0 /* input from keyboard */
205 #define PROMDEV_SCREEN 0 /* output to screen */
206 #define PROMDEV_TTYA 1 /* in/out to ttya */
207 #define PROMDEV_TTYB 2 /* in/out to ttyb */
209 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
210 int (*pv_getchar
)(void);
211 void (*pv_putchar
)(int ch
);
213 /* Non-blocking variants. */
214 int (*pv_nbgetchar
)(void);
215 int (*pv_nbputchar
)(int ch
);
217 void (*pv_putstr
)(char *str
, int len
);
220 void (*pv_reboot
)(char *bootstr
);
221 void (*pv_printf
)(__const__
char *fmt
, ...);
222 void (*pv_abort
)(void);
223 __volatile__
int *pv_ticks
;
224 void (*pv_halt
)(void);
225 void (**pv_synchook
)(void);
227 /* Evaluate a forth string, not different proto for V0 and V2->up. */
229 void (*v0_eval
)(int len
, char *str
);
230 void (*v2_eval
)(char *str
);
233 struct linux_arguments_v0
**pv_v0bootargs
;
235 /* Get ether address. */
236 unsigned int (*pv_enaddr
)(int d
, char *enaddr
);
238 struct linux_bootargs_v2 pv_v2bootargs
;
239 struct linux_dev_v2_funcs pv_v2devops
;
243 /* This one is sun4c/sun4 only. */
244 void (*pv_setctxt
)(int ctxt
, char *va
, int pmeg
);
246 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
247 * No joke. Calling these when there is only one cpu probably
248 * crashes the machine, have to test this. :-)
251 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
252 * 'thiscontext' executing at address 'prog_counter'
254 int (*v3_cpustart
)(unsigned int whichcpu
, int ctxtbl_ptr
,
255 int thiscontext
, char *prog_counter
);
257 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
258 * until a resume cpu call is made.
260 int (*v3_cpustop
)(unsigned int whichcpu
);
262 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
263 * resume cpu call is made.
265 int (*v3_cpuidle
)(unsigned int whichcpu
);
267 /* v3_cpuresume() will resume processor 'whichcpu' executing
268 * starting with whatever 'pc' and 'npc' were left at the
269 * last 'idle' or 'stop' call.
271 int (*v3_cpuresume
)(unsigned int whichcpu
);
275 /* Routines for traversing the prom device tree. */
276 struct linux_nodeops
{
277 int (*no_nextnode
)(int node
);
278 int (*no_child
)(int node
);
279 int (*no_proplen
)(int node
, char *name
);
280 int (*no_getprop
)(int node
, char *name
, char *val
);
281 int (*no_setprop
)(int node
, char *name
, char *val
, int len
);
282 char * (*no_nextprop
)(int node
, char *name
);
285 /* More fun PROM structures for device probing. */
286 #define PROMREG_MAX 16
287 #define PROMVADDR_MAX 16
288 #define PROMINTR_MAX 15
290 struct linux_prom_registers
{
291 int which_io
; /* is this in OBIO space? */
292 char *phys_addr
; /* The physical address of this register */
293 int reg_size
; /* How many bytes does this register take up? */
296 struct linux_prom_irqs
{
297 int pri
; /* IRQ priority */
298 int vector
; /* This is foobar, what does it do? */
301 /* Element of the "ranges" vector */
302 struct linux_prom_ranges
{
303 unsigned int ot_child_space
;
304 unsigned int ot_child_base
; /* Bus feels this */
305 unsigned int ot_parent_space
;
306 unsigned int ot_parent_base
; /* CPU looks from here */
307 unsigned int or_size
;
310 #endif /* !(__ASSEMBLY__) */
312 #endif /* !(__SPARC_OPENPROM_H) */