From patchwork Tue Jul 18 18:17:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 790464 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 3xBpRz72H3z9t1G for ; Wed, 19 Jul 2017 04:22:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7876CC21E00; Tue, 18 Jul 2017 18:20:24 +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 9F32BC21E40; Tue, 18 Jul 2017 18:18:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 110CCC21E62; Tue, 18 Jul 2017 18:18:25 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 3257AC21DCD for ; Tue, 18 Jul 2017 18:18:21 +0000 (UTC) Received: from localhost.localdomain ([84.118.154.110]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Likl3-1e3r8a47ll-00czTW; Tue, 18 Jul 2017 20:17:34 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Tue, 18 Jul 2017 20:17:20 +0200 Message-Id: <20170718181723.1780-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170718181723.1780-1-xypron.glpk@gmx.de> References: <20170718181723.1780-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:tG2yq4z8QdwRG7VF9pg+QF5anQbosXHM9Nca7nvZW74MjMaSLvD HOCYOE/o1vRyB3QHcYDktd0pswFkHdiYd5gLOM1B8cW2JKX3H+/uoO0VfPLcb1kyF+Z0Bda XnBRgjr/KHq84SKhxi4woLfTWO09na1Xr8xv8zG+Hg3w9z2WyzCzeJhVOx0s/KTI/NEygo0 1UaUw3vayw29zhmf5v0qg== X-UI-Out-Filterresults: notjunk:1; V01:K0:jLhaL3UOVZU=:rMpfcwxr0g1vda4oRgBKBK MVzr5n54zmIBaV0WG/AJOkBE8ZsTgwaArrKkNG9ENxNNiYPhDylUkFDzEnANWTejFBZI+v1M6 ajOGwr8K5M9AHD36DHyUiYPlzndnMjzbsyyYd/EjxZvJLsz71/lXnem+0KYlvh6X2mSOXCkgB Ae38JBMBhnGFr3PxuqacqjFWavmaox/R5xQdBIPMc02LIBv5/Rue7hJOnqO+0Favz9WJXl+e+ q869SgBwekngMBLMvYhYa5guci2PE6KxDxKHm21FtqVhzyTELm9r7ABzdjLa9LTK02XPEGflR kVfZpGQmJp8IEdQKNyV9Yol58xkXKrYAyTwvQM+Dfpz60lOwXX12oUccBa3yZHxwbjYs9tlar n+iqLVuvTMR3xXCt8NL7XsSVt0LZq/p9LgeiJEVsxxbwPMQ0X6jiv6Vm+6GrXUeBgimQ06o9W E7wzmUT5hMGjCOxf4WhqsPr2obmIOyczgk54POg9x5eLe2zHv+Z3rU1Bd2b6yoogAaqwr+kpa mFUdEjA5ltwL/mMkg8TGRvZhwVF7nD1I7nQUbOBbKKQoYhf9Df8X0cbsf4ZFnQcLIkMfnJG9C OgtwGqqW5aYOrVHacHdVq9Zzf9CE7bsCPlPWE4wJIx6lBUHMPycAY/Eu6Vw+736535xeb7x4P eg4npL/5unFR4NwjAqxE2ezQyA9hTDYh5Gpb175Bphg1bzYqaNesGa4CrMweXP8LsTvEGW5gS LDwTlhBtjH0sw5XT+SVgDN9zVipDYUnfrYfU01Cmy1vLpGGYY7Hpks4mxiQPF+RTTvA9R1cTJ Cdq9rLyqjOnEP83zDjVO7kyzBiarg== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 4/7] efi_loader: refactor efi_create_event 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" efi_create_event is refactored to make it possible to call it internally. For EFI applications wrapper function efi_create_event_ext is created. Signed-off-by: Heinrich Schuchardt --- v2 new patch --- include/efi_loader.h | 6 ++++++ lib/efi_loader/efi_boottime.c | 35 +++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index b922720068..c3640153e1 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -116,6 +116,12 @@ efi_status_t efi_exit_func(efi_status_t ret); void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); /* Call this to set the current device name */ void efi_set_bootdev(const char *dev, const char *devnr, const char *path); +/* Call this to create an event */ +efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, + void (EFIAPI *notify_function) ( + struct efi_event *event, + void *context), + void *notify_context, struct efi_event **event); /* Generic EFI memory allocator, call this to get memory */ void *efi_alloc(uint64_t len, int memory_type); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c3c00b7a87..e38da35a8a 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -180,26 +180,23 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer) */ static struct efi_event efi_events[16]; -static efi_status_t EFIAPI efi_create_event( - enum efi_event_type type, UINTN notify_tpl, - void (EFIAPI *notify_function) ( +efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, + void (EFIAPI *notify_function) ( struct efi_event *event, void *context), - void *notify_context, struct efi_event **event) + void *notify_context, struct efi_event **event) { int i; - EFI_ENTRY("%d, 0x%zx, %p, %p", type, notify_tpl, notify_function, - notify_context); if (event == NULL) - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT)) - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) && notify_function == NULL) - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; for (i = 0; i < ARRAY_SIZE(efi_events); ++i) { if (efi_events[i].type) @@ -212,11 +209,25 @@ static efi_status_t EFIAPI efi_create_event( efi_events[i].trigger_next = -1ULL; efi_events[i].signaled = 0; *event = &efi_events[i]; - return EFI_EXIT(EFI_SUCCESS); + return EFI_SUCCESS; } - return EFI_EXIT(EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; } +static efi_status_t EFIAPI efi_create_event_ext( + enum efi_event_type type, UINTN notify_tpl, + void (EFIAPI *notify_function) ( + struct efi_event *event, + void *context), + void *notify_context, struct efi_event **event) +{ + EFI_ENTRY("%d, 0x%zx, %p, %p", type, notify_tpl, notify_function, + notify_context); + return EFI_EXIT(efi_create_event(type, notify_tpl, notify_function, + notify_context, event)); +} + + /* * Our timers have to work without interrupts, so we check whenever keyboard * input or disk accesses happen if enough time elapsed for it to fire. @@ -1100,7 +1111,7 @@ static const struct efi_boot_services efi_boot_services = { .get_memory_map = efi_get_memory_map_ext, .allocate_pool = efi_allocate_pool_ext, .free_pool = efi_free_pool_ext, - .create_event = efi_create_event, + .create_event = efi_create_event_ext, .set_timer = efi_set_timer, .wait_for_event = efi_wait_for_event, .signal_event = efi_signal_event_ext,