aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-09-24 06:48:16 +0000
committerWarner Losh <imp@FreeBSD.org>2026-09-24 06:59:42 +0000
commit85fb40bad584e7d8c503e5a99bb81cc2d3cf9fee (patch)
tree0be136fc2ba74b5af6a217a4408be874dead50db
parente960cb4c033c8f65af1e8b09310c1bd5414f21ac (diff)
loader.efi: Use EfiLoaderData memory type for ram disks
For the images we read into the memory, use EfiLoaderData memory type instead of EfiReservedMemoryType. The kernel handles the former properly and won't reallocate it. While the latter isn't necessarily mapped, which can cause ram disks to fault when loaded. memdisk_uefi.efi used the latter type, but also registered the device as an ACPI RAM disk, which we don't do. Fixes: afee781523e45 Sponsored by: Netflix
-rw-r--r--stand/efi/loader/decompress.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/stand/efi/loader/decompress.c b/stand/efi/loader/decompress.c
index e10daaa423ad..fbf800f87862 100644
--- a/stand/efi/loader/decompress.c
+++ b/stand/efi/loader/decompress.c
@@ -19,7 +19,14 @@
#define ULL(x) ((unsigned long long)(x))
-static EFI_MEMORY_TYPE mem_type = EfiReservedMemoryType;
+/*
+ * While memdisk_uefi.efi used EfiReservedMemoryType, we need to use
+ * EfiLoaderData instead, the standard memory type the loader uses to pass
+ * memory to the kernel. This is also safe if we're chain booting to another efi
+ * progarm since the memory will be available to that program. The other type
+ * isn't necessarily in the pmap, so the md driver fails.
+ */
+static EFI_MEMORY_TYPE mem_type = EfiLoaderData;
struct decomp_state
{