Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.55 retrieving revision 1.63 diff -u -p -r1.55 -r1.63 --- src/sys/arch/evbarm/fdt/fdt_machdep.c 2018/11/15 23:53:40 1.55 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c 2019/07/15 08:44:33 1.63 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.55 2018/11/15 23:53:40 jmcneill Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.63 2019/07/15 08:44:33 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.55 2018/11/15 23:53:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.63 2019/07/15 08:44:33 skrll Exp $"); #include "opt_machdep.h" #include "opt_bootconfig.h" @@ -158,8 +158,7 @@ static struct consdev earlycons = { #endif /* - * ARM: Get the first physically contiguous region of memory. - * ARM64: Get all of physical memory, including holes. + * Get all of physical memory, including holes. */ static void fdt_get_memory(uint64_t *pstart, uint64_t *pend) @@ -184,14 +183,8 @@ fdt_get_memory(uint64_t *pstart, uint64_ VPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", index, cur_addr, cur_size); -#ifdef __aarch64__ if (cur_addr + cur_size > *pend) *pend = cur_addr + cur_size; -#else - /* If subsequent entries follow the previous, append them. */ - if (*pend == cur_addr) - *pend = cur_addr + cur_size; -#endif } } @@ -258,14 +251,22 @@ static struct boot_physmem fdt_physmem[M static void fdt_add_boot_physmem(const struct fdt_memory *m, void *arg) { - struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++]; + const paddr_t saddr = round_page(m->start); + const paddr_t eaddr = trunc_page(m->end); - VPRINTF(" %" PRIx64 " - %" PRIx64 "\n", m->start, m->end - 1); + VPRINTF(" %" PRIx64 " - %" PRIx64, m->start, m->end - 1); + if (saddr >= eaddr) { + VPRINTF(" skipped\n"); + return; + } + VPRINTF("\n"); + + struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++]; KASSERT(nfdt_physmem <= MAX_PHYSMEM); - bp->bp_start = atop(round_page(m->start)); - bp->bp_pages = atop(trunc_page(m->end)) - bp->bp_start; + bp->bp_start = atop(saddr); + bp->bp_pages = atop(eaddr) - bp->bp_start; bp->bp_freelist = VM_FREELIST_DEFAULT; #ifdef _LP64 @@ -545,24 +546,36 @@ initarm(void *arg) u_int sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem, nfdt_physmem); - VPRINTF("mpstart\n"); - if (plat->ap_mpstart) - plat->ap_mpstart(); + /* + * initarm_common flushes cache if required before AP start + */ + error = 0; + if ((boothowto & RB_MD1) == 0) { + VPRINTF("mpstart\n"); + if (plat->ap_mpstart) + error = plat->ap_mpstart(); + } + if (error) + return sp; /* * Now we have APs started the pages used for stacks and L1PT can * be given to uvm */ - extern char __start__init_memory[], __stop__init_memory[]; + extern char const __start__init_memory[]; + extern char const __stop__init_memory[] __weak; + if (__start__init_memory != __stop__init_memory) { const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory); const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory); const paddr_t spg = atop(spa); const paddr_t epg = atop(epa); + VPRINTF(" start %08lx end %08lx... " + "loading in freelist %d\n", spa, epa, VM_FREELIST_DEFAULT); + uvm_page_physload(spg, epg, spg, epg, VM_FREELIST_DEFAULT); - VPRINTF(" start %08lx end %08lx", ptoa(spa), ptoa(epa)); } return sp;