summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2022-11-04 10:51:16 +0000
committerjmcneill <jmcneill@NetBSD.org>2022-11-04 10:51:16 +0000
commit1b9ecf2f5f48ebf786044ea2e6749fd26232eeb9 (patch)
treeb3cc433e84b2ee94acc684366f76801136307a11
parentd1901be670ff24ed069ab3cd545cd70961997857 (diff)
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.
-rw-r--r--sys/arch/evbarm/fdt/fdt_machdep.c9
-rw-r--r--sys/dev/fdt/fdt_memory.c8
-rw-r--r--sys/dev/fdt/fdt_memory.h8
3 files changed, 13 insertions, 12 deletions
diff --git a/sys/arch/evbarm/fdt/fdt_machdep.c b/sys/arch/evbarm/fdt/fdt_machdep.c
index 7bb6df1e51f..c009aaa405d 100644
--- a/sys/arch/evbarm/fdt/fdt_machdep.c
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c
@@ -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 <jmcneill@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_memory *m, void *arg)
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_memory *m, void *arg)
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;
diff --git a/sys/dev/fdt/fdt_memory.c b/sys/dev/fdt/fdt_memory.c
index 61cc08736bc..5cf2344d526 100644
--- a/sys/dev/fdt/fdt_memory.c
+++ b/sys/dev/fdt/fdt_memory.c
@@ -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,v 1.7 2022/10/20 11:38:21 skrll Exp $")
#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;
diff --git a/sys/dev/fdt/fdt_memory.h b/sys/dev/fdt/fdt_memory.h
index 9fd69ca4bd0..4e7cfaa688f 100644
--- a/sys/dev/fdt/fdt_memory.h
+++ b/sys/dev/fdt/fdt_memory.h
@@ -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;