2 * init.c: PROM library initialisation code.
4 * Copyright (C) 1998 Harald Koerfgen
5 * Copyright (C) 2002, 2004 Maciej W. Rozycki
7 #include <linux/init.h>
8 #include <linux/kernel.h>
9 #include <linux/linkage.h>
10 #include <linux/smp.h>
11 #include <linux/string.h>
12 #include <linux/types.h>
14 #include <asm/bootinfo.h>
16 #include <asm/processor.h>
18 #include <asm/dec/prom.h>
21 int (*__rex_bootinit)(void);
22 int (*__rex_bootread)(void);
23 int (*__rex_getbitmap)(memmap *);
24 unsigned long *(*__rex_slot_address)(int);
25 void *(*__rex_gettcinfo)(void);
26 int (*__rex_getsysid)(void);
27 void (*__rex_clear_cache)(void);
29 int (*__prom_getchar)(void);
30 char *(*__prom_getenv)(char *);
31 int (*__prom_printf)(char *, ...);
33 int (*__pmax_open)(char*, int);
34 int (*__pmax_lseek)(int, long, int);
35 int (*__pmax_read)(int, void *, int);
36 int (*__pmax_close)(int);
40 * Detect which PROM the DECSTATION has, and set the callback vectors
43 void __init which_prom(s32 magic, s32 *prom_vec)
46 * No sign of the REX PROM's magic number means we assume a non-REX
47 * machine (i.e. we're on a DS2100/3100, DS5100 or DS5000/2xx)
49 if (prom_is_rex(magic)) {
51 * Set up prom abstraction structure with REX entry points.
54 (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
56 (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
58 (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
60 (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
62 (void *)(long)*(prom_vec + REX_PROM_GETENV);
64 (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
66 (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
68 (void *)(long)*(prom_vec + REX_PROM_PRINTF);
70 (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
72 (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
75 * Set up prom abstraction structure with non-REX entry points.
77 __prom_getchar = (void *)PMAX_PROM_GETCHAR;
78 __prom_getenv = (void *)PMAX_PROM_GETENV;
79 __prom_printf = (void *)PMAX_PROM_PRINTF;
80 __pmax_open = (void *)PMAX_PROM_OPEN;
81 __pmax_lseek = (void *)PMAX_PROM_LSEEK;
82 __pmax_read = (void *)PMAX_PROM_READ;
83 __pmax_close = (void *)PMAX_PROM_CLOSE;
87 void __init prom_init(void)
89 extern void dec_machine_halt(void);
90 static char cpu_msg[] __initdata =
91 "Sorry, this kernel is compiled for a wrong CPU type!\n";
93 s32 *argv = (void *)fw_arg1;
95 s32 *prom_vec = (void *)fw_arg3;
98 * Determine which PROM we have
99 * (and therefore which machine we're on!)
101 which_prom(magic, prom_vec);
103 if (prom_is_rex(magic))
106 /* Register the early console. */
107 register_prom_console();
109 /* Were we compiled with the right CPU option? */
110 #if defined(CONFIG_CPU_R3000)
111 if ((current_cpu_type() == CPU_R4000SC) ||
112 (current_cpu_type() == CPU_R4400SC)) {
113 static char r4k_msg[] __initdata =
114 "Please recompile with \"CONFIG_CPU_R4x00 = y\".\n";
121 #if defined(CONFIG_CPU_R4X00)
122 if ((current_cpu_type() == CPU_R3000) ||
123 (current_cpu_type() == CPU_R3000A)) {
124 static char r3k_msg[] __initdata =
125 "Please recompile with \"CONFIG_CPU_R3000 = y\".\n";
133 prom_identify_arch(magic);
134 prom_init_cmdline(argc, argv, magic);