diff --git a/sys/arch/zaurus/conf/Makefile.zaurus.inc b/sys/arch/zaurus/conf/Makefile.zaurus.inc index c6f11040403d..1c5890e7b209 100644 --- a/sys/arch/zaurus/conf/Makefile.zaurus.inc +++ b/sys/arch/zaurus/conf/Makefile.zaurus.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.zaurus.inc,v 1.3 2011/05/05 09:07:59 nonaka Exp $ +# $NetBSD: Makefile.zaurus.inc,v 1.4 2012/01/20 15:00:27 nonaka Exp $ MACHINE_ARCH= arm CPPFLAGS+= -D${MACHINE} @@ -6,10 +6,6 @@ CPPFLAGS+= -D${MACHINE} SYSTEM_FIRST_OBJ= zaurus_start.o SYSTEM_FIRST_SFILE= ${THISARM}/zaurus/zaurus_start.S -LINKFLAGS= -T ${THISARM}/conf/ldscript - -EXTRA_CLEAN+= netbsd.map assym.d - SYSTEM_LD_TAIL_EXTRA+=; \ echo "Checking kernel size..."; \ size=`wc -c "$@" | ${TOOL_AWK} '{ print $$1 }'`; \ @@ -20,3 +16,17 @@ SYSTEM_LD_TAIL_EXTRA+=; \ echo "Fatal: kernel size: $$size, max kernel size: $$maxsize"; \ false; \ fi + +KERNEL_BASE_VIRT= $(LOADADDRESS) + +LINKFLAGS= -T ldscript + +EXTRA_CLEAN+= netbsd.map assym.d ldscript tmp + +netbsd: ldscript # XXX + +# generate ldscript from common template +ldscript: ${THISARM}/conf/ldscript.zaurus ${THISARM}/conf/Makefile.zaurus.inc Makefile + ${TOOL_SED} -e 's/@KERNEL_BASE_PHYS@/${KERNEL_BASE_PHYS}/' \ + -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' \ + ${THISARM}/conf/ldscript.zaurus > tmp && mv tmp $@ diff --git a/sys/arch/zaurus/conf/ldscript b/sys/arch/zaurus/conf/ldscript.zaurus similarity index 91% rename from sys/arch/zaurus/conf/ldscript rename to sys/arch/zaurus/conf/ldscript.zaurus index 766762760ed3..3b36444666a4 100644 --- a/sys/arch/zaurus/conf/ldscript +++ b/sys/arch/zaurus/conf/ldscript.zaurus @@ -1,11 +1,11 @@ -/* $NetBSD: ldscript,v 1.1 2006/12/17 16:07:11 peter Exp $ */ +/* $NetBSD: ldscript.zaurus,v 1.3 2012/01/20 15:00:27 nonaka Exp $ */ OUTPUT_ARCH(arm) ENTRY(KERNEL_BASE_phys) SECTIONS { - KERNEL_BASE_phys = 0xa0200000; - KERNEL_BASE_virt = 0xc0200000; + KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; + KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; /* Kernel start: */ .start (KERNEL_BASE_phys) : diff --git a/sys/arch/zaurus/conf/std.zaurus b/sys/arch/zaurus/conf/std.zaurus index d0f7ddd5caf2..3291061a50d0 100644 --- a/sys/arch/zaurus/conf/std.zaurus +++ b/sys/arch/zaurus/conf/std.zaurus @@ -1,4 +1,4 @@ -# $NetBSD: std.zaurus,v 1.3 2008/01/27 12:37:12 chris Exp $ +# $NetBSD: std.zaurus,v 1.4 2012/01/20 15:00:27 nonaka Exp $ # # standard NetBSD/zaurus options @@ -13,7 +13,8 @@ options EXEC_SCRIPT # To support easy transit to ../arch/arm/arm32 options ARM32 -#options ARM32_NEW_VM_LAYOUT # Not yet ready for prime-time +makeoptions KERNEL_BASE_PHYS="0xa0200000" +makeoptions LOADADDRESS="0xc0200000" options ARM_INTR_IMPL="" diff --git a/sys/arch/zaurus/zaurus/kloader_machdep.c b/sys/arch/zaurus/zaurus/kloader_machdep.c index e24f98cda2e6..37e627ad2e47 100644 --- a/sys/arch/zaurus/zaurus/kloader_machdep.c +++ b/sys/arch/zaurus/zaurus/kloader_machdep.c @@ -1,7 +1,7 @@ -/* $NetBSD: kloader_machdep.c,v 1.4 2011/11/20 04:07:50 nonaka Exp $ */ +/* $NetBSD: kloader_machdep.c,v 1.5 2012/01/20 15:00:27 nonaka Exp $ */ /*- - * Copyright (c) 2009 NONAKA Kimihiro + * Copyright (c) 2009-2012 NONAKA Kimihiro * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.4 2011/11/20 04:07:50 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.5 2012/01/20 15:00:27 nonaka Exp $"); #include "debug_kloader.h" @@ -44,9 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.4 2011/11/20 04:07:50 nonaka E #include -#ifndef KERNEL_BASE -#define KERNEL_BASE 0xc0000000 -#endif +#define KERNEL_TEXT_BASE ((vaddr_t)&KERNEL_BASE_virt) kloader_jumpfunc_t kloader_zaurus_jump __attribute__((__noreturn__)); kloader_bootfunc_t kloader_zaurus_boot __attribute__((__noreturn__)); @@ -78,8 +76,9 @@ kloader_zaurus_jump(kloader_bootfunc_t func, vaddr_t sp, struct kloader_bootinfo *kbi, struct kloader_page_tag *tag) { extern int kloader_howto; - void (*bootinfop)(void *, void *) = (void *)(0xc0200000 - PAGE_SIZE); - uint32_t *bootmagicp = (uint32_t *)(0xc0200000 - BOOTARGS_BUFSIZ); + extern char KERNEL_BASE_virt[]; + void (*bootinfop)(void *, void *); + uint32_t *bootmagicp; vaddr_t top, ptr; struct bootinfo *bootinfo; struct btinfo_howto *bi_howto; @@ -88,11 +87,13 @@ kloader_zaurus_jump(kloader_bootfunc_t func, vaddr_t sp, disable_interrupts(I32_bit|F32_bit); /* copy 2nd boot-loader to va=pa page */ + bootinfop = (void *)(KERNEL_TEXT_BASE - PAGE_SIZE); memmove(bootinfop, func, PAGE_SIZE); /* * make bootinfo */ + bootmagicp = (uint32_t *)(KERNEL_TEXT_BASE - BOOTARGS_BUFSIZ); memset(bootmagicp, 0, BOOTARGS_BUFSIZ); bootinfo = (struct bootinfo *)(bootmagicp + 1); bootinfo->nentries = 0; @@ -119,8 +120,7 @@ kloader_zaurus_jump(kloader_bootfunc_t func, vaddr_t sp, ptr += bi_rootdv->common.len; } - if (bootinfo->nentries > 0) - *bootmagicp = BOOTARGS_MAGIC; + *bootmagicp = BOOTARGS_MAGIC; cpu_idcache_wbinv_all(); /* jump to 2nd boot-loader */ @@ -140,7 +140,7 @@ kloader_phystov(paddr_t pa) vaddr_t va; int error; - va = KERNEL_BASE + pa - 0xa0000000UL; + va = KERNEL_BASE + pa - PXA2X0_SDRAM0_START; error = pmap_enter(pmap_kernel(), va, pa, VM_PROT_ALL, 0); if (error) { printf("%s: map failed: pa=0x%lx, va=0x%lx, error=%d\n", diff --git a/sys/arch/zaurus/zaurus/machdep.c b/sys/arch/zaurus/zaurus/machdep.c index 7a878d28dd9b..f78e27a48501 100644 --- a/sys/arch/zaurus/zaurus/machdep.c +++ b/sys/arch/zaurus/zaurus/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.27 2011/11/12 04:39:19 nonaka Exp $ */ +/* $NetBSD: machdep.c,v 1.28 2012/01/20 15:00:27 nonaka Exp $ */ /* $OpenBSD: zaurus_machdep.c,v 1.25 2006/06/20 18:24:04 todd Exp $ */ /* @@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.27 2011/11/12 04:39:19 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.28 2012/01/20 15:00:27 nonaka Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -179,8 +179,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.27 2011/11/12 04:39:19 nonaka Exp $"); #endif /* Kernel text starts 2MB in from the bottom of the kernel address space. */ -#define KERNEL_TEXT_OFFSET 0x00200000 -#define KERNEL_TEXT_BASE (KERNEL_BASE + KERNEL_TEXT_OFFSET) +#define KERNEL_TEXT_BASE ((vaddr_t)&KERNEL_BASE_virt) #ifndef KERNEL_VM_BASE #define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000) #endif @@ -265,7 +264,7 @@ struct bootinfo _bootinfo; struct bootinfo *bootinfo; struct btinfo_howto *bi_howto; -#define KERNEL_BASE_PHYS (PXA2X0_SDRAM0_START + KERNEL_TEXT_OFFSET) +#define KERNEL_BASE_PHYS ((paddr_t)&KERNEL_BASE_phys) #define BOOTINFO_PAGE (KERNEL_BASE_PHYS - PAGE_SIZE) /* Prototypes */ @@ -640,6 +639,7 @@ initarm(void *arg) extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */ #endif extern vaddr_t xscale_cache_clean_addr; + extern char KERNEL_BASE_phys[], KERNEL_BASE_virt[]; int loop; int loop1; u_int l1pagetable; @@ -931,8 +931,9 @@ initarm(void *arg) textsize = (textsize + PGOFSET) & ~PGOFSET; totalsize = (totalsize + PGOFSET) & ~PGOFSET; - - logical = KERNEL_TEXT_OFFSET; /* offset of kernel in RAM */ + + /* offset of kernel in RAM */ + logical = KERNEL_TEXT_BASE - KERNEL_BASE; logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical, physical_start + logical, textsize,