diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-02-06 23:13:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-02-06 23:13:38 +0000 |
commit | 6101889507706e8a5bbbe7a836d307f8d47659a1 (patch) | |
tree | 456b635a29227301a7a7004443f941bfcb5248cc /sys | |
parent | 69e26346d106308170a7dcd32af51d0c9accbb0b (diff) |
Get memory size from SH-IPL+g whenever possible, before relying upon the
hardcoded 64MB. No functional change since we have not encountered non-64MB
systems yet.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/landisk/landisk/locore.S | 8 | ||||
-rw-r--r-- | sys/arch/landisk/landisk/machdep.c | 16 |
2 files changed, 19 insertions, 5 deletions
diff --git a/sys/arch/landisk/landisk/locore.S b/sys/arch/landisk/landisk/locore.S index 4d0215e65c3..d9531954a6b 100644 --- a/sys/arch/landisk/landisk/locore.S +++ b/sys/arch/landisk/landisk/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.1 2006/10/06 21:16:15 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.2 2007/02/06 23:13:37 miod Exp $ */ /* $NetBSD: locore.S,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /*- @@ -77,3 +77,9 @@ ALTENTRY(kernel_text) _L.landisk_startup: .long _C_LABEL(landisk_startup) _L.bootstrap_stack: .long _C_LABEL(start) _L.MMUCR: .long SH4_MMUCR + +ENTRY(getramsize) + mov #4, r0 + trapa #0x3f + rts + nop diff --git a/sys/arch/landisk/landisk/machdep.c b/sys/arch/landisk/landisk/machdep.c index a594da9966f..cce14dadb6a 100644 --- a/sys/arch/landisk/landisk/machdep.c +++ b/sys/arch/landisk/landisk/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.7 2006/11/09 00:12:12 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.8 2007/02/06 23:13:37 miod Exp $ */ /* $NetBSD: machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /*- @@ -110,6 +110,8 @@ char machine[] = MACHINE; /* landisk */ __dead void landisk_startup(int, char *); __dead void main(void); +extern u_int32_t getramsize(void); + void cpu_startup(void) { @@ -127,12 +129,16 @@ char *esym; __dead void landisk_startup(int howto, char *_esym) { + u_int32_t ramsize; + /* Start to determine heap area */ esym = _esym; kernend = (vaddr_t)round_page((vaddr_t)esym); boothowto = howto; + ramsize = getramsize(); + /* Initialize CPU ops. */ sh_cpu_init(CPU_ARCH_SH4, CPU_PRODUCT_7751R); @@ -140,11 +146,13 @@ landisk_startup(int howto, char *_esym) consinit(); /* Load memory to UVM */ - physmem = atop(IOM_RAM_SIZE); + if (ramsize == 0 || ramsize > 512 * 1024 * 1024) + ramsize = IOM_RAM_SIZE; + physmem = atop(ramsize); kernend = atop(round_page(SH3_P1SEG_TO_PHYS(kernend))); uvm_page_physload(atop(IOM_RAM_BEGIN), - atop(IOM_RAM_BEGIN + IOM_RAM_SIZE), kernend, - atop(IOM_RAM_BEGIN + IOM_RAM_SIZE), VM_FREELIST_DEFAULT); + atop(IOM_RAM_BEGIN + ramsize), kernend, + atop(IOM_RAM_BEGIN + ramsize), VM_FREELIST_DEFAULT); /* Initialize proc0 u-area */ sh_proc0_init(); |