From patchwork Wed Oct 18 16:13:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827707 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 3yHHLj1YwQz9sBd for ; Thu, 19 Oct 2017 03:19:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AA64FC21E43; Wed, 18 Oct 2017 16:15: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.0 required=5.0 tests=FREEMAIL_FROM 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 5B979C21EE6; Wed, 18 Oct 2017 16:13:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BFE15C21ECE; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id C5C64C21EEB for ; Wed, 18 Oct 2017 16:13:32 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M9K5G-1dwYhI3TSA-00CipO; Wed, 18 Oct 2017 18:13:30 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:03 +0200 Message-Id: <20171018161320.7231-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:g2+O0XRlRViIdm599/0jZiXYjBfJ//4d/mMSGTniOuJa9UTqarI U7Be9a4h6guut93TgPvf76bYpHkuEhc836hW0IdrVQwnrTekDUyov380UF1+3sfRZUYKzHa IhSjjhHtGkn9mDC9f439sXp+v2saCc1g2VEw3adi+NZh2uJf+JSD7DJORJRYiIqlm/7+liA PJdK0tysfI3TQlRlXDL5g== X-UI-Out-Filterresults: notjunk:1; V01:K0:7W2TT3znCNw=:aWtIEHO9mpGSWGRKk5Uc0H BmbpXNoMHRxBgvEiKwXHGUzSyKIoOwSQvWYMLxyUBneLwGs63+XG3cWPnzaPOMe0SOkF+FdrQ nGhtG0pWOBQOQ7cfDoJWHqiM1N1llrZZCINT0uthG3hcyh0e4dtfxUk4ClBt1lBCwd9mIZH0L app5bIR/JFZW1/u9HMMR2P2YUv7eG1XnvYseElPczcQZSnHylfzo2/swHF6AKBosbUxd1Mn+l VBQo8aaP5JlI/4gX2WQv+pwcV8b7FsMghhkAGZaDE0XPELiWX9X88zMPvf4aaersAp4D4PeBZ 2/YTnpgh8DjTRYp/DE0tNypVkk6HEjUHAp8OidTW/HGHGUISvJJPneINzZAJhOqfz+EpDdem9 xmxss8dT+kMNsAnxuHcBHvVKrWrYHGdLT6ywjvha7tsyrfWiiFXa683+t2jdQXNOBOnyhN22s OQ1OeLdjpDiCfVvLfSBfse1JX6GATfe7qwUr0xigSX7/w0d4dZ0szkVmB8/+kE4HyFUmZWCPH X2LbH9kPtKLNCYFuRvaRwrYBL8znroLylrvVNuTdnKM7ZP1+1vnxmwJRWJejnRQWzz1ZOWRSA oWoJNS31H76h1OUgL2SvLQrPI99/7Bn6jp67z14bRsKxWVa4hWZwidSdZJZ3WZ7B7ynBt27an DWj5X9UF5u7UKVxXR/XJ6sREjjpRQgGs6/D/9K6nPMdO3BXeOouF0rbxRT8itDr27ZufJ56H9 g2Xh3gerZaj+FpzyrA7nBViACMa76Wv8p0/X0f0WHcC84TN9JcWlNzlC5LD3qujSmuvhL/uVB UOo+hFYqGhkSD4cHHyMlgeuxelG+Q== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 01/18] efi_loader: move efi_search_obj up in code 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" To avoid a forward declaration move efi_search_obj before all protocol services functions. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 no change v2 no change --- lib/efi_loader/efi_boottime.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f627340de4..30577f717e 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -690,6 +690,27 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event) return EFI_EXIT(EFI_INVALID_PARAMETER); } +/* + * Find the internal EFI object for a handle. + * + * @handle handle to find + * @return EFI object + */ +static struct efi_object *efi_search_obj(void *handle) +{ + struct list_head *lhandle; + + list_for_each(lhandle, &efi_obj_list) { + struct efi_object *efiobj; + + efiobj = list_entry(lhandle, struct efi_object, link); + if (efiobj->handle == handle) + return efiobj; + } + + return NULL; +} + /* * Install protocol interface. * @@ -1355,26 +1376,6 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle, panic("EFI application exited"); } -/* - * Find the internal EFI object for a handle. - * - * @handle handle to find - * @return EFI object - */ -static struct efi_object *efi_search_obj(void *handle) -{ - struct list_head *lhandle; - - list_for_each(lhandle, &efi_obj_list) { - struct efi_object *efiobj; - efiobj = list_entry(lhandle, struct efi_object, link); - if (efiobj->handle == handle) - return efiobj; - } - - return NULL; -} - /* * Unload an EFI image. * From patchwork Wed Oct 18 16:13:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827712 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 3yHHMR0Q9bz9sBd for ; Thu, 19 Oct 2017 03:19:46 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 96AABC21F01; Wed, 18 Oct 2017 16:17:06 +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.0 required=5.0 tests=FREEMAIL_FROM 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 67146C21EA5; Wed, 18 Oct 2017 16:13:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 054F9C21EC5; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id A99F2C21EA2 for ; Wed, 18 Oct 2017 16:13:32 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LgptO-1dPgnF0YkA-00oHZi; Wed, 18 Oct 2017 18:13:31 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:04 +0200 Message-Id: <20171018161320.7231-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:xMu/gxFfR0w/SvlsiCpcQqGpWHb0ycjUakkCC8+0Y8FrRwWMGjb XzI6kBtRezVU2TxP5IqTPkzvKRjU4zGRPcvDovzXX1D59yPdkYYJHwXD4KMo9ziIsFyNVRa ig2ts3gYmUFInmf3oYA6jRjSLlxWDtIr+30BMw3qi5mjqXvwtU9izW+IiFTPXkTwOLob6vC rZtYkahMzCJmq0R75mo/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:/inEcZ7OV4Q=:HCAmVeSeDb69KFmUa7XkEw 5E6F8zc2sV+0l2yiJCi4s9gPhG6wQ9wPnWuC5V6Zr5HwKC+YvJPxXrUc63I8/4hVw3XX4AAGR O5R6+Mes/nOPyCOhgEpDXq+ayJl1mrR+ECDTaWRb/7ckNL0vf8A/9du/PE+0pq+pfIZ4hivTi LytCTUl09DLDTf5b5fW5COB19xDjndmlD3r8Ph1M6ecbiMKzQDi/B2gj7N2vFLsYVsOkKCI0e di5K8HxvzX9ImtvZqBwENO2jAndUZkWFwillRUZySNSrIpLMBRudzf3UAvUJkU3PHq+7L3Q5k y48nK1Cq9iebnA2S4JdC4w32hMXjgBZyUstLg+xtl6uv6ctGS4WxyCUsMNF2dYs3pKfVwvKwq kTWlqK4iP7aiuYgkIDzhCrIZK4q0KyKWvHY8QVylhW1M+jWyMGMeexTe1pxiRV7qAxPV49MYz U4sdGwD7vKp3vDer9JGasX+a/mpHZ00duXWiFnsDdoCcm9idKvauPKWOb9T3ES+WIlyiQrVIT 5uTeZnuyiOPtE8lKoN1g0PLPc6Sn+qaGx7Iys+PsHnv59mvEBvnlrBZcsSbWL5GWPp3exo7Gm LAV3DAxA/UH9WRT6/UTom4W+yqv/R4B/7RDPimGkG0n+0Ys+Q5UOcIF63vu4Si7T0Rgn4FTBZ 2mK2KNL9cfuv0o6GVjuAddb/a6flcjNkO79qSwIY/vFTHd49J0RAL3yd49xQ+sZG3f7hi/zNU /T8BPDZX694UVh66EcOx/4lm8sWDeUOhecU5msUcQV4AGh7N8Pzrq/boHQh4LzxJeeHBavkLf lqNGN9yxg6BdprKXLHOc0Oa830qFA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 02/18] efi_loader: implement SetWatchdogTimer 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" The watchdog is initialized with a 5 minute timeout period. It can be reset by SetWatchdogTimer. It is stopped by ExitBoottimeServices. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 add a constant for 1s to 100ns conversion v2 code comments updated --- cmd/bootefi.c | 1 + include/efi_loader.h | 4 ++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_boottime.c | 17 ++------- lib/efi_loader/efi_watchdog.c | 89 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 lib/efi_loader/efi_watchdog.c diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 478bc116e2..18176a1266 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -43,6 +43,7 @@ static void efi_init_obj_list(void) #ifdef CONFIG_GENERATE_SMBIOS_TABLE efi_smbios_register(); #endif + efi_watchdog_register(); /* Initialize EFI runtime services */ efi_reset_system_init(); diff --git a/include/efi_loader.h b/include/efi_loader.h index 1b92edbd77..af64b11cee 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -163,6 +163,8 @@ int efi_disk_register(void); int efi_gop_register(void); /* Called by bootefi to make the network interface available */ int efi_net_register(void); +/* Called by bootefi to make the watchdog available */ +int efi_watchdog_register(void); /* Called by bootefi to make SMBIOS tables available */ void efi_smbios_register(void); @@ -171,6 +173,8 @@ efi_fs_from_path(struct efi_device_path *fp); /* Called by networking code to memorize the dhcp ack package */ void efi_net_set_dhcp_ack(void *pkt, int len); +/* Called by efi_set_watchdog_timer to reset the timer */ +efi_status_t efi_set_watchdog(unsigned long timeout); /* Called from places to check whether a timer expired */ void efi_timer_check(void); diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index ddb978f650..83d879b686 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -17,7 +17,7 @@ endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o -obj-y += efi_file.o efi_variable.o efi_bootmgr.o +obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 30577f717e..fd8d15655b 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -155,18 +155,6 @@ void efi_signal_event(struct efi_event *event) event->is_queued = false; } -/* - * Write a debug message for an EPI API service that is not implemented yet. - * - * @funcname function that is not yet implemented - * @return EFI_UNSUPPORTED - */ -static efi_status_t efi_unsupported(const char *funcname) -{ - debug("EFI: App called into unimplemented function %s\n", funcname); - return EFI_EXIT(EFI_UNSUPPORTED); -} - /* * Raise the task priority level. * @@ -1454,6 +1442,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle, bootm_disable_interrupts(); /* Give the payload some time to boot */ + efi_set_watchdog(0); WATCHDOG_RESET(); return EFI_EXIT(EFI_SUCCESS); @@ -1497,7 +1486,7 @@ static efi_status_t EFIAPI efi_stall(unsigned long microseconds) /* * Reset the watchdog timer. * - * This function implements the WatchdogTimer service. + * This function implements the SetWatchdogTimer service. * See the Unified Extensible Firmware Interface (UEFI) specification * for details. * @@ -1514,7 +1503,7 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout, { EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code, data_size, watchdog_data); - return efi_unsupported(__func__); + return EFI_EXIT(efi_set_watchdog(timeout)); } /* diff --git a/lib/efi_loader/efi_watchdog.c b/lib/efi_loader/efi_watchdog.c new file mode 100644 index 0000000000..35a45dedf8 --- /dev/null +++ b/lib/efi_loader/efi_watchdog.c @@ -0,0 +1,89 @@ +/* + * EFI watchdog + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +/* Conversion factor from seconds to multiples of 100ns */ +#define EFI_SECONDS_TO_100NS 10000000ULL + +static struct efi_event *watchdog_timer_event; + +/* + * Reset the system when the watchdog event is notified. + * + * @event: the watchdog event + * @context: not used + */ +static void EFIAPI efi_watchdog_timer_notify(struct efi_event *event, + void *context) +{ + EFI_ENTRY("%p, %p", event, context); + + printf("\nEFI: Watchdog timeout\n"); + EFI_CALL_VOID(efi_runtime_services.reset_system(EFI_RESET_COLD, + EFI_SUCCESS, 0, NULL)); + + EFI_EXIT(EFI_UNSUPPORTED); +} + +/* + * Reset the watchdog timer. + * + * This function is used by the SetWatchdogTimer service. + * + * @timeout: seconds before reset by watchdog + * @return: status code + */ +efi_status_t efi_set_watchdog(unsigned long timeout) +{ + efi_status_t r; + + if (timeout) + /* Reset watchdog */ + r = efi_set_timer(watchdog_timer_event, EFI_TIMER_RELATIVE, + EFI_SECONDS_TO_100NS * timeout); + else + /* Deactivate watchdog */ + r = efi_set_timer(watchdog_timer_event, EFI_TIMER_STOP, 0); + return r; +} + +/* + * Initialize the EFI watchdog. + * + * This function is called by efi_init_obj_list() + */ +int efi_watchdog_register(void) +{ + efi_status_t r; + + /* + * Create a timer event. + */ + r = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, + efi_watchdog_timer_notify, NULL, + &watchdog_timer_event); + if (r != EFI_SUCCESS) { + printf("ERROR: Failed to register watchdog event\n"); + return r; + } + /* + * The UEFI standard requires that the watchdog timer is set to five + * minutes when invoking an EFI boot option. + * + * Unified Extensible Firmware Interface (UEFI), version 2.7 Errata A + * 7.5. Miscellaneous Boot Services - EFI_BOOT_SERVICES.SetWatchdogTimer + */ + r = efi_set_watchdog(300); + if (r != EFI_SUCCESS) { + printf("ERROR: Failed to set watchdog timer\n"); + return r; + } + return 0; +} From patchwork Wed Oct 18 16:13:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827724 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 3yHHSF4lzpz9sBd for ; Thu, 19 Oct 2017 03:23:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 61AD4C21EEE; Wed, 18 Oct 2017 16:16:27 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 89147C21F1B; Wed, 18 Oct 2017 16:13:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 04695C21EDD; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 47B88C21EF2 for ; Wed, 18 Oct 2017 16:13:33 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MLeoF-1e41tI1kQ7-000wCV; Wed, 18 Oct 2017 18:13:31 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:05 +0200 Message-Id: <20171018161320.7231-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:uMS6KECGBXHlhJmVdd7A58fyK4QonmgEKJazrnFVA1XhCYWCC34 uTgc4nEO/DNEjb2FXL3qobTogIIU5zOyZ9P0DMxVYZY3hUgrSKsHOrA4+WBMxeY5wMnfCYR htZ2Oem/bkJ8tG7O5KSk2jMUz4WzyTChc1IfmaKC/pZDfmW8UYKnQKYuA6pO5CnzVushzTi obTs88SyE5l1s8Z6kx95A== X-UI-Out-Filterresults: notjunk:1; V01:K0:afr0pHateOM=:mU1AphtgWAbbgA+pPjNqKl AOYVHrkUFltLFsb9BjnHOo8U8qugOpE8S4+lYxA0gBFu6m1FHbooFZBchzmSl7fGHi4crUKKB eJvRSmy+zwb+A4E/V/HGQ8Ez8T7FYA4JflvxLY3EYC+LRiCHXwY4TtE5AHhDEL/Yzm2NUszGJ 8FLzc9rL7GufxpTrcqUZ7KcwLn/r3DR8B+TKc5XFbzQ01p81pq37nWcQ4WuyG5sXFWXYsFUb6 TeSQijD/MD/JxqcVaddIsROC0P9YQ8tX4jrVq6+uQmZZFc14xxCBV1jfe6A2XFk9b94gjJOT9 G3C+ziYiRHZXcg7jgzKgMUTGK4qRrW2xaVUTVB+t814XtQpIoup5eDjfNILLfyfg1HEjW2Wt2 jOatDOBepwMALOMT7LufXn4Ym5BGAbJglfIQltYK57wfMjioFPAkxl6NQN6n/VtUaCIf2Opyf sZpZ0qsrgZndCbeOcSHXW7bjPW9oaNPreX56hqe6kaKoA+K9+kRM64reAFZZBLqHTdPJLQncj Iaxsfs6yXLtecwFiicaf6Xp4HNymX4U9U2MYOXHllwmmVCQddBQS3Z5wkILfGkQFDqYu+CjDu GM9m6+N4aqD+vyBGx4DZrmMAsq2PH0+Zpb5A8dH+8rCKxN4Zwv0jIWAw0+j97VvipahDnyoyV uSKnNuGuy/P4n57HVmkP6NBPDodXSGnuPAwThCm32IvNA5jhXL19wb9kJB/9k+sKYSVsj9Fa5 DG9qLPQzRb7OPHulm7A13AMke8qG/J70FUr3Bw0mMA/wI5K3iIIy6Rp5FQHMXO1EtXOw2jLsb 73QBsTT3e7+7xVZPzBwBeR9Vh7xRA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 03/18] efi_selftest: provide test for watchdog 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" The test verifies that resetting the watchdog timer ensures that it is not called during the timeout period. Testing that the watchdog timer actually executes a reset would require a test outside the efi_selftest framework. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 no change v2 no change --- lib/efi_selftest/Makefile | 5 +- lib/efi_selftest/efi_selftest_watchdog.c | 185 +++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 lib/efi_selftest/efi_selftest_watchdog.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index e446046e02..3e5c9a6d16 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -21,6 +21,8 @@ CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_watchdog.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_watchdog.o := $(CFLAGS_NON_EFI) obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \ efi_selftest.o \ @@ -29,4 +31,5 @@ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_snp.o \ efi_selftest_tpl.o \ -efi_selftest_util.o +efi_selftest_util.o \ +efi_selftest_watchdog.o diff --git a/lib/efi_selftest/efi_selftest_watchdog.c b/lib/efi_selftest/efi_selftest_watchdog.c new file mode 100644 index 0000000000..f8c5404000 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_watchdog.c @@ -0,0 +1,185 @@ +/* + * efi_selftest_watchdog + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This unit test checks that the watchdog timer will not cause + * a system restart during the timeout period after a timer reset. + * + * Testing that the watchdog timer actually will reset the system + * after a timeout is not possible within the used framework. + */ + +#include + +/* + * This is the communication structure for the notification function. + */ +struct notify_context { + /* Status code returned when resetting watchdog */ + efi_status_t status; + /* Number of invocations of the notification function */ + unsigned int timer_ticks; +}; + +static struct efi_event *event_notify; +static struct efi_event *event_wait; +static struct efi_boot_services *boottime; +static struct notify_context notification_context; + +/* + * Notification function, increments the notfication count if parameter + * context is provided. + * + * @event notified event + * @context pointer to the timeout + */ +static void EFIAPI notify(struct efi_event *event, void *context) +{ + struct notify_context *notify_context = context; + efi_status_t ret = EFI_SUCCESS; + + if (!notify_context) + return; + + /* Reset watchdog timer to one second */ + ret = boottime->set_watchdog_timer(1, 0, 0, NULL); + if (ret != EFI_SUCCESS) + notify_context->status = ret; + /* Count number of calls */ + notify_context->timer_ticks++; +} + +/* + * Setup unit test. + * + * Create two timer events. + * One with EVT_NOTIFY_SIGNAL, the other with EVT_NOTIFY_WAIT. + * + * @handle: handle of the loaded image + * @systable: system table + * @return: EFI_ST_SUCCESS for success + */ +static int setup(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + efi_status_t ret; + + boottime = systable->boottime; + + notification_context.status = EFI_SUCCESS; + notification_context.timer_ticks = 0; + ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, notify, + (void *)¬ification_context, + &event_notify); + if (ret != EFI_SUCCESS) { + efi_st_error("could not create event\n"); + return EFI_ST_FAILURE; + } + ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT, + TPL_CALLBACK, notify, NULL, &event_wait); + if (ret != EFI_SUCCESS) { + efi_st_error("could not create event\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +/* + * Tear down unit test. + * + * Close the events created in setup. + * + * @return: EFI_ST_SUCCESS for success + */ +static int teardown(void) +{ + efi_status_t ret; + + /* Set the watchdog timer to the five minute default value */ + ret = boottime->set_watchdog_timer(300, 0, 0, NULL); + if (ret != EFI_SUCCESS) { + efi_st_error("Setting watchdog timer failed\n"); + return EFI_ST_FAILURE; + } + if (event_notify) { + ret = boottime->close_event(event_notify); + event_notify = NULL; + if (ret != EFI_SUCCESS) { + efi_st_error("Could not close event\n"); + return EFI_ST_FAILURE; + } + } + if (event_wait) { + ret = boottime->close_event(event_wait); + event_wait = NULL; + if (ret != EFI_SUCCESS) { + efi_st_error("Could not close event\n"); + return EFI_ST_FAILURE; + } + } + return EFI_ST_SUCCESS; +} + +/* + * Execute unit test. + * + * Run a 600 ms periodic timer that resets the watchdog to one second + * on every timer tick. + * + * Run a 1350 ms single shot timer and check that the 600ms timer has + * been called 2 times. + * + * @return: EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + size_t index; + efi_status_t ret; + + /* Set the watchdog timeout to one second */ + ret = boottime->set_watchdog_timer(1, 0, 0, NULL); + if (ret != EFI_SUCCESS) { + efi_st_error("Setting watchdog timer failed\n"); + return EFI_ST_FAILURE; + } + /* Set 600 ms timer */ + ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 6000000); + if (ret != EFI_SUCCESS) { + efi_st_error("Could not set timer\n"); + return EFI_ST_FAILURE; + } + /* Set 1350 ms timer */ + ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 13500000); + if (ret != EFI_SUCCESS) { + efi_st_error("Could not set timer\n"); + return EFI_ST_FAILURE; + } + + ret = boottime->wait_for_event(1, &event_wait, &index); + if (ret != EFI_SUCCESS) { + efi_st_error("Could not wait for event\n"); + return EFI_ST_FAILURE; + } + if (notification_context.status != EFI_SUCCESS) { + efi_st_error("Setting watchdog timer failed\n"); + return EFI_ST_FAILURE; + } + if (notification_context.timer_ticks != 2) { + efi_st_error("The timer was called %u times, expected 2.\n", + notification_context.timer_ticks); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(watchdog) = { + .name = "watchdog timer", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, + .teardown = teardown, +}; From patchwork Wed Oct 18 16:13:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827704 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 3yHHKb2Gbrz9sBd for ; Thu, 19 Oct 2017 03:18:11 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CC8EBC21EA5; Wed, 18 Oct 2017 16:15:40 +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.0 required=5.0 tests=FREEMAIL_FROM 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 32562C21EF1; Wed, 18 Oct 2017 16:13:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A447C21EE6; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id ED777C21EE6 for ; Wed, 18 Oct 2017 16:13:32 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Meh8S-1dtlAp349o-00OFgC; Wed, 18 Oct 2017 18:13:31 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:06 +0200 Message-Id: <20171018161320.7231-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:kwDqB7RQddJJgked3Ca4Y3HOeUkTaP6xkKcbo3QZ+DpnBsKoktt GPq4HwxdS8iwLzybavOYKBWuXoblmrxh2o7eDIK1mFfgGMjutbWpDEMTbfpGFKk0BHNsst7 rgld20576XWM+HAXT9B6FB9A9HASkbl0kxP4OEXH8jWHQlsiikjTqGWs76fMrIL1fI9YXpt ZtnQa7U/Y43W09Pw78Bzw== X-UI-Out-Filterresults: notjunk:1; V01:K0:cHATknfzzwk=:hbU6QA2BBnnzsd8L7+juzu ocF+byPafphTH5jsyrrAnwUOUt2DcacwxByI2ZCQk+XuNCxj2B9fN3brnQKj6JIJcbrr0d6XL +sSD13fmwd3tC8PpLqLSpA5Orbgd1C2QJrFVB1c/Me4GNcQRF+pHgskB5nvWWINVATwwiKS1Z pXwQ0+xvJpjWUXJFT251UOpPthzcnMz9EhJSUJuyXmxBcGyB20CbSCBI1KF2ied/rkb8q2W6S BUNnNAR/X+sTOEfm51xYhAtMXCvbad8IL+PIeQQVFbQlAdbZdDhX0t5vJHkJaVOgg31u6uzd8 jZKQdVyXmGh/jqMbonbnlZF6LMDhVir8AjlwiZszTl2maQwKMvwrDr1sFLkIH8FNPg9sSrJ8G R1nQjYdh1o97m2p6ut5aKGAwDOT5/170p5oUEr9kxKgnpOT8LC/Kw44RmxUsFbJ8emYWPzrm0 WdhRvA5LTbifO9RFy3uPQB33jkC13P//AbxwaIgaHWqxGbAVSZMvW3m8dtrEAm8OhMc9yDzRr VO/AzHdkB0hUcAZnFRNfHJYPZweBohfpTTepkpXyXPINMkx+lQdEgJyClV/Ugi5u2s66x9NfT G4b4TWYfD4h4fv+j92FpULEu28vJ9eUQRteYFauGCIPDe3j7LW6sNLk+bVPg+t8VtWUsVUBFR QpeVZCCbPQRajwhs9noksmZ5JnmEyl0FjoIx8HCz57rfjFGxv0fqER2bz22ALF6GUG1TjqeFS Gyl02GfetKaqINY6AkB2Fw3oFt6SDfppBPQENTC+zbWZ5WQu0sVJaWXhEpgfYZ7NA9/PPnIPW ZShBwyrEmLHp6VhMHPZ2YMcwOHeMQ== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 04/18] efi_loader: new function utf8_to_utf16 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" Provide a conversion function from utf8 to utf16. Add missing #include in include/charset.h. Remove superfluous #include in lib/charset.c. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 new patch --- include/charset.h | 15 +++++++++++++++ lib/charset.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/include/charset.h b/include/charset.h index 37a3278499..2662c2f7c9 100644 --- a/include/charset.h +++ b/include/charset.h @@ -9,6 +9,8 @@ #ifndef __CHARSET_H_ #define __CHARSET_H_ +#include + #define MAX_UTF8_PER_UTF16 3 /** @@ -62,4 +64,17 @@ uint16_t *utf16_strdup(const uint16_t *s); */ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size); +/** + * utf8_to_utf16() - Convert an utf8 string to utf16 + * + * Converts up to 'size' characters of the utf16 string 'src' to utf8 + * written to the 'dest' buffer. Stops at 0x00. + * + * @dest the destination buffer to write the utf8 characters + * @src the source utf16 string + * @size maximum number of utf16 characters to convert + * @return the pointer to the first unwritten byte in 'dest' + */ +uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size); + #endif /* __CHARSET_H_ */ diff --git a/lib/charset.c b/lib/charset.c index ff76e88c77..8cd17ea1cb 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -6,7 +6,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include #include @@ -99,3 +98,59 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size) return dest; } + +uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size) +{ + while (size--) { + int extension_bytes; + uint32_t code; + + extension_bytes = 0; + if (*src <= 0x7f) { + code = *src++; + /* Exit on zero byte */ + if (!code) + size = 0; + } else if (*src <= 0xbf) { + /* Illegal code */ + code = '?'; + } else if (*src <= 0xdf) { + code = *src++ & 0x1f; + extension_bytes = 1; + } else if (*src <= 0xef) { + code = *src++ & 0x0f; + extension_bytes = 2; + } else if (*src <= 0xf7) { + code = *src++ & 0x07; + extension_bytes = 3; + } else { + /* Illegal code */ + code = '?'; + } + + for (; extension_bytes && size; --size, --extension_bytes) { + if ((*src & 0xc0) == 0x80) { + code <<= 6; + code |= *src++ & 0x3f; + } else { + /* Illegal code */ + code = '?'; + ++src; + --size; + break; + } + } + + if (code < 0x10000) { + *dest++ = code; + } else { + /* + * Simplified expression for + * (((code - 0x10000) >> 10) & 0x3ff) | 0xd800 + */ + *dest++ = (code >> 10) + 0xd7c0; + *dest++ = (code & 0x3ff) | 0xdc00; + } + } + return dest; +} From patchwork Wed Oct 18 16:13:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827715 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 3yHHQ70QTYz9sBd for ; Thu, 19 Oct 2017 03:22:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7C4E9C21EF3; Wed, 18 Oct 2017 16:18:45 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 7F675C21F16; Wed, 18 Oct 2017 16:14:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D89FCC21F39; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 25CA2C21E68 for ; Wed, 18 Oct 2017 16:13:33 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M6SJX-1dJsKF0AFH-00yPVn; Wed, 18 Oct 2017 18:13:32 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:07 +0200 Message-Id: <20171018161320.7231-6-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:zD/ax5JCF6gej03kw/Cv7jLdMVS0pk+qshdgiSQkRkBm/BpbOtn N/9BAfNRUjwKYw9hPipzrM8Fe2OZvNEc4J3kDU5qRd3lwu66btEcfyEkcelaLCepJJ0JXeL NFOotF2VxUMFEpwhBzf06rkS9JJNfRA0mZLt7vnizGtBLL+TOcAw71SKuLRvJkhfBZWrjww 5LFFlIWUCSf7keolPGnsA== X-UI-Out-Filterresults: notjunk:1; V01:K0:mzWCwiVoPAI=:zxtx1optrvRaaevZqCai1S j1nmQDHQsJGk8uRjwsqtZD6WIGU4+f2N9cNGFVyn5ONYnfWQ6MnRvs7wrE27EvhMnAlGW512n +PF2Paj5CmSo4pw3sKpRrAUBKdcuE+HfjmF35oAfux//SwZDaQM/ivTm1oXZ/VOs9rEHxHp2Q pyREaanHpw6JwXJWqwdqKSRY9WFUY/1QvGbZul+ifbWVnGbHWgYiY1tzbKSVJwz4QonXMmEMw Hagokd1NaAFgp/JuljxJoPdSAGaWbufsVE5S5c7JFuuqMDJMu3xHYQeJ8p8rsBmaVZz1jEISq nrAc7RIN8oC/xrJCKc6fzJOm7J0pNJPvx2/shKaoQh9K5F26BsXDSso3uddb0fkaQ0W/mc0op qSVuiGqcYgO9+Zf1lKoNjpZxC4+Mu6qrA7NH3V0nR6kGTUvCeAOK+spBtRQ6GIp4jJvMIrbLc N/5FrbFDITropZbUvRTBtw13uw/51IwKs7LjZuSMHw4uw5FMX9xvPCN2sexN8njv/27hFWZhI 2BOrUq05fX/N3wH1KfsypK63+6XUCggyEoVWdKbrZYvjk2QHJIxRgjgb0TU0PiNjJdK48+l8c XzODg4PqJmHyESzce3hKP9GDNiLTzZtkecPiBB6xY8KfVAkXQpvyfYZaiCxbYFH3fiAxXtzUh 3GLyGdFPevdPRTnFOu933hfY7ZKbyJRXwc7ertQ++dqBHlO0yGi0MQhO9PWn/Owv1l4kLueyQ ivpEom8jCbQSs5LI10XmBxdbO3FXPaNqZqQwYj4OkkMf44lM+pZKskud4qGKAijLenwTLOYoj rzeX8zlOvoZl34IPJZMnwrvVfWjIg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 05/18] efi_loader: guard against double inclusion of efi_loader.h 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" Use a define to detect double inclusion of efi_loader.h. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 no change v2 new patch --- include/efi_loader.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index af64b11cee..e506eeec61 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -6,6 +6,9 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _EFI_LOADER_H +#define _EFI_LOADER_H 1 + #include #include #include @@ -345,4 +348,6 @@ static inline void efi_set_bootdev(const char *dev, const char *devnr, const char *path) { } static inline void efi_net_set_dhcp_ack(void *pkt, int len) { } -#endif +#endif /* CONFIG_EFI_LOADER && !CONFIG_SPL_BUILD */ + +#endif /* _EFI_LOADER_H */ From patchwork Wed Oct 18 16:13:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827705 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 3yHHL45BYSz9sBd for ; Thu, 19 Oct 2017 03:18:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 72BB6C21ECE; Wed, 18 Oct 2017 16:15:08 +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.0 required=5.0 tests=FREEMAIL_FROM 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 7A1A6C21EEE; Wed, 18 Oct 2017 16:13:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6530EC21E93; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 60AD0C21EB9 for ; Wed, 18 Oct 2017 16:13:33 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LhwLy-1dQnFu1N9m-00nB78; Wed, 18 Oct 2017 18:13:32 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:08 +0200 Message-Id: <20171018161320.7231-7-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:tNRkFuu+BmF8FESwRj/j3rYiS7cqn7JH7yMuj+yVin29IDfUQgQ xBS71BZhNK52LPS7Gx61y8ipKH8z37VYZXqW8VbpoNhmdNbW6V6k2ywPuYMq7UwrO4s7oGP OXktvzqPavyZUxa688BB0awPAIUXH5S3xrPM8MOovusSmyJG/HFO6BB7U5C+T+VWb9XQWpQ ZxEfX9h4DdwCzbdo2Bk0g== X-UI-Out-Filterresults: notjunk:1; V01:K0:6DSWmqCCgNg=:EVKpK+Q4XXQ49IcD37cNFJ Vjz2iwswQuNyqCvmZkxvHJQ2NsGQrIz2IwGJahOxhJLgmOW6+YAOPDk0bVO1onDTsRSADz5DH hzvruqFhvqB9I/4UQ3ptL0KFLxzSpe3C6G/K+LKKWCpknSDVCm0MfNM5rzLw97JCe3kqZxJs2 qWrg3a6p55Wj8D3LtZ914NXUMt2jws+h7bKgpSWf0llrC4O3GTxXL2OxL+DnTkN82XRiAamHC JmY/MSC25bzrBnLM9FDmwi9KIBTstCMC+BXqO/f8kuBmGTuRXDag052QUZo692XYQPnd0HxHj tDZNPFpyNAwnEKyCBE1J3mD3lnd1UWBCWRCzOFmg6nD6AK5j1s1MVYYVeNIjO81MStPcne+CO XhUX+bjI3a/rAeNnTnAKLdaTSpfI23vGY23kpgD9n7vQwmPXWSJ9/u9+0CSJEO3V0fkGiSaS7 hWX2flLnf2Rg8hZ59t/Z3bJ/uoQxXnns7j/A3tiFNh8qgECxeq9gtvYl1YqaPVIUOi4FWYquA wOelXnPvKHKtaX4xOqbB+jZ3yLZul5h4jdruiPTY+zgraxNogwepchnTv4bMO3QunW0aLgiZK SZRkuOnMn8K4A5U0aQCZ1kzg4KKIFA40BB4HTVR9nOhecU/6Kz/JqyC4rUk9HzgmrBjz6v1H4 prBk9Aee4usVwqQth5NrzYKQrs17KrRjByWWoMSbVABKg5ktv+sTUGX+FQtfZG3OQQE+BEahj 3523Y5vY7KAoQIyh3bZcl9I+j+up/1PugC6Zn8jbbBc3Uiz4YUanzBNl7EAXBN7hUvPG8Nbpy ss7fN6Xp0gc/AFW/0wA2Q5iqApvuQ== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 06/18] efi_loader: consistently use efi_status_t in bootefi 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" Where ulong or unsigned long are used to hold an EFI status code we should consistenly use efi_status_t. Signed-off-by: Heinrich Schuchardt --- v4 fix indentation v3 new patch --- cmd/bootefi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 18176a1266..6bdbb89c29 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -93,10 +93,10 @@ static void *copy_fdt(void *fdt) return new_fdt; } -static ulong efi_do_enter(void *image_handle, - struct efi_system_table *st, - asmlinkage ulong (*entry)(void *image_handle, - struct efi_system_table *st)) +static efi_status_t efi_do_enter( + void *image_handle, struct efi_system_table *st, + asmlinkage ulong (*entry)(void *image_handle, + struct efi_system_table *st)) { efi_status_t ret = EFI_LOAD_ERROR; @@ -107,7 +107,7 @@ static ulong efi_do_enter(void *image_handle, } #ifdef CONFIG_ARM64 -static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)( +static efi_status_t efi_run_in_el2(asmlinkage ulong (*entry)( void *image_handle, struct efi_system_table *st), void *image_handle, struct efi_system_table *st) { @@ -122,9 +122,9 @@ static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)( * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. */ -static unsigned long do_bootefi_exec(void *efi, void *fdt, - struct efi_device_path *device_path, - struct efi_device_path *image_path) +static efi_status_t do_bootefi_exec(void *efi, void *fdt, + struct efi_device_path *device_path, + struct efi_device_path *image_path) { struct efi_loaded_image loaded_image_info = {}; struct efi_object loaded_image_info_obj = {}; @@ -278,7 +278,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *saddr, *sfdt; unsigned long addr, fdt_addr = 0; - unsigned long r; + efi_status_t r; if (argc < 2) return CMD_RET_USAGE; From patchwork Wed Oct 18 16:13:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827701 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 3yHHHx4XPGz9t5q for ; Thu, 19 Oct 2017 03:16:45 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9082FC21EA2; Wed, 18 Oct 2017 16:15:55 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 863FAC21F14; Wed, 18 Oct 2017 16:13:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 79901C21EDD; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id D7953C21EF7 for ; Wed, 18 Oct 2017 16:13:33 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LiTm8-1dWsb22bXA-00ckBk; Wed, 18 Oct 2017 18:13:32 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:09 +0200 Message-Id: <20171018161320.7231-8-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:RtjXboq11vgmJq8LBg1a4JNrj1BRuQlAbOFkOyWNrCmJvP9QoOV vfUjShJGjHJSQOtsJPd84E6s64V8H7WMJWdxp3Cx7xNx3JI2IXop9YIIjw3FqNNUV9dQCvy O2WYfrMtPAvk4bkIn1y0tHC8Y8I4MWuMjv8PtiitpL4+9fhYNX2i/JUx+RyGsgxAR1SyQbM d1+SPP53ahw4fhhR8tCUg== X-UI-Out-Filterresults: notjunk:1; V01:K0:rHRwehI1EJs=:Ty8frKour2mfEN11X1M0Er ncV7RvMJXyCCEKkBhJKtMyT+hfZ4yPIqqbyEEkgdtWJqlS2h5xbOc2KU7OszBpu7u0VScIe6l +ZLbKqBL5jtD6Sw/PnW2BIjbC7LgzYJqf5GE3Ey/ukUJkdh/ruoOhZX2wOfKg/uRsA07X/1jH MI091cd1eSMAHJu9s0fTpMX8QirAWMapyaW3BO1TMa5hNWukOEsS5FBlZcpEPvCP0V9rjtDLB 59s6vXY5uTCqkQGZa9hGHYCimDjEaBTa8Azn+8ZUevia3SU7nLsnWFZ5CI+9i2/xImlgWMOdo orU7X0ADdcCAUVct1mRrR3EIjMSYx1WDkiBODGSD2YCmUVbbPnj/bJiGTOCIH+/3qFsQThOAj S9uuU2pP9TVpX8MXWiK0rgGKKImQBYdbBNjdJKUSBSx9EDOApXj6s1XaO7Jg30bOFW8t/7kv2 oqjICGG/dNTFqBSw1UONkgDn2cAs6+7yj4N/uF0gjpxZ3NzLBBSL0tHFLzYfK1imB42tSNqgY rOwyfmadBhlG+Wv31+uaZc95gea+tFeXLe8rRJ/cqgKZ3Wz7rjDIRAuqJwcWCnd1RwCqtmy7o CchGy7nPf3tNoHH30UT6IPPt7z2UjiARNb1FTg6exfr32n1QIiEs4v7hgdWe1gK7sRZa2ryw8 dzpEZIIYndcrDgMsaMBV4yBP0Ki8HCrH7CGPs62qpBkcGIHhDhTTjhR9C1jWCkJ/huEVyycG1 MhjO0urcZkkartccHrcA3rojbCLG59ECWYCZjchmHWLSbBWcDQBEUkwLzeqs0ykA0avi0XQvs M1OEDu9VN9FHaJr6qjPRO0H3RnylA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 07/18] efi_selftest: provide a dummy device path 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" Currently we pass bootefi_device_path and bootefi_image_path as device and image path without initializing them. They may carry values from previous calls to bootefi. With the patch the variables are initialized valid dummy values. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 new patch split off --- cmd/bootefi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 59696f4601..d497381ac3 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -299,6 +299,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) struct efi_loaded_image loaded_image_info = {}; struct efi_object loaded_image_info_obj = {}; + /* Construct a dummy device path. */ + bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, + (uintptr_t)&efi_selftest, + (uintptr_t)&efi_selftest); + bootefi_image_path = efi_dp_from_file(NULL, 0, "\\selftest"); + efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj, bootefi_device_path, bootefi_image_path); From patchwork Wed Oct 18 16:13:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827725 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 3yHHSP4bQPz9t4c for ; Thu, 19 Oct 2017 03:24:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 60E28C21E66; Wed, 18 Oct 2017 16:19:01 +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.0 required=5.0 tests=FREEMAIL_FROM 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 94697C21F18; Wed, 18 Oct 2017 16:14:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DF72DC21F4A; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 12A7FC21E78 for ; Wed, 18 Oct 2017 16:13:34 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Me8di-1ds6kM3sAo-00Pu6c; Wed, 18 Oct 2017 18:13:33 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:10 +0200 Message-Id: <20171018161320.7231-9-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:tZPgVc9aPJVne4fdtv8V3CqG4QvJCCKFFH+ZWtYaCS2f1eQ4wQw TD/kruEicpePquyynmPiDpeaCRAMWhIyzfL5gJrB//bE0wFK41BUIN+p7Ps53dLpwaTKRco nXLiF0TkyKGYiJvPvislkSaZ429jL10+asM1SiEQg9wwMK/i35cWtZgb2qBZa/ukr7olHvw OIg8j4M3LN3Fb/qwPBB2g== X-UI-Out-Filterresults: notjunk:1; V01:K0:pz02HwU9neI=:rgXgs2q4kxhk/KpgYQ72Ra 780mRKh6MOk33Voj81FF1Ta5OA7U2UpX5EoNc2nGMzvml2unYQM2UKEXz/FR6/sFYpjSU1LOx wjBdRybfzMIb9LGBAg/trPJJWHuyYsFO5iTMKWwVOZy5k+c+r9jzSoSicHypw/7d6leLOKjFC za7boXVY6LDFFLWKR3gQ0GQjhSrUm25WJvFSqtXrufF4T0gBu3sqcKHRiSwcCiMygAig4RjPL eUXRcphjHSHkNeVugNRnmi2IOfVA6qBou8qhn8OixqVQ9HZmiWjtmz9BnJ5L460R19hr7ObWY 0BYsAeldB0wuePQNq8oK88jgHtfNJ62hdIY/qHfgrbQG0yJoECnh7/qFLzm9HgwL8yzirknZX wlQM86q3dXMeIZjxDxp17quCjqhy5Xgv6mM0I7ne83obYYaoZk9zd1LXoUp6QGwUIu2Xj1zQY ZhkXsQAUxLUZLSJ6CYT8zbqPpucZSdPA39k5OY2B5AMNrbpgHAT4lJmySUm3pRWQbfMtCHL1f y6respQNhrvJvJZYQNwb8DRKofARb6f+N27+jBxa8LanCKCyPADLpuS5Yzu1+bTS3ibIGK1sD ZEe94qyDhwvFGGURgYJyar/qMs3681NfXucR/zJ61f1DkFdkOCoKL/M3JKctkLEt/NCo31Udu zzcrjus4SSTtXmSbwPeF+XulD25CWjHWI2AktFe74/Of6HlQUYq2P/2VIsQIKudwdk8zwujeB WD+ghBshXQFnjrd/f6L1c17NQXBYSH0Lbe3lnFaezYCWPn6sWYhlpA2UYu/aibPpjxed/7AhA 8HwHnFgXPKALrZFxUkiXhXs9NY7Kw== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 08/18] efi_selftest: reformat code 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" Remove superfluous spaces. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 new patch split off --- lib/efi_selftest/efi_selftest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 45d8d3d384..c2c339a7be 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -25,8 +25,8 @@ static u16 reset_message[] = L"Selftest completed"; */ void efi_st_exit_boot_services(void) { - unsigned long map_size = 0; - unsigned long map_key; + unsigned long map_size = 0; + unsigned long map_key; unsigned long desc_size; u32 desc_version; efi_status_t ret; From patchwork Wed Oct 18 16:13:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827694 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 3yHHF52w8vz9t4c for ; Thu, 19 Oct 2017 03:14:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1099AC21EFF; Wed, 18 Oct 2017 16:13:45 +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.0 required=5.0 tests=FREEMAIL_FROM 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 2C6E1C21EE6; Wed, 18 Oct 2017 16:13:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11AC4C21ECA; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 473B4C21EF4 for ; Wed, 18 Oct 2017 16:13:34 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Ld0fQ-1dMxUz0qO0-00iDIS; Wed, 18 Oct 2017 18:13:33 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:11 +0200 Message-Id: <20171018161320.7231-10-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:I+44LPVtcEI9srKR7v6yAtL4k0Y9r/pbVfICXQvVz8oQEaqXTI6 +cclAgLWxq6AtmQOa7LOlTp67ztFP8k4gpyeX+p6E/hBvxBlyKeG93/e+KcPPZEvtLgmqqW aawz9zGDhkAYZjUr5SkUJYgNp96S7J4tlvHZDU7AeU3GDc4tQcxzlySX4thEV2h/OBe3i8y H5IwOiBqn6N/7M9TOVtdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZE5VJQr8XgI=:axMdocN8i4CK437//BgToV KLnzoPX7vQlArk8yVzyG22YnCA3naRif8SVXrXU0lXRLS1zKt3H+8g+B6jdhFLoZeSjrc/wCs D73jJFKC9GmqH8d/87Oh2awAaumum8peXRiqTUFCPYtq8XaFoivMj2h0f7r4WoAoqesHKrVZp 6sHm33XZ05YsVeOXYdDFUzw2w2o7A9q84qnVdBt8ZjCc7OjTOZLBZjs6rc2oLZzmjrA3aOgG4 9X0MhcX7cwPLbyhzAPezIPD8olb66xRcci/mrrXYry6j6UCi992nBwgykt0cEzI54PSnhKpQQ FUPRNYWgPyhjtOcP6p/R/bosvkF/dDnyvBrMwN9eD+fcqG7BkL3a7jSYaPTlgkmynB27rbyMf QBSmVXCVGbMZcpQjYru5JjPHtmh2yQcvrGaZJqdgcWdN01DXT1Tn+Oz7UcvNfNFGX8Ywpqbph Ogckw+au6CBOBLhAoc3VWVB1gtR+LwlXGIRRb8vQ4nfNijpU03FTjJGEYE7eHX8QR8kSa4onW FQFDEjmOHDH3Y5UTEjf6Ve2NEZ0ntMgugsd2ZjSO263w9b42a68R8n370mJaQCrw5BEzaRUIZ HoAyb3YATOpo3o9dt8+2htAVEl3PHjdYSCH4sWp3Je903Tz1y2LqBYcpCERv0NMcfzTgkVOQa jI9WzhNqtACJX14fvAtbulQwZuoPpZTG+oiSujhv3k0iC74bHt0MORuQ+rJ4HQUYYip1KH3ph HBg4m47o5JcQ2AK+7YjX6LGnltfcUqQG3MYyfEW447FUuYaQPlTZB8PwjwBe3fygBwvWQnkCr B7V2E92Nls5VmXXSuQxHULxEuz5Jw== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 09/18] efi_selftest: efi_st_memcmp should return 0 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" If the compared memory areas match the return value should be 0. We should not use the unrelated constant EFI_ST_SUCCESS. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 new patch split off --- lib/efi_selftest/efi_selftest_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c index 5cffe383d8..5f81f251c4 100644 --- a/lib/efi_selftest/efi_selftest_util.c +++ b/lib/efi_selftest/efi_selftest_util.c @@ -21,5 +21,5 @@ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length) ++pos1; ++pos2; } - return EFI_ST_SUCCESS; + return 0; } From patchwork Wed Oct 18 16:13:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827711 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 3yHHMM4t80z9sBd for ; Thu, 19 Oct 2017 03:19:43 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3BB71C21E70; Wed, 18 Oct 2017 16:16:47 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 779F1C21F26; Wed, 18 Oct 2017 16:13:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 670B9C21EDD; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id D1F65C21EFD for ; Wed, 18 Oct 2017 16:13:34 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MYwVv-1dhuX8206F-00VeKV; Wed, 18 Oct 2017 18:13:33 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:12 +0200 Message-Id: <20171018161320.7231-11-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:q8JVi6RMOr3rWlxN7yy9ic/Y9GcZecS+WF/vm5F+3udf9/zDg0l 1ay60HqhT2HJnwWqdo0Fr+qNHDOarf2PozGcJTJjlFDqFdtQA+24WYgwSMTmOyVsIahuB9Y 88GNd9LBEMSrnyqF+gYG60593ix0r1UrefFRDwBbCY50SVmWh1/8LBhZd8ht629/Nr7PK3K MTYPbtMXWEjAGXoXH0wpA== X-UI-Out-Filterresults: notjunk:1; V01:K0:80449kqhV+U=:8bmPykiD3pxFVxzcvIUe7h b2c33+D4Bo4JB8EoeumON/FmpmDHqbwxIm3t0JX6YOKe+dEWm+E6s86eR4gNmh9y19gPujpgj bigNlC09QrJ7xo8BaWoYlZio1UVpC+zEVSn0XbtNQNwfWbrMrOozeAn+lVkWHJlAcSxwK79+s WfK4cAD22Mh+9kfAXrd1V++QCD/dqmnmb5fOn+anIGXjVjMouKwTk4cWjGwPx4SfAF9NRYFue 10+QmcQ6ak207N68nTuhosrv7gAZLz1gXyDAVHSoidCfHYtOBoJa4XiHV7ZPT+JaKpFRzzhm5 5WtEI8jAJ1V7GGGVV7DfZ52Ypz21CsrsPqYdInmpUlgREHsymOVqYk7E8tDLzECP1wPgmGQcI VLrJNEbtHT5CE3r1/Q4v8g3SgwO37bwBGBvS2cN9XgOLlD+W668d/vqsgbuCHbQidGobP2tEV 8P/rTUcg8q+g+L9Cqgi8ttTf5tlGW/oQgY0DBt0WMsAIOnq1pY/7X40B8i9suGUsJXhRfRIXo iiqOTw25sc9C9zINXIjjzK2jotgDYq9STGhnGEJ+FeUSyRPbJ7aLS0lBwsumBEARFYUmEEZ9o 1LGx1Q+dsllAyRMJ3bp0dAQbV/ohNiBQXQhpsIFywo2JRI7FZ1uU2xZTFdVOy7l1z+4W35Qoq N940rsFIUCV8EhDyoa3+SjsthBSOTdoJ0dYnQp6jtDAxZ0GyQuoBr1EcUsCdiSjuYI8ZM3BhM YcqTeJinkcdlaQCLtVKfR8hyiKb1ev7u6otPoteu59tQlm3p5H+13PfegoK9ct5klIf9oFISg KcJgL5PO29KeIA8Dmyj0f99G2YDOg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 10/18] efi_selftest: deduplicate code 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" Move duplicate code to the new function efi_st_do_tests. Suggested-by: Alexander Graf Signed-off-by: Heinrich Schuchardt --- v4 new patch --- lib/efi_selftest/efi_selftest.c | 71 ++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index c2c339a7be..73f074d9e1 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -9,6 +9,13 @@ #include #include +/* + * Constants for test step bitmap + */ +#define EFI_ST_SETUP 1 +#define EFI_ST_EXECUTE 2 +#define EFI_ST_TEARDOWN 4 + static const struct efi_system_table *systable; static const struct efi_boot_services *boottime; static const struct efi_runtime_services *runtime; @@ -133,6 +140,31 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures) return ret; } +/* + * Execute test steps of one phase. + * + * @phase test phase + * @steps steps to execute + * failures returns EFI_ST_SUCCESS if all test steps succeeded + */ +void efi_st_do_tests(unsigned int phase, unsigned int steps, + unsigned int *failures) +{ + struct efi_unit_test *test; + + for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); + test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { + if (test->phase != phase) + continue; + if (steps & EFI_ST_SETUP) + setup(test, failures); + if (steps & EFI_ST_EXECUTE) + execute(test, failures); + if (steps & EFI_ST_TEARDOWN) + teardown(test, failures); + } +} + /* * Execute selftest of the EFI API * @@ -153,7 +185,6 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures) efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, struct efi_system_table *systab) { - struct efi_unit_test *test; unsigned int failures = 0; systable = systab; @@ -169,41 +200,23 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, ll_entry_count(struct efi_unit_test, efi_unit_test)); /* Execute boottime tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); - test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_EXECUTE_BEFORE_BOOTTIME_EXIT) { - setup(test, &failures); - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, + &failures); /* Execute mixed tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); - test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT) - setup(test, &failures); - } + efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + EFI_ST_SETUP, &failures); efi_st_exit_boot_services(); - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); - test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT) { - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); /* Execute runtime tests */ - for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); - test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { - if (test->phase == EFI_SETUP_AFTER_BOOTTIME_EXIT) { - setup(test, &failures); - execute(test, &failures); - teardown(test, &failures); - } - } + efi_st_do_tests(EFI_SETUP_AFTER_BOOTTIME_EXIT, + EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, + &failures); /* Give feedback */ efi_st_printf("\nSummary: %u failures\n\n", failures); From patchwork Wed Oct 18 16:13:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827697 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 3yHHHX0gpbz9t4c for ; Thu, 19 Oct 2017 03:16:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BCF3CC21EB9; Wed, 18 Oct 2017 16:14:25 +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.0 required=5.0 tests=FREEMAIL_FROM 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 C1D81C21ED9; Wed, 18 Oct 2017 16:13:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A4786C21EA2; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id 0A515C21EC8 for ; Wed, 18 Oct 2017 16:13:35 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MBmvH-1du5j03EjX-00Ao5T; Wed, 18 Oct 2017 18:13:33 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:13 +0200 Message-Id: <20171018161320.7231-12-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:cHfEu5mn3EGGcUJMr59tCLbwb2GRpeynRQ4FxBNdlvFmjUFTmV8 XG0w/koDsL70DnQ0jpSPEGPkvJPA305XmLDo6g8OHOrD0uV/ksuwQNviMsm+mIHCY7iSgD7 c7w/txKLkgT1jBp5zpCHfRo3WDgL09Pfond2NugogNlHXxl2iF7bew3ADF7gtYWnWFfHmu8 DjETHmDnhesUOKImoGAzQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:f/W86j+hLx4=:UCQQhBkS/SUl3oSjx3bSLb NT/jjmnm4Yx9mKUxCe3NwXV0vSwysxPiVj2KU2n/v4ZfoHMY0o2UlIQQoimcENyAuOkfzOhzs cfJ44kG4+qaoyjktmaU5VYVAlVtnup5cGEHyUT23HMzWsmhMKBvLHEeo5TI/95Yp4s06Nkqsk AZmjzGZblZtPY1PhpgKU/VB/O2EbI518B2PIM+sdtHplSLPslBQO00TolcZCtsNimoFeqVDla bU+DdDQOR8y63ph6K43mKCVilH5w5zD2QqxhVSpO+SXSM4btGskYwYa8xbKn9MD2WFM6QHYaM gtKmRZvS+M97qQHEO3sIrF2cT42znmw28dOLcm0BmmG7Be7iEmLizwP83LcEO+8Fpove4C8hz 3iVsBZvj4m1XtZch8tPilOCnHReSwYINVxcsNOaZLlBsvTHmkhLCbqNB3IdRMCTbEtLJcL2jk lnKev2qnYB4i6PNYz+eu+czAIc5RpqvYMHzjfSFGOWLRmSYTsFwDhT/TWHcUQNTfzZzkb2zVC C+XjOb2at4bgvrcgNcERo4IKsA1XgaLJyerSQJos6mZVMNo2iyO26Z0dPr8emKnUvb5wcIuq5 uJySUK9FhwXsAySmbCJecA0W5A/xv+feHyLKKcNAg5XqSbCeB2Oq+EdauQ3K3cdMacBTjwctQ RQ8wFqTDQgUybtzv+WvAe4dPe9li3EKvZqeHOsFYb4KxNvfxkw80j/LhvLse1ZsNnCs9c15NW JToAcMfYnuZXEZRMuE4C1NUWXe5pJunMW0gyNuKBuNTM4XnJDjFDtZdJoVWtW28oKM4Najej4 ihBKVcjUsQbrCxJPlMZrWHh7k6pnA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 12/18] efi_selftest: allow to select a single test for exexution 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" Environment variable efi_selftest is passed as load options to the selftest application. It is used to select a single test to be executed. The load options are an UTF8 string. Yet I decided to keep the name propertiy of the tests as char[] to reduce code size. Special value 'list' displays a list of all available tests. Tests get an on_request property. If this property is set the tests are only executed if explicitly requested. The invocation of efi_selftest is changed to reflect that bootefi selftest with efi_selftest = 'list' will call the Exit bootservice. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- v4 remove superfluous definitions v3 split off unrelated changes to separate patches v2 use an environment variable to choose a test --- cmd/bootefi.c | 37 +++++++++++++- include/efi_selftest.h | 12 +++++ lib/efi_selftest/efi_selftest.c | 88 ++++++++++++++++++++++++++++++--- lib/efi_selftest/efi_selftest_console.c | 10 ++++ lib/efi_selftest/efi_selftest_util.c | 9 ++++ 5 files changed, 149 insertions(+), 9 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 6dab3cc2a7..05375a657a 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -6,10 +6,12 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include #include #include +#include #include #include #include @@ -50,6 +52,32 @@ static void efi_init_obj_list(void) efi_get_time_init(); } +/* + * Set the load options of an image from an environment variable. + * + * @loaded_image_info: the image + * @env_var: name of the environment variable + */ +static void set_load_options(struct efi_loaded_image *loaded_image_info, + const char *env_var) +{ + size_t size; + const char *env = env_get(env_var); + + loaded_image_info->load_options = NULL; + loaded_image_info->load_options_size = 0; + if (!env) + return; + size = strlen(env) + 1; + loaded_image_info->load_options = calloc(size, sizeof(u16)); + if (!loaded_image_info->load_options) { + printf("ERROR: Out of memory\n"); + return; + } + utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size); + loaded_image_info->load_options_size = size * 2; +} + static void *copy_fdt(void *fdt) { u64 fdt_size = fdt_totalsize(fdt); @@ -317,7 +345,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Initialize and populate EFI object list */ if (!efi_obj_list_initalized) efi_init_obj_list(); - return efi_selftest(&loaded_image_info, &systab); + /* Transfer environment variable efi_selftest as load options */ + set_load_options(&loaded_image_info, "efi_selftest"); + /* Execute the test */ + r = efi_selftest(&loaded_image_info, &systab); + free(loaded_image_info.load_options); + return r; } else #endif if (!strcmp(argv[1], "bootmgr")) { @@ -363,6 +396,8 @@ static char bootefi_help_text[] = #ifdef CONFIG_CMD_BOOTEFI_SELFTEST "bootefi selftest\n" " - boot an EFI selftest application stored within U-Boot\n" + " Use environment variable efi_selftest to select a single test.\n" + " Use 'setenv efi_selftest list' to enumerate all tests.\n" #endif "bootmgr [fdt addr]\n" " - load and boot EFI payload based on BootOrder/BootXXXX variables.\n" diff --git a/include/efi_selftest.h b/include/efi_selftest.h index 7ec42a0406..5cc8d4f600 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #define EFI_ST_SUCCESS 0 @@ -71,6 +72,15 @@ void efi_st_printf(const char *fmt, ...) */ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length); +/* + * Compare an u16 string to a char string. + * + * @buf1: u16 string + * @buf2: char string + * @return: 0 if both buffers contain the same bytes + */ +int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2); + /* * Reads an Unicode character from the input device. * @@ -88,6 +98,7 @@ u16 efi_st_get_key(void); * @setup: set up the unit test * @teardown: tear down the unit test * @execute: execute the unit test + * @on_request: test is only executed on request */ struct efi_unit_test { const char *name; @@ -96,6 +107,7 @@ struct efi_unit_test { const struct efi_system_table *systable); int (*execute)(void); int (*teardown)(void); + bool on_request; }; /* Declare a new EFI unit test */ diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 73f074d9e1..5d8bb54d53 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -140,20 +142,59 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures) return ret; } +/* + * Check that a test exists. + * + * @testname: name of the test + * @return: test + */ +static struct efi_unit_test *find_test(const u16 *testname) +{ + struct efi_unit_test *test; + + for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); + test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { + if (!efi_st_strcmp_16_8(testname, test->name)) + return test; + } + efi_st_printf("\nTest '%ps' not found\n", testname); + return NULL; +} + +/* + * List all available tests. + */ +static void list_all_tests(void) +{ + struct efi_unit_test *test; + + /* List all tests */ + efi_st_printf("\nAvailable tests:\n"); + for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); + test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { + efi_st_printf("'%s'%s\n", test->name, + test->on_request ? " - on request" : ""); + } +} + /* * Execute test steps of one phase. * + * @testname name of a single selected test or NULL * @phase test phase * @steps steps to execute * failures returns EFI_ST_SUCCESS if all test steps succeeded */ -void efi_st_do_tests(unsigned int phase, unsigned int steps, - unsigned int *failures) +void efi_st_do_tests(const u16 *testname, unsigned int phase, + unsigned int steps, unsigned int *failures) { struct efi_unit_test *test; for (test = ll_entry_start(struct efi_unit_test, efi_unit_test); test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) { + if (testname ? + efi_st_strcmp_16_8(testname, test->name) : test->on_request) + continue; if (test->phase != phase) continue; if (steps & EFI_ST_SETUP) @@ -186,6 +227,9 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, struct efi_system_table *systab) { unsigned int failures = 0; + const u16 *testname = NULL; + struct efi_loaded_image *loaded_image; + efi_status_t ret; systable = systab; boottime = systable->boottime; @@ -194,27 +238,57 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, con_out = systable->con_out; con_in = systable->con_in; + ret = boottime->handle_protocol(image_handle, &efi_guid_loaded_image, + (void **)&loaded_image); + if (ret != EFI_SUCCESS) { + efi_st_error("Cannot open loaded image protocol"); + return ret; + } + + if (loaded_image->load_options) + testname = (u16 *)loaded_image->load_options; + + if (testname) { + if (!efi_st_strcmp_16_8(testname, "list") || + !find_test(testname)) { + list_all_tests(); + /* + * TODO: + * Once the Exit boottime service is correctly + * implemented we should call + * boottime->exit(image_handle, EFI_SUCCESS, 0, NULL); + * here, cf. + * https://lists.denx.de/pipermail/u-boot/2017-October/308720.html + */ + return EFI_SUCCESS; + } + } + efi_st_printf("\nTesting EFI API implementation\n"); - efi_st_printf("\nNumber of tests to execute: %u\n", - ll_entry_count(struct efi_unit_test, efi_unit_test)); + if (testname) + efi_st_printf("\nSelected test: '%ps'\n", testname); + else + efi_st_printf("\nNumber of tests to execute: %u\n", + ll_entry_count(struct efi_unit_test, + efi_unit_test)); /* Execute boottime tests */ - efi_st_do_tests(EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + efi_st_do_tests(testname, EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); /* Execute mixed tests */ - efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + efi_st_do_tests(testname, EFI_SETUP_BEFORE_BOOTTIME_EXIT, EFI_ST_SETUP, &failures); efi_st_exit_boot_services(); - efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT, + efi_st_do_tests(testname, EFI_SETUP_BEFORE_BOOTTIME_EXIT, EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); /* Execute runtime tests */ - efi_st_do_tests(EFI_SETUP_AFTER_BOOTTIME_EXIT, + efi_st_do_tests(testname, EFI_SETUP_AFTER_BOOTTIME_EXIT, EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN, &failures); diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index 840e2290c6..6a7fd20da5 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -142,6 +142,7 @@ void efi_st_printf(const char *fmt, ...) const char *c; u16 *pos = buf; const char *s; + const u16 *u; va_start(args, fmt); @@ -179,9 +180,18 @@ void efi_st_printf(const char *fmt, ...) case 'p': ++c; switch (*c) { + /* MAC address */ case 'm': mac(va_arg(args, void*), &pos); break; + + /* u16 string */ + case 's': + u = va_arg(args, u16*); + /* Ensure string fits into buffer */ + for (; *u && pos < buf + 120; ++u) + *pos++ = *u; + break; default: --c; pointer(va_arg(args, void*), &pos); diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c index 5f81f251c4..1b17bf4d4b 100644 --- a/lib/efi_selftest/efi_selftest_util.c +++ b/lib/efi_selftest/efi_selftest_util.c @@ -23,3 +23,12 @@ int efi_st_memcmp(const void *buf1, const void *buf2, size_t length) } return 0; } + +int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2) +{ + for (; *buf1 || *buf2; ++buf1, ++buf2) { + if (*buf1 != *buf2) + return *buf1 - *buf2; + } + return 0; +} From patchwork Wed Oct 18 16:13:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827706 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 3yHHLR2gRBz9t4c for ; Thu, 19 Oct 2017 03:18:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 76BFCC21E78; Wed, 18 Oct 2017 16:17: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.0 required=5.0 tests=FREEMAIL_FROM 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 15728C21F3D; Wed, 18 Oct 2017 16:14:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1EC10C21F2D; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 7E1F5C21EE4 for ; Wed, 18 Oct 2017 16:13:35 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0M39zL-1dCCHh1b55-00suGR; Wed, 18 Oct 2017 18:13:34 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:15 +0200 Message-Id: <20171018161320.7231-14-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:odEUxvw5BATx5urd6AJ1go0x82hblptP0haKblAOwLq2V/wWn2H +p26jy2JlcxV5aHjHezhbMi33VKesr1qQR5zWIwMQDKcRMUzriKtHOzDeHmJ6Zid9QJRWmN 5xZj8acJYCsk3E4aE6SkLeohP0wFYSyAg1cJchdo2WgHTKlNqCP9C27uZUmhZ8QKtLPWXt5 2DZBhS++Ylyuzex0kjjyQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Tg+p3LvrG6I=:4u3kCrIzAaot1ogasZYFCY J0+I6MnB5vs2Oea+IHcJw34I2HM9jbWZlTxXu3Wlvk8wt6Ry8kBfC/ikcXp1/2mv78AHD3Pp1 XVmsjmKRdB/aYJ7vIyf8wDnqNjsp877xMOlUe3M4HQZubZyy04QK0allHDZFfnShta71eP2Js 6ih0CuG/9iX6Pjr/N4DiAHgUpEj+ivMy9tsM0bg/V3YP0qdQhw+9mPkmSQDf3EBeFUxHNkBLM 4y1jgmaLBc8m4gAkMHQ2ndp6eGDqBvuduup28K3Ew5CA4WV782PPu2Hl2zT94qMSworUjOWxV ZZ2boSLgp98zx31FmmfKuHZVBFio8V9Jd8PT3PkaDxJy04N0f6uEzrtXUH4fPrjQ141FgsMYG Ho9L85QiLHXfelykAiwUuVH8jFcubqYSHDrEy70pubgoSx7P/iIIvQgRkq9M1nFJZJLp8mqUN BZka/OSdb+R46XO9xIJlB6tWjjnNYvsfQdYvHyU3cM9vtPY/topO1qm98Iqn+vetO3g7RQi+X TQSYVcJHiPztnQAl5gZXfF6oIqtakDXbPXaQ5IuXIp6XsdQfwT54heg5iZsSMCkkkirb2JkAq M85szX5YyRMgp7e2krisKRygMUQC+Ss6LXyGqoPQje3We9YodQRNOCGBYiB2CrmB/JdtgpQaH d2obox+PHd7PxuizRt66D7CxkUOc0CV3GFhzzueb44pPo0fVvTmMcvFEuvz0g+gveAiUxdzoQ +9iP0ixPRcf8Luw9MGoBnHw+hiAjaljCWQYrINXzRz7iQGwuB2aLvrhDKE/4l/io4OwG5sft5 7fkH7+FFWRb3+pm9f4TCXT5V/a3sg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 13/18] efi_loader: use bootargs as load options 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" Use environment variable bootargs used as load options for bootefi payloads. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 new patch split off --- cmd/bootefi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 40834f3899..ff659fc02f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -218,6 +218,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt, efi_install_configuration_table(&fdt_guid, NULL); } + /* Transfer environment variable bootargs as load options */ + set_load_options(&loaded_image_info, "bootargs"); /* Load the EFI payload */ entry = efi_load_pe(efi, &loaded_image_info); if (!entry) { From patchwork Wed Oct 18 16:13:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827703 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 3yHHK92P8vz9sBd for ; Thu, 19 Oct 2017 03:17:49 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0A3BDC21EE8; Wed, 18 Oct 2017 16:14:05 +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.0 required=5.0 tests=FREEMAIL_FROM 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 E320AC21F01; Wed, 18 Oct 2017 16:13:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 02FF2C21E68; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id BB3C1C21EF3 for ; Wed, 18 Oct 2017 16:13:35 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MVvi4-1dkvTC2m3E-00X16a; Wed, 18 Oct 2017 18:13:34 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:16 +0200 Message-Id: <20171018161320.7231-15-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:0fETWxJZo31vTrFv4GGeT4XB539Tumg/DzDZ7bMFRJjqwx8K0Xg sIqvhryG09/i+qHUgjocu+cLKmN/2D0TvXuGx+rucV18+V3XXclmdcVP4jC8taKyLxX8bs3 4NSGnAPSvDzItOEpee9aXqktscIoKbt36ue/EKQo/2nEh/ood04gbscGvsUhOZgh2/e/WR0 OI9yN8i1FvKAkdKwfjo/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:xy1pA2q+j1U=:c1KMIxzJWI+GnC/eBB290U 9y63hV1K/EWdx3kq6J9XYJ7OnARnX8RX8j7ZfGrbTdWAaoOkw51aL4mGm4/GKNkb2vntKg4Y+ Jlk3WG9+t0XeTHDWDCT/XK/2TzLWNLvMJ+lAEh/a+qc15IqAvuXsEpN99/iCXbd6Rii2vAk81 BmPYv/OifaCqN6RGPWQGJgSRR5sbcp8bBV9b12qy4aUcfSbUlbDvhtcpHE4DQUhXNqEqXpQsn 4CyeQw9608nQyPgGnQSU+NYvBzum0wK+JUz8aU+f60w7cL7z1Nq5Qv5ay0aefkyt7Xm5S6aGI 48HxlVovPTJ6BtQXZ+DVP+ZQ8Zs4iqyLhRiWH7r9tn5uwHCQIleIGsD1O7EyWd0g0lghNHfqQ k5fFd3f5FP5MUEApZhqq0ILWkIesDNNAiD0ANX3SMTgydoTUJVW10x8beZ9TxcwHtvibaRlI7 QEAx4APPK72Ta4je0/fSoQb6YrY/MJH9dS7NlhHLN9vZPAB6dTAHNJTsV46XHdq1kg1BPvEFn nfl+6Xs0UzyIGMQEZt1KoxV/LQTqj/Ackl4Yoozm3fX9OU3x38Yr7Y48FKH0r84JiiwTWmNBd w/aFWGwxUtDyB9zrMEWL8gjsXSW1wEWVdOjL650K7CALZKT8d7wq9+5+75XcUKkfCLrGfLlNc 0mljUp3RHwIiPLKdtJ9X6m1BZm6qLqtMnk0Xv8UbEJTILq1fd7Thwb3agdTW+NiNLCq4wiVh6 4oqsaMWzGwRumvC8WvqeDC2txDmenUsUyBvqEse8UJik1k9UvFUNO5N615c/xm0YzNtAzGTCl HsBAhOXxDwb3VAhh1PplvtE+FWGxg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 14/18] efi_selftest: test reboot by watchdog 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" A test is added that verifies that the watchdog timer actually causes a reboot upon timeout. The test is only executed on request using setenv efi_selftest watchdog reboot bootefi selftest Signed-off-by: Heinrich Schuchardt --- v4 no change v3 correct comments v2 no change --- lib/efi_selftest/efi_selftest_watchdog.c | 68 ++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_watchdog.c b/lib/efi_selftest/efi_selftest_watchdog.c index f8c5404000..e4af38407f 100644 --- a/lib/efi_selftest/efi_selftest_watchdog.c +++ b/lib/efi_selftest/efi_selftest_watchdog.c @@ -5,11 +5,16 @@ * * SPDX-License-Identifier: GPL-2.0+ * - * This unit test checks that the watchdog timer will not cause - * a system restart during the timeout period after a timer reset. + * The 'watchdog timer' unit test checks that the watchdog timer + * will not cause a system restart during the timeout period after + * a timer reset. * - * Testing that the watchdog timer actually will reset the system - * after a timeout is not possible within the used framework. + * The 'watchdog reboot' unit test checks that the watchdog timer + * actually reboots the system after a timeout. The test is only + * executed on explicit request. Use the following commands: + * + * setenv efi_selftest watchdog reboot + * bootefi selftest */ #include @@ -28,6 +33,7 @@ static struct efi_event *event_notify; static struct efi_event *event_wait; static struct efi_boot_services *boottime; static struct notify_context notification_context; +static bool watchdog_reset; /* * Notification function, increments the notfication count if parameter @@ -88,6 +94,34 @@ static int setup(const efi_handle_t handle, return EFI_ST_SUCCESS; } +/* + * Execute the test resetting the watchdog in a timely manner. No reboot occurs. + * + * @handle: handle of the loaded image + * @systable: system table + * @return: EFI_ST_SUCCESS for success + */ +static int setup_timer(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + watchdog_reset = true; + return setup(handle, systable); +} + +/* + * Execute the test without resetting the watchdog. A system reboot occurs. + * + * @handle: handle of the loaded image + * @systable: system table + * @return: EFI_ST_SUCCESS for success + */ +static int setup_reboot(const efi_handle_t handle, + const struct efi_system_table *systable) +{ + watchdog_reset = false; + return setup(handle, systable); +} + /* * Tear down unit test. * @@ -146,11 +180,14 @@ static int execute(void) efi_st_error("Setting watchdog timer failed\n"); return EFI_ST_FAILURE; } - /* Set 600 ms timer */ - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 6000000); - if (ret != EFI_SUCCESS) { - efi_st_error("Could not set timer\n"); - return EFI_ST_FAILURE; + if (watchdog_reset) { + /* Set 600 ms timer */ + ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, + 6000000); + if (ret != EFI_SUCCESS) { + efi_st_error("Could not set timer\n"); + return EFI_ST_FAILURE; + } } /* Set 1350 ms timer */ ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 13500000); @@ -176,10 +213,19 @@ static int execute(void) return EFI_ST_SUCCESS; } -EFI_UNIT_TEST(watchdog) = { +EFI_UNIT_TEST(watchdog1) = { .name = "watchdog timer", .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, - .setup = setup, + .setup = setup_timer, + .execute = execute, + .teardown = teardown, +}; + +EFI_UNIT_TEST(watchdog2) = { + .name = "watchdog reboot", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup_reboot, .execute = execute, .teardown = teardown, + .on_request = true, }; From patchwork Wed Oct 18 16:13:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827719 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 3yHHQS27Wjz9sBd for ; Thu, 19 Oct 2017 03:22:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DF0B7C21EF8; Wed, 18 Oct 2017 16:18:14 +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.0 required=5.0 tests=FREEMAIL_FROM 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 E4FCCC21F1F; Wed, 18 Oct 2017 16:14:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 089BCC21E3E; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 17C98C21E70 for ; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LvV1X-1d4T2j463n-010ZEF; Wed, 18 Oct 2017 18:13:35 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:17 +0200 Message-Id: <20171018161320.7231-16-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:0RQDTQ6B4OYFNljLTe60xFq7HKbeuv08Bw4k9nevR8+Zc1ly6Dr pAJGtNc4imO/n+lDv+ZI3DbpIYmbYnlJ4bTkv7dau9VrViPcQwhPR0Taw32VNO4CgMSCgAv uRl+Lzy5wMLE90Bl8AKJtlGroiptzUSg8Ma7WlpGvBFHjYWj6YV2vJtKW5uVtYNn4+1FxEk IYqvy8dSN7V2hs33+gCmA== X-UI-Out-Filterresults: notjunk:1; V01:K0:1/Be5wP4U0I=:LOYMpUIDEdQlLTiJmFzTgU PZcXgzfk5/NeTePk1hFPEg9VIPKZ2ynSZPA0Ie8zHnxXSNniMB1GwY3T9ZP9tWq0rpdXfDZdm MdvIU2f9R4mumgPNvnwDEsLDuye2ZrZm/klaMiXiWHn2BsEQwEoQZVgNcPaP3K6yaxGGm/Rag cRKXY2LghdEBajY8jBr+ayrmOykIbYfbNJnLqJU0l0FAiuokLDKCMPd0MhaaJdaPSQw8Xoroh lfdvr49vQOS4KVF410Nsj2sVvPt8alkjGwDOkEf2EDGmw1NMRKskJYMq/BJbFIsi1uQSRbuCB VmZ6d3pHR1H8MG258syqJ76HfHsS0anWulTkLecTyDogrVuGookFLIX4491mkYr06bFgSivuu t39G5PSFqhWzgyCRHXsSU+6dTwCVUNjMv+ynEgvPyxx1SeXqzNiMGiCBjvw4XJcZ5B0fgUBoA q4kqFCJ7XLnl00VQF4qrVQzlwd8grp67NUkEhImXfAIUm4fIM099y2rAaq8h9XUyOMynAmW3L aRc/+HJdf3FCkcEjUB4UjAMROWFEybVaaGOwQrYVQll9lF98xbgkFJ1op04I5VG0tvwtSKyIT qGImMY42QCPx4VkU/Uonhoc403h8TSdYoBe2aBenY/sal1aBuIsYETxdRxGeIpAq/rzpLnXg4 PxxTXI9pPZ5MGC8faoKSebjldv4kwrFWuUMu6N/4QnL86nCBee8UPdfy1gzyPR/YAVSmuCaNE rUgkvbQ2UFUENwgygEfBCd6lCZLt0iN4dX8AwCVYYY/6Micct7slCgMA0P4AK2eja5GobwKSj n6JxMdmXYeXh4zytlEG0IR2hUy9wA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 15/18] test/py: test reboot by EFI watchdog 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" Clear environment variable efi_selftest before executing the default tests. Provide a test verifying that the EFI watchdog reboots the system upon timeout. The test depends on CONFIG_CMD_EFI_SELFTEST=y. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 no change v2 choose test via environment variable --- test/py/tests/test_efi_selftest.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py index 76e282a6c7..66b799bed6 100644 --- a/test/py/tests/test_efi_selftest.py +++ b/test/py/tests/test_efi_selftest.py @@ -1,4 +1,3 @@ -# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2017, Heinrich Schuchardt # # SPDX-License-Identifier: GPL-2.0 @@ -14,6 +13,7 @@ def test_efi_selftest(u_boot_console): Run bootefi selftest """ + u_boot_console.run_command(cmd='setenv efi_selftest') u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) if m != 0: @@ -23,3 +23,15 @@ def test_efi_selftest(u_boot_console): if m != 0: raise Exception('Reset failed during the EFI selftest') u_boot_console.restart_uboot(); + +@pytest.mark.buildconfigspec('cmd_bootefi_selftest') +def test_efi_selftest_watchdog_reboot(u_boot_console): + u_boot_console.run_command(cmd='setenv efi_selftest list') + output = u_boot_console.run_command('bootefi selftest') + assert '\'watchdog reboot\'' in output + u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot') + u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) + m = u_boot_console.p.expect(['resetting', 'U-Boot']) + if m != 0: + raise Exception('Reset failed in \'watchdog reboot\' test') + u_boot_console.restart_uboot(); From patchwork Wed Oct 18 16:13:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827720 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 3yHHQl2j8Bz9sBd for ; Thu, 19 Oct 2017 03:22:39 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2A888C21F26; Wed, 18 Oct 2017 16:17:41 +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.0 required=5.0 tests=FREEMAIL_FROM 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 4D4F4C21F32; Wed, 18 Oct 2017 16:14:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 64393C21F0D; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 63A7BC21EC5 for ; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Lmb2Z-1dUy7g18h1-00aGx5; Wed, 18 Oct 2017 18:13:35 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:18 +0200 Message-Id: <20171018161320.7231-17-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:70SmRJ7VGhdxD7fSjvtk0m/bMMli8pdI8HhdTmmwgq0y2sk0oFm G/itl0ZkMRDGroZUdHGrWeS7VQwaWdNKzxkSQ7SH9i/GNZd0toRvnsSmunxlTQuI4F6HNt5 ekc6tv/Q4OebEHGoV5O54TykAAdxH5J1pBKQb9DdC6HJZ4XHPJfwtljJNst7vDVTmtS+CMB M6Xjq8sBU4CQ8LQmuU+AQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Fa9OX7/y2XQ=:Mx4UadDnZQSdh0CtdyOFK6 WW1GRtdaeGFTDzQYhMp29DyEB2UnwNewIfzL0cEJ4/TIffp8DTGpW6YktoQl8d3cpfFaQy9FF XFGbQFslDdT57jVHIicJkC7vhTTh5Qq0IHL4v5hcxeG3KPOZzDD/dIkLFmuTiDo2kiuIf8l4/ TeRxrHVZV4N7VtlhdGLHiGJU7ttklWSWRM6QFsbTCDw6YObc8VdDMgQgBQu3v765SWY9HJ+bT lsbtu3ghTtb4jDz5vi2letS671efiwahEM6q6qDwjSFfaFpozucGAKN3VlJGoebOuoyWlJytI umTyI+9XOwD4r0yZvYqqY/MsDhl77koybdC9BPo1WUDTEmyXUaEmb5IVywzverKFdjuzEIBfI 365cfF8swPk9IO76b/loTNMgIAPbcEKapuvEVQCT77osWQ7wHHHI3kysdPpjTn4B68531F/2W YJr0pDwZotl/UKtdHtCkCs7j/gg3NyEqS9JLrAY4AMYjkkSMUZ2nNdwUFH0HGHch+jeow2mZg 7eVSqIbp3G0kyFtb4L4AFGci97tkBccRfrjQtfUsAjTGEd9+C70rzRR7S1eQoHKZSDaBycAqQ VHBSAankmaRn6oie3Q9qpYzooS6EqccFz+iurnu+Zo+Fwn569OggNKwdXlx8PEH2EDW09ArNT 9EPaIhxruzlm1lWTcYbwentBO82y8pd7rPnJrnXGC19v0B/VXHp1ll2dObkdbaq9469vHFAdI mLTT0WDi0UwO2Cvbm2/djxmNIjkPpCSK2cE3iDHb+cCGOMghD2ikKn0pXZxKLmET/3a191bJi Cfz+tWnwZqGBVVOwDrERNJZvEjd0w== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 16/18] test/py: fix typo in test_efi_loader.py 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" Make a comment line easier to read. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 no change v2 no change --- test/py/tests/test_efi_loader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 5d7f5dbfb2..4d391e13ef 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -12,7 +12,7 @@ import u_boot_utils """ Note: This test relies on boardenv_* containing configuration values to define -which the network environment available for testing. Without this, the parts +which network environment is available for testing. Without this, the parts that rely on network will be automatically skipped. For example: From patchwork Wed Oct 18 16:13:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827714 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 3yHHN66Jbpz9sBd for ; Thu, 19 Oct 2017 03:20:21 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8AA19C21EF8; Wed, 18 Oct 2017 16:16:12 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 69197C21F1D; Wed, 18 Oct 2017 16:13:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AED21C21EE6; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id BF4BBC21E68 for ; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MXI5V-1dhM2E2Iwn-00WCpF; Wed, 18 Oct 2017 18:13:35 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:19 +0200 Message-Id: <20171018161320.7231-18-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:PcAZgDFHQSe3HQHryVnbWkxkaplBumvL46doh1vr62R8a/lGNcr NUFrdzzuLw1zlK5/WFZGiLo2Pbo0pjivkIIsOoS6yKuzrLox5d3ZaibwM22YyZNFA1y3UmH l/wbMxEFo3liMcR5NGWf0jUeXO7gNDTrNxNoCLRm9S9f8on6mzAvrl0bo9i9TkEqBKCuHqn IpErHUhRBux213lU2gb9Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:7MxknI4zmXM=:yIEPPVZ58fCLYHeEQzMVUk zFm2/JkhL9PsuBeycNcHMXbTUoOHbDWQaAfO6Dx6Yh+55KNmsKw+/uIfIw26IJ4IsZlbtCWzz nP92x7OT6Ozs8oxyBkEkVlHK/efi93Le3gEl+PDQGOj8VQOo6SIl7zXZeMUw6fEAhzNWIJLlL UtYwBbyAyyFOLhX6gXUmXWqCw/FeejVGGCfr814496YlhVIQ3wjryDb6AyI8R7I9cq7RPybGD 02Z/2fqpHveensZDC42Dm55jiWylyxVBDbKuXGKINnYtrOmVzrhW/ycKrt5GKrmz1WMd4ctlg LHFcNId8fmLoYido3ytnU9eMekbNreDSF+xhXQ14x9xjRzhvwZqbgkZ7fzgFJmdLLuwxw4MFo cU9XaiMDPvNnifya3/F2T9JbFnoJto4ZMFe7ucv+jSwjtYgDu0nOENCp8ABbmEUz/SVM8bgJm gRQ+4VQjM15gFVGGdAPHKMC2p4qLeiAcdgXIfbzvsMifo+lNI1/LcIS2LMyCm1kxyahVYCqI2 fE7c60cyvd8uOogUoM8wqtLyJRuFbjElW4XT01EM6oDTce08IKks0qIRkJ0pBbTSg71OLRwH+ LhdpQwnc9ZziWCmcnu0ZwaCJxLeO3slBKT34MoTjxb2gIDQSod317wrP8SKBTCJbmYmcxnaGn iEl/uw0TSMt8NJPckxSPQh0s1Gqt5oVbjKZtiuL84fc1MCAuIjh0WygQfk86e5GWDXwtqRtju KC0Q54GaXDd+uzyNiGtr7E+DCDGpxIL6EbldMd4VY+60Ir1PHBLC3lSQq0xOZMYoM5kqmIJAn cas+a0nNjRTetToLnl3JL9yvWCCIA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 17/18] efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL 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" The following services are tested: OutputString, TestString, SetAttribute. Signed-off-by: Heinrich Schuchardt --- v4 fix build flags v3 new patch --- lib/efi_selftest/Makefile | 3 ++ lib/efi_selftest/efi_selftest_textoutput.c | 53 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 3e5c9a6d16..b1385383ed 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -17,7 +17,9 @@ CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_textoutput.o := $(CFLAGS_EFI) +CFLAGS_REVMOE_efi_selftest_textoutput.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) @@ -30,6 +32,7 @@ efi_selftest_console.o \ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_snp.o \ +efi_selftest_textoutput.o \ efi_selftest_tpl.o \ efi_selftest_util.o \ efi_selftest_watchdog.o diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c new file mode 100644 index 0000000000..7bc4d2f446 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_textoutput.c @@ -0,0 +1,53 @@ +/* + * efi_selftest_textoutput + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Test the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. + * + * The following services are tested: + * OutputString, TestString, SetAttribute. + */ + +#include + +/* + * Execute unit test. + * + * @return: EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + size_t foreground; + size_t background; + size_t attrib; + efi_status_t ret; + + /* SetAttribute */ + efi_st_printf("\nColor palette\n"); + for (foreground = 0; foreground < 0x10; ++foreground) { + for (background = 0; background < 0x80; background += 0x10) { + attrib = foreground | background; + con_out->set_attribute(con_out, attrib); + efi_st_printf("%p", (void *)attrib); + } + con_out->set_attribute(con_out, 0); + efi_st_printf("\n"); + } + /* TestString */ + ret = con_out->test_string(con_out, + L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n"); + if (ret != EFI_ST_SUCCESS) { + efi_st_error("TestString failed for ANSI characters\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(textoutput) = { + .name = "text output", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .execute = execute, +}; From patchwork Wed Oct 18 16:13: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: 827723 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 3yHHRZ466Sz9t4c for ; Thu, 19 Oct 2017 03:23:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 46A37C21F19; Wed, 18 Oct 2017 16:18:30 +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.0 required=5.0 tests=FREEMAIL_FROM, 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 9EB51C21F47; Wed, 18 Oct 2017 16:14:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D0988C21E70; Wed, 18 Oct 2017 16:13:39 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id EEFCEC21ED9 for ; Wed, 18 Oct 2017 16:13:36 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LnPSg-1daiLx3dfi-00hi0Q; Wed, 18 Oct 2017 18:13:35 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 18:13:20 +0200 Message-Id: <20171018161320.7231-19-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171018161320.7231-1-xypron.glpk@gmx.de> References: <20171018161320.7231-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:fUCj0nlxMh/V+pyF6dY5ShgORMtcIZGPPR8t74Wcrw217i8Nnw0 HlQ+uqaS03GkmANgldWMGgNbhRZnOEsgY9388YsN7iNnXz0xvAidmCjNpZL3kj3z/q6RnkI rqp78AKgOh5VdGFwcmzoBe1r6CL5Q4hvENnFaDQIlxzWwYyEfNCSIWafNqIFEPJDm/1GuO7 jVNzYLGpCPEWYyB6Cwl8Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:Ps//UL+7fD4=:O1M2LUgvxTP7/JlbeyLWJk a6Fn48rLkLHrkkNxWKEtCx8kNa5AD68qEHCOMP9cPHje5iLaJQEvnvqDdc/zHekkdCu0Lf6yC IeOLtCMBvIcq416CXOEVPi1JZMVLgDCnaGitWdk5kaad5aSlOrgncNozzi24uC4AELQ5aNdkb /d2ZrQ5tdSGPL+fUGz1T60BFjfXkskH+Kyut6pjTi6co7ppPwDQacK5GI5Njb859x/4IxVCup lfW7wjTB6zEEsB9nLiOoCUNsQKXM15ORFM2nqVScbPPY//7h0mCNAe92xPW34dopC21BArMdp lndirPtE91VBhmwQj8ASdc9tiZG2if4cNydFNYmSvun5B1A1VwBseiwHdtQ+hRdlcQrvz78qj V3SNagYugzJIoz9t5wIDdC6xfzgwcWT3O2G0TueX17H8WIrJtczubdGO2WkiVmI5G2fM4kXj4 gzAD7bZ6M22EGnN6LqGm1tagTR/awwhl3of/dJ8R9l8dmzfyxpYrpSvKCh5+rDQXtiZJXzs0c jkigTl5Gr6g4BcRyqOF22V2dBAZkoogi6sR6Gyut1IQHHbcZO+fLtL6T8ullYzcw29eKLefSV OKZgfCUzLG5/ZFsk3TTQUHmCsDu0gAKk3j6Y3TISm3KRB1kkNayb7gutH7e+C4Ls5NsRqQvS/ jCgw5c+xXkWVUDdtJINyv5XiFTtd+mX6cSKj6hO7M5emVyVfAGOYP+GGzOX+DOHUv+YM/YKg/ ++bdt8dWd5/Q/PCPwk9b+Ep3pQ9tG8jhxocSWWLJrZdy2WQ679Dx0OjEnTw05tMg3jB7YdJqi EY85PPQQRM/ZAgNi9C1BkqJMSgRZg== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v4 18/18] efi_loader: set parent handle in efi_load_image 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" The parent_handle of the loaded image must be set. Set the system table. Signed-off-by: Heinrich Schuchardt --- v4 no change v3 new patch --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index fd8d15655b..f70d8658ab 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1282,6 +1282,8 @@ static efi_status_t EFIAPI efi_load_image(bool boot_policy, return EFI_EXIT(EFI_UNSUPPORTED); } + info->system_table = &systab; + info->parent_handle = parent_image; *image_handle = info; return EFI_EXIT(EFI_SUCCESS);