0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _ASM_DEC_PROM_H
0012 #define _ASM_DEC_PROM_H
0013
0014 #include <linux/types.h>
0015
0016 #include <asm/addrspace.h>
0017
0018
0019
0020
0021
0022 #define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
0023
0024
0025 #define PMAX_PROM_ENTRY(x) (VEC_RESET + (x))
0026
0027 #define PMAX_PROM_HALT PMAX_PROM_ENTRY(2)
0028 #define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5)
0029 #define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
0030 #define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
0031 #define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
0032 #define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
0033 #define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
0034 #define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13)
0035 #define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
0036 #define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
0037 #define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33)
0038
0039
0040
0041
0042
0043
0044 #define REX_PROM_MAGIC 0x30464354
0045
0046
0047 static inline bool prom_is_rex(u32 magic)
0048 {
0049 return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC;
0050 }
0051
0052
0053
0054
0055
0056 #define REX_PROM_GETBITMAP 0x84/4
0057 #define REX_PROM_GETCHAR 0x24/4
0058 #define REX_PROM_GETENV 0x64/4
0059 #define REX_PROM_GETSYSID 0x80/4
0060 #define REX_PROM_GETTCINFO 0xa4/4
0061 #define REX_PROM_PRINTF 0x30/4
0062 #define REX_PROM_SLOTADDR 0x6c/4
0063 #define REX_PROM_BOOTINIT 0x54/4
0064 #define REX_PROM_BOOTREAD 0x58/4
0065 #define REX_PROM_CLEARCACHE 0x7c/4
0066
0067
0068
0069
0070
0071 typedef struct {
0072 int pagesize;
0073 unsigned char bitmap[0];
0074 } memmap;
0075
0076
0077
0078
0079
0080 extern int (*__rex_bootinit)(void);
0081 extern int (*__rex_bootread)(void);
0082 extern int (*__rex_getbitmap)(memmap *);
0083 extern unsigned long *(*__rex_slot_address)(int);
0084 extern void *(*__rex_gettcinfo)(void);
0085 extern int (*__rex_getsysid)(void);
0086 extern void (*__rex_clear_cache)(void);
0087
0088 extern int (*__prom_getchar)(void);
0089 extern char *(*__prom_getenv)(char *);
0090 extern int (*__prom_printf)(char *, ...);
0091
0092 extern int (*__pmax_open)(char*, int);
0093 extern int (*__pmax_lseek)(int, long, int);
0094 extern int (*__pmax_read)(int, void *, int);
0095 extern int (*__pmax_close)(int);
0096
0097
0098 #ifdef CONFIG_64BIT
0099
0100
0101
0102
0103
0104 #define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
0105 __asm__(#fun " = call_o32")
0106
0107 int __DEC_PROM_O32(_rex_bootinit, (int (*)(void), void *));
0108 int __DEC_PROM_O32(_rex_bootread, (int (*)(void), void *));
0109 int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), void *, memmap *));
0110 unsigned long *__DEC_PROM_O32(_rex_slot_address,
0111 (unsigned long *(*)(int), void *, int));
0112 void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void), void *));
0113 int __DEC_PROM_O32(_rex_getsysid, (int (*)(void), void *));
0114 void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void), void *));
0115
0116 int __DEC_PROM_O32(_prom_getchar, (int (*)(void), void *));
0117 char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), void *, char *));
0118 int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), void *, char *, ...));
0119
0120
0121 #define rex_bootinit() _rex_bootinit(__rex_bootinit, NULL)
0122 #define rex_bootread() _rex_bootread(__rex_bootread, NULL)
0123 #define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, NULL, x)
0124 #define rex_slot_address(x) _rex_slot_address(__rex_slot_address, NULL, x)
0125 #define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo, NULL)
0126 #define rex_getsysid() _rex_getsysid(__rex_getsysid, NULL)
0127 #define rex_clear_cache() _rex_clear_cache(__rex_clear_cache, NULL)
0128
0129 #define prom_getchar() _prom_getchar(__prom_getchar, NULL)
0130 #define prom_getenv(x) _prom_getenv(__prom_getenv, NULL, x)
0131 #define prom_printf(x...) _prom_printf(__prom_printf, NULL, x)
0132
0133 #else
0134
0135
0136
0137
0138 #define rex_bootinit __rex_bootinit
0139 #define rex_bootread __rex_bootread
0140 #define rex_getbitmap __rex_getbitmap
0141 #define rex_slot_address __rex_slot_address
0142 #define rex_gettcinfo __rex_gettcinfo
0143 #define rex_getsysid __rex_getsysid
0144 #define rex_clear_cache __rex_clear_cache
0145
0146 #define prom_getchar __prom_getchar
0147 #define prom_getenv __prom_getenv
0148 #define prom_printf __prom_printf
0149
0150 #define pmax_open __pmax_open
0151 #define pmax_lseek __pmax_lseek
0152 #define pmax_read __pmax_read
0153 #define pmax_close __pmax_close
0154
0155 #endif
0156
0157
0158 extern void prom_meminit(u32);
0159 extern void prom_identify_arch(u32);
0160 extern void prom_init_cmdline(s32, s32 *, u32);
0161
0162 extern void register_prom_console(void);
0163 extern void unregister_prom_console(void);
0164
0165 #endif