The UEFI standard indicates that the EfiBootServicesCode and
EfiBootServicesData memory types are available for general use after
ExitBootServices() has been called.  So unless the firmware is really
really buggy, this should be safe and give us a bit more memory.

Tested this on three different UEFI implementations already.  But a
bit more testing is always good.

The reason I want this is that I'm in a bit of a bind with Apple M1
support.  The U-Boot port I'm writing will mark a large chunk of
memory as EfiBootServicesData.  This diff makes sure we can use that
chunk in OpenBSD.

ok?


Index: arch/arm64/arm64/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v
retrieving revision 1.59
diff -u -p -r1.59 machdep.c
--- arch/arm64/arm64/machdep.c  11 Mar 2021 11:16:55 -0000      1.59
+++ arch/arm64/arm64/machdep.c  11 Mar 2021 22:29:21 -0000
@@ -947,7 +947,9 @@ initarm(struct arm64_bootparams *abp)
                            desc->Type, desc->PhysicalStart,
                            desc->VirtualStart, desc->NumberOfPages,
                            desc->Attribute);
-                       if (desc->Type == EfiConventionalMemory &&
+                       if ((desc->Type == EfiConventionalMemory ||
+                            desc->Type == EfiBootServicesCode ||
+                            desc->Type == EfiBootServicesData) &&
                            desc->NumberOfPages >= 16) {
                                uvm_page_physload(atop(desc->PhysicalStart),
                                    atop(desc->PhysicalStart) +

Reply via email to