git: 46c2d93c5728 - main - loader.efi: Allocate ram disks as EfiReservedMemoryType
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:14:43 UTC
The branch main has been updated by olivier:
URL: https://cgit.FreeBSD.org/src/commit/?id=46c2d93c572865f6441788ad8416ff7ff971829a
commit 46c2d93c572865f6441788ad8416ff7ff971829a
Author: Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-11-08 20:35:08 +0000
Commit: Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-11-12 09:08:46 +0000
loader.efi: Allocate ram disks as EfiReservedMemoryType
The kernel adds EfiLoaderData ranges to physmap and reuses the pages, so a
memdisk=root is overwritten while the system runs. The kernel skips
EfiReservedMemoryType, which ACPI requires for a registered RAM disk.
Fixes: 85fb40bad584
Reviewed by: imp
Approved by: imp
Sponsored by: Netflix
Differential Revision: https://ron-dev.freebsd.org/FreeBSD/src/pulls/96
---
stand/efi/loader/decompress.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/stand/efi/loader/decompress.c b/stand/efi/loader/decompress.c
index fbf800f87862..11199e1ed3bc 100644
--- a/stand/efi/loader/decompress.c
+++ b/stand/efi/loader/decompress.c
@@ -20,13 +20,14 @@
#define ULL(x) ((unsigned long long)(x))
/*
- * 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.
+ * RamDisks live for the life of the next stage or longer. ACPI requires this
+ * for disks registered with the RamDisk protocol, and most operating systems
+ * will ignore this memory if not given other instructions. The FreeBSD
+ * kernel will skip it, but will properly use reserved memory for ram disks
+ * when told about them by the boot loader.
*/
-static EFI_MEMORY_TYPE mem_type = EfiLoaderData;
+
+static EFI_MEMORY_TYPE mem_type = EfiReservedMemoryType;
struct decomp_state
{