From patchwork Tue Aug 15 19:42:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 801734 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xX2vX4mVmz9sCZ for ; Wed, 16 Aug 2017 05:43:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 69EC0C21DA4; Tue, 15 Aug 2017 19:42:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1E190C21C51; Tue, 15 Aug 2017 19:42:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6E82DC21C51; Tue, 15 Aug 2017 19:42:53 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 205A8C21C41 for ; Tue, 15 Aug 2017 19:42:53 +0000 (UTC) Received: from localhost.localdomain ([84.118.154.110]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M0y47-1dSdQS0lXL-00v5ea; Tue, 15 Aug 2017 21:42:51 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Tue, 15 Aug 2017 21:42:45 +0200 Message-Id: <20170815194245.1450-1-xyp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d8PEHU7hR1gazcvrkBSLZtpym/e3Ux0QslhIcOhhqFiSenN5s72mTwRo1Z6 mpSk3BuHUxo+J76vrto7D8KtK0OZA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 1/1] efi_loader: allow return value in EFI_CALL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Macro EFI_CALL was introduced to call an UEFI function. Unfortunately is did not support return values. Most UEFI functions have a return value. So let's rename EFI_CALL to EFI_CALL_VOID and introduce a new EFI_CALL macro that supports return values. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 16 ++++++++++++++-- lib/efi_loader/efi_boottime.c | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 037cc7c543..1cee10ea0c 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -41,9 +41,21 @@ const char *__efi_nesting_dec(void); }) /* - * Callback into UEFI world from u-boot: + * Call non-void UEFI function from u-boot and retrieve return value: */ -#define EFI_CALL(exp) do { \ +#define EFI_CALL(exp) ({ \ + debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \ + assert(__efi_exit_check()); \ + typeof(exp) r = exp; \ + assert(__efi_entry_check()); \ + debug("%sEFI: Return From: %s\n", __efi_nesting_dec(), #exp); \ + r; \ +}) + +/* + * Call void UEFI function world from u-boot: + */ +#define EFI_CALL_VOID(exp) do { \ debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \ assert(__efi_exit_check()); \ exp; \ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 43f32385fa..6489a32505 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -158,7 +158,8 @@ void efi_signal_event(struct efi_event *event) return; event->signaled = 1; if (event->type & EVT_NOTIFY_SIGNAL) { - EFI_CALL(event->notify_function(event, event->notify_context)); + EFI_CALL_VOID(event->notify_function(event, + event->notify_context)); } }