efi_loader: Install the ACPI table from the bloblist

When BLOBLIST_TABLES is used, the ACPI tables are not currently added to
the list of EFI tables. While we don't want to create a new memory
region, we do want to tell EFI about the tables.

Fix this by covering this case. At some point the non-bloblist code can
likely be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 3da59ee9579 ("efi_loader: Avoid mapping the ACPI tables twice")
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
This commit is contained in:
Simon Glass 2025-03-06 07:31:24 -07:00 committed by Heinrich Schuchardt
parent 6f7fb8d29f
commit 7b269a2bd6

View File

@ -7,6 +7,7 @@
#define LOG_CATEGORY LOGC_EFI
#include <bloblist.h>
#include <efi_loader.h>
#include <log.h>
#include <mapmem.h>
@ -34,25 +35,38 @@ efi_status_t efi_acpi_register(void)
* add_u_boot_and_runtime(). At some point that function could create a
* more detailed map.
*/
if (IS_ENABLED(CONFIG_BLOBLIST_TABLES))
return EFI_SUCCESS;
if (IS_ENABLED(CONFIG_BLOBLIST_TABLES)) {
int size;
void *tab = bloblist_get_blob(BLOBLISTT_ACPI_TABLES, &size);
/* Mark space used for tables */
start = ALIGN_DOWN(gd->arch.table_start, EFI_PAGE_MASK);
end = ALIGN(gd->arch.table_end, EFI_PAGE_MASK);
ret = efi_add_memory_map(start, end - start, EFI_ACPI_RECLAIM_MEMORY);
if (ret != EFI_SUCCESS)
return ret;
if (gd->arch.table_start_high) {
start = ALIGN_DOWN(gd->arch.table_start_high, EFI_PAGE_MASK);
end = ALIGN(gd->arch.table_end_high, EFI_PAGE_MASK);
if (!tab)
return EFI_NOT_FOUND;
addr = map_to_sysmem(tab);
ret = efi_add_memory_map(addr, size,
EFI_ACPI_RECLAIM_MEMORY);
if (ret != EFI_SUCCESS)
return ret;
} else {
/* Mark space used for tables */
start = ALIGN_DOWN(gd->arch.table_start, EFI_PAGE_MASK);
end = ALIGN(gd->arch.table_end, EFI_PAGE_MASK);
ret = efi_add_memory_map(start, end - start,
EFI_ACPI_RECLAIM_MEMORY);
if (ret != EFI_SUCCESS)
return ret;
}
if (gd->arch.table_start_high) {
start = ALIGN_DOWN(gd->arch.table_start_high,
EFI_PAGE_MASK);
end = ALIGN(gd->arch.table_end_high, EFI_PAGE_MASK);
ret = efi_add_memory_map(start, end - start,
EFI_ACPI_RECLAIM_MEMORY);
if (ret != EFI_SUCCESS)
return ret;
}
addr = gd_acpi_start();
addr = gd_acpi_start();
}
log_debug("EFI using ACPI tables at %lx\n", addr);
/* And expose them to our EFI payload */