From patchwork Tue Jul 18 18:17:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 790462 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 3xBpPh0p7qz9t1G for ; Wed, 19 Jul 2017 04:20:56 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D63DFC21E43; Tue, 18 Jul 2017 18:18:56 +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_H3, RCVD_IN_MSPIKE_WL 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 F39F3C21E15; Tue, 18 Jul 2017 18:18:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E448AC21D5C; Tue, 18 Jul 2017 18:18:17 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 94897C21C38 for ; Tue, 18 Jul 2017 18:18:17 +0000 (UTC) Received: from localhost.localdomain ([84.118.154.110]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Mh9yT-1dKWVz1G0P-00MIVS; Tue, 18 Jul 2017 20:17:34 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Tue, 18 Jul 2017 20:17:21 +0200 Message-Id: <20170718181723.1780-6-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:bgo2j9txSOoY70dg1uKcuTOdvf8XhPnXEZFHS/9VGtfiiZ162Px EjR1oII5GRFik1ydlaKfYV1HXNYUC6Zub/NZOvBfVVyGb6x8aK96e+iALhnhnIeB6B/IwQi 2nTqd+13nGrwyQTlCjx4f9+02DgbjnZgg286vD8CCkidHUAESQCxH0/SpA9XKjNhnkspucM mtgqASoVvKcNp9U57ZEbQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:DSkz7ADxRR0=:mE9WK+FcG5c8dMznuv6KSp a2ogIKTZt1ZDtRSzYVZhLkFc/VZiaURUD9l1t4AM7W8/Kx8BA2HIOntHNt5sCF7hoTtx/H36f CO9vLdZIc3C0Y0ZChqbcNuzn6V57GjzOzgDs6qMoTK/Gexzy991vDSLGRoFZ+mLDyzpbh9Ha6 7bEmoXCzzu6ZGRaiz6k7W7FIO9OrqtKV83sYKRCO7cCw2R3pUmjsL+zoiHTf6Qhz8HL9Qr5k/ mTX4BlVoxxXeOrDoYYsZ2vRyXJWhOT+B1oWqGO76AUghk/KGMUmRZsLxyMAdafcmHhIKLTWut bO0UVvvUCI7ugY1BoQsZPrQjcz0CbEdC7eB1rfgnPpx3HKHs0rv3siqFjFAFYdp4LF2dQJJqX E80HIime9HUhUFUU+BCHOtRd4W/vp6tymIni+2f3SBvLK6MNB8o84rVa8zWP4h4CeXd7p8/9I SsI7kEBdgDmV+ALAIWrQAbmCyPLgJbvwAn9P0zOH2eq2nT1qR5SheQrR0atbCLQ8SqXGGQIGq teERA9t0rkD+TCvuSZZ2k4EDDSzoEsCHoDA03dsybFoFqXp8dnPtr6dPpYzkc2BFsBCG1YuSV 2muXTQ2ph4decupKv420JYZmLBgDkzoMQ8X20zozhF/2yw8DzVB2djaP+WHSVViawXiEqzzTM 2llGjQA26bQpdLAjBYB56ehfQYJS3d3H2lQZ8RWuizjet0eWj5VCH5htHCWpoizpeFEqDMFO/ PFq1xTOkAXDm7dDLpqCoSx4kmNwc7YI5w/+7YAVXj75vYwxQcRbuWl/bw8l+AlEYFDagW+031 HIpUHpPmfJTlxfG+MYJUfRI5fpYew== Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 5/7] efi_loader: refactor efi_set_timer 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_set_timer is refactored to make the function callable internally. Wrapper function efi_set_timer_ext is provided for EFI applications. Signed-off-by: Heinrich Schuchardt --- v2 new patch --- include/efi_loader.h | 3 +++ lib/efi_loader/efi_boottime.c | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index c3640153e1..342e960d14 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -122,6 +122,9 @@ efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, struct efi_event *event, void *context), void *notify_context, struct efi_event **event); +/* Call this to set a timer */ +efi_status_t efi_set_timer(struct efi_event *event, int type, + uint64_t trigger_time); /* 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 e38da35a8a..7f10b6090a 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -253,16 +253,14 @@ void efi_timer_check(void) WATCHDOG_RESET(); } -static efi_status_t EFIAPI efi_set_timer(struct efi_event *event, int type, - uint64_t trigger_time) +efi_status_t efi_set_timer(struct efi_event *event, int type, + uint64_t trigger_time) { /* We don't have 64bit division available everywhere, so limit timer * distances to 32bit bits. */ u32 trigger32 = trigger_time; int i; - EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time); - if (trigger32 < trigger_time) { printf("WARNING: Truncating timer from %"PRIx64" to %x\n", trigger_time, trigger32); @@ -284,13 +282,20 @@ static efi_status_t EFIAPI efi_set_timer(struct efi_event *event, int type, timer_get_us() + (trigger32 / 10); break; default: - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; } event->trigger_type = type; event->trigger_time = trigger_time; - return EFI_EXIT(EFI_SUCCESS); + return EFI_SUCCESS; } - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; +} + +static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, int type, + uint64_t trigger_time) +{ + EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time); + return EFI_EXIT(efi_set_timer(event, type, trigger_time)); } static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events, @@ -1112,7 +1117,7 @@ static const struct efi_boot_services efi_boot_services = { .allocate_pool = efi_allocate_pool_ext, .free_pool = efi_free_pool_ext, .create_event = efi_create_event_ext, - .set_timer = efi_set_timer, + .set_timer = efi_set_timer_ext, .wait_for_event = efi_wait_for_event, .signal_event = efi_signal_event_ext, .close_event = efi_close_event,