[Concept,06/11] acpi: fpdt: Generate the table

Message ID 20251023094308.3406453-7-sjg@u-boot.org
State New
Headers
Series Bootstage and script enhancements |

Commit Message

Simon Glass Oct. 23, 2025, 9:42 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add an ACPI writer to automatically generate the FPDT table with boot
timing information when ACPI tables are created.

This allows the OS to read firmware boot-timing metrics from the FPDT
table.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/acpi/acpi_table.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Patch

diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index 31d8d314314..0c1b8e20cf4 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -785,3 +785,14 @@  int acpi_fix_fpdt_checksum(void)
 
 	return 0;
 }
+
+static int acpi_create_fpdt(struct acpi_ctx *ctx,
+			    const struct acpi_writer *entry)
+{
+	u64 uboot_start;
+
+	uboot_start = bootstage_get_time(BOOTSTAGE_ID_START_UBOOT_F);
+
+	return acpi_write_fpdt(ctx, uboot_start);
+}
+ACPI_WRITER(6fpdt, "FPDT", acpi_create_fpdt, 0);