diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
commit | dcec8a13bf565e47942a1751a9cec21bec5648fe (patch) | |
tree | 548b69625b18cc2e88c3e68d0923be546c9ebb03 /arch/sparc64/prom/init.c | |
parent | 2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff) |
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash.
o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'arch/sparc64/prom/init.c')
-rw-r--r-- | arch/sparc64/prom/init.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/arch/sparc64/prom/init.c b/arch/sparc64/prom/init.c index 7dcef7642..4c1bd1e00 100644 --- a/arch/sparc64/prom/init.c +++ b/arch/sparc64/prom/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.7 1997/03/24 17:43:59 jj Exp $ +/* $Id: init.c,v 1.8 1998/03/15 10:14:44 ecd Exp $ * init.c: Initialize internal variables used by the PROM * library functions. * @@ -9,6 +9,7 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/string.h> +#include <linux/ctype.h> #include <asm/openprom.h> #include <asm/oplib.h> @@ -32,11 +33,13 @@ extern void prom_cif_init(void *, void *); __initfunc(void prom_init(void *cif_handler, void *cif_stack)) { - char buffer[80]; + char buffer[80], *p; + int ints[3]; int node; - + int i = 0; + prom_vers = PROM_P1275; - + prom_cif_init(cif_handler, cif_stack); prom_root_node = prom_getsibling(0); @@ -46,34 +49,45 @@ __initfunc(void prom_init(void *cif_handler, void *cif_stack)) prom_chosen_node = prom_finddevice("/chosen"); if (!prom_chosen_node || prom_chosen_node == -1) prom_halt(); - + prom_stdin = prom_getint (prom_chosen_node, "stdin"); prom_stdout = prom_getint (prom_chosen_node, "stdout"); node = prom_finddevice("/openprom"); if (!node || node == -1) prom_halt(); - + prom_getstring (node, "version", buffer, sizeof (buffer)); - + prom_printf ("\n"); - - if (strncmp (buffer, "OBP ", 4) || buffer[5] != '.' || buffer[7] != '.') { - prom_printf ("Strange OBP version `%s'.\n", buffer); - prom_halt (); + + if (strncmp (buffer, "OBP ", 4)) + goto strange_version; + + /* Version field is expected to be 'OBP xx.yy.zz date...' */ + + p = buffer + 4; + while (p && isdigit(*p) && i < 3) { + ints[i++] = simple_strtoul(p, NULL, 0); + if ((p = strchr(p, '.')) != NULL) + p++; } - /* Version field is expected to be 'OBP x.y.z date...' */ - - prom_rev = buffer[6] - '0'; - prom_prev = ((buffer[4] - '0') << 16) | - ((buffer[6] - '0') << 8) | - (buffer[8] - '0'); - + if (i != 3) + goto strange_version; + + prom_rev = ints[1]; + prom_prev = (ints[0] << 16) | (ints[1] << 8) | ints[2]; + printk ("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + 4); - + prom_meminit(); prom_ranges_init(); /* Initialization successful. */ + return; + +strange_version: + prom_printf ("Strange OBP version `%s'.\n", buffer); + prom_halt (); } |