From patchwork Wed Aug 20 11:23:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 68 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=1755689065; bh=FxYqQ9EnC0m/UpmrMzMmwS3l4/0n7On6PIrlv/Sar9I=; 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=sw8tqYbJBUFND4zZOjQ34ygsP7Xg63kOZTItNm6r44S5TIsW2vH4fOc5TZRUwh+GN Cv3NIlUoX7qef1kQwUJByCw20rphZP/MMy9t4K7iampwb92cps9QwLr7AaXJOeUpsZ dWI08dkj5UtxB3UR7mwiFaAt4M12FzBMTtPxGu1D2G8KdOGhpItjXNCsVT2UfXdb2O n67hzH+Bm5zn1M8910uecc/U4TGXvE6ooShMFc1szOoA4aLbipW3sncUJ/JZ1GAw4E suMY6aAnmZkL2TXEYQTfypSotxBAjvnPzzE+4sxywxCnjeRdDnBPGEQfMiZsWPDslT rRf2nda4ENJVw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E5016765F for ; Wed, 20 Aug 2025 05:24:25 -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 1tHwIp2mzI50 for ; Wed, 20 Aug 2025 05:24:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689063; bh=FxYqQ9EnC0m/UpmrMzMmwS3l4/0n7On6PIrlv/Sar9I=; 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=UvnZxhDSLl5Db553ORzBqtfmwPt0ORnwYY+3pWyJ5wuGLv7FGztP5uJDurfgV9AJk 0d1ZSpZg3Tg/4kXGvj+ab8i/34kKCv1fpZ8xXprOS2jMROBW6TgkwgJPb0k+xcWeBF tRHkoetG7zJCgopMgTwBqBNpRz7cJ612CDwe9GLgLmTc5Wl94T343P/8gnpi+uC3gF OXEJqEXivBZka4c3ukfFNBBBj7+K9uA3yLblDBU4oE0bpHqVEbuzqji4ZAOWjjxvCy 6Pt37o8XbED0Mu8FYkHETeRYUxLAz5mrb/Di5Xmo7cMxbxeO6KeUmtpTyGSKhSd4fJ 2hW/5jqaiyK3g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 478C367669 for ; Wed, 20 Aug 2025 05:24:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689058; bh=vXvc7L8j4KVAJJP5QiXH904AQL62MsnsfyhCMosb1H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=giEK01KUoLWs7QbQjoXwTfcfW+CU9H9ofdl0cC9fE8dUiS70KleOwTm/KRg/r/6Ja P63F9hvlyLAhQz9gt3FTissIOIQvXdwMgJHHNK/WwoS4B88nWdL3jxHrBjbM5vVDPZ FCoyVY6clrz6prDnbEXsPNr1pd6Y0QBoT7U/hQjpX27CSVWiWean2PyLgoPgjFym4m vk9g8Uy+1SV5GCpedCICwXdPp9QYd2Hb8go0oqeBFO5XkLQ9oZQ/7TKdq0NfOtuesv VxC52jbxXgZDq+f3VIQEsid4tqUVCdgeS7mNruAkOMhk0sHbxrdPSKKuAA/8JYAt0Q Qffwo2BWO1MUw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D00D2674B4; Wed, 20 Aug 2025 05:24:18 -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 vKJaoN82awTG; Wed, 20 Aug 2025 05:24:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689055; bh=Sr8fKAWwfuwCAH96P25oAPzhvST7bCjuvIWfcp86Rzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSZ/TuY2bjz7x19NjNabSSWsHxktYb+94UHftqh+er3Bjkm42/G1ZCUnbNEZ+WOFP SCR8RnDun0AOjcZyrypd+SO3AbJcHbC78B0e7hrzDrNkYoywEJFSr1b51kAC3CBzPc 1D1o6riCFyksQFrM+zd4jJJD7Uz44DsYdaNp5GhxKPde5PFLueCDl6PQ3nzcuT/8Jq gVgEM9qo3YEuaMD4cI1KnX+MNwcwawsFC8nDmqmWVZjK5mzvCf/1RluWs3Po+E2t1o u9dtHe21NXPdMRKHvO+EuomJ3tqiuiTcAbUlbhmBpQfLKUq3HOiEUqF2FCEJKxgKvh drFoRpO2PPvPQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E3BCF674AF; Wed, 20 Aug 2025 05:24:14 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 20 Aug 2025 05:23:24 -0600 Message-ID: <20250820112340.147082-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250820112340.147082-1-sjg@u-boot.org> References: <20250820112340.147082-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IJK3HP7FW4ULXC7FC446IS7HDBLKYR4Q X-Message-ID-Hash: IJK3HP7FW4ULXC7FC446IS7HDBLKYR4Q 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 12/18] efi: app: Find the device-path-to-text protocol on startup 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 Some protocols are generally useful for the app and it makes sense to store these in the priv struct rather than requesting them each time they are needed. Add a new function which locates the device-path-to-text protocol and stores it. Signed-off-by: Simon Glass --- (no changes since v1) include/efi.h | 2 ++ lib/efi_client/efi_app.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/efi.h b/include/efi.h index ed22ff9a5a4..28c297d87db 100644 --- a/include/efi.h +++ b/include/efi.h @@ -471,6 +471,7 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc( * allocate_pages() and free_pages() * @ram_base: Base address of RAM (size CONFIG_EFI_RAM_SIZE) * @image_data_type: Type of the loaded image (e.g. EFI_LOADER_CODE) + * @efi_dp_to_text: Pointer to the EFI_DEVICE_PATH protocol, or NULL if none * * @info: Header of the info list, holding info collected by the stub and passed * to U-Boot @@ -496,6 +497,7 @@ struct efi_priv { bool use_pool_for_malloc; unsigned long ram_base; unsigned int image_data_type; + struct efi_device_path_to_text_protocol *efi_dp_to_text; /* stub: */ struct efi_info_hdr *info; diff --git a/lib/efi_client/efi_app.c b/lib/efi_client/efi_app.c index df51c5a4de9..7c9c156e006 100644 --- a/lib/efi_client/efi_app.c +++ b/lib/efi_client/efi_app.c @@ -176,6 +176,14 @@ static void scan_tables(struct efi_system_table *sys_table) } } +static void find_protocols(struct efi_priv *priv) +{ + efi_guid_t guid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; + struct efi_boot_services *boot = priv->boot; + + boot->locate_protocol(&guid, NULL, (void **)&priv->efi_dp_to_text); +} + /** * efi_main() - Start an EFI image * @@ -211,6 +219,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, } scan_tables(priv->sys_table); + find_protocols(priv); /* * We could store the EFI memory map here, but it changes all the time,