1 /* 2 * DECstation PROM interface. 3 * 4 * Copyright (C) 2002 Maciej W. Rozycki 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 9 * 2 of the License, or (at your option) any later version. 10 * 11 * Based on arch/mips/dec/prom/prom.h by the Anonymous. 12 */ 13 #ifndef __ASM_DEC_PROM_H 14 #define __ASM_DEC_PROM_H 15 16 #include <linux/types.h> 17 18 #include <asm/addrspace.h> 19 20 /* 21 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's. 22 * Many of these will work for MIPSen as well! 23 */ 24 #define VEC_RESET (u64 *)KSEG1ADDR(0x1fc00000) 25 /* Prom base address */ 26 27 #define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */ 28 29 #define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */ 30 #define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */ 31 #define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6) 32 #define PMAX_PROM_READ PMAX_PROM_ENTRY(7) 33 #define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10) 34 #define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11) 35 #define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12) 36 #define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */ 37 #define PMAX_PROM_GETS PMAX_PROM_ENTRY(15) 38 #define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17) 39 #define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */ 40 41 42 /* 43 * Magic number indicating REX PROM available on DECstation. Found in 44 * register a2 on transfer of control to program from PROM. 45 */ 46 #define REX_PROM_MAGIC 0x30464354 47 48 #ifdef CONFIG_MIPS64 49 50 #define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ 51 52 #else /* !CONFIG_MIPS64 */ 53 54 #define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) 55 56 #endif /* !CONFIG_MIPS64 */ 57 58 59 /* 60 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and 61 * DS5000/2x0. 62 */ 63 #define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */ 64 #define REX_PROM_GETCHAR 0x24/4 /* getch() */ 65 #define REX_PROM_GETENV 0x64/4 /* get env. variable */ 66 #define REX_PROM_GETSYSID 0x80/4 /* get system id */ 67 #define REX_PROM_GETTCINFO 0xa4/4 68 #define REX_PROM_PRINTF 0x30/4 /* printf() */ 69 #define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */ 70 #define REX_PROM_BOOTINIT 0x54/4 /* open() */ 71 #define REX_PROM_BOOTREAD 0x58/4 /* read() */ 72 #define REX_PROM_CLEARCACHE 0x7c/4 73 74 75 /* 76 * Used by rex_getbitmap(). 77 */ 78 typedef struct { 79 int pagesize; 80 unsigned char bitmap[0]; 81 } memmap; 82 83 84 /* 85 * Function pointers as read from a PROM's callback vector. 86 */ 87 extern int (*__rex_bootinit)(void); 88 extern int (*__rex_bootread)(void); 89 extern int (*__rex_getbitmap)(memmap *); 90 extern unsigned long *(*__rex_slot_address)(int); 91 extern void *(*__rex_gettcinfo)(void); 92 extern int (*__rex_getsysid)(void); 93 extern void (*__rex_clear_cache)(void); 94 95 extern int (*__prom_getchar)(void); 96 extern char *(*__prom_getenv)(char *); 97 extern int (*__prom_printf)(char *, ...); 98 99 extern int (*__pmax_open)(char*, int); 100 extern int (*__pmax_lseek)(int, long, int); 101 extern int (*__pmax_read)(int, void *, int); 102 extern int (*__pmax_close)(int); 103 104 105 #ifdef CONFIG_MIPS64 106 107 /* 108 * On MIPS64 we have to call PROM functions via a helper 109 * dispatcher to accomodate ABI incompatibilities. 110 */ 111 #define __DEC_PROM_O32 __attribute__((alias("call_o32"))) 112 113 int _rex_bootinit(int (*)(void)) __DEC_PROM_O32; 114 int _rex_bootread(int (*)(void)) __DEC_PROM_O32; 115 int _rex_getbitmap(int (*)(memmap *), memmap *) __DEC_PROM_O32; 116 unsigned long *_rex_slot_address(unsigned long *(*)(int), int) __DEC_PROM_O32; 117 void *_rex_gettcinfo(void *(*)(void)) __DEC_PROM_O32; 118 int _rex_getsysid(int (*)(void)) __DEC_PROM_O32; 119 void _rex_clear_cache(void (*)(void)) __DEC_PROM_O32; 120 121 int _prom_getchar(int (*)(void)) __DEC_PROM_O32; 122 char *_prom_getenv(char *(*)(char *), char *) __DEC_PROM_O32; 123 int _prom_printf(int (*)(char *, ...), char *, ...) __DEC_PROM_O32; 124 125 126 #define rex_bootinit() _rex_bootinit(__rex_bootinit) 127 #define rex_bootread() _rex_bootread(__rex_bootread) 128 #define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x) 129 #define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x) 130 #define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo) 131 #define rex_getsysid() _rex_getsysid(__rex_getsysid) 132 #define rex_clear_cache() _rex_clear_cache(__rex_clear_cache) 133 134 #define prom_getchar() _prom_getchar(__prom_getchar) 135 #define prom_getenv(x) _prom_getenv(__prom_getenv, x) 136 #define prom_printf(x...) _prom_printf(__prom_printf, x) 137 138 #else /* !CONFIG_MIPS64 */ 139 140 /* 141 * On plain MIPS we just call PROM functions directly. 142 */ 143 #define rex_bootinit __rex_bootinit 144 #define rex_bootread __rex_bootread 145 #define rex_getbitmap __rex_getbitmap 146 #define rex_slot_address __rex_slot_address 147 #define rex_gettcinfo __rex_gettcinfo 148 #define rex_getsysid __rex_getsysid 149 #define rex_clear_cache __rex_clear_cache 150 151 #define prom_getchar __prom_getchar 152 #define prom_getenv __prom_getenv 153 #define prom_printf __prom_printf 154 155 #define pmax_open __pmax_open 156 #define pmax_lseek __pmax_lseek 157 #define pmax_read __pmax_read 158 #define pmax_close __pmax_close 159 160 #endif /* !CONFIG_MIPS64 */ 161 162 163 extern void prom_meminit(u32); 164 extern void prom_identify_arch(u32); 165 extern void prom_init_cmdline(s32, s32 *, u32); 166 167 extern void register_prom_console(void); 168 extern void unregister_prom_console(void); 169 170 #endif /* __ASM_DEC_PROM_H */ 171