Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814135/?format=api
{ "id": 814135, "url": "http://patchwork.ozlabs.org/api/patches/814135/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-7-xypron.glpk@gmx.de/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "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-7-xypron.glpk@gmx.de>", "list_archive_url": null, "date": "2017-09-15T08:06:15", "name": "[U-Boot,06/10] efi_selftest: provide unit test for event services", "commit_ref": "bd126692da45ace7c5bfecc782443d042545ea77", "pull_url": null, "state": "accepted", "archived": false, "hash": "4678ab917e1e3c94c259f0e3be8b5aec7fa4193b", "submitter": { "id": 61270, "url": "http://patchwork.ozlabs.org/api/people/61270/?format=api", "name": "Heinrich Schuchardt", "email": "xypron.glpk@gmx.de" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-7-xypron.glpk@gmx.de/mbox/", "series": [ { "id": 3244, "url": "http://patchwork.ozlabs.org/api/series/3244/?format=api", "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/814135/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814135/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 3xtp5r1Gsdz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:12:00 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid CADCEC21FC6; Fri, 15 Sep 2017 08:10:13 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 6917DC21FE2;\n\tFri, 15 Sep 2017 08:08:31 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 788E3C21FCA; Fri, 15 Sep 2017 08:07:54 +0000 (UTC)", "from mout.gmx.net (mout.gmx.net [212.227.17.20])\n\tby lists.denx.de (Postfix) with ESMTPS id 8069EC21FBE\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 08:07:49 +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 0Ldbqw-1dA7EK1BZ4-00ioHD;\n\tFri, 15 Sep 2017 10:07:18 +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:15 +0200", "Message-Id": "<20170915080619.25250-7-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:SmhBzeguO9r44Eo3wdRZsBLRBCYtn4ebvFHHB5UQEsr+78fT5/x\n\tJrVUI9H3/1ARwZQ8mBtqAlZJrGRxszTcZA8Pc96yfY/2f6zZLqQhPbYZbDP+cbfqVQy5NYY\n\t6WymTeE699jwje1a4BFigEIj9cMfxm/GLlzcUcTwfrkbFZK/Bh+FMiaIFDRDS2KgCuRsI2L\n\tblDsclQJCHc9u7maHZZeg==", "X-UI-Out-Filterresults": "notjunk:1; V01:K0:b6qmd48F5rA=:yRRbKVFviNXsU47GAWOeLF\n\tYYvZUcf5DeeLuutP6yvCuIwPesjWyBQ/IgrtBXux6BtugBtWLyRwO3gJDM2Qx76njkgm7TDx7\n\tzdutHAengrZfWwzybEr+z5VohIVM5448idoWSlrTbl/6V8HTdkjkVMEVZY5d8Y9lyNpGfl1/Y\n\t5bqjHULT8LoWv9doIKeUBxlKqF0TxenFhUZGemID0EI5RNiE7rv9bZjfS8uWWKgGnTMeVl7is\n\ts24Mo1taXyydPOaGKw5637eP9UI3xYaJKxtznbYrbJ6Gy5SAz9n/Q2U7I7Pa92Gj9oCg0yI+I\n\t737n5ug65k7mBs5Pl6alX6wG+M8L31fJiUY+OSEXg6ycNueGQQwjsB0SudKeCsnN7JFSmsTmV\n\tKuUHEZX+3iLZrb28m8WcL+Az5EgV6wvYqmJ7VbU0YRCVAz83ijh55NFKOQIRwey2PCVOarjnE\n\tJXUVAF9HkvooqHrfoNWD9kT+UlQzbHz7d3dp+suNvH4aIgVE+9rMZRbc6IcJz94gVEinF5e2T\n\tyDn67FH9qNwHycfyPYk6Kzuyef/BcQtb8dYMQfrehXMdP6NZLNttP5ZKs/7ubX1LHSvcylLag\n\txGAdf8D3Kq6qij91Wp7dmvzb/QHfa3GWprk+xUGl8BVGdWYrUfYQE/J9O/5LCLijVKR49OPot\n\tNFvK36UglvtjEFTcz7kb8NqhwOIrCTSqEZbVArVjN73GLllb7y0etf6LDyfgehoSGrZ0Oerop\n\t7njX/Evo/SzD9iJ+IjedCSRvRusqymXyAFsxt0BabW9Wn6Y04ii5jhnJeeViCCUJx1Ot/8tMg\n\t3/ozcAn7pCnf/SIr9XpJo/0qj8rZA==", "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 06/10] efi_selftest: provide unit test for event\n\tservices", "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": "This unit test uses timer events to check the implementation\nof the following boottime services:\nCreateEvent, CloseEvent, WaitForEvent, CheckEvent, SetTimer\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_selftest/Makefile | 5 +-\n lib/efi_selftest/efi_selftest_events.c | 195 +++++++++++++++++++++++++++++++++\n 2 files changed, 199 insertions(+), 1 deletion(-)\n create mode 100644 lib/efi_selftest/efi_selftest_events.c", "diff": "diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile\nindex 34f5ff1838..a71c8bf937 100644\n--- a/lib/efi_selftest/Makefile\n+++ b/lib/efi_selftest/Makefile\n@@ -11,7 +11,10 @@ CFLAGS_efi_selftest.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest.o := $(CFLAGS_NON_EFI)\n CFLAGS_efi_selftest_console.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_console.o := $(CFLAGS_NON_EFI)\n+CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI)\n+CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI)\n \n obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \\\n efi_selftest.o \\\n-efi_selftest_console.o\n+efi_selftest_console.o \\\n+efi_selftest_events.o\ndiff --git a/lib/efi_selftest/efi_selftest_events.c b/lib/efi_selftest/efi_selftest_events.c\nnew file mode 100644\nindex 0000000000..c4f66952b9\n--- /dev/null\n+++ b/lib/efi_selftest/efi_selftest_events.c\n@@ -0,0 +1,195 @@\n+/*\n+ * efi_selftest_events\n+ *\n+ * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0+\n+ *\n+ * This unit test uses timer events to check the implementation\n+ * of the following boottime services:\n+ * CreateEvent, CloseEvent, WaitForEvent, CheckEvent, SetTimer.\n+ */\n+\n+#include <efi_selftest.h>\n+\n+static struct efi_event *event_notify;\n+static struct efi_event *event_wait;\n+static unsigned int counter;\n+static struct efi_boot_services *boottime;\n+\n+/*\n+ * Notification function, increments a counter.\n+ *\n+ * @event\tnotified event\n+ * @context\tpointer to the counter\n+ */\n+static void EFIAPI notify(struct efi_event *event, void *context)\n+{\n+\tif (!context)\n+\t\treturn;\n+\t++*(unsigned int *)context;\n+}\n+\n+/*\n+ * Setup unit test.\n+ *\n+ * Create two timer events.\n+ * One with EVT_NOTIFY_SIGNAL, the other with EVT_NOTIFY_WAIT.\n+ *\n+ * @handle:\thandle of the loaded image\n+ * @systable:\tsystem table\n+ */\n+static int setup(const efi_handle_t handle,\n+\t\t const struct efi_system_table *systable)\n+{\n+\tefi_status_t ret;\n+\n+\tboottime = systable->boottime;\n+\n+\tret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,\n+\t\t\t\t TPL_CALLBACK, notify, (void *)&counter,\n+\t\t\t\t &event_notify);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"could not create event\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,\n+\t\t\t\t TPL_CALLBACK, notify, NULL, &event_wait);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"could not create event\\n\");\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Tear down unit test.\n+ *\n+ * Close the events created in setup.\n+ */\n+static int teardown(void)\n+{\n+\tefi_status_t ret;\n+\n+\tif (event_notify) {\n+\t\tret = boottime->close_event(event_notify);\n+\t\tevent_notify = NULL;\n+\t\tif (ret != EFI_SUCCESS) {\n+\t\t\tefi_st_error(\"could not close event\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t}\n+\tif (event_wait) {\n+\t\tret = boottime->close_event(event_wait);\n+\t\tevent_wait = NULL;\n+\t\tif (ret != EFI_SUCCESS) {\n+\t\t\tefi_st_error(\"could not close event\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Execute unit test.\n+ *\n+ * Run a 10 ms periodic timer and check that it is called 10 times\n+ * while waiting for 100 ms single shot timer.\n+ *\n+ * Run a 100 ms single shot timer and check that it is called once\n+ * while waiting for 100 ms periodic timer for two periods.\n+ */\n+static int execute(void)\n+{\n+\tunsigned long index;\n+\tefi_status_t ret;\n+\n+\t/* Set 10 ms timer */\n+\tcounter = 0;\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 100 ms timer */\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\n+\tindex = 5;\n+\tret = boottime->wait_for_event(1, &event_wait, &index);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not wait for event\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->check_event(event_wait);\n+\tif (ret != EFI_NOT_READY) {\n+\t\tefi_st_error(\"Signaled state was not cleared.\\n\");\n+\t\tefi_st_printf(\"ret = %u\\n\", (unsigned int)ret);\n+\t\treturn 1;\n+\t}\n+\tif (index != 0) {\n+\t\tefi_st_error(\"WaitForEvent returned wrong index\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Counter periodic: %u\\n\", counter);\n+\tif (counter < 8 || counter > 12) {\n+\t\tefi_st_error(\"Incorrect timing of events\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_STOP, 0);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not cancel timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 10 ms timer */\n+\tcounter = 0;\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_RELATIVE, 100000);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 100 ms timer */\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_PERIODIC, 1000000);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->wait_for_event(1, &event_wait, &index);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not wait for event\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Counter single shot: %u\\n\", counter);\n+\tif (counter != 1) {\n+\t\tefi_st_error(\"Single shot timer failed\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->wait_for_event(1, &event_wait, &index);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not wait for event\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Stopped counter: %u\\n\", counter);\n+\tif (counter != 1) {\n+\t\tefi_st_error(\"Stopped timer fired\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_STOP, 0);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not cancel timer\\n\");\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+EFI_UNIT_TEST(events) = {\n+\t.name = \"event services\",\n+\t.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,\n+\t.setup = setup,\n+\t.execute = execute,\n+\t.teardown = teardown,\n+};\n", "prefixes": [ "U-Boot", "06/10" ] }