diff options
Diffstat (limited to 'arch/sparc64/prom')
-rw-r--r-- | arch/sparc64/prom/bootstr.c | 20 | ||||
-rw-r--r-- | arch/sparc64/prom/misc.c | 14 | ||||
-rw-r--r-- | arch/sparc64/prom/p1275.c | 84 |
3 files changed, 58 insertions, 60 deletions
diff --git a/arch/sparc64/prom/bootstr.c b/arch/sparc64/prom/bootstr.c index e226c6e95..7ef17159d 100644 --- a/arch/sparc64/prom/bootstr.c +++ b/arch/sparc64/prom/bootstr.c @@ -1,4 +1,4 @@ -/* $Id: bootstr.c,v 1.3 1997/03/04 16:27:06 jj Exp $ +/* $Id: bootstr.c,v 1.4 1997/06/17 13:25:35 jj Exp $ * bootstr.c: Boot string/argument acquisition from the PROM. * * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -6,18 +6,20 @@ */ #include <linux/string.h> +#include <linux/init.h> #include <asm/oplib.h> #define BARG_LEN 256 -static char barg_buf[BARG_LEN]; -static char fetched = 0; +int bootstr_len __initdata = BARG_LEN; +static int bootstr_valid __initdata = 0; +static char bootstr_buf[BARG_LEN] __initdata = { 0 }; -char * -prom_getbootargs(void) +__initfunc(char * +prom_getbootargs(void)) { /* This check saves us from a panic when bootfd patches args. */ - if (fetched) return barg_buf; - prom_getstring(prom_chosen_node, "bootargs", barg_buf, BARG_LEN); - fetched = 1; - return barg_buf; + if (bootstr_valid) return bootstr_buf; + prom_getstring(prom_chosen_node, "bootargs", bootstr_buf, BARG_LEN); + bootstr_valid = 1; + return bootstr_buf; } diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c index fe9bf9c6b..8b738fd41 100644 --- a/arch/sparc64/prom/misc.c +++ b/arch/sparc64/prom/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.6 1997/04/10 05:13:05 davem Exp $ +/* $Id: misc.c,v 1.8 1997/07/14 23:45:28 davem Exp $ * misc.c: Miscellaneous prom functions that don't belong * anywhere else. * @@ -6,6 +6,7 @@ * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ +#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -45,8 +46,8 @@ void prom_cmdline(void) { extern void kernel_enter_debugger(void); - extern void install_obp_ticker(void); - extern void install_linux_ticker(void); + /* extern void install_obp_ticker(void); */ + /* extern void install_linux_ticker(void); */ unsigned long flags; /* kernel_enter_debugger(); */ @@ -132,3 +133,10 @@ void prom_set_trap_table(unsigned long tba) { p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba); } + +#ifdef __SMP__ +void prom_start_cpu(int cpunode, unsigned long pc, unsigned long o0) +{ + p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, o0); +} +#endif diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc64/prom/p1275.c index 3eb0311df..18de40deb 100644 --- a/arch/sparc64/prom/p1275.c +++ b/arch/sparc64/prom/p1275.c @@ -1,4 +1,4 @@ -/* $Id: p1275.c,v 1.8 1997/04/03 09:29:21 davem Exp $ +/* $Id: p1275.c,v 1.10 1997/06/27 04:18:30 davem Exp $ * p1275.c: Sun IEEE 1275 PROM low level interface routines * * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -14,50 +14,42 @@ #include <asm/spitfire.h> #include <asm/pstate.h> -/* If you change layout of this structure, please change the prom_doit - function below as well. */ -typedef struct { - unsigned prom_doit_code [24]; /* 0x8000 */ - long prom_sync_routine; /* 0x8060 */ - void (*prom_cif_handler)(long *); /* 0x8068 */ - unsigned long prom_cif_stack; /* 0x8070 */ - unsigned long prom_args [23]; /* 0x8078 */ - char prom_buffer [7888]; -} at0x8000; +struct { + long prom_sync_routine; /* 0x00 */ + void (*prom_cif_handler)(long *); /* 0x08 */ + unsigned long prom_cif_stack; /* 0x10 */ + unsigned long prom_args [23]; /* 0x18 */ + char prom_buffer [3000]; +} p1275buf; -static void (*prom_do_it)(void); - -void prom_cif_interface (void) __attribute__ ((__section__ (".p1275"))); - -/* At most 14 insns */ void prom_cif_interface (void) { __asm__ __volatile__ (" - sethi %%hi(0x8000), %%o0 - ldx [%%o0 + 0x070], %%o1 ! prom_cif_stack + mov %0, %%o0 + ldx [%%o0 + 0x010], %%o1 ! prom_cif_stack save %%o1, -0xc0, %%sp - ldx [%%i0 + 0x068], %%l2 ! prom_cif_handler + ldx [%%i0 + 0x008], %%l2 ! prom_cif_handler rdpr %%pstate, %%l4 mov %%g4, %%l0 mov %%g6, %%l1 - wrpr %%l4, %0, %%pstate ! turn on address masking + wrpr %%l4, %1, %%pstate ! turn on address masking call %%l2 - or %%i0, 0x078, %%o0 ! prom_args + add %%i0, 0x018, %%o0 ! prom_args wrpr %%l4, 0, %%pstate ! put pstate back mov %%l0, %%g4 ret restore %%l1, 0, %%g6 save %%sp, -0xc0, %%sp ! If you change the offset of the save rdpr %%pstate, %%l4 ! here, please change the 0x8038 - andn %%l4, %0, %%l3 ! constant below as well + andn %%l4, %1, %%l3 ! constant below as well wrpr %%l3, %%pstate - ldx [%%o0 + 0x060], %%l2 + ldx [%%o0 + 0x000], %%l2 call %%l2 nop wrpr %%l4, 0, %%pstate ret restore - " : : "i" (PSTATE_AM)); + " : : "r" (&p1275buf), "i" (0 /* PSTATE_AM */)); } long p1275_cmd (char *service, long fmt, ...) @@ -68,61 +60,60 @@ long p1275_cmd (char *service, long fmt, ...) va_list list; long attrs, x; long ctx = 0; - at0x8000 *low = (at0x8000 *)(0x8000); - p = low->prom_buffer; + p = p1275buf.prom_buffer; save_and_cli(flags); ctx = spitfire_get_primary_context (); if (ctx) { flushw_user (); spitfire_set_primary_context (0); } - low->prom_args[0] = (unsigned long)p; /* service */ + p1275buf.prom_args[0] = (unsigned long)p; /* service */ strcpy (p, service); p = (char *)(((long)(strchr (p, 0) + 8)) & ~7); - low->prom_args[1] = nargs = (fmt & 0x0f); /* nargs */ - low->prom_args[2] = nrets = ((fmt & 0xf0) >> 4); /* nrets */ + p1275buf.prom_args[1] = nargs = (fmt & 0x0f); /* nargs */ + p1275buf.prom_args[2] = nrets = ((fmt & 0xf0) >> 4); /* nrets */ attrs = fmt >> 8; va_start(list, fmt); for (i = 0; i < nargs; i++, attrs >>= 3) { switch (attrs & 0x7) { case P1275_ARG_NUMBER: - low->prom_args[i + 3] = (unsigned)va_arg(list, long); break; + p1275buf.prom_args[i + 3] = (unsigned)va_arg(list, long); break; case P1275_ARG_IN_STRING: strcpy (p, va_arg(list, char *)); - low->prom_args[i + 3] = (unsigned long)p; + p1275buf.prom_args[i + 3] = (unsigned long)p; p = (char *)(((long)(strchr (p, 0) + 8)) & ~7); break; case P1275_ARG_OUT_BUF: (void) va_arg(list, char *); - low->prom_args[i + 3] = (unsigned long)p; + p1275buf.prom_args[i + 3] = (unsigned long)p; x = va_arg(list, long); i++; attrs >>= 3; p = (char *)(((long)(p + (int)x + 7)) & ~7); - low->prom_args[i + 3] = x; + p1275buf.prom_args[i + 3] = x; break; case P1275_ARG_IN_BUF: q = va_arg(list, char *); - low->prom_args[i + 3] = (unsigned long)p; + p1275buf.prom_args[i + 3] = (unsigned long)p; x = va_arg(list, long); i++; attrs >>= 3; memcpy (p, q, (int)x); p = (char *)(((long)(p + (int)x + 7)) & ~7); - low->prom_args[i + 3] = x; + p1275buf.prom_args[i + 3] = x; break; case P1275_ARG_OUT_32B: (void) va_arg(list, char *); - low->prom_args[i + 3] = (unsigned long)p; + p1275buf.prom_args[i + 3] = (unsigned long)p; p += 32; break; case P1275_ARG_IN_FUNCTION: - low->prom_args[i + 3] = 0x8038; - low->prom_sync_routine = va_arg(list, long); break; + p1275buf.prom_args[i + 3] = (unsigned long)prom_cif_interface + 0x38; + p1275buf.prom_sync_routine = va_arg(list, long); break; } } va_end(list); - - (*prom_do_it)(); + + prom_cif_interface(); attrs = fmt >> 8; va_start(list, fmt); @@ -142,17 +133,17 @@ long p1275_cmd (char *service, long fmt, ...) case P1275_ARG_OUT_BUF: p = va_arg(list, char *); x = va_arg(list, long); - memcpy (p, (char *)(low->prom_args[i + 3]), (int)x); + memcpy (p, (char *)(p1275buf.prom_args[i + 3]), (int)x); i++; attrs >>= 3; break; case P1275_ARG_OUT_32B: p = va_arg(list, char *); - memcpy (p, (char *)(low->prom_args[i + 3]), 32); + memcpy (p, (char *)(p1275buf.prom_args[i + 3]), 32); break; } } va_end(list); - x = low->prom_args [nargs + 3]; + x = p1275buf.prom_args [nargs + 3]; if (ctx) spitfire_set_primary_context (ctx); @@ -162,9 +153,6 @@ long p1275_cmd (char *service, long fmt, ...) void prom_cif_init(void *cif_handler, void *cif_stack) { - at0x8000 *low = (at0x8000 *)(0x8000); - - low->prom_cif_handler = (void (*)(long *))cif_handler; - low->prom_cif_stack = (unsigned long)cif_stack; - prom_do_it = (void (*)(void))(0x8000); + p1275buf.prom_cif_handler = (void (*)(long *))cif_handler; + p1275buf.prom_cif_stack = (unsigned long)cif_stack; } |