0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/init.h>
0009 #include <linux/kernel.h>
0010 #include <linux/linkage.h>
0011 #include <linux/smp.h>
0012 #include <linux/string.h>
0013 #include <linux/types.h>
0014
0015 #include <asm/bootinfo.h>
0016 #include <asm/cpu.h>
0017 #include <asm/cpu-type.h>
0018 #include <asm/processor.h>
0019
0020 #include <asm/dec/prom.h>
0021
0022
0023 int (*__rex_bootinit)(void);
0024 int (*__rex_bootread)(void);
0025 int (*__rex_getbitmap)(memmap *);
0026 unsigned long *(*__rex_slot_address)(int);
0027 void *(*__rex_gettcinfo)(void);
0028 int (*__rex_getsysid)(void);
0029 void (*__rex_clear_cache)(void);
0030
0031 int (*__prom_getchar)(void);
0032 char *(*__prom_getenv)(char *);
0033 int (*__prom_printf)(char *, ...);
0034
0035 int (*__pmax_open)(char*, int);
0036 int (*__pmax_lseek)(int, long, int);
0037 int (*__pmax_read)(int, void *, int);
0038 int (*__pmax_close)(int);
0039
0040
0041
0042
0043
0044
0045 void __init which_prom(s32 magic, s32 *prom_vec)
0046 {
0047
0048
0049
0050
0051 if (prom_is_rex(magic)) {
0052
0053
0054
0055 __rex_bootinit =
0056 (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
0057 __rex_bootread =
0058 (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
0059 __rex_getbitmap =
0060 (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
0061 __prom_getchar =
0062 (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
0063 __prom_getenv =
0064 (void *)(long)*(prom_vec + REX_PROM_GETENV);
0065 __rex_getsysid =
0066 (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
0067 __rex_gettcinfo =
0068 (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
0069 __prom_printf =
0070 (void *)(long)*(prom_vec + REX_PROM_PRINTF);
0071 __rex_slot_address =
0072 (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
0073 __rex_clear_cache =
0074 (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
0075 } else {
0076
0077
0078
0079 __prom_getchar = (void *)PMAX_PROM_GETCHAR;
0080 __prom_getenv = (void *)PMAX_PROM_GETENV;
0081 __prom_printf = (void *)PMAX_PROM_PRINTF;
0082 __pmax_open = (void *)PMAX_PROM_OPEN;
0083 __pmax_lseek = (void *)PMAX_PROM_LSEEK;
0084 __pmax_read = (void *)PMAX_PROM_READ;
0085 __pmax_close = (void *)PMAX_PROM_CLOSE;
0086 }
0087 }
0088
0089 void __init prom_init(void)
0090 {
0091 extern void dec_machine_halt(void);
0092 static const char cpu_msg[] __initconst =
0093 "Sorry, this kernel is compiled for a wrong CPU type!\n";
0094 s32 argc = fw_arg0;
0095 s32 *argv = (void *)fw_arg1;
0096 u32 magic = fw_arg2;
0097 s32 *prom_vec = (void *)fw_arg3;
0098
0099
0100
0101
0102
0103 which_prom(magic, prom_vec);
0104
0105 if (prom_is_rex(magic))
0106 rex_clear_cache();
0107
0108
0109 register_prom_console();
0110
0111
0112 #if defined(CONFIG_CPU_R3000)
0113 if ((current_cpu_type() == CPU_R4000SC) ||
0114 (current_cpu_type() == CPU_R4400SC)) {
0115 static const char r4k_msg[] __initconst =
0116 "Please recompile with \"CONFIG_CPU_R4X00 = y\".\n";
0117 printk(cpu_msg);
0118 printk(r4k_msg);
0119 dec_machine_halt();
0120 }
0121 #endif
0122
0123 #if defined(CONFIG_CPU_R4X00)
0124 if ((current_cpu_type() == CPU_R3000) ||
0125 (current_cpu_type() == CPU_R3000A)) {
0126 static const char r3k_msg[] __initconst =
0127 "Please recompile with \"CONFIG_CPU_R3000 = y\".\n";
0128 printk(cpu_msg);
0129 printk(r3k_msg);
0130 dec_machine_halt();
0131 }
0132 #endif
0133
0134 prom_meminit(magic);
0135 prom_identify_arch(magic);
0136 prom_init_cmdline(argc, argv, magic);
0137 }