From patchwork Mon Oct 6 23:21:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 532 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=1759792980; bh=vtxdoBpaHhT2/B0YuRdZ5VCq7Gb91oxMUYr0BuCgx0U=; 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=OM4Eoz5wUlop+sD6ypkCJbJnWztLrHejhqKkD1jjbb9j6A2cGWneYRU2w99ltkhdu GikIKXl19FWsf+OSNP0Ttg+WoNPHKrhlzWZ5LyfJlBeCa95h0PlGrY8pns/aQnMG4f c965VZOK/JpdLkE5qYL4Y82rYtwKWAmSexoJPCKnIYit0T97NszSEhBfDlsdivBRGD zip0zmsQy/0r7bJGyWV1fXkq5SuwCWDp5F3uDWksAK9plDU4nslgMdBNPcwLAw8IJe aVkSTUz+dkMOw4dHQAzYwEeUX6PjeitX2WYVamWbk7n2yasrr6lAoTZE+n7ybyQnnv GT2Ksu3bTlWpA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6B7AF67F03 for ; Mon, 6 Oct 2025 17:23:00 -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 IWgwIgMK9OrA for ; Mon, 6 Oct 2025 17:23:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759792980; bh=vtxdoBpaHhT2/B0YuRdZ5VCq7Gb91oxMUYr0BuCgx0U=; 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=OM4Eoz5wUlop+sD6ypkCJbJnWztLrHejhqKkD1jjbb9j6A2cGWneYRU2w99ltkhdu GikIKXl19FWsf+OSNP0Ttg+WoNPHKrhlzWZ5LyfJlBeCa95h0PlGrY8pns/aQnMG4f c965VZOK/JpdLkE5qYL4Y82rYtwKWAmSexoJPCKnIYit0T97NszSEhBfDlsdivBRGD zip0zmsQy/0r7bJGyWV1fXkq5SuwCWDp5F3uDWksAK9plDU4nslgMdBNPcwLAw8IJe aVkSTUz+dkMOw4dHQAzYwEeUX6PjeitX2WYVamWbk7n2yasrr6lAoTZE+n7ybyQnnv GT2Ksu3bTlWpA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5A95A67F58 for ; Mon, 6 Oct 2025 17:23:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759792978; bh=Qp9+0TLDVJjJNCcYwBE/bfngr7fr+Xx3nFE2VploI3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uq9HOHCU6ZQfS8WVOWtvaPJ1h67/gULuxjx7e6PUgnEuP3SN+NzS9/Cenn901dmeE aa7BNv7wHRSNfvUV/Q9xmY4t/07EcnWHVrN1GUzWPfjtZvTrJllz4ZZMqGme+2tvBC bIRc0hA0ACvmKynhH/Css9I7AaSY23+ougnVRydaBSBKtID72xDuM/9fSnWucw2xzU uqVdr26sXZR6xTt2DkNUDVdCa+ra5i7YGZPe+IsJnmz/eKojNJ3JHwF68bDnyz0T6/ 5Afn4VJJ316fwSN5v426NrO8HUDU6pRRGDDIA3n11B7G8xHC1MvhM2y9ulpDaog22O gR0zpk9GXQ/bQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0C9AF67DB4; Mon, 6 Oct 2025 17:22:58 -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 y5rmqLSN4KDG; Mon, 6 Oct 2025 17:22:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759792974; bh=hFbw5TkWyQ9YMbcBg+63pYswnepnELyvUCCM4f9paOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ILyRqJ17heiy/11/Q2v7JJZS6ojam+9utfF7eeGZBhROsrVV8vxqbVIsKA2v1UxMJ zGJUCR0de3+2ZpoWjcizmf4EbULOLIfMrsZcs0P8Mm5cQLPcouj8nVqjupwzlY2v00 lbnhwetHn8kRldtcBu1q89rCjwMueKY0cW/LhsSkOg2Fz0A+KsJxW09L3TXP9dCAhU GioeVq4FArFQjuJlKnjZ3xsTBG0lmLfagq9GfenkivQ54hgIlaqmLraZO4LLPZQxDj Y1msTLcaspiMdeSU7l404NaTr3px3uLsN+Hj9Ox1PYCZKBTSNI45jTATSzC3NhJeiQ gmsrS15uv4Tzg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A400D67FD0; Mon, 6 Oct 2025 17:22:53 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 17:21:43 -0600 Message-ID: <20251006232236.2091941-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251006232236.2091941-1-sjg@u-boot.org> References: <20251006232236.2091941-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2YRHMDDB3F5ABC6CU7CK5YLGH2JPBKJU X-Message-ID-Hash: 2YRHMDDB3F5ABC6CU7CK5YLGH2JPBKJU 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 01/17] 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 --- 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 *