From patchwork Wed Aug 20 11:23:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 63 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=1755689061; bh=qrsgZ6SjHN12M/N0bQdQXGVy3m45urDYKw+JrQJvZjg=; 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=NLKkVQl240MtXFXA/zKG8AiQfosGRj5PZ2LXsUvy76+pZw+zD1iSnRF7USMbHn1uf Q4Gm23M41TOW3PUN1ckyuFi6jYbtjTR1OiZwwVEY8jq1ioN00aeuNQ1D7NWbjpxgCB UrdDJPGMkNfdKfC3zBQFrHWP++8zcLjIJwIyJrq8j2gFN3bP3TVSFN1U/NJ8jXVM02 n/GjZx/FpLhAQvd82WhOzj8d0qtC5p0DRymj0oaQFayi/Uu5epEPc28np3HafNUQ8p 3eTv3OUlY/hORLCkYaQ8QHmq9s0h1ITn0+tr1A2Cz2wRJCc5bB30495a+v8zBoIQYr L/jUbx63QzXUg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0607B6767E for ; Wed, 20 Aug 2025 05:24:21 -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 dsVyrFEwWvFi for ; Wed, 20 Aug 2025 05:24:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689057; bh=qrsgZ6SjHN12M/N0bQdQXGVy3m45urDYKw+JrQJvZjg=; 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=Bhaii/SvzT24vtV/EdZSNrEoyQc77vhWx5H8gKtTcgBv5nBLUwMvb08scCFza/GS5 nzo6TcZc2J0xC9nsInMvSV0LOB1jhKvnrgUNvwVssg6YDVuMqVuglucUm8XEBYEK5T +Ajgf6UrtlLpJIIfe2mMUcP1dsy0aU1b4SJqEN5pFf0omEaCyq2xpH5K9RpZU78S6W ich0hrA1J2X9Y7Z+dQlM2L2VACFqBTYWUggGxM7VfKJQsHSbCezb3X9zUlEQgJUIp8 IIwk/m23BOJXyYkXl3GBMqf1fwh58wGJcLKaEkgiT7aeOwn7nqpdMYTylnNKN5T1E3 JbWxtlCv1gsvA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 51073674FA for ; Wed, 20 Aug 2025 05:24:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689054; bh=C0zk7IWh0RNQIkMlRnYsCgQLpPwb7W6EJnjlgGHc3Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnaLGFzeBrE7paR0K7mum0CIByrHzvHi1E/51irmn8F6+912nmJ9zUVWLmNbpzFNG Pj9S0YY2ZMRUUXWatt6aDSp5oFAhBnHMRAWLObHaczH6PQHQkkeNptF79xi9H5C6n7 UnR8WvPLUQ/iwmH+i79fJdLzElqW8mIM78yoR/bSXvPP/RcNUKOJh/XNer8LCCX3t/ KAukBsnxsQLHU0PXHVDiVD1Z4UuBHSQpQ99aDMLchIx69Kd8p87xWKp4Rs5JGlZ6RH U3EP9kNhyqi0O/qGpKkstwQU6DQQ/Gbm9Cmv/DMyz/8/ZDtphJYwujSgODqHX5phu9 2HujvFERG8GwA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4BBBC6767D; Wed, 20 Aug 2025 05:24:14 -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 TfdRFt7Qfchg; Wed, 20 Aug 2025 05:24:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689050; bh=FgZQnXd9WvoIdyGw7I72u9O00ZXtGyDzlbE7g4LzlBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XC+zrN0kTa4/TAc8NMakNU9oFIKmCOhvzys5+ICV9G7ZFoCNgzczWSxD1H1ehKa6S lH3wkv9xeQjttG+rElGGkyH3ZoE1t8Gc8GqwC0pt9I0nYfzv4G8E43LNDw6f8Ji4aM SwMtVI9T30M2qG0AXL5TFo9HuoFcsAeFZ4Wmlnv8s0zR9RMcVAhqfa981wsAfC/glo CcvitAjGlRYU439p6666+1WXDLtPEWxWaQTSCR/QgEhE50l8g0GKQCfAvSU28zfFJb MrgJfGweMn04gCgcHTlqNWrXxsoDYng05Kk08Sx7ZJ1YYEzaYUYW/wgUbgMxHWQB79 vsicjMQYam55w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 88E466766B; Wed, 20 Aug 2025 05:24:10 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 20 Aug 2025 05:23:19 -0600 Message-ID: <20250820112340.147082-8-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: G6TVFNVIOIDR3ZJ3P56TAHE2J2ZPODZN X-Message-ID-Hash: G6TVFNVIOIDR3ZJ3P56TAHE2J2ZPODZN 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 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 --- (no changes since v1) 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); }