From 2e7e2d978bb2cc29b8b0335d46b3ed90ed36bbcc Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 3 Mar 2022 22:28:27 +0100 Subject: coreboot_tables.c: Expose the ACPI RSDP The ACPI RSDP can only be found in: - legacy BIOS region - via UEFI service On some systems like ARM that legacy BIOS region is not an option, so to avoid needing UEFI it makes sense to expose the RSDP via a coreboot table entry. This also adds the respective unit test. Change-Id: I591312a2c48f0cbbb03b2787e4b365e9c932afff Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/62573 Reviewed-by: Lance Zhao Reviewed-by: Angel Pons Reviewed-by: Nico Huber Reviewed-by: Tim Wawrzynczak Tested-by: build bot (Jenkins) --- src/lib/coreboot_table.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/lib/coreboot_table.c') diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index d0cba80dcc..3ceab3746f 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include @@ -420,6 +421,16 @@ static unsigned long lb_table_fini(struct lb_header *head) return (unsigned long)rec + rec->size; } +static void lb_add_acpi_rsdp(struct lb_header *head) +{ + struct lb_acpi_rsdp *acpi_rsdp; + struct lb_record *rec = lb_new_record(head); + acpi_rsdp = (struct lb_acpi_rsdp *)rec; + acpi_rsdp->tag = LB_TAG_ACPI_RSDP; + acpi_rsdp->size = sizeof(*acpi_rsdp); + acpi_rsdp->rsdp_pointer = pack_lb64(get_coreboot_rsdp()); +} + size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target) { struct lb_header *head; @@ -523,6 +534,9 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end) /* Add all cbmem entries into the coreboot tables. */ cbmem_add_records_to_cbtable(head); + if (CONFIG(HAVE_ACPI_TABLES)) + lb_add_acpi_rsdp(head); + /* Remember where my valid memory ranges are */ return lb_table_fini(head); } -- cgit v1.2.3