From patchwork Sun Jun 2 19:33:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1108969 X-Patchwork-Delegate: xypron.glpk@gmx.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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="STddh5Ub"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45H7gK6LZ0z9s4V for ; Mon, 3 Jun 2019 05:34:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 89D7AC21D56; Sun, 2 Jun 2019 19:34:28 +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, T_DKIM_INVALID 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 63D9EC21D83; Sun, 2 Jun 2019 19:34:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BE6D8C21C57; Sun, 2 Jun 2019 19:34:12 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lists.denx.de (Postfix) with ESMTPS id 6B7C5C21BE5 for ; Sun, 2 Jun 2019 19:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559504028; bh=2vuQ6ffEgdaZE2yBXs1UPiruXvimmPGIOeRefbpmV8A=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=STddh5UbUDzn6hgQrdWQUFXJOD+T1X75A2NzNfnC5hTXffcFYyEZupmR8iFtP3zMF pguGk7c2QL9Xw7J1zgAkJxYaLG4uANAaK3598+9xoDXyoFUAk4m24k6tZ4+Y4TltcD rTqQlwNwvg9TMLhiWYqMF605iV0B7Ep3SLflrLNo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([84.118.159.3]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M3UZ6-1hY4T81zL0-000ZKC; Sun, 02 Jun 2019 21:33:48 +0200 From: Heinrich Schuchardt To: Tom Rini Date: Sun, 2 Jun 2019 21:33:15 +0200 Message-Id: <20190602193316.26195-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190602193316.26195-1-xypron.glpk@gmx.de> References: <20190602193316.26195-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:e8D0iUNn9W5FEEAyXikgOuYS/Kq9rJNrDLSV1Vau9Q4TGGy/b5t cejnepFrR1wsrnrGXpodvwY4bURsVttdETM995+667MZBis7ge8QZWjNRkvDVPt6Z/2f3hL 6McQMU3wx7LzEyeqIEFczc4499FrZMOJ8+cBf3981T/Rd7tyImEXCf36mBieBXYg80nGH18 YrdqiO4cKl91MvLmnLo6A== X-UI-Out-Filterresults: notjunk:1; V03:K0:iz0f4AYRVZk=:lZ/BT60W+AOB6Zmcmu3Cjz b7P3YKPGpR8rfltoY11Fwr5aKZP99xlGh9/yYAkrRg9TQ73rhEnf/A8F8y7Mjtctn/evgOrS6 Y63fw7+QyhSmby7qn5cKpTCVGfWW/Uzu9/FPVfR/D+1nwv7RkGHnfGNZyTcDDbuWRgGmS129u DhBhJ3G1fzsIL1S+emFIPzXSrHj0D7PjzxnaAdxNDNuu/+O4Crb7zq5ibx1m91lGmY2HA5MO1 ujW28p/pZO/VuwkOj4AcmFQ02Igzp1Vyc8QSnHyeHusyom+eLjtWNdCxo5EmVYRXmu/vHSnh9 dDc0bREUjS/7pRELVNASNW1QEweGqLALFfbLlRlficwCCImt3NfE5gJoMkvw0L/J2Iww4EJ5H dwWw/bFko0Fl0otfrlsMXhknEDkW3ZzPP5Kl8hwb2FJdri7B6MP+IU9IGyJyhaPOupy8m0VzC yE0dudCXgiL9iEU49kBQyP2meE1Npqa4qOYtmyC+VK2ufxnjUphA032wcoXMm+8flHixBSvq8 H12AzWq2qHgjwqndpMF8hMsxyJkD9/iBXqSAomze+vdbTdLYyW72vsViNnP/SfTNJmAXepGxg A5D/1bBYoJ1dC4+hQq6cd+7A7papk9bL+FMBZbR/7o+RfhSQBMxYtBUskry5XTib8gPhpYaWl vr6DtH/ZQF1PLRAhuimfhQCjp+Q9aq7eJUFHHKTYSMU0VAifBYq+IH4Hgi77pH++C0NIYHlWf VCNLyfT4Ap/IO9nZ05DkaJZTfnfFsAq6jCuKDq9hiDq5YOR/4riza9Z5Nod+ntEvnJyyvAqEe NSEam/6X9Gto1oanomhg9jO2JalLijkVW8dYq3pRouejKOrRNVeL3hVSMnd37aniVs9OJTdav ThmhJONgUTduNDKZcwhOqlVFUuZcUoi6DE7c/e+99jQo7/52nSuPT/qdCw4+bEKbX5uvFYT5V 2l5H2HSeatS43Yt2aY+tcg8N9HT90jo4= Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH 1/2] lib: time: export usec_to_tick() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In the UEFI Stall() boottime service we need access to usec_to_tick(). Export the function. Signed-off-by: Heinrich Schuchardt --- include/time.h | 9 +++++++++ lib/time.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/include/time.h b/include/time.h index 9fd0d73fb4..99d45d3ae2 100644 --- a/include/time.h +++ b/include/time.h @@ -4,6 +4,7 @@ #define _TIME_H #include +#include unsigned long get_timer(unsigned long base); @@ -21,6 +22,14 @@ unsigned long timer_get_us(void); */ void timer_test_add_offset(unsigned long offset); +/** + * usec_to_tick() - convert microseconds to clock ticks + * + * @usec: duration in microseconds + * Return: duration in clock ticks + */ +uint64_t usec_to_tick(unsigned long usec); + /* * These inlines deal with timer wrapping correctly. You are * strongly encouraged to use them diff --git a/lib/time.c b/lib/time.c index 9c55da6f1b..f5751ab162 100644 --- a/lib/time.c +++ b/lib/time.c @@ -139,7 +139,7 @@ unsigned long __weak notrace timer_get_us(void) return tick_to_time(get_ticks() * 1000); } -static uint64_t usec_to_tick(unsigned long usec) +uint64_t usec_to_tick(unsigned long usec) { uint64_t tick = usec; tick *= get_tbclk(); From patchwork Sun Jun 2 19:33:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1108970 X-Patchwork-Delegate: xypron.glpk@gmx.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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="IsLTVBGv"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45H7gf0NVFz9s4V for ; Mon, 3 Jun 2019 05:35:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B16CFC21D74; Sun, 2 Jun 2019 19:34: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, T_DKIM_INVALID 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 DBC99C21DB6; Sun, 2 Jun 2019 19:34:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 883F4C21C57; Sun, 2 Jun 2019 19:34:13 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lists.denx.de (Postfix) with ESMTPS id 3A920C21BE5 for ; Sun, 2 Jun 2019 19:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559504029; bh=doCIJlddPL2/5vxx/oNH/fmwew7Q4ZuKsBDIVy4oJKU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IsLTVBGvrYtDV6745npZgcr/VwGjrM0wzt7G83iYBFCL3UEdzerRPvmQbRb8sUGB4 F1L8ZjlzXvz/NBCFOSMAS4nMqp7u3WVFm97zMT/d5fa7eQfjZvk6oxI2H2c4Xw+TUF G8Cjg8S8VWj4EmHYV8cHRGZt6r+hq9nI+sa7aJng= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([84.118.159.3]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MS3ir-1hABy33Srz-00TYQj; Sun, 02 Jun 2019 21:33:48 +0200 From: Heinrich Schuchardt To: Tom Rini Date: Sun, 2 Jun 2019 21:33:16 +0200 Message-Id: <20190602193316.26195-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190602193316.26195-1-xypron.glpk@gmx.de> References: <20190602193316.26195-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:wxvOtB/NKMWIIUNruAURjyWzHKdQD6Zahow1Sbd9tYOcT2CncPl eHL7RgRmpDjxec5qQgfR/gQuB/O2l5oYMGcMg4XApbkni1wHySuAhmvq6/in+wuGGlSlwdJ NRX4E/LFlPBTFfY+epqJqp2QNpvNnZ1rsC7FABe5gPtIYebtH7RmneRhUcEwK1BfjICYYTk uVgHHrjrEw040kXKgpc6g== X-UI-Out-Filterresults: notjunk:1; V03:K0:n0aGEyceMRY=:Oyg7X5TwwXm+Qom71X65Es gOo9kpx7epdAvmG8ppbX6D/cEONHopUXjOtSG/lHBoP8vIq0lOa/ZAVmY07y17oJEZX2iof7c S1vBKgVCbowlQJYghlNdX7916BNZZXL/vWTO+krt5XMnJ71aXwJ7tv1PaMX6aR7UN7xxLdSu5 2MxWMoCWO5Th53grwA3K+j0q+BD343E9EhfiWsiOJy6AZz6VgeDUBCWgUrAMOPMskabBCUNTr nBMfLJtHn0EF6s6CIlH8kOdKd/yNA26zu2/8BcqUPE08xH8CFVP8eXeSzDUad83SEnhyplJeh oD3ku+y9aTIK+nmvxIo31S47pqt66n7lGcn+XNnJGoW3odB25CeLEuYnATx2IoLkloAysoNct ZkL35lGysM07UgHD/uJYb4lj403UgrvoN0Ki9CEwFlAkTj3fV0+KtLOlM5VEml0SON38fWEPs KQ/8nb1GyQtlft2jB/pqMi3+S26r5fHKOEC34re624pmXZGjCEJ+O2dQ9gSczWR5OAPN3DBFL wO6b69c/MZE8ebxC6OtGwn7Io+WNUdqSSsDtBoPQhQuVUBwT/vZzdUDkR90J6WesA31VmqKy/ f3sWZaNe032K6fDsmvvTBIwlcLeMAh1CAqnSlGJJFa5fUZ2n7ad1jGseF4m6PukSg7VDX/ooY aJcjzTbTp6IDKUhGC38qUntM+sNPiJyZnEiYv5hVD26Jg+IXIBgPbn/3zmgDIIi/d2fhw++I7 j9SUl1skZq3MYmoTvSgRxNzsOQFCSzcTvuA3VKi9B5CEUZbobM2Xv3EStA0DxyeOWwk/6YCwC eZMuswbbpYxEIFKzn1CcrHnZptGUXu/1xjlGfk54W0nOg19WjsqgGxklDrug4jZ0etimH1Zj9 kb2rzuwhfGktR9melJfV6aJdtVqI9KW02MsA7s0K9Q7CmN5o6g3xNY+t12vAyggkt52SbXuOK KDXI0Sq9TNOwCiFQIGDEm/rKyMy2kAuo= Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH 2/2] efi_loader: check timer events in Stall() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" During a call to Stall() we should periodically check for timer events. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f4e3186ffc..5036e239b6 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1990,8 +1990,14 @@ out: */ static efi_status_t EFIAPI efi_stall(unsigned long microseconds) { + u64 end_tick; + EFI_ENTRY("%ld", microseconds); - udelay(microseconds); + + end_tick = get_ticks() + usec_to_tick(microseconds); + while (get_ticks() < end_tick) + efi_timer_check(); + return EFI_EXIT(EFI_SUCCESS); }