1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 #ifndef __SPARC_OPENPROM_H 3 #define __SPARC_OPENPROM_H 4 5 /* openprom.h: Prom structures and defines fo 6 * prom routines and data areas. 7 * 8 * Copyright (C) 1995,1996 David S. Miller (da 9 */ 10 11 /* Empirical constants... */ 12 #define LINUX_OPPROM_MAGIC 0x10010407 13 14 #ifndef __ASSEMBLY__ 15 #include <linux/of.h> 16 17 /* V0 prom device operations. */ 18 struct linux_dev_v0_funcs { 19 int (*v0_devopen)(char *device_str); 20 int (*v0_devclose)(int dev_desc); 21 int (*v0_rdblkdev)(int dev_desc, int n 22 int (*v0_wrblkdev)(int dev_desc, int n 23 int (*v0_wrnetdev)(int dev_desc, int n 24 int (*v0_rdnetdev)(int dev_desc, int n 25 int (*v0_rdchardev)(int dev_desc, int 26 int (*v0_wrchardev)(int dev_desc, int 27 int (*v0_seekdev)(int dev_desc, long l 28 }; 29 30 /* V2 and later prom device operations. */ 31 struct linux_dev_v2_funcs { 32 phandle (*v2_inst2pkg)(int d); /* Con 33 char * (*v2_dumb_mem_alloc)(char *va, 34 void (*v2_dumb_mem_free)(char *va, uns 35 36 /* To map devices into virtual I/O spa 37 char * (*v2_dumb_mmap)(char *virta, in 38 void (*v2_dumb_munmap)(char *virta, un 39 40 int (*v2_dev_open)(char *devpath); 41 void (*v2_dev_close)(int d); 42 int (*v2_dev_read)(int d, char *buf, i 43 int (*v2_dev_write)(int d, const char 44 int (*v2_dev_seek)(int d, int hi, int 45 46 /* Never issued (multistage load suppo 47 void (*v2_wheee2)(void); 48 void (*v2_wheee3)(void); 49 }; 50 51 struct linux_mlist_v0 { 52 struct linux_mlist_v0 *theres_more; 53 unsigned int start_adr; 54 unsigned int num_bytes; 55 }; 56 57 struct linux_mem_v0 { 58 struct linux_mlist_v0 **v0_totphys; 59 struct linux_mlist_v0 **v0_prommap; 60 struct linux_mlist_v0 **v0_available; 61 }; 62 63 /* Arguments sent to the kernel from the boot 64 struct linux_arguments_v0 { 65 char *argv[8]; 66 char args[100]; 67 char boot_dev[2]; 68 int boot_dev_ctrl; 69 int boot_dev_unit; 70 int dev_partition; 71 char *kernel_file_name; 72 void *aieee1; /* XXX */ 73 }; 74 75 /* V2 and up boot things. */ 76 struct linux_bootargs_v2 { 77 char **bootpath; 78 char **bootargs; 79 int *fd_stdin; 80 int *fd_stdout; 81 }; 82 83 /* The top level PROM vector. */ 84 struct linux_romvec { 85 /* Version numbers. */ 86 unsigned int pv_magic_cookie; 87 unsigned int pv_romvers; 88 unsigned int pv_plugin_revision; 89 unsigned int pv_printrev; 90 91 /* Version 0 memory descriptors. */ 92 struct linux_mem_v0 pv_v0mem; 93 94 /* Node operations. */ 95 struct linux_nodeops *pv_nodeops; 96 97 char **pv_bootstr; 98 struct linux_dev_v0_funcs pv_v0devops; 99 100 char *pv_stdin; 101 char *pv_stdout; 102 #define PROMDEV_KBD 0 /* inp 103 #define PROMDEV_SCREEN 0 /* out 104 #define PROMDEV_TTYA 1 /* in/ 105 #define PROMDEV_TTYB 2 /* in/ 106 107 /* Blocking getchar/putchar. NOT REEN 108 int (*pv_getchar)(void); 109 void (*pv_putchar)(int ch); 110 111 /* Non-blocking variants. */ 112 int (*pv_nbgetchar)(void); 113 int (*pv_nbputchar)(int ch); 114 115 void (*pv_putstr)(char *str, int len); 116 117 /* Miscellany. */ 118 void (*pv_reboot)(char *bootstr); 119 void (*pv_printf)(__const__ char *fmt, 120 void (*pv_abort)(void); 121 __volatile__ int *pv_ticks; 122 void (*pv_halt)(void); 123 void (**pv_synchook)(void); 124 125 /* Evaluate a forth string, not differ 126 union { 127 void (*v0_eval)(int len, char 128 void (*v2_eval)(char *str); 129 } pv_fortheval; 130 131 struct linux_arguments_v0 **pv_v0boota 132 133 /* Get ether address. */ 134 unsigned int (*pv_enaddr)(int d, char 135 136 struct linux_bootargs_v2 pv_v2bootargs 137 struct linux_dev_v2_funcs pv_v2devops; 138 139 int filler[15]; 140 141 /* This one is sun4c/sun4 only. */ 142 void (*pv_setctxt)(int ctxt, char *va, 143 144 /* Prom version 3 Multiprocessor routi 145 * No joke. Calling these when there i 146 * crashes the machine, have to test t 147 */ 148 149 /* v3_cpustart() will start the cpu 'w 150 * 'thiscontext' executing at address 151 */ 152 int (*v3_cpustart)(unsigned int whichc 153 int thiscontext, ch 154 155 /* v3_cpustop() will cause cpu 'whichc 156 * until a resume cpu call is made. 157 */ 158 int (*v3_cpustop)(unsigned int whichcp 159 160 /* v3_cpuidle() will idle cpu 'whichcp 161 * resume cpu call is made. 162 */ 163 int (*v3_cpuidle)(unsigned int whichcp 164 165 /* v3_cpuresume() will resume processo 166 * starting with whatever 'pc' and 'np 167 * last 'idle' or 'stop' call. 168 */ 169 int (*v3_cpuresume)(unsigned int which 170 }; 171 172 /* Routines for traversing the prom device tre 173 struct linux_nodeops { 174 phandle (*no_nextnode)(phandle node); 175 phandle (*no_child)(phandle node); 176 int (*no_proplen)(phandle node, const 177 int (*no_getprop)(phandle node, const 178 int (*no_setprop)(phandle node, const 179 char * (*no_nextprop)(phandle node, ch 180 }; 181 182 /* More fun PROM structures for device probing 183 #if defined(__sparc__) && defined(__arch64__) 184 #define PROMREG_MAX 24 185 #define PROMVADDR_MAX 16 186 #define PROMINTR_MAX 32 187 #else 188 #define PROMREG_MAX 16 189 #define PROMVADDR_MAX 16 190 #define PROMINTR_MAX 15 191 #endif 192 193 struct linux_prom_registers { 194 unsigned int which_io; /* hi part of 195 unsigned int phys_addr; /* The physica 196 unsigned int reg_size; /* How many by 197 }; 198 199 struct linux_prom64_registers { 200 unsigned long phys_addr; 201 unsigned long reg_size; 202 }; 203 204 struct linux_prom_irqs { 205 int pri; /* IRQ priority */ 206 int vector; /* This is foobar, what do 207 }; 208 209 /* Element of the "ranges" vector */ 210 struct linux_prom_ranges { 211 unsigned int ot_child_space; 212 unsigned int ot_child_base; 213 unsigned int ot_parent_space; 214 unsigned int ot_parent_base; 215 unsigned int or_size; 216 }; 217 218 /* 219 * Ranges and reg properties are a bit differe 220 */ 221 #if defined(__sparc__) && defined(__arch64__) 222 struct linux_prom_pci_registers { 223 unsigned int phys_hi; 224 unsigned int phys_mid; 225 unsigned int phys_lo; 226 227 unsigned int size_hi; 228 unsigned int size_lo; 229 }; 230 #else 231 struct linux_prom_pci_registers { 232 /* 233 * We don't know what information this 234 * We guess, PCI device function is in 235 * So, ... 236 */ 237 unsigned int which_io; /* Let it be w 238 239 unsigned int phys_hi; 240 unsigned int phys_lo; 241 242 unsigned int size_hi; 243 unsigned int size_lo; 244 }; 245 246 #endif 247 248 struct linux_prom_pci_ranges { 249 unsigned int child_phys_hi; /* Onl 250 unsigned int child_phys_mid; 251 unsigned int child_phys_lo; 252 253 unsigned int parent_phys_hi; 254 unsigned int parent_phys_lo; 255 256 unsigned int size_hi; 257 unsigned int size_lo; 258 }; 259 260 struct linux_prom_pci_intmap { 261 unsigned int phys_hi; 262 unsigned int phys_mid; 263 unsigned int phys_lo; 264 265 unsigned int interrupt; 266 267 int cnode; 268 unsigned int cinterrupt; 269 }; 270 271 struct linux_prom_pci_intmask { 272 unsigned int phys_hi; 273 unsigned int phys_mid; 274 unsigned int phys_lo; 275 unsigned int interrupt; 276 }; 277 278 #endif /* !(__ASSEMBLY__) */ 279 280 #endif /* !(__SPARC_OPENPROM_H) */ 281
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.