[Concept,05/14] efi: Use a function to obtain boot services in efi debug

Message ID 20250820144621.1073679-6-sjg@u-boot.org
State New
Headers
Series efi: app: Support booting an OS |

Commit Message

Simon Glass Aug. 20, 2025, 2:46 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Rather than accessing the EFI loader's structure, create an
efi_get_boot() function to match that used by the app, so that the
call to protocols_per_handle() can operate in the app as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/efidebug.c                | 4 ++--
 lib/efi_loader/efi_boottime.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 3a4429a3928..d7f88692d8c 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -491,8 +491,8 @@  static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
 					  &handler);
 		if (ret == EFI_SUCCESS)
 			printf("  %pD\n", handler->protocol_interface);
-		ret = systab.boottime->protocols_per_handle(handles[i], &guid,
-							    &count);
+		ret = efi_get_boot()->protocols_per_handle(handles[i], &guid,
+							   &count);
 		/* Print other protocols */
 		for (j = 0; j < count; j++) {
 			if (guidcmp(guid[j], &efi_guid_device_path))
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 6c5ebdad95e..8b46e43f1ea 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -4026,3 +4026,8 @@  struct efi_system_table *efi_get_sys_table(void)
 {
 	return &systab;
 }
+
+struct efi_boot_services *efi_get_boot(void)
+{
+	return systab.boottime;
+}