From patchwork Wed Aug 20 00:40:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 45 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=1755650483; bh=WBHgxG6jTzDJaSD9cG6cKU5A4EKRpPQTNGP6I+JPiTk=; 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=sD6GOMVkVeZ+LaKhuQoPcQkvhs0FXeXeQYBtjIyirCe6BtzzylN3g+4GYeBmp4WRX 0afE4OXZKM0hUHdOKjDtX/D6Mh2Ep9wR2HDEY8vneE5GmL05DHnQzWZtU6xf7SIsBh pNPe6Pl+KrldPNYGJ1rq6Weay6SA6gxp0Ww4ikpHGxV/UzhG/qpxdEywZasQ4iozy/ bz8sP+iGy9iT/E7va69ebBMLI45KHQBfTIqMG1vmtGZaJVpXam50XaYVRjSHrY8g8+ HYzzZtk6IOahQWRpGgJSPh+eZaX9PEeScLy9mqrUc7DCS8E7aayxpNQFBfH94hvifu 05986BRViVivQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 900EF6766B for ; Tue, 19 Aug 2025 18:41:23 -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 aZjpycSgzldW for ; Tue, 19 Aug 2025 18:41:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650481; bh=WBHgxG6jTzDJaSD9cG6cKU5A4EKRpPQTNGP6I+JPiTk=; 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=nvx/LTtgUqAKG/xQbwMt+BzBJ38ZG42Of7G7Si4DK8TYQRN4libWNvMNLbHeeRUx7 JzDixUao8VY7agYqRKtRBsqxBZ7KupMsUdKr+6yTqSyKN8YHcIA5jwGUu+A0t8G73G OZj75ILMp/G1ExNBVtEKaHqxBce+SlDVIOl27mC5Wp9mF7YW34vbI+dceoIfEwOcEf X6HPWYMjckZtpvi5iNAPqiXtsYfDC8GnmbV9dSe2LctxakOAEiLzcNXjPJMTpNZpO/ 37swsFDbe0zoj9QENxdFkna/LAiTigMBzysCxu6nY1wZf2nFcSQdHSHW7+OUuTuopU 4vJwcyLHaSSzQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E3C6E675C0 for ; Tue, 19 Aug 2025 18:41:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650478; bh=P+2a+3dXDCM2jZ2iQIN1gRGnqp8D+ZZvm3P10HH6yic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9rlqan2NxuD634zH7FAK9f33SDRwlTEorhO4SsZlFiIaQkXUq44hZyl/jh5meDQS KoiTIGEpXoZ+0PsBnNsWT38zKj8O/IGZefgBMpktadUP/83xy8mqOLnZwVVGADCQ0V X6ezelkcDy2kfCs8kaLuDDIVqT60nMZjIb3ILKZDE8CGBTsBEq9iVAZR8W6WTaulnH 0g0AlXpI3P8/WOFTwg8hTj5S9LxeAYHEH003mieIIzMsAd7/voBEPPX5m0aeZbuDvL VLqBBk1QgyJQi+DeU0TAQjHPQnHqZyM3euVsImLj2X3Q776wYVnvisLiISTn1BzrNM pgnNuyoxf1DnQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B81A0675DE; Tue, 19 Aug 2025 18:41: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 ONmLVG-QgyVr; Tue, 19 Aug 2025 18:41:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650477; bh=c0benN0k3zBzvGmc9mo2oJPUb0ZYnCR+Om3NwOm9mlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOfDSdCE6nC6+ilQNeMrvsQNQDo/PTllrbma0pAd1GGg0NffiQG9oBonYzJnTteQD e97aWaWoH56DeLp/4vFApMEIkdTThjSOVfPNKjXK5xgbd1IvgsWq46b19vXICU4/HB GfemODhlApesagyggZJly9EDZ4Lz7z0RrFya8s2GJJz5WkQRVsVmDc1TJDjqARs0lr 6J3R+Kvziqoyq6odg2T8M3Wy5Q3GNgZMbEBpM/3MKZ108voW9DajJusrVoetMAvXRS bZuueXPopI5YT0tPNQ+IWUNjRVzEAg3Mw2vTL02v1kL+LXYS+HP4A3kt4S+PkFr3KD g5kzApimpkG8Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 38D3C675C0; Tue, 19 Aug 2025 18:41:17 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 19 Aug 2025 18:40:21 -0600 Message-ID: <20250820004039.3920254-8-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: AW4HTCSTERK6CCBL5UMURYCTUQTYWNFY X-Message-ID-Hash: AW4HTCSTERK6CCBL5UMURYCTUQTYWNFY 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 07/18] efi: app: Provide easy access to runtime services 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 Add a function which allows the app to obtain the runtime services without first obtaining the priv data. Make use of this in efi_vars.c Signed-off-by: Simon Glass --- include/efi.h | 7 +++++++ lib/efi_client/efi.c | 5 +++++ lib/efi_client/efi_vars.c | 9 +++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/efi.h b/include/efi.h index 9ff945ae1c3..742c40bfd8c 100644 --- a/include/efi.h +++ b/include/efi.h @@ -604,6 +604,13 @@ struct efi_system_table *efi_get_sys_table(void); */ struct efi_boot_services *efi_get_boot(void); +/** + * efi_get_run() - Get access to the EFI runtime-services table + * + * Returns: pointer to EFI runtime-services table + */ +struct efi_runtime_services *efi_get_run(void); + /** * efi_get_parent_image() - Get the handle of the parent image * diff --git a/lib/efi_client/efi.c b/lib/efi_client/efi.c index c5573dd67f9..e2cc9d3eae3 100644 --- a/lib/efi_client/efi.c +++ b/lib/efi_client/efi.c @@ -65,6 +65,11 @@ struct efi_boot_services *efi_get_boot(void) return global_priv->boot; } +struct efi_runtime_services *efi_get_run(void) +{ + return global_priv->run; +} + efi_handle_t efi_get_parent_image(void) { return global_priv->parent_image; diff --git a/lib/efi_client/efi_vars.c b/lib/efi_client/efi_vars.c index 099a59b2a1e..e652ee3f243 100644 --- a/lib/efi_client/efi_vars.c +++ b/lib/efi_client/efi_vars.c @@ -18,8 +18,7 @@ efi_status_t efi_get_variable_int(const u16 *variable_name, const efi_guid_t *ve u32 *attributes, efi_uintn_t *data_size, void *data, u64 *timep) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->get_variable((u16 *)variable_name, vendor, attributes, data_size, data); } @@ -28,8 +27,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, const efi_guid_t *ve u32 attributes, efi_uintn_t data_size, const void *data, bool ro_check) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->set_variable((u16 *)variable_name, vendor, attributes, data_size, data); } @@ -37,8 +35,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, const efi_guid_t *ve efi_status_t efi_get_next_variable_name_int(efi_uintn_t *variable_name_size, u16 *variable_name, efi_guid_t *vendor) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->get_next_variable_name(variable_name_size, variable_name, vendor); }