{"id":814136,"url":"http://patchwork.ozlabs.org/api/patches/814136/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-8-xypron.glpk@gmx.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170915080619.25250-8-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-09-15T08:06:16","name":"[U-Boot,07/10] efi_loader: implement task priority level (TPL)","commit_ref":"32f4b2f8c455b70cea65f5ba63346a6efc9d4e1e","pull_url":null,"state":"accepted","archived":false,"hash":"24c60e599eda3c15d967551cc2048839532073ef","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/?format=json","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"delegate":{"id":3400,"url":"http://patchwork.ozlabs.org/api/users/3400/?format=json","username":"agraf","first_name":"Alexander","last_name":"Graf","email":"agraf@suse.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-8-xypron.glpk@gmx.de/mbox/","series":[{"id":3244,"url":"http://patchwork.ozlabs.org/api/series/3244/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3244","date":"2017-09-15T08:06:10","name":"efi_loader: event services & API test","version":1,"mbox":"http://patchwork.ozlabs.org/series/3244/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814136/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814136/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtp6113KFz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:12:09 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid DD405C21FA0; Fri, 15 Sep 2017 08:09:03 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A0A11C21FC9;\n\tFri, 15 Sep 2017 08:08:01 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B396AC21FBE; Fri, 15 Sep 2017 08:07:40 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.21])\n\tby lists.denx.de (Postfix) with ESMTPS id 1AF82C21F3A\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 08:07:39 +0000 (UTC)","from laptop1.fritz.box ([94.197.120.111]) by mail.gmx.com (mrgmx102\n\t[212.227.17.174]) with ESMTPSA (Nemesis) id 0MACmL-1dhWIy1jdB-00BPOy;\n\tFri, 15 Sep 2017 10:07:22 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Alexander Graf <agraf@suse.de>","Date":"Fri, 15 Sep 2017 10:06:16 +0200","Message-Id":"<20170915080619.25250-8-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170915080619.25250-1-xypron.glpk@gmx.de>","References":"<20170915080619.25250-1-xypron.glpk@gmx.de>","X-Provags-ID":"V03:K0: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FRv\n\tTRN/vW5N7hIX+SwwhjTY+h/sclm2MzG0X1UOAaeG0nY5j5Db0VJBmA5RSZye61e2BNG3fhJyq\n\tX3tnAY7tnHJWO5WVYKLxTgzhtGDog==","Cc":"=?utf-8?q?=C5=81ukasz_Majewski?= <l.majewski@samsung.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>, Andy Shevchenko\n\t<andriy.shevchenko@linux.intel.com>, u-boot@lists.denx.de, Fabio Estevam\n\t<fabio.estevam@nxp.com>, Maxime Ripard <maxime.ripard@free-electrons.com>","Subject":"[U-Boot] [PATCH 07/10] efi_loader: implement task priority level\n\t(TPL)","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Define variable holding tpl.\nImplement RaiseTPL and RestoreTPL.\nImplement TPL check in efi_signal_event.\nImplement TPL check in efi_wait_for_event.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_loader/efi_boottime.c | 32 ++++++++++++++++++++++++++++----\n 1 file changed, 28 insertions(+), 4 deletions(-)","diff":"diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\nindex 73793cd986..7c92a68bf4 100644\n--- a/lib/efi_loader/efi_boottime.c\n+++ b/lib/efi_loader/efi_boottime.c\n@@ -18,6 +18,9 @@\n \n DECLARE_GLOBAL_DATA_PTR;\n \n+/* Task priority level */\n+static UINTN efi_tpl = TPL_APPLICATION;\n+\n /* This list contains all the EFI objects our payload has access to */\n LIST_HEAD(efi_obj_list);\n \n@@ -161,7 +164,9 @@ void efi_signal_event(struct efi_event *event)\n {\n \tif (event->notify_function) {\n \t\tevent->queued = 1;\n-\t\t/* Put missing TPL check here */\n+\t\t/* Check TPL */\n+\t\tif (efi_tpl >= event->notify_tpl)\n+\t\t\treturn;\n \t\tEFI_CALL_VOID(event->notify_function(event,\n \t\t\t\t\t\t     event->notify_context));\n \t}\n@@ -176,14 +181,31 @@ static efi_status_t efi_unsupported(const char *funcname)\n \n static unsigned long EFIAPI efi_raise_tpl(UINTN new_tpl)\n {\n+\tUINTN old_tpl = efi_tpl;\n+\n \tEFI_ENTRY(\"0x%zx\", new_tpl);\n-\treturn EFI_EXIT(0);\n+\n+\tif (new_tpl < efi_tpl)\n+\t\tdebug(\"WARNING: new_tpl < current_tpl in %s\\n\", __func__);\n+\tefi_tpl = new_tpl;\n+\tif (efi_tpl > TPL_HIGH_LEVEL)\n+\t\tefi_tpl = TPL_HIGH_LEVEL;\n+\n+\tEFI_EXIT(EFI_SUCCESS);\n+\treturn old_tpl;\n }\n \n static void EFIAPI efi_restore_tpl(UINTN old_tpl)\n {\n \tEFI_ENTRY(\"0x%zx\", old_tpl);\n-\tefi_unsupported(__func__);\n+\n+\tif (old_tpl > efi_tpl)\n+\t\tdebug(\"WARNING: old_tpl > current_tpl in %s\\n\", __func__);\n+\tefi_tpl = old_tpl;\n+\tif (efi_tpl > TPL_HIGH_LEVEL)\n+\t\tefi_tpl = TPL_HIGH_LEVEL;\n+\n+\tEFI_EXIT(EFI_SUCCESS);\n }\n \n static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,\n@@ -388,7 +410,9 @@ static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events,\n \t/* Check parameters */\n \tif (!num_events || !event)\n \t\treturn EFI_EXIT(EFI_INVALID_PARAMETER);\n-\t/* Put missing TPL check here */\n+\t/* Check TPL */\n+\tif (efi_tpl != TPL_APPLICATION)\n+\t\treturn EFI_EXIT(EFI_UNSUPPORTED);\n \tfor (i = 0; i < num_events; ++i) {\n \t\tfor (j = 0; j < ARRAY_SIZE(efi_events); ++j) {\n \t\t\tif (event[i] == &efi_events[j])\n","prefixes":["U-Boot","07/10"]}