2 * init.c: PROM library initialisation code.
4 * Copyright (C) 1998 Harald Koerfgen
5 * Copyright (C) 2002, 2004 Maciej W. Rozycki
7 #include <linux/config.h>
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/linkage.h>
11 #include <linux/smp.h>
12 #include <linux/string.h>
13 #include <linux/types.h>
15 #include <asm/bootinfo.h>
17 #include <asm/processor.h>
19 #include <asm/dec/prom.h>
22 int (*__rex_bootinit)(void);
23 int (*__rex_bootread)(void);
24 int (*__rex_getbitmap)(memmap *);
25 unsigned long *(*__rex_slot_address)(int);
26 void *(*__rex_gettcinfo)(void);
27 int (*__rex_getsysid)(void);
28 void (*__rex_clear_cache)(void);
30 int (*__prom_getchar)(void);
31 char *(*__prom_getenv)(char *);
32 int (*__prom_printf)(char *, ...);
34 int (*__pmax_open)(char*, int);
35 int (*__pmax_lseek)(int, long, int);
36 int (*__pmax_read)(int, void *, int);
37 int (*__pmax_close)(int);
41 * Detect which PROM the DECSTATION has, and set the callback vectors
44 void __init which_prom(s32 magic, s32 *prom_vec)
47 * No sign of the REX PROM's magic number means we assume a non-REX
48 * machine (i.e. we're on a DS2100/3100, DS5100 or DS5000/2xx)
50 if (prom_is_rex(magic)) {
52 * Set up prom abstraction structure with REX entry points.
55 (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
57 (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
59 (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
61 (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
63 (void *)(long)*(prom_vec + REX_PROM_GETENV);
65 (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
67 (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
69 (void *)(long)*(prom_vec + REX_PROM_PRINTF);
71 (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
73 (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
76 * Set up prom abstraction structure with non-REX entry points.
78 __prom_getchar = (void *)PMAX_PROM_GETCHAR;
79 __prom_getenv = (void *)PMAX_PROM_GETENV;
80 __prom_printf = (void *)PMAX_PROM_PRINTF;
81 __pmax_open = (void *)PMAX_PROM_OPEN;
82 __pmax_lseek = (void *)PMAX_PROM_LSEEK;
83 __pmax_read = (void *)PMAX_PROM_READ;
84 __pmax_close = (void *)PMAX_PROM_CLOSE;
88 void __init prom_init(void)
90 extern void ATTRIB_NORET dec_machine_halt(void);
91 static char cpu_msg[] __initdata =
92 "Sorry, this kernel is compiled for a wrong CPU type!\n";
94 s32 *argv = (void *)fw_arg1;
96 s32 *prom_vec = (void *)fw_arg3;
99 * Determine which PROM we have
100 * (and therefore which machine we're on!)
102 which_prom(magic, prom_vec);
104 if (prom_is_rex(magic))
107 /* Register the early console. */
108 register_prom_console();
110 /* Were we compiled with the right CPU option? */
111 #if defined(CONFIG_CPU_R3000)
112 if ((current_cpu_data.cputype == CPU_R4000SC) ||
113 (current_cpu_data.cputype == CPU_R4400SC)) {
114 static char r4k_msg[] __initdata =
115 "Please recompile with \"CONFIG_CPU_R4x00 = y\".\n";
122 #if defined(CONFIG_CPU_R4X00)
123 if ((current_cpu_data.cputype == CPU_R3000) ||
124 (current_cpu_data.cputype == CPU_R3000A)) {
125 static char r3k_msg[] __initdata =
126 "Please recompile with \"CONFIG_CPU_R3000 = y\".\n";
134 prom_identify_arch(magic);
135 prom_init_cmdline(argc, argv, magic);