1 #ifndef __SPARC64_OPENPROM_H
2 #define __SPARC64_OPENPROM_H
4 /* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
7 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
11 /* V0 prom device operations. */
12 struct linux_dev_v0_funcs {
13 int (*v0_devopen)(char *device_str);
14 int (*v0_devclose)(int dev_desc);
15 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
16 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
17 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
18 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
19 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
20 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
21 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
24 /* V2 and later prom device operations. */
25 struct linux_dev_v2_funcs {
26 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
27 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
28 void (*v2_dumb_mem_free)(char *va, unsigned sz);
30 /* To map devices into virtual I/O space. */
31 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
32 void (*v2_dumb_munmap)(char *virta, unsigned size);
34 int (*v2_dev_open)(char *devpath);
35 void (*v2_dev_close)(int d);
36 int (*v2_dev_read)(int d, char *buf, int nbytes);
37 int (*v2_dev_write)(int d, char *buf, int nbytes);
38 int (*v2_dev_seek)(int d, int hi, int lo);
40 /* Never issued (multistage load support) */
41 void (*v2_wheee2)(void);
42 void (*v2_wheee3)(void);
45 struct linux_mlist_v0 {
46 struct linux_mlist_v0 *theres_more;
52 struct linux_mlist_v0 **v0_totphys;
53 struct linux_mlist_v0 **v0_prommap;
54 struct linux_mlist_v0 **v0_available; /* What we can use */
57 /* Arguments sent to the kernel from the boot prompt. */
58 struct linux_arguments_v0 {
65 char *kernel_file_name;
66 void *aieee1; /* XXX */
69 /* V2 and up boot things. */
70 struct linux_bootargs_v2 {
77 /* The top level PROM vector. */
79 /* Version numbers. */
80 unsigned int pv_magic_cookie;
81 unsigned int pv_romvers;
82 unsigned int pv_plugin_revision;
83 unsigned int pv_printrev;
85 /* Version 0 memory descriptors. */
86 struct linux_mem_v0 pv_v0mem;
88 /* Node operations. */
89 struct linux_nodeops *pv_nodeops;
92 struct linux_dev_v0_funcs pv_v0devops;
96 #define PROMDEV_KBD 0 /* input from keyboard */
97 #define PROMDEV_SCREEN 0 /* output to screen */
98 #define PROMDEV_TTYA 1 /* in/out to ttya */
99 #define PROMDEV_TTYB 2 /* in/out to ttyb */
101 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
102 int (*pv_getchar)(void);
103 void (*pv_putchar)(int ch);
105 /* Non-blocking variants. */
106 int (*pv_nbgetchar)(void);
107 int (*pv_nbputchar)(int ch);
109 void (*pv_putstr)(char *str, int len);
112 void (*pv_reboot)(char *bootstr);
113 void (*pv_printf)(__const__ char *fmt, ...);
114 void (*pv_abort)(void);
115 __volatile__ int *pv_ticks;
116 void (*pv_halt)(void);
117 void (**pv_synchook)(void);
119 /* Evaluate a forth string, not different proto for V0 and V2->up. */
121 void (*v0_eval)(int len, char *str);
122 void (*v2_eval)(char *str);
125 struct linux_arguments_v0 **pv_v0bootargs;
127 /* Get ether address. */
128 unsigned int (*pv_enaddr)(int d, char *enaddr);
130 struct linux_bootargs_v2 pv_v2bootargs;
131 struct linux_dev_v2_funcs pv_v2devops;
135 /* This one is sun4c/sun4 only. */
136 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
138 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
139 * No joke. Calling these when there is only one cpu probably
140 * crashes the machine, have to test this. :-)
143 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
144 * 'thiscontext' executing at address 'prog_counter'
146 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
147 int thiscontext, char *prog_counter);
149 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
150 * until a resume cpu call is made.
152 int (*v3_cpustop)(unsigned int whichcpu);
154 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
155 * resume cpu call is made.
157 int (*v3_cpuidle)(unsigned int whichcpu);
159 /* v3_cpuresume() will resume processor 'whichcpu' executing
160 * starting with whatever 'pc' and 'npc' were left at the
161 * last 'idle' or 'stop' call.
163 int (*v3_cpuresume)(unsigned int whichcpu);
166 /* Routines for traversing the prom device tree. */
167 struct linux_nodeops {
168 int (*no_nextnode)(int node);
169 int (*no_child)(int node);
170 int (*no_proplen)(int node, char *name);
171 int (*no_getprop)(int node, char *name, char *val);
172 int (*no_setprop)(int node, char *name, char *val, int len);
173 char * (*no_nextprop)(int node, char *name);
176 /* More fun PROM structures for device probing. */
177 #define PROMREG_MAX 24
178 #define PROMVADDR_MAX 16
179 #define PROMINTR_MAX 32
181 struct linux_prom_registers {
182 unsigned which_io; /* hi part of physical address */
183 unsigned phys_addr; /* The physical address of this register */
184 int reg_size; /* How many bytes does this register take up? */
187 struct linux_prom64_registers {
188 unsigned long phys_addr;
189 unsigned long reg_size;
192 struct linux_prom_irqs {
193 int pri; /* IRQ priority */
194 int vector; /* This is foobar, what does it do? */
197 /* Element of the "ranges" vector */
198 struct linux_prom_ranges {
199 unsigned int ot_child_space;
200 unsigned int ot_child_base; /* Bus feels this */
201 unsigned int ot_parent_space;
202 unsigned int ot_parent_base; /* CPU looks from here */
203 unsigned int or_size;
206 struct linux_prom64_ranges {
207 unsigned long ot_child_base; /* Bus feels this */
208 unsigned long ot_parent_base; /* CPU looks from here */
209 unsigned long or_size;
212 /* Ranges and reg properties are a bit different for PCI. */
213 struct linux_prom_pci_registers {
214 unsigned int phys_hi;
215 unsigned int phys_mid;
216 unsigned int phys_lo;
218 unsigned int size_hi;
219 unsigned int size_lo;
222 struct linux_prom_pci_ranges {
223 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
224 unsigned int child_phys_mid;
225 unsigned int child_phys_lo;
227 unsigned int parent_phys_hi;
228 unsigned int parent_phys_lo;
230 unsigned int size_hi;
231 unsigned int size_lo;
234 struct linux_prom_pci_intmap {
235 unsigned int phys_hi;
236 unsigned int phys_mid;
237 unsigned int phys_lo;
239 unsigned int interrupt;
242 unsigned int cinterrupt;
245 struct linux_prom_pci_intmask {
246 unsigned int phys_hi;
247 unsigned int phys_mid;
248 unsigned int phys_lo;
249 unsigned int interrupt;
252 struct linux_prom_ebus_ranges {
253 unsigned int child_phys_hi;
254 unsigned int child_phys_lo;
256 unsigned int parent_phys_hi;
257 unsigned int parent_phys_mid;
258 unsigned int parent_phys_lo;
263 struct linux_prom_ebus_intmap {
264 unsigned int phys_hi;
265 unsigned int phys_lo;
267 unsigned int interrupt;
270 unsigned int cinterrupt;
273 struct linux_prom_ebus_intmask {
274 unsigned int phys_hi;
275 unsigned int phys_lo;
276 unsigned int interrupt;
278 #endif /* !(__ASSEMBLY__) */
280 #endif /* !(__SPARC64_OPENPROM_H) */