? rockchip-2gb.patch ? conf/ROCKCHIP.local Index: conf/ROCKCHIP =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/conf/ROCKCHIP,v retrieving revision 1.4 diff -u -p -r1.4 ROCKCHIP --- conf/ROCKCHIP 28 Dec 2014 16:04:05 -0000 1.4 +++ conf/ROCKCHIP 28 Dec 2014 23:35:18 -0000 @@ -166,7 +166,7 @@ a9tmr0 at armperiph? # Global Timer a9wdt0 at armperiph? # Watchdog # Specify the memory size in megabytes. -options MEMSIZE=1024 +#options MEMSIZE=1024 # L3 Interconnect #L3i0 at mainbus? Index: conf/mk.rockchip =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/conf/mk.rockchip,v retrieving revision 1.2 diff -u -p -r1.2 mk.rockchip --- conf/mk.rockchip 28 Dec 2014 16:29:21 -0000 1.2 +++ conf/mk.rockchip 28 Dec 2014 23:35:18 -0000 @@ -14,8 +14,8 @@ MKUBOOTIMAGEARGS+= -n "NetBSD/$(BOARDTYP MKUBOOTIMAGEARGS_NONE= ${MKUBOOTIMAGEARGS} -C none MKUBOOTIMAGEARGS_GZ= ${MKUBOOTIMAGEARGS} -C gz -KERNEL_BASE_PHYS=0x60408000 -KERNEL_BASE_VIRT=0x80408000 +KERNEL_BASE_PHYS=0x80000000 +KERNEL_BASE_VIRT=0x80000000 SYSTEM_LD_TAIL_EXTRA+=; \ echo ${OBJCOPY} -S -O binary $@ $@.bin; \ Index: conf/std.rockchip =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/conf/std.rockchip,v retrieving revision 1.1 diff -u -p -r1.1 std.rockchip --- conf/std.rockchip 26 Dec 2014 16:53:33 -0000 1.1 +++ conf/std.rockchip 28 Dec 2014 23:35:18 -0000 @@ -16,8 +16,9 @@ options __HAVE_MM_MD_DIRECT_MAPPED_PHYS options TPIDRPRW_IS_CURCPU options KERNEL_BASE_EXT=0x80000000 options FPU_VFP +options PMAP_NEED_ALLOC_POOLPAGE -makeoptions LOADADDRESS="0x60408000" +makeoptions LOADADDRESS="0x80000000" makeoptions BOARDTYPE="rockchip" makeoptions BOARDMKFRAG="${THISARM}/conf/mk.rockchip" Index: rockchip/rockchip_machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/rockchip/rockchip_machdep.c,v retrieving revision 1.10 diff -u -p -r1.10 rockchip_machdep.c --- rockchip/rockchip_machdep.c 28 Dec 2014 21:34:33 -0000 1.10 +++ rockchip/rockchip_machdep.c 28 Dec 2014 23:35:18 -0000 @@ -402,11 +402,18 @@ rockchip_get_memsize(void) static void rockchip_parse_atag(u_int atag_base) { - uint32_t *p = (uint32_t *)atag_base; + const uint32_t *p = (const uint32_t *)atag_base; int count; +#ifdef VERBOSE_INIT_ARM + printf("ATAG: checking %#x\n", atag_base); +#endif + /* List must start with ATAG_CORE */ if (p[0] != 5 || p[1] != ATAG_CORE) { +#ifdef VERBOSE_INIT_ARM + printf("ATAG: not found\n"); +#endif return; } @@ -424,7 +431,8 @@ rockchip_parse_atag(u_int atag_base) switch (tag) { case ATAG_CMDLINE: - strlcpy(bootargs, (char *)&p[2], sizeof(bootargs)); + strlcpy(bootargs, (const char *)&p[2], + sizeof(bootargs)); #ifdef VERBOSE_INIT_ARM printf("ATAG_CMDLINE: \"%s\"\n", bootargs); #endif @@ -438,6 +446,15 @@ rockchip_parse_atag(u_int atag_base) } } +#ifdef PMAP_NEED_ALLOC_POOLPAGE +static struct boot_physmem bp_highgig = { + .bp_start = 0x60000000 / NBPG, + .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, + .bp_freelist = VM_FREELIST_ISADMA, + .bp_flags = 0, +}; +#endif + /* * u_int initarm(...) * @@ -529,15 +546,6 @@ initarm(void *arg) ram_size = rockchip_get_memsize(); -#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS - if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) { - printf("%s: dropping RAM size from %luMB to %uMB\n", - __func__, (unsigned long) (ram_size >> 20), - (KERNEL_VM_BASE - KERNEL_BASE) >> 20); - ram_size = KERNEL_VM_BASE - KERNEL_BASE; - } -#endif - /* * If MEMSIZE specified less than what we really have, limit ourselves * to that. @@ -557,10 +565,18 @@ initarm(void *arg) #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS const bool mapallmem_p = true; - KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE); +#ifndef PMAP_NEED_ALLOC_POOLPAGE + if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) { + printf("%s: dropping RAM size from %luMB to %uMB\n", + __func__, (unsigned long) (ram_size >> 20), + (KERNEL_VM_BASE - KERNEL_BASE) >> 20); + ram_size = KERNEL_VM_BASE - KERNEL_BASE; + } +#endif #else const bool mapallmem_p = false; #endif + KASSERT((armreg_pfr1_read() & ARM_PFR1_SEC_MASK) != 0); arm32_bootmem_init(bootconfig.dram[0].address, ram_size, @@ -568,6 +584,9 @@ initarm(void *arg) arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap, mapallmem_p); + printf("uboot_args[2] = %#x\n", uboot_args[2]); + printf("atags @ #%x ?\n", uboot_args[2] + KERNEL_BASE_VOFFSET); + if (mapallmem_p) { /* "bootargs" atag start is passed as 3rd argument to kernel */ if (uboot_args[2] - 0x60000000 < ram_size) { @@ -588,6 +607,15 @@ initarm(void *arg) use_fb_console = true; } +#ifdef PMAP_NEED_ALLOC_POOLPAGE + if (atop(ram_size) > bp_highgig.bp_pages) { + bp_highgig.bp_start += atop(ram_size) - bp_highgig.bp_pages; + arm_poolpage_vmfreelist = bp_highgig.bp_freelist; + return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, + &bp_highgig, 1); + } +#endif + return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); }