Skip to contentSkip to conversation

mach-snapdragon: Add EFI fallback for reading FIT overlay identifiers

PATCH In review Sumit Singh Dhami 2 participants 2 messages Oct 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mach-snapdragon: Add EFI fallback for reading FIT overlay identifiers

Read the VendorDtbOverlays EFI variable when the vendor_dtbo environment variable is unavailable. Use the EFI-provided overlay identifiers during FIT multi-DTB configuration matching.

Move QCOM FIT multi-DTB selection to EVT_POST_PREBOOT so EFI variables can be initialized successfully before they are read.

---
This patch extends the FIT multi-DTB support introduced by Aswin Murugan's
series: https://lore.kernel.org/u-boot/[email protected]/

---
 arch/arm/mach-snapdragon/board.c             |   6 -
 arch/arm/mach-snapdragon/qcom_fit_multidtb.c | 175 +++++++++++++++++--
 arch/arm/mach-snapdragon/qcom_fit_multidtb.h |  18 --
 3 files changed, 161 insertions(+), 38 deletions(-)
arch/arm/mach-snapdragon/board.c +0 -6
index 9bfb7183241..055ef6b8221 100644
@@ -453,11 +453,5 @@ int board_late_init(void)
 	/* Configure the dfu_string for capsule updates */
 	qcom_configure_capsule_updates();
 
-	/* Try FIT multi-DTB selection if enabled */
-	if (IS_ENABLED(CONFIG_QCOM_FIT_MULTIDTB)) {
-		if (qcom_fit_multidtb_setup())
-			log_debug("FIT multi-DTB selection not available or failed\n");
-	}
-
 	return 0;
 }
arch/arm/mach-snapdragon/qcom_fit_multidtb.c +161 -14

219 lines not on this page · raw message

arch/arm/mach-snapdragon/qcom_fit_multidtb.h +0 -18
index 00b6d935a4a..4929930e060 100644
@@ -40,22 +40,4 @@ enum node_process_type {
 	NODE_TYPE_SOFTSKU,
 };
 
-/* Function prototypes */
-
-/**
- * qcom_fit_multidtb_setup() - Main entry point for FIT multi-DTB selection
- *
- * This function:
- * 1. Loads qclinux_fit.img from EFI partition
- * 2. Extracts metadata DTB
- * 3. Detects hardware parameters from SMEM
- * 4. Builds bucket list from metadata
- * 5. Finds matching FIT configuration
- * 6. Loads DTB and applies overlays
- * 7. Sets FDT for EFI
- *
- * Return: 0 on success, negative error code on failure
- */
-int qcom_fit_multidtb_setup(void);
-
 #endif /* __QCOM_FIT_MULTIDTB_H__ */

---
base-commit: dfcfc4c9f78d1743f490a497082a4ec8e058aae8
prerequisite-patch-id: 288b5e1177317e5684aa37b877adaae1ecb87611
prerequisite-patch-id: 52c8de1a3d51dcb7487bc8252603fe89e731000f
prerequisite-patch-id: a9eaa119a8d0fc81394544f5cdbfb125726e9f57
prerequisite-patch-id: 48ad0bec210dfc2dfae8e1e69c831cc96073c1e3
prerequisite-patch-id: feacdbb3eb20691078dca1928afe7359f5eb181e

Signature · 2 lines
Best regards,
Sumit Singh Dhami
#1 lore raw
Quoted 50 lines · Sumit Singh Dhami

Read the VendorDtbOverlays EFI variable when the vendor_dtbo environment variable is unavailable. Use the EFI-provided overlay identifiers during FIT multi-DTB configuration matching.

Move QCOM FIT multi-DTB selection to EVT_POST_PREBOOT so EFI variables can be initialized successfully before they are read.

---
This patch extends the FIT multi-DTB support introduced by Aswin Murugan's
series: https://lore.kernel.org/u-boot/[email protected]/

---
 arch/arm/mach-snapdragon/board.c             |   6 -
 arch/arm/mach-snapdragon/qcom_fit_multidtb.c | 175 +++++++++++++++++--
 arch/arm/mach-snapdragon/qcom_fit_multidtb.h |  18 --
 3 files changed, 161 insertions(+), 38 deletions(-)
arch/arm/mach-snapdragon/board.c +0 -6
index 9bfb7183241..055ef6b8221 100644
@@ -453,11 +453,5 @@ int board_late_init(void)
 	/* Configure the dfu_string for capsule updates */
 	qcom_configure_capsule_updates();
 
-	/* Try FIT multi-DTB selection if enabled */
-	if (IS_ENABLED(CONFIG_QCOM_FIT_MULTIDTB)) {
-		if (qcom_fit_multidtb_setup())
-			log_debug("FIT multi-DTB selection not available or failed\n");
-	}
-
 	return 0;
 }
arch/arm/mach-snapdragon/qcom_fit_multidtb.c +5 -0
index 45423910d34..40f660b453b 100644
@@ -27,6 +27,11 @@
 #include "qcom_fit_multidtb.h"
 #include "qcom_hwdetect.h"
 
+#if CONFIG_IS_ENABLED(EFI_VARIABLE_FILE_STORE)
+#include <efi_loader.h>
+#include <efi_variable.h>
+#endif
+
 /* GPT partition name containing the FIT image */
 #define QCOM_FIT_PARTNAME	"dtb_a"
 

arch/arm/mach-snapdragon/qcom_fit_multidtb.c line 74

Quoted 10 lines
arch/arm/mach-snapdragon/qcom_fit_multidtb.c +4 -0
@@ -60,6 +65,10 @@
 #define PROP_FDT               "fdt"
 #define PROP_DATA              "data"
 
+#if CONFIG_IS_ENABLED(EFI_VARIABLE_FILE_STORE)
+#define QCOM_VENDOR_DTBO_EFIVAR_MAX_LEN	256
+#endif
+
 /**
  * struct overlay_entry - Gathered overlay FDT image info
  * @name: Overlay image name in the FIT

Neither of these guards should be needed.

Quoted 5 lines
arch/arm/mach-snapdragon/qcom_fit_multidtb.c +0 -1
@@ -1029,5 +1168,13 @@ cleanup_fit:
 	if (fit)
 		free(fit);
 
-	return ret;

arch/arm/mach-snapdragon/qcom_fit_multidtb.c cleanup_fit: · line 1180

Quoted 10 lines
arch/arm/mach-snapdragon/qcom_fit_multidtb.c +9 -0
+	if (ret)
+		log_err("FIT multi-DTB selection not available or failed\n");
+
+	return 0;
 }
+
+/* Try FIT multi-DTB selection if enabled */
+#if CONFIG_IS_ENABLED(QCOM_FIT_MULTIDTB)
+EVENT_SPY_SIMPLE(EVT_POST_PREBOOT, qcom_fit_multidtb_setup);
+#endif

Why is this guarded by itself? It should either be by the function that's also guarded, or EVENT should be select'd. Seeing that we're at around line 1100 now, possibly some file split and broken up, too, first.

Signature · 1 line
Tom