From patchwork Wed Aug 20 00:40:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 50 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=1755650491; bh=3XwlsFFjouK3A4G3xCZe+oNFMm0es/LFScUZJJTXa0k=; 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=T1RviexRcSe85mCI5oHDtsdjEijtlf5inogyRXWMPJOrXOwgvdbA4N4loQOzev0TU hHw0wW+LD1Vh1n8K0m7R6A4ESnnt5BnD/ANNotKcNTaksRMSKl1WJEVwfc8cVlFpM6 aE2oKn+DG1dIEhs4k9UkX4UDiVxSJ16lMcyjEcObkeEWRy90KqaBHdEJK0jnqLSeur ffmxuklbl2wVCHKYwoZu3X6ufT1swj4CTG0KXyHBBzbMpp0wjbNLoOLRufIcyKHK8x RPWFs9tOv1jQ7ua1JGfZG6q2X9a6lVA9g4jKnazkwPhjIAeuldm4tFWoQhPts+ed2A S08rLNPsS0BBw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF02067662 for ; Tue, 19 Aug 2025 18:41:31 -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 mDd7IepjRw-9 for ; Tue, 19 Aug 2025 18:41:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650489; bh=3XwlsFFjouK3A4G3xCZe+oNFMm0es/LFScUZJJTXa0k=; 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=reBSv8zo/NlbTmnBf6mMNJTcy51pOqJjXtut1AGt+Xjo48dclYld2p5CHRjPL85XT zQWOFNu+EY744Cs4DyL4vA9B6Dn3yDgfZkQj24yY2GW4eBV+ITme/9g+dR3QWM20uA fpoxJdN0DmYOdh1SYCVsBCNYIe655ySYMNDEBB4H6g043bc0P7xXj4Cl6twaqfZnye UKGOTUW4O4Iy0DFOVSXq0KN/d6lLHbp8Bo3MgfCwBB62xEtCBtp20xp6k1XMRKVGKv 4HL1fwkI82swbiD81rgIjYh1tQnAetE0DFsY+smm9iTCn8eJGTWzyv9k9AVFsD51xk 0GjhvCihhPmug== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A561C67665 for ; Tue, 19 Aug 2025 18:41:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650487; bh=tWl1Pm6dxn8sCQKTTKlqKJi6wFjJtBBj7Vter9McWso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JpsX51p4yJgfjE1F3gp66ff3H016exLg2ctkXP4cNMIEqUt2SFK5dAzcZUrUCzY+P GEMY4VGMykpfX30THZXfXMOtCAGJYfrRcboevNkhCXofLv+2qoC9Wchi9uT0LhnfsM Gjtxb9l+Q+9fFuudvG9zXeIv0JXJGSFr6+sJyR2Dy1Bn4V2ILtSqQffMTuCYJNUIAU 4Za4mNpE0FdJyQYoiDvzsiiRZO9dZvLi07/yP33+sc8OqSPqNtxCA+fODqnBIQRYr5 1QbDlBqtTa09oQVwR/YDngmAKvhBemfv/yU7ho0QQ6vbZOJoLlXpNtSHUyjvmA0Z6h YNxEB8+l/03jg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 98184675C0; Tue, 19 Aug 2025 18:41:27 -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 mQ-B5wVO3eL0; Tue, 19 Aug 2025 18:41:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650486; bh=9pL1A2U02rNpGOss+W70HqrRGsazdgJ5eKVlPxBTV5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8mUZmbmwKLWENA4kJVaggdUuaGJWNcZUyMJnlR/w9gWK4U6j43WhwnTKe65d2PHC lZmhunVbdHZsy824iexH8FBct2XdijC27KvZg3XRppkp+D4caOPGqjrQLprb7CQUbw UWowl/dTQdV8LF5QPkJgvHh7PAe4lpcCmhG5i/MhNAsDcxBefcRMZq8qQyRdbIDsju cDINrgg4auaPDzMnY0XX6LPD1A2dvT0fezGlw9mvS5FBvRshcLf65LFIM0FoTA75f0 KJtQzmQswhYzrht0PfjrrHvZ3hVsmeFN4hcxqNMfJ9kaKh0qhTV7eldWeXby7+VQe9 OH18tuEq+06rg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9BF5A675B8; Tue, 19 Aug 2025 18:41:26 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 19 Aug 2025 18:40:26 -0600 Message-ID: <20250820004039.3920254-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250820004039.3920254-1-sjg@u-boot.org> References: <20250820004039.3920254-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FCCLRF6EQJQB22ZA6EVQ6WCVRIYQXQNE X-Message-ID-Hash: FCCLRF6EQJQB22ZA6EVQ6WCVRIYQXQNE 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 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 --- 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,