Attention is currently required from: Arthur Heymans.

Arthur Heymans would like Arthur Heymans to review this change.

View Change

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.

Change-Id: I591312a2c48f0cbbb03b2787e4b365e9c932afff
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/acpi/acpi.c
M src/commonlib/include/commonlib/coreboot_tables.h
M src/include/acpi/acpi.h
M src/lib/coreboot_table.c
4 files changed, 34 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/62573/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index 3bf57c6..390c727 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -1588,6 +1588,13 @@
cbfs_preload(file);
}

+uintptr_t coreboot_rsdp;
+
+uintptr_t get_coreboot_rsdp(void)
+{
+ return coreboot_rsdp;
+}
+
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -1695,6 +1702,7 @@

/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
+ coreboot_rsdp = (uintptr_t)rsdp;
current += sizeof(acpi_rsdp_t);
current = acpi_align_current(current);
rsdt = (acpi_rsdt_t *) current;
diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h
index 91da8e0..3b215bf 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -85,6 +85,7 @@
LB_TAG_BOARD_CONFIG = 0x0040,
LB_TAG_ACPI_CNVS = 0x0041,
LB_TAG_TYPE_C_INFO = 0x0042,
+ LB_TAG_ACPI_RSDP = 0x0043,
/* The following options are CMOS-related */
LB_TAG_CMOS_OPTION_TABLE = 0x00c8,
LB_TAG_OPTION = 0x00c9,
@@ -574,4 +575,15 @@
uint8_t tpm_version; /* 1: TPM1.2, 2: TPM2.0 */
uint8_t ppi_version; /* BCD encoded */
} __packed;
+
+
+/*
+ * Handoff the ACPI RSDP
+ */
+struct lb_acpi_rsdp {
+ uint32_t tag;
+ uint32_t size;
+ uint64_t rsdp_pointer; /* Address of the ACPI RSDP */
+} __packed;
+
#endif
diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h
index dade92d..0ba8767 100644
--- a/src/include/acpi/acpi.h
+++ b/src/include/acpi/acpi.h
@@ -54,6 +54,7 @@
};

#define RSDP_SIG "RSD PTR " /* RSDT pointer signature */
+uintptr_t get_coreboot_rsdp(void);
#define ASLC "CORE" /* Must be exactly 4 bytes long! */

#define ACPI_NAME_BUFFER_SIZE 5 /* 4 chars + 1 NUL */
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index d0cba80..ec10ff2 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 <acpi/acpi.h>
#include <arch/cbconfig.h>
#include <console/console.h>
#include <console/uart.h>
@@ -420,6 +421,16 @@
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 = get_coreboot_rsdp();
+}
+
size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target)
{
struct lb_header *head;
@@ -523,6 +534,8 @@
/* Add all cbmem entries into the coreboot tables. */
cbmem_add_records_to_cbtable(head);

+ lb_add_acpi_rsdp(head);
+
/* Remember where my valid memory ranges are */
return lb_table_fini(head);
}

To view, visit change 62573. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I591312a2c48f0cbbb03b2787e4b365e9c932afff
Gerrit-Change-Number: 62573
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur.heymans@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Attention: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange