From fca33a07e08b4c987c79a1ab442941c25aa6ea15 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 19 May 2015 00:05:59 +0000 Subject: [PATCH] use the same va entry point on all armv7 socs Similiar changes were made in bitrig by Patrick Wildt. As part of this change the physical load address for imx and sunxi have changed. Any u-boot settings that include it will need to be modified. imx: 0x10800000 -> 0x10300000 sunxi: 0x40800000 -> 0x40300000 Tested by bmercer, canacar and myself. ok bmercer@ --- distrib/armv7/ramdisk/Makefile | 6 ++-- etc/etc.armv7/Makefile.inc | 6 ++-- sys/arch/armv7/armv7/armv7_machdep.c | 23 +++++++++++++-- sys/arch/armv7/armv7/armv7_machdep.h | 3 +- sys/arch/armv7/conf/GENERIC-IMX | 9 ++---- sys/arch/armv7/conf/GENERIC-OMAP | 5 +--- sys/arch/armv7/conf/GENERIC-SUNXI | 9 ++---- sys/arch/armv7/conf/Makefile.armv7 | 7 +++-- sys/arch/armv7/conf/RAMDISK-IMX | 9 ++---- sys/arch/armv7/conf/RAMDISK-OMAP | 5 +--- sys/arch/armv7/conf/RAMDISK-SUNXI | 9 ++---- sys/arch/armv7/imx/imx_machdep.c | 19 +------------ sys/arch/armv7/omap/omap_machdep.c | 42 +--------------------------- sys/arch/armv7/sunxi/sunxi_machdep.c | 27 +----------------- 14 files changed, 49 insertions(+), 130 deletions(-) diff --git a/distrib/armv7/ramdisk/Makefile b/distrib/armv7/ramdisk/Makefile index fd5ec8cff56..9e5f6e4c16a 100644 --- a/distrib/armv7/ramdisk/Makefile +++ b/distrib/armv7/ramdisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2013/11/01 20:35:52 jasper Exp $ +# $OpenBSD: Makefile,v 1.8 2015/05/19 00:05:59 jsg Exp $ REV= ${OSrev} @@ -22,8 +22,8 @@ VND_CRDEV= /dev/r${VND}c PID!= echo $$$$ KERNADDR_OMAP=0x80300000 -KERNADDR_IMX=0x10800000 -KERNADDR_SUNXI=0x40800000 +KERNADDR_IMX=0x10300000 +KERNADDR_SUNXI=0x40300000 DISKTYPE= rdroot NBLKS= 10240 diff --git a/etc/etc.armv7/Makefile.inc b/etc/etc.armv7/Makefile.inc index 4f44675204b..2c4008b8873 100644 --- a/etc/etc.armv7/Makefile.inc +++ b/etc/etc.armv7/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.6 2015/01/26 01:55:55 jsg Exp $ +# $OpenBSD: Makefile.inc,v 1.7 2015/05/19 00:05:59 jsg Exp $ ALLSOC=IMX OMAP SUNXI KERNELS= @@ -12,8 +12,8 @@ MDEXT+= bsd.rd.${SOC}.umg .endfor KERNADDR_OMAP=0x80300000 -KERNADDR_IMX=0x10800000 -KERNADDR_SUNXI=0x40800000 +KERNADDR_IMX=0x10300000 +KERNADDR_SUNXI=0x40300000 .for CONF K in ${KERNELS} . if !target($K) diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index 6bb8746ad9b..6e8087ee38d 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.c,v 1.22 2015/05/15 15:35:43 jsg Exp $ */ +/* $OpenBSD: armv7_machdep.c,v 1.23 2015/05/19 00:05:59 jsg Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -209,6 +209,7 @@ int bootstrap_bs_map(void *, bus_addr_t, bus_size_t, int, void process_kernel_args(char *); void parse_uboot_tags(void *); void consinit(void); +void bootconfig_dram(BootConfig *, psize_t *, psize_t *); bs_protos(bs_notimpl); @@ -437,7 +438,7 @@ initarm(void *arg0, void *arg1, void *arg2) #endif /* RAMDISK_HOOKS */ /* normally u-boot will set up bootconfig.dramblocks */ - platform_bootconfig_dram(&bootconfig, &memstart, &memsize); + bootconfig_dram(&bootconfig, &memstart, &memsize); /* * Set up the variables that define the availablilty of @@ -849,3 +850,21 @@ board_startup(void) #endif } } + +void +bootconfig_dram(BootConfig *bootconfig, psize_t *memstart, psize_t *memsize) +{ + int loop; + + if (bootconfig->dramblocks == 0) + panic("%s: dramblocks not set up!", __func__); + + *memstart = bootconfig->dram[0].address; + *memsize = bootconfig->dram[0].pages * PAGE_SIZE; + printf("memory size derived from u-boot\n"); + for (loop = 0; loop < bootconfig->dramblocks; loop++) { + printf("bootconf.mem[%d].address = %08x pages %d/0x%08x\n", + loop, bootconfig->dram[loop].address, bootconfig->dram[loop].pages, + bootconfig->dram[loop].pages * PAGE_SIZE); + } +} diff --git a/sys/arch/armv7/armv7/armv7_machdep.h b/sys/arch/armv7/armv7/armv7_machdep.h index 0243a8a4682..02fb5f033c8 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.h +++ b/sys/arch/armv7/armv7/armv7_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.h,v 1.2 2015/05/15 15:35:43 jsg Exp $ */ +/* $OpenBSD: armv7_machdep.h,v 1.3 2015/05/19 00:05:59 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -22,7 +22,6 @@ void platform_powerdown(void); void platform_watchdog_reset(void); void platform_init_cons(void); const char *platform_board_name(void); -void platform_bootconfig_dram(BootConfig *, psize_t *, psize_t *); void platform_disable_l2_if_needed(void); extern const char *platform_boot_name; diff --git a/sys/arch/armv7/conf/GENERIC-IMX b/sys/arch/armv7/conf/GENERIC-IMX index 4276c42b46a..d5b548b2e33 100644 --- a/sys/arch/armv7/conf/GENERIC-IMX +++ b/sys/arch/armv7/conf/GENERIC-IMX @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC-IMX,v 1.12 2015/04/16 09:09:49 mpi Exp $ +# $OpenBSD: GENERIC-IMX,v 1.13 2015/05/19 00:05:59 jsg Exp $ # # GENERIC machine description file # @@ -21,11 +21,8 @@ machine armv7 arm include "../../../conf/GENERIC" -makeoptions KERNEL_BASE_PHYS="0x10800000" -makeoptions KERNEL_BASE_VIRT="0xc0800000" -options BUILD_STARTUP_PAGETABLE -options STARTUP_PAGETABLE_ADDR=0x10200000 -options SDRAM_START="0x10000000" +makeoptions KERNEL_BASE_PHYS="0x10300000" +makeoptions KERNEL_BASE_VIRT="0xc0300000" #options APERTURE diff --git a/sys/arch/armv7/conf/GENERIC-OMAP b/sys/arch/armv7/conf/GENERIC-OMAP index c31c91ef8ad..1209f346816 100644 --- a/sys/arch/armv7/conf/GENERIC-OMAP +++ b/sys/arch/armv7/conf/GENERIC-OMAP @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC-OMAP,v 1.15 2015/04/16 09:09:49 mpi Exp $ +# $OpenBSD: GENERIC-OMAP,v 1.16 2015/05/19 00:05:59 jsg Exp $ # # GENERIC machine description file # @@ -23,9 +23,6 @@ include "../../../conf/GENERIC" makeoptions KERNEL_BASE_PHYS="0x80300000" makeoptions KERNEL_BASE_VIRT="0xc0300000" -options BUILD_STARTUP_PAGETABLE -options STARTUP_PAGETABLE_ADDR=0x80200000 -options SDRAM_START="0x80000000" option CONF_HAVE_GPIO diff --git a/sys/arch/armv7/conf/GENERIC-SUNXI b/sys/arch/armv7/conf/GENERIC-SUNXI index 8db66cf173f..4a6536822c6 100644 --- a/sys/arch/armv7/conf/GENERIC-SUNXI +++ b/sys/arch/armv7/conf/GENERIC-SUNXI @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC-SUNXI,v 1.13 2015/04/16 09:09:49 mpi Exp $ +# $OpenBSD: GENERIC-SUNXI,v 1.14 2015/05/19 00:05:59 jsg Exp $ # # GENERIC machine description file # @@ -21,11 +21,8 @@ machine armv7 arm include "../../../conf/GENERIC" -makeoptions KERNEL_BASE_PHYS="0x40800000" -makeoptions KERNEL_BASE_VIRT="0xc0800000" -options BUILD_STARTUP_PAGETABLE -options STARTUP_PAGETABLE_ADDR=0x40200000 -options SDRAM_START="0x40000000" +makeoptions KERNEL_BASE_PHYS="0x40300000" +makeoptions KERNEL_BASE_VIRT="0xc0300000" option CONF_HAVE_GPIO diff --git a/sys/arch/armv7/conf/Makefile.armv7 b/sys/arch/armv7/conf/Makefile.armv7 index 3b27b9d2a58..417492e9a7e 100644 --- a/sys/arch/armv7/conf/Makefile.armv7 +++ b/sys/arch/armv7/conf/Makefile.armv7 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.armv7,v 1.7 2015/01/13 01:12:49 deraadt Exp $ +# $OpenBSD: Makefile.armv7,v 1.8 2015/05/19 00:05:59 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -72,8 +72,9 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJ} SYSTEM_LD_HEAD= @rm -f $@ SYSTEM_LD_HEAD+=; \ cat ${_archdir}/conf/ldscript.head ${_archdir}/conf/ldscript.tail | \ - sed -e 's/@KERNEL_BASE_PHYS@/${KERNEL_BASE_PHYS}/' \ - -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' > ldscript + sed -e 's/@KERNEL_BASE_PHYS@/0/' \ + -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' \ + -e 's/(KERNEL_BASE_phys)/(KERNEL_BASE_virt)/' > ldscript SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS} diff --git a/sys/arch/armv7/conf/RAMDISK-IMX b/sys/arch/armv7/conf/RAMDISK-IMX index 62ad730dacc..ce0d78149a3 100644 --- a/sys/arch/armv7/conf/RAMDISK-IMX +++ b/sys/arch/armv7/conf/RAMDISK-IMX @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK-IMX,v 1.14 2015/01/04 20:55:38 uaa Exp $ +# $OpenBSD: RAMDISK-IMX,v 1.15 2015/05/19 00:05:59 jsg Exp $ machine armv7 arm maxusers 4 @@ -20,11 +20,8 @@ option INET option INET6 option EXT2FS -makeoptions KERNEL_BASE_PHYS="0x10800000" -makeoptions KERNEL_BASE_VIRT="0xc0800000" -option BUILD_STARTUP_PAGETABLE -option STARTUP_PAGETABLE_ADDR=0x10200000 -option SDRAM_START="0x10000000" +makeoptions KERNEL_BASE_PHYS="0x10300000" +makeoptions KERNEL_BASE_VIRT="0xc0300000" option CPU_ARMv7 # Support the ARMv7 config bsd root on rd0a swap on rd0b diff --git a/sys/arch/armv7/conf/RAMDISK-OMAP b/sys/arch/armv7/conf/RAMDISK-OMAP index da15920bb36..aded0541b82 100644 --- a/sys/arch/armv7/conf/RAMDISK-OMAP +++ b/sys/arch/armv7/conf/RAMDISK-OMAP @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK-OMAP,v 1.11 2014/11/04 12:26:09 jsg Exp $ +# $OpenBSD: RAMDISK-OMAP,v 1.12 2015/05/19 00:05:59 jsg Exp $ machine armv7 arm maxusers 4 @@ -21,9 +21,6 @@ option INET6 makeoptions KERNEL_BASE_PHYS="0x80300000" makeoptions KERNEL_BASE_VIRT="0xc0300000" -option BUILD_STARTUP_PAGETABLE -option STARTUP_PAGETABLE_ADDR=0x80200000 -option SDRAM_START="0x80000000" option CPU_ARMv7 # Support the ARMv7 config bsd root on rd0a swap on rd0b diff --git a/sys/arch/armv7/conf/RAMDISK-SUNXI b/sys/arch/armv7/conf/RAMDISK-SUNXI index 58016169ec0..6d1f055c44d 100644 --- a/sys/arch/armv7/conf/RAMDISK-SUNXI +++ b/sys/arch/armv7/conf/RAMDISK-SUNXI @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK-SUNXI,v 1.12 2014/11/24 02:03:37 brad Exp $ +# $OpenBSD: RAMDISK-SUNXI,v 1.13 2015/05/19 00:05:59 jsg Exp $ machine armv7 arm maxusers 4 @@ -19,11 +19,8 @@ option MSDOSFS option INET option INET6 -makeoptions KERNEL_BASE_PHYS="0x40800000" -makeoptions KERNEL_BASE_VIRT="0xc0800000" -option BUILD_STARTUP_PAGETABLE -option STARTUP_PAGETABLE_ADDR=0x40200000 -option SDRAM_START="0x40000000" +makeoptions KERNEL_BASE_PHYS="0x40300000" +makeoptions KERNEL_BASE_VIRT="0xc0300000" option CPU_ARMv7 # Support the ARMv7 config bsd root on rd0a swap on rd0b diff --git a/sys/arch/armv7/imx/imx_machdep.c b/sys/arch/armv7/imx/imx_machdep.c index 67099f59145..ce90a8cf861 100644 --- a/sys/arch/armv7/imx/imx_machdep.c +++ b/sys/arch/armv7/imx/imx_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imx_machdep.c,v 1.13 2015/05/15 15:35:43 jsg Exp $ */ +/* $OpenBSD: imx_machdep.c,v 1.14 2015/05/19 00:05:59 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -97,23 +97,6 @@ platform_board_name(void) return (imx_board_name()); } -void -platform_bootconfig_dram(BootConfig *bootconfig, psize_t *memstart, psize_t *memsize) -{ - if (bootconfig->dramblocks == 0) { - *memstart = SDRAM_START; - *memsize = 0x10000000; /* 256 MB */ - /* Fake bootconfig structure for the benefit of pmap.c */ - /* XXX must make the memory description h/w independant */ - bootconfig->dram[0].address = *memstart; - bootconfig->dram[0].pages = *memsize / PAGE_SIZE; - bootconfig->dramblocks = 1; - } else { - *memstart = bootconfig->dram[0].address; - *memsize = bootconfig->dram[0].pages * PAGE_SIZE; - } -} - void platform_disable_l2_if_needed(void) { diff --git a/sys/arch/armv7/omap/omap_machdep.c b/sys/arch/armv7/omap/omap_machdep.c index f3bb79d78e5..ca67d37d138 100644 --- a/sys/arch/armv7/omap/omap_machdep.c +++ b/sys/arch/armv7/omap/omap_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap_machdep.c,v 1.4 2015/05/15 15:35:43 jsg Exp $ */ +/* $OpenBSD: omap_machdep.c,v 1.5 2015/05/19 00:05:59 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -95,46 +95,6 @@ platform_board_name(void) return (omap_board_name()); } -void -platform_bootconfig_dram(BootConfig *bootconfig, psize_t *memstart, psize_t *memsize) -{ - uint32_t sdrc_mcfg_0, sdrc_mcfg_1, memsize0, memsize1; - int loop; - - if (bootconfig->dramblocks == 0) { - sdrc_mcfg_0 = *(uint32_t *)0x6d000080; - sdrc_mcfg_1 = *(uint32_t *)0x6d0000b0; - memsize0 = (((sdrc_mcfg_0 >> 8))&0x3ff) * (2 * 1024 * 1024); - memsize1 = (((sdrc_mcfg_1 >> 8))&0x3ff) * (2 * 1024 * 1024); - *memsize = memsize0 + memsize1; - - *memstart = SDRAM_START; - *memsize = 0x02000000; /* 32MB */ - /* Fake bootconfig structure for the benefit of pmap.c */ - /* XXX must make the memory description h/w independant */ - bootconfig->dram[0].address = *memstart; - bootconfig->dram[0].pages = memsize0 / PAGE_SIZE; - bootconfig->dramblocks = 1; - if (memsize1 != 0) { - bootconfig->dram[1].address = bootconfig->dram[0].address - + memsize0; /* XXX */ - bootconfig->dram[1].pages = memsize1 / PAGE_SIZE; - bootconfig->dramblocks++; /* both banks populated */ - } - } else { - /* doesn't deal with multiple segments, hopefully u-boot collaped them into one */ - *memstart = bootconfig->dram[0].address; - *memsize = bootconfig->dram[0].pages * PAGE_SIZE; - printf("memory size derived from u-boot\n"); - for (loop = 0; loop < bootconfig->dramblocks; loop++) { - printf("bootconf.mem[%d].address = %08x pages %d/0x%08x\n", - loop, bootconfig->dram[0].address, bootconfig->dram[0].pages, - bootconfig->dram[0].pages * PAGE_SIZE); - } - } - -} - void platform_disable_l2_if_needed(void) { diff --git a/sys/arch/armv7/sunxi/sunxi_machdep.c b/sys/arch/armv7/sunxi/sunxi_machdep.c index 5972b1c9784..210fb292cb0 100644 --- a/sys/arch/armv7/sunxi/sunxi_machdep.c +++ b/sys/arch/armv7/sunxi/sunxi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunxi_machdep.c,v 1.6 2015/05/15 15:35:43 jsg Exp $ */ +/* $OpenBSD: sunxi_machdep.c,v 1.7 2015/05/19 00:05:59 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -84,31 +84,6 @@ platform_board_name(void) return (sunxi_board_name()); } -void -platform_bootconfig_dram(BootConfig *bootconfig, psize_t *memstart, psize_t *memsize) -{ - int loop; - - if (bootconfig->dramblocks == 0) { - *memstart = SDRAM_START; - *memsize = 0x10000000; /* 256 MB */ - /* Fake bootconfig structure for the benefit of pmap.c */ - /* XXX must make the memory description h/w independant */ - bootconfig->dram[0].address = *memstart; - bootconfig->dram[0].pages = *memsize / PAGE_SIZE; - bootconfig->dramblocks = 1; - } else { - *memstart = bootconfig->dram[0].address; - *memsize = bootconfig->dram[0].pages * PAGE_SIZE; - printf("memory size derived from u-boot\n"); - for (loop = 0; loop < bootconfig->dramblocks; loop++) { - printf("bootconf.mem[%d].address = %08x pages %d/0x%08x\n", - loop, bootconfig->dram[0].address, bootconfig->dram[0].pages, - bootconfig->dram[0].pages * PAGE_SIZE); - } - } -} - void platform_disable_l2_if_needed(void) { -- 2.20.1