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/string.h>
10 #include <linux/types.h>
12 #include <asm/bootinfo.h>
14 #include <asm/processor.h>
16 #include <asm/dec/prom.h>
19 int (*__rex_bootinit)(void);
20 int (*__rex_bootread)(void);
21 int (*__rex_getbitmap)(memmap *);
22 unsigned long *(*__rex_slot_address)(int);
23 void *(*__rex_gettcinfo)(void);
24 int (*__rex_getsysid)(void);
25 void (*__rex_clear_cache)(void);
27 int (*__prom_getchar)(void);
28 char *(*__prom_getenv)(char *);
29 int (*__prom_printf)(char *, ...);
31 int (*__pmax_open)(char*, int);
32 int (*__pmax_lseek)(int, long, int);
33 int (*__pmax_read)(int, void *, int);
34 int (*__pmax_close)(int);
38 * Detect which PROM the DECSTATION has, and set the callback vectors
41 void __init which_prom(s32 magic, s32 *prom_vec)
44 * No sign of the REX PROM's magic number means we assume a non-REX
45 * machine (i.e. we're on a DS2100/3100, DS5100 or DS5000/2xx)
47 if (prom_is_rex(magic)) {
49 * Set up prom abstraction structure with REX entry points.
52 (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
54 (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
56 (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
58 (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
60 (void *)(long)*(prom_vec + REX_PROM_GETENV);
62 (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
64 (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
66 (void *)(long)*(prom_vec + REX_PROM_PRINTF);
68 (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
70 (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
73 * Set up prom abstraction structure with non-REX entry points.
75 __prom_getchar = (void *)PMAX_PROM_GETCHAR;
76 __prom_getenv = (void *)PMAX_PROM_GETENV;
77 __prom_printf = (void *)PMAX_PROM_PRINTF;
78 __pmax_open = (void *)PMAX_PROM_OPEN;
79 __pmax_lseek = (void *)PMAX_PROM_LSEEK;
80 __pmax_read = (void *)PMAX_PROM_READ;
81 __pmax_close = (void *)PMAX_PROM_CLOSE;
85 int __init prom_init(s32 argc, s32 *argv, u32 magic, s32 *prom_vec)
87 extern void dec_machine_halt(void);
88 static char cpu_msg[] __initdata =
89 "Sorry, this kernel is compiled for a wrong CPU type!\n";
90 static char r3k_msg[] __initdata =
91 "Please recompile with \"CONFIG_CPU_R3000 = y\".\n";
92 static char r4k_msg[] __initdata =
93 "Please recompile with \"CONFIG_CPU_R4x00 = y\".\n";
96 * Determine which PROM we have
97 * (and therefore which machine we're on!)
99 which_prom(magic, prom_vec);
101 if (prom_is_rex(magic))
104 /* Register the early console. */
105 register_prom_console();
107 /* Were we compiled with the right CPU option? */
108 #if defined(CONFIG_CPU_R3000)
109 if ((current_cpu_data.cputype == CPU_R4000SC) ||
110 (current_cpu_data.cputype == CPU_R4400SC)) {
117 #if defined(CONFIG_CPU_R4X00)
118 if ((current_cpu_data.cputype == CPU_R3000) ||
119 (current_cpu_data.cputype == CPU_R3000A)) {
127 prom_identify_arch(magic);
128 prom_init_cmdline(argc, argv, magic);