diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-20 11:57:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-20 11:57:05 +0000 |
commit | 43c184e3749b9964be27d5c7b3ba8c0a61582663 (patch) | |
tree | c897811b76e0b2f451389a8f81141409a7481683 /sys | |
parent | a7e75802006b95ac91285962228e1407da74cb2b (diff) |
Save the PROM VBR on startup, rather than assuming the PROM (and thus its
VBR) will always reside at the same address.
Also, when querying the PROM for the memory size, ask it for the ``user''
size - i.e. with the PROM data area taken out.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/aviion/aviion/av400_machdep.c | 20 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/locore.S | 7 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/prom.c | 30 | ||||
-rw-r--r-- | sys/arch/aviion/include/prom.h | 5 |
4 files changed, 36 insertions, 26 deletions
diff --git a/sys/arch/aviion/aviion/av400_machdep.c b/sys/arch/aviion/aviion/av400_machdep.c index 0c1f0bc345a..c6600f7281a 100644 --- a/sys/arch/aviion/aviion/av400_machdep.c +++ b/sys/arch/aviion/aviion/av400_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: av400_machdep.c,v 1.1 2006/05/09 18:25:34 miod Exp $ */ +/* $OpenBSD: av400_machdep.c,v 1.2 2006/05/20 11:57:02 miod Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat. * @@ -205,7 +205,7 @@ av400_memsize() { vaddr_t memsize; - memsize = scm_memsize(); + memsize = scm_memsize(1); /* * What we got is the ``top of memory'', i.e. the largest addressable @@ -213,28 +213,12 @@ av400_memsize() */ memsize = round_page(memsize); - /* - * But then the PROM uses at least one full page for its own needs... - */ - memsize -= PAGE_SIZE; - return (memsize); } void av400_startup() { -#if 0 - /* - * Supply the self-inflicted vector base. Note that since we don't - * use this functionality, this is not really necessary. - * Moreover, writing to this register in av400_bootstrap() causes - * an exception (and at this point we can not handle it). - * This might be a good way to tell 400s from 5000s! - */ - /* supply a vector base for av400ih */ - *(volatile u_int8_t *)AV400_VIRQV = AV400_IVEC; -#endif } int32_t cpuid, sysid; diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S index 5ade1e515a8..c8e7945c5f2 100644 --- a/sys/arch/aviion/aviion/locore.S +++ b/sys/arch/aviion/aviion/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.1 2006/05/07 21:32:26 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.2 2006/05/20 11:57:02 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -175,6 +175,11 @@ ASLOCAL(main_start) set r11, r11, 1<PSR_SERIALIZE_BIT> stcr r11, PSR FLUSH_PIPELINE + + /* save PROM vbr */ + ldcr r12, VBR + or.u r13, r0, hi16(_C_LABEL(prom_vbr)) + st r12, r13, lo16(_C_LABEL(prom_vbr)) stcr r0, VBR #ifdef MULTIPROCESSOR diff --git a/sys/arch/aviion/aviion/prom.c b/sys/arch/aviion/aviion/prom.c index 507c948e2e9..675355501a0 100644 --- a/sys/arch/aviion/aviion/prom.c +++ b/sys/arch/aviion/aviion/prom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.c,v 1.1 2006/05/08 16:34:56 miod Exp $ */ +/* $OpenBSD: prom.c,v 1.2 2006/05/20 11:57:02 miod Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat. @@ -29,9 +29,10 @@ #include <sys/systm.h> #include <machine/asm_macro.h> -#include <machine/av400.h> /* PROM_VBR */ #include <machine/prom.h> +register_t prom_vbr; /* set in locore.S */ + /* * No locking is necessary, since we will only use the SCM routines * during startup, before any secondary CPU is started. @@ -48,7 +49,7 @@ "r9", "r10", "r11", "r12", "r13") #define SCM_VBR() \ - __asm__ __volatile__ ("stcr %0, cr7" : : "r" (PROM_VBR)) + __asm__ __volatile__ ("stcr %0, cr7" : : "r" (prom_vbr)) #define SCM_CONTEXT() \ __asm__ __volatile__ ("ldcr %0, cr17" : "=r" (ossr0)); \ @@ -156,7 +157,7 @@ scm_halt() } u_int -scm_memsize() +scm_memsize(int which) { SCM_DECL; u_int msize; @@ -164,7 +165,7 @@ scm_memsize() disable_interrupt(psr); SCM_CONTEXT(); SCM_VBR(); - __asm__ __volatile__ ("or r2, r0, r0"); + __asm__ __volatile__ ("or r2, r0, %0" : : "r" (which)); SCM_CALL(SCM_MSIZE); __asm__ __volatile__ ("or %0, r0, r2" : "=r" (msize)); OS_CONTEXT(); @@ -174,6 +175,25 @@ scm_memsize() return (msize); } +/* + * Does not accept parameters beyond a string because this would need extra + * register constraints. + */ +void +scm_printf(const char *msg) +{ + SCM_DECL; + + disable_interrupt(psr); + SCM_CONTEXT(); + SCM_VBR(); + __asm__ __volatile__ ("or r2, r0, %0" : : "r" (msg)); + SCM_CALL(SCM_PTLINE); + OS_CONTEXT(); + OS_VBR(); + set_psr(psr); +} + u_int scm_promver() { diff --git a/sys/arch/aviion/include/prom.h b/sys/arch/aviion/include/prom.h index 49863f505a4..4ce7f0f6574 100644 --- a/sys/arch/aviion/include/prom.h +++ b/sys/arch/aviion/include/prom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.h,v 1.1 2006/05/09 18:19:43 miod Exp $ */ +/* $OpenBSD: prom.h,v 1.2 2006/05/20 11:57:04 miod Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat. * @@ -65,7 +65,8 @@ u_int scm_cpuid(void); int scm_getc(void); void scm_getenaddr(u_char *); __dead void scm_halt(void); -u_int scm_memsize(void); +u_int scm_memsize(int); +void scm_printf(const char *); u_int scm_promver(void); void scm_putc(int); void scm_putcrlf(void); |