Module Name: src Committed By: jmcneill Date: Fri Nov 4 10:51:17 UTC 2022
Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c src/sys/dev/fdt: fdt_memory.c fdt_memory.h Log Message: Size boot_physmem with FDT_MEMORY_RANGES. This effectively increases the size from 64 to 256 entries for Arm kernels. It turns out on large systems that memory can be quite fragmented by UEFI. Increasing the size of this just kicks the can down the road, we need a better solution to deal with boot_physmem/fdt_memory/bootparams.dram sizing. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fdt_memory.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.98 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.99 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.98 Fri Oct 21 05:51:08 2022 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Nov 4 10:51:17 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.98 2022/10/21 05:51:08 skrll Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.98 2022/10/21 05:51:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bootconfig.h" @@ -185,9 +185,8 @@ fdt_add_dram_blocks(const struct fdt_mem bc->dramblocks++; } -#define MAX_PHYSMEM 64 static int nfdt_physmem = 0; -static struct boot_physmem fdt_physmem[MAX_PHYSMEM]; +static struct boot_physmem fdt_physmem[FDT_MEMORY_RANGES]; static void fdt_add_boot_physmem(const struct fdt_memory *m, void *arg) @@ -204,7 +203,7 @@ fdt_add_boot_physmem(const struct fdt_me struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++]; - KASSERT(nfdt_physmem <= MAX_PHYSMEM); + KASSERT(nfdt_physmem <= FDT_MEMORY_RANGES); bp->bp_start = atop(saddr); bp->bp_pages = atop(eaddr) - bp->bp_start; Index: src/sys/dev/fdt/fdt_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.7 src/sys/dev/fdt/fdt_memory.c:1.8 --- src/sys/dev/fdt/fdt_memory.c:1.7 Thu Oct 20 11:38:21 2022 +++ src/sys/dev/fdt/fdt_memory.c Fri Nov 4 10:51:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $"); #include <sys/param.h> #include <sys/queue.h> @@ -41,10 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_memory.c #include <dev/fdt/fdtvar.h> #include <dev/fdt/fdt_memory.h> -#ifndef FDT_MEMORY_RANGES -#define FDT_MEMORY_RANGES 256 -#endif - struct fdt_memory_range { struct fdt_memory mr_mem; bool mr_used; Index: src/sys/dev/fdt/fdt_memory.h diff -u src/sys/dev/fdt/fdt_memory.h:1.1 src/sys/dev/fdt/fdt_memory.h:1.2 --- src/sys/dev/fdt/fdt_memory.h:1.1 Sat Dec 12 09:27:31 2020 +++ src/sys/dev/fdt/fdt_memory.h Fri Nov 4 10:51:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.h,v 1.1 2020/12/12 09:27:31 skrll Exp $ */ +/* $NetBSD: fdt_memory.h,v 1.2 2022/11/04 10:51:16 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,6 +32,12 @@ #ifndef _DEV_FDT_FDT_MEMORY_H_ #define _DEV_FDT_FDT_MEMORY_H_ +#include "opt_fdt.h" + +#ifndef FDT_MEMORY_RANGES +#define FDT_MEMORY_RANGES 256 +#endif + struct fdt_memory { uint64_t start; uint64_t end;