patch-2.4.22 linux-2.4.22/arch/mips/dec/prom/init.c
Next file: linux-2.4.22/arch/mips/dec/prom/locore.S
Previous file: linux-2.4.22/arch/mips/dec/prom/identify.c
Back to the patch index
Back to the overall index
- Lines: 178
- Date:
2003-08-25 04:44:39.000000000 -0700
- Orig file:
linux-2.4.21/arch/mips/dec/prom/init.c
- Orig date:
2002-11-28 15:53:10.000000000 -0800
diff -urN linux-2.4.21/arch/mips/dec/prom/init.c linux-2.4.22/arch/mips/dec/prom/init.c
@@ -2,98 +2,102 @@
* init.c: PROM library initialisation code.
*
* Copyright (C) 1998 Harald Koerfgen
+ * Copyright (C) 2002 Maciej W. Rozycki
*/
-#include <linux/init.h>
#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/types.h>
+
#include <asm/bootinfo.h>
#include <asm/cpu.h>
-#include "prom.h"
+#include <asm/processor.h>
+
+#include <asm/dec/prom.h>
+
+
+int (*__rex_bootinit)(void);
+int (*__rex_bootread)(void);
+int (*__rex_getbitmap)(memmap *);
+unsigned long *(*__rex_slot_address)(int);
+void *(*__rex_gettcinfo)(void);
+int (*__rex_getsysid)(void);
+void (*__rex_clear_cache)(void);
+
+int (*__prom_getchar)(void);
+char *(*__prom_getenv)(char *);
+int (*__prom_printf)(char *, ...);
+
+int (*__pmax_open)(char*, int);
+int (*__pmax_lseek)(int, long, int);
+int (*__pmax_read)(int, void *, int);
+int (*__pmax_close)(int);
-/*
- * PROM Interface (whichprom.c)
- */
-typedef struct {
- int pagesize;
- unsigned char bitmap[0];
-} memmap;
-
-int (*rex_bootinit)(void);
-int (*rex_bootread)(void);
-int (*rex_getbitmap)(memmap *);
-unsigned long *(*rex_slot_address)(int);
-void *(*rex_gettcinfo)(void);
-int (*rex_getsysid)(void);
-void (*rex_clear_cache)(void);
-
-int (*prom_getchar)(void);
-char *(*prom_getenv)(char *);
-int (*prom_printf)(char *, ...);
-
-int (*pmax_open)(char*, int);
-int (*pmax_lseek)(int, long, int);
-int (*pmax_read)(int, void *, int);
-int (*pmax_close)(int);
-
-extern void prom_meminit(unsigned int);
-extern void prom_identify_arch(unsigned int);
-extern void prom_init_cmdline(int, char **, unsigned long);
/*
* Detect which PROM's the DECSTATION has, and set the callback vectors
* appropriately.
*/
-void __init which_prom(unsigned long magic, int *prom_vec)
+void __init which_prom(s32 magic, s32 *prom_vec)
{
/*
* No sign of the REX PROM's magic number means we assume a non-REX
* machine (i.e. we're on a DS2100/3100, DS5100 or DS5000/2xx)
*/
- if (magic == REX_PROM_MAGIC)
- {
+ if (prom_is_rex(magic)) {
/*
* Set up prom abstraction structure with REX entry points.
*/
- rex_bootinit = (int (*)(void)) *(prom_vec + REX_PROM_BOOTINIT);
- rex_bootread = (int (*)(void)) *(prom_vec + REX_PROM_BOOTREAD);
- rex_getbitmap = (int (*)(memmap *)) *(prom_vec + REX_PROM_GETBITMAP);
- prom_getchar = (int (*)(void)) *(prom_vec + REX_PROM_GETCHAR);
- prom_getenv = (char *(*)(char *)) *(prom_vec + REX_PROM_GETENV);
- rex_getsysid = (int (*)(void)) *(prom_vec + REX_PROM_GETSYSID);
- rex_gettcinfo = (void *(*)(void)) *(prom_vec + REX_PROM_GETTCINFO);
- prom_printf = (int (*)(char *, ...)) *(prom_vec + REX_PROM_PRINTF);
- rex_slot_address = (unsigned long *(*)(int)) *(prom_vec + REX_PROM_SLOTADDR);
- rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE);
- }
- else
- {
+ __rex_bootinit =
+ (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
+ __rex_bootread =
+ (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
+ __rex_getbitmap =
+ (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
+ __prom_getchar =
+ (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
+ __prom_getenv =
+ (void *)(long)*(prom_vec + REX_PROM_GETENV);
+ __rex_getsysid =
+ (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
+ __rex_gettcinfo =
+ (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
+ __prom_printf =
+ (void *)(long)*(prom_vec + REX_PROM_PRINTF);
+ __rex_slot_address =
+ (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
+ __rex_clear_cache =
+ (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
+ } else {
/*
* Set up prom abstraction structure with non-REX entry points.
*/
- prom_getchar = (int (*)(void)) PMAX_PROM_GETCHAR;
- prom_getenv = (char *(*)(char *)) PMAX_PROM_GETENV;
- prom_printf = (int (*)(char *, ...)) PMAX_PROM_PRINTF;
- pmax_open = (int (*)(char *, int)) PMAX_PROM_OPEN;
- pmax_lseek = (int (*)(int, long, int)) PMAX_PROM_LSEEK;
- pmax_read = (int (*)(int, void *, int)) PMAX_PROM_READ;
- pmax_close = (int (*)(int)) PMAX_PROM_CLOSE;
+ __prom_getchar = (void *)PMAX_PROM_GETCHAR;
+ __prom_getenv = (void *)PMAX_PROM_GETENV;
+ __prom_printf = (void *)PMAX_PROM_PRINTF;
+ __pmax_open = (void *)PMAX_PROM_OPEN;
+ __pmax_lseek = (void *)PMAX_PROM_LSEEK;
+ __pmax_read = (void *)PMAX_PROM_READ;
+ __pmax_close = (void *)PMAX_PROM_CLOSE;
}
}
-int __init prom_init(int argc, char **argv,
- unsigned long magic, int *prom_vec)
+int __init prom_init(s32 argc, s32 *argv, u32 magic, s32 *prom_vec)
{
extern void dec_machine_halt(void);
- /* Determine which PROM's we have (and therefore which machine we're on!) */
+ /*
+ * Determine which PROM's we have
+ * (and therefore which machine we're on!)
+ */
which_prom(magic, prom_vec);
- if (magic == REX_PROM_MAGIC)
+ if (prom_is_rex(magic))
rex_clear_cache();
/* Were we compiled with the right CPU option? */
#if defined(CONFIG_CPU_R3000)
- if ((mips_cpu.cputype == CPU_R4000SC) ||
- (mips_cpu.cputype == CPU_R4400SC)) {
+ if ((current_cpu_data.cputype == CPU_R4000SC) ||
+ (current_cpu_data.cputype == CPU_R4400SC)) {
prom_printf("Sorry, this kernel is compiled for the wrong CPU type!\n");
prom_printf("Please recompile with \"CONFIG_CPU_R4x00 = y\"\n");
dec_machine_halt();
@@ -101,8 +105,8 @@
#endif
#if defined(CONFIG_CPU_R4X00)
- if ((mips_cpu.cputype == CPU_R3000) ||
- (mips_cpu.cputype == CPU_R3000A)) {
+ if ((current_cpu_data.cputype == CPU_R3000) ||
+ (current_cpu_data.cputype == CPU_R3000A)) {
prom_printf("Sorry, this kernel is compiled for the wrong CPU type!\n");
prom_printf("Please recompile with \"CONFIG_CPU_R3000 = y\"\n");
dec_machine_halt();
@@ -115,4 +119,3 @@
return 0;
}
-
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)