[Concept,v2,2/5] acpi: Explain why boot-services data is used for BGRT image

Message ID 20250820152223.1569324-3-sjg@u-boot.org
State New
Headers
Series ACPI fixes |

Commit Message

Simon Glass Aug. 20, 2025, 3:22 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

There is some conflicting documentation here, so add a comment about
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Add new patch to explain why boot-services data is used for BGRT image

 lib/acpi/acpi_extra.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/acpi/acpi_extra.c b/lib/acpi/acpi_extra.c
index 7620f953add..43962094ef9 100644
--- a/lib/acpi/acpi_extra.c
+++ b/lib/acpi/acpi_extra.c
@@ -61,7 +61,16 @@  int acpi_write_bgrt(struct acpi_ctx *ctx)
 	/* Image Type: 0 = Bitmap */
 	bgrt->image_type = 0;
 
-	/* Mark space used for tables */
+	/*
+	 * Mark space used for tables. The EFI spec says "ACPI Tables loaded at
+	 * boot time can be contained in memory of type EfiACPIReclaimMemory
+	 * (recommended) or EfiACPIMemoryNVS. The ACPI spec says "The image
+	 * should be stored in EfiBootServicesData, allowing the system to
+	 * reclaim the memory when the image is no longer needed. Linux checks
+	 * for EfiBootServicesData and ignores the image if it is anything else.
+	 *
+	 * So use EFI_BOOT_SERVICES_DATA here.
+	 */
 	eret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, size, &buf);
 	if (eret)
 		return -ENOMEM;