blob: 2eb273afc6ee42d248b7279913394f7860e9e23f [file] [log] [blame]
Andrew Geissler220dafd2023-10-04 10:18:08 -05001From 729c0163ae6aed76b3267b95d2989e70ded66716 Mon Sep 17 00:00:00 2001
2From: Sughosh Ganu <sughosh.ganu@linaro.org>
3Date: Thu, 21 Sep 2023 14:15:13 +0100
4Subject: [PATCH 36/37] bootefi: Call the EVT_FT_FIXUP event handler
5
6The bootefi command passes the devicetree to the kernel through the
7EFI config table. Call the event handlers for fixing the devicetree
8before jumping into the kernel. This removes any devicetree nodes
9and/or properties that are specific only to U-Boot, and are not to be
10passed to the OS.
11
12Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
13Upstream-Status: Submitted [RFC: https://lore.kernel.org/u-boot/aca7e6fa-2dec-a7c5-e47e-84c5ffa6f9b7@gmx.de/T/#m16d14ee960427cc88066bdcdd76f0a26738bb66d]
14---
15 cmd/bootefi.c | 18 ++++++++++++++++++
16 1 file changed, 18 insertions(+)
17
18diff --git a/cmd/bootefi.c b/cmd/bootefi.c
19index 5c0afec154..f9588b66c7 100644
20--- a/cmd/bootefi.c
21+++ b/cmd/bootefi.c
22@@ -237,6 +237,23 @@ static void *get_config_table(const efi_guid_t *guid)
23 return NULL;
24 }
25
26+/**
27+ * event_notify_dt_fixup() - call ft_fixup event
28+ *
29+ * @fdt: address of the device tree to be passed to the kernel
30+ * through the configuration table
31+ * Return: None
32+ */
33+static void event_notify_dt_fixup(void *fdt)
34+{
35+ int ret;
36+ struct event_ft_fixup fixup = {0};
37+
38+ fixup.tree.fdt = fdt;
39+ ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup));
40+ if (ret)
41+ printf("Error: %d: FDT Fixup event failed\n", ret);
42+}
43 #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
44
45 /**
46@@ -318,6 +335,7 @@ efi_status_t efi_install_fdt(void *fdt)
47 efi_carve_out_dt_rsv(fdt);
48
49 efi_try_purge_kaslr_seed(fdt);
50+ event_notify_dt_fixup(fdt);
51
52 if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
53 ret = efi_tcg2_measure_dtb(fdt);
54--
552.25.1
56