From patchwork Tue Oct 7 17:05:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 548 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759856780; bh=pWZ3cUPHaWweZtRsmpP9p8aOHEMXcq/0Osto4+fHNdE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HHCCowozLfOGa7Z7BOiD6hBQyQlPyZcFFdbXHhg0x5BswSiuE186Io4rNttnxFBxv Hs+RoPN1dhlpSQ5G0nmnUYWJ+UgcKHtgfmX3qbBr8J/zuRCdWGilA4VLGKQa1/RMC2 P9AavAaZR6Ft6k0D+QN6tyjyDf277OKFJgxNzafFJPpsfJqOzJ404DBbAdupuX7SLk 1nGec2D6mjfDMD3qM6lFEqyzokmmVBabToHdB/VT4XdN8MZlB+KXI8zuPMCpKXiGLu wxdUo1G3Ik8DgHkItgF+POPDsC7DzzmZppvlc6L0azR2P5N/5Bgdszxor/45uG38u5 TR3u1CnQv6fSw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A0C5767FF8 for ; Tue, 7 Oct 2025 11:06:20 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bgQpkWdnfT9D for ; Tue, 7 Oct 2025 11:06:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759856780; bh=pWZ3cUPHaWweZtRsmpP9p8aOHEMXcq/0Osto4+fHNdE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HHCCowozLfOGa7Z7BOiD6hBQyQlPyZcFFdbXHhg0x5BswSiuE186Io4rNttnxFBxv Hs+RoPN1dhlpSQ5G0nmnUYWJ+UgcKHtgfmX3qbBr8J/zuRCdWGilA4VLGKQa1/RMC2 P9AavAaZR6Ft6k0D+QN6tyjyDf277OKFJgxNzafFJPpsfJqOzJ404DBbAdupuX7SLk 1nGec2D6mjfDMD3qM6lFEqyzokmmVBabToHdB/VT4XdN8MZlB+KXI8zuPMCpKXiGLu wxdUo1G3Ik8DgHkItgF+POPDsC7DzzmZppvlc6L0azR2P5N/5Bgdszxor/45uG38u5 TR3u1CnQv6fSw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 839D567FF9 for ; Tue, 7 Oct 2025 11:06:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759856776; bh=pQDNBMeF5f0R1P0EgpWpCp7oMqsmtN0fHyRoZ5TKvn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ArS/5efpGPdxnLGbkXGQh222SBmsnVH+owSTXgKOugU1xqY/B65YhH7pp2cxC1tl7 FSTswg+74AkFQwWWD6OMdWTO1dcWVTu3rsy1Luz97HgLjfcSbgvuf+kXu/SY6Uss3m rmyvGU3aOGaNg8kzuZ4hfsGlMtFWZSL6m1Yg1Yru4m5yn0RUvDuFrJ3UEodeatZKSc oFvGGvWUJ8PlFkPZM2lttrOuKeuaEgol7zXcYfgbBJPVWkF/Q6GWVGIKgtpiFYSfKD 3OMkFJgkOAyqp//b72SheDIMpnVVKQrxgyGVytMFY2ltQnR2zN7aA2aAK1UTvnoWml JvuITKOcEEmEA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C70AA67FF9; Tue, 7 Oct 2025 11:06:16 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id a9GQZGmknuzz; Tue, 7 Oct 2025 11:06:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759856772; bh=q52XV1YUyxeE7OPh1plvwrJJ7+yEx4AMuPAalER0mEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=quAwZ/Z8DMZuwlJnPJwytCTcB5oo1pg1ZrfHumhN9jXS8c4IJ5TGffPpCXAhNeYr7 5x6nuVYFobhSTWaCOKfVOpR3Mhzf/yyAlwNSnHEan0JiGB1JVODVd3dmOYwXfqBBWb eBfxCnjnsz7aSa+z8TLINnzUDDFM04wAFs1d9MgxzzBgMG/RPAjZIODbbr7SjC77gg hsp0XTqJ9WWPuRq2Lw5ul0GWP5EgdfMi/VTqx3Ubb4uK/ExRH8cy77gV0/Oz3QtLYU cgdT6st/sgYv4sFwUOV9Aez7IJ8deEO4jsFtoUB4b0b7P0DYOnN23nFCTuzNr5mkD4 N5Hu3NEIF6NJQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F34E867F6C; Tue, 7 Oct 2025 11:06:11 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 7 Oct 2025 11:05:15 -0600 Message-ID: <20251007170549.541981-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251007170549.541981-1-sjg@u-boot.org> References: <20251007170549.541981-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MRLNLXFH5RNI2SABUKPRERAEFFG5N4EW X-Message-ID-Hash: MRLNLXFH5RNI2SABUKPRERAEFFG5N4EW X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 01/20] qfw: Export qfw_locate_file() for external use List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- (no changes since v1) drivers/qfw/qfw.c | 4 ++-- include/qfw.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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 *