[Concept,01/17] qfw: Export qfw_locate_file() for external use

Message ID 20251006232236.2091941-2-sjg@u-boot.org
State New
Headers
Series expo: Complete mouse operation in the EFI app |

Commit Message

Simon Glass Oct. 6, 2025, 11:21 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Export the qfw_locate_file() function to allow other modules to locate
files in the QEMU firmware config without loading them into memory.

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

 drivers/qfw/qfw.c |  4 ++--
 include/qfw.h     | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/qfw/qfw.c b/drivers/qfw/qfw.c
index 6ac5b1cd625..2e260d60449 100644
--- a/drivers/qfw/qfw.c
+++ b/drivers/qfw/qfw.c
@@ -212,8 +212,8 @@  int qemu_fwcfg_setup_kernel(struct udevice *qfw_dev, ulong load_addr,
 	return 0;
 }
 
-static int qfw_locate_file(struct udevice *dev, const char *fname,
-			   enum fw_cfg_selector *selectp, ulong *sizep)
+int qfw_locate_file(struct udevice *dev, const char *fname,
+		    enum fw_cfg_selector *selectp, ulong *sizep)
 {
 	struct fw_file *file;
 	int ret;
diff --git a/include/qfw.h b/include/qfw.h
index c1f558b6f87..75aada09206 100644
--- a/include/qfw.h
+++ b/include/qfw.h
@@ -464,6 +464,18 @@  int qfw_load_file(struct udevice *dev, const char *fname, ulong addr);
  */
 int qfw_get_file(struct udevice *dev, const char *fname, struct abuf *loader);
 
+/**
+ * qfw_locate_file() - Locate a file in the QEMU firmware config
+ *
+ * @dev: UCLASS_QFW device
+ * @fname: Filename to locate
+ * @selectp: Returns the selector for the file
+ * @sizep: Returns the size of the file
+ * Return: 0 on success, -EINVAL if firmware list cannot be read or file not found
+ */
+int qfw_locate_file(struct udevice *dev, const char *fname,
+		    enum fw_cfg_selector *selectp, ulong *sizep);
+
 /**
  * cmd_qfw_e820() - Execute the 'qfw e820' command for x86
  *