From patchwork Fri Jun 7 06:22:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1111575 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="S+YbLhC7"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Ksrv6Sl5z9sNR for ; Fri, 7 Jun 2019 16:22:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D9BEEC21E44; Fri, 7 Jun 2019 06:22:34 +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 DDA01C21DCA; Fri, 7 Jun 2019 06:22:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4C7F7C21DA1; Fri, 7 Jun 2019 06:22:30 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id F133AC21C51 for ; Fri, 7 Jun 2019 06:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559888547; bh=BK6umhqir3KSlmhgzNmlrcnYISDt2J9l7eBVfJecc7w=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=S+YbLhC7e4Se2Jko2Vtf0cdmMRuqPThePHEDBYLaFT119PPWA5SZkZkoW7ruUfRBA q+mcOx3ojUXfaT6u0oYickpAGFRGVds7H65q1AbpzxkEnChoN14LoF4NTdymdlB1TG d3t884ORQGzSUeDhF6thtD4RJyhZYyEG11n3ziGo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MIiHs-1hWwPb1l5U-002I2i; Fri, 07 Jun 2019 08:22:27 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 7 Jun 2019 08:22:14 +0200 Message-Id: <20190607062216.21525-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607062216.21525-1-xypron.glpk@gmx.de> References: <20190607062216.21525-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:8nBbK9Zze8jPrVyE11J3QdLPBWeKagG/5r3/EJU0PYngRXJnE52 D2jfOdspcXfsGiRyIwI/jpnF6qaVFGxSYnBBuHZZh/3TMQqT/vjJIzArryp/sz0vkMu77CQ OAHa9AUYdawuXJwYC8JGGB1zBA8s4+rNodN24YZrw0ZPAsLuz2rIHnVzPY+Fik4a9dp6Uur DPzC1Fo+IwiIFv10ispiQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:3Y8nRimChd0=:h2T5Yf3ph7S6GVYewR1pIi 52u2tSBZNCp3Er76fuQ/zfif+vdq4EeY4P7egS4krvQ9pokUq9jAexGuA71H/BP4OZs0dqFR+ zBHL1U5rC8B/T8mge9GG44aNyr0CPUyZ7sCy1A3LkEFNfZ20Q6VSNFJPvUGxX6IO0TsESE/eT jf5nxOPnahM7g4Ow1HrcLVvpfaiFpz8SOBtcKlz6F6+hfJax/iCBozocgp+vnC1CzN5bostAo RscsvcWp+lCbuMXhu5zC/V/jTfD0FvdxHX6Fj6FSFa6yw4Nc5NR8f5Mk1Ac21E4Qh1H/VFFiM TP/90GOifR3c43p2TqmQAUzSJgIWQQriYBtJoPjAwvVKONFa224UegohigUSUafjMaVyhEMnA g9jdoGTiaW9ZvZrInJbszkVTvEBXHZ1qe7dpZ50SHWe3OCy74ep8RKZR/hA8kYJ2fRP46OA6o 4Jmb90WcPNgaUxLtqBPddgfm2qUJ5A+ccdUWJMMfwU0ha2bNkraBJ6h5AUXOw5cvA4oH97s5y QpezMQL1J2gzCAlT4fQ9kuUctD3aDkORTbY5W8heon6+6MGbGdRbpTUrO/58R/kmxwJBhDxEF L/XPWqiOmyjb+LCEP1PPMVeFy9hgn/Uq4OxB2i5or9acaQMIPCLSbOEYxL8QnbDqtO95SEtiJ 1u/cu7oNldtbiD0zvIlubKUMJqYMwkeskfbK1OglUl72TAl7+e3LHEIrxxnly/uMGtHJyg4V+ MbptaUFsvDgbgt+vgTI5bjNnhDQccglvu+2tDomWGaE0b0Ec/q0m+yXZR72fBwytqAoA6EQtG m8nnUrYqbPoqElJTjL/dQruoEvZn2q9HrPYsgTfPiOZYgX8xmEq/lBr9fUB8y9H5R8xgIns3a HVTzNmJgonSbdsCU6Ct+6NZUk3nZD9Cf3pg2U0L9eQbVKa8LA+VdguED8CKJVvuo/mIAZqwKa NU1JpC32Ey2cB9MSO/IJRgf3YnocUSY4= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 1/3] efi_loader: RegisterProtocolNotify event signaling 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 a following patch efi_signal_event() will only queue an event if it is not signaled. Set the is_signaled status to false before signaling the event. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 7d1d6e9213..c7e2ecbf00 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1068,6 +1068,7 @@ efi_status_t efi_add_protocol(const efi_handle_t handle, } notif->handle = handle; list_add_tail(¬if->link, &event->handles); + event->event->is_signaled = false; efi_signal_event(event->event, true); } } From patchwork Fri Jun 7 06:22: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: 1111578 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="VBlzlRdw"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45Ksyk60Vyz9sNR for ; Fri, 7 Jun 2019 16:27:42 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 68D82C21EA7; Fri, 7 Jun 2019 06:27:38 +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 4A83AC21DAF; Fri, 7 Jun 2019 06:27:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D419DC21DAF; Fri, 7 Jun 2019 06:27:34 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lists.denx.de (Postfix) with ESMTPS id 8EA75C21C51 for ; Fri, 7 Jun 2019 06:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559888854; bh=U3+h3yswRPnEYi8BgYntJsnx9h3qrnV2t3NuVKtA8O8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VBlzlRdw31yeuJ6KvIEC3oDxfdJgpgDMG4uw7xs5mDycXyqLjwYcPfq4jnBVD6wR1 l+ktZ5wJ3JrlVkDqQM8IdYWmUTwnbzKuRSnDiXonX4CJn8K8NBEXQWTUeFERfJ/jy+ 6jhB53usZk1Zbj0WoI3TV6K5BQQHt7huQQ1k1Xt0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0Mcyxq-1hH3BZ2rIY-00IBGk; Fri, 07 Jun 2019 08:22:27 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 7 Jun 2019 08:22:15 +0200 Message-Id: <20190607062216.21525-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607062216.21525-1-xypron.glpk@gmx.de> References: <20190607062216.21525-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XjeDuxCsOF7PiXoiHaGi7dHIDVbIBmKLoP+/CU9tZFtEi8IG3t1 kESqFkV83d7SdyPzWA+2wY6sKA6aAVC2GUclcNGDSS/n+/6nn8BoLqpHSCmz8qp3+kpe6ZW Yxb1OKN2xARgaU1omhOddqKnC4lLkGO7MVrA9jMCPtgj8aDVYIpNLs15yZmpk155ZWgCTMX SQhQoq10w3DWNrovfWV6A== X-UI-Out-Filterresults: notjunk:1; V03:K0:lBhMlPwDxsY=:OTKFnQJxpZHskpOAjOEGtP Op2lrhStN/um38g8dIOenbmNZ0g9moJMym+Bv4PAt0tXvMqQZo7jfJ9aeHmsS3yxO36k88Kus qjkT4jyNb9fBLMSj8V7kJOpRqlGM43EsyBnJmHD4298lJsgMjMnZ6dNNwG5fHKEThr07IuasA ju9RMxTMEazUo614QT4oY+zL/ivsfzR9dcs8D7XqV2T5u2fNVqJDkRxyx5VJB5WBaVMRwsUmZ VTNsi4TnGA6FEGElXxsSJyLsm6hwuiMsWBMJIv8hjhWVKjykOGCAP83XqnksC/Nrn/z2Q5CaE zT7cRoguV4+gGyJf5Z7eu2bd6x2P6pdmzMrRDnbDtz3bWoWBEqrFAIRp8xdkf9XRFlhn7VJVR saBhuEDDlbf4bGZ3Pon3Ksb1jvZBA20VMpln7OO0v4Nprqkk67UjkY3h6Z8JKtobs17JU8+6N RLFpiN1qYcFUs52o5/a6/DgYpemdm6ZTH9sR/iHUf5gEhETSbzjLzxTriR+aMXGm2b+eiGsbs 7BqXQ5EKJwHW+PiezCC97YxqMN//T1rsamHijHAv0os6hINAS0tv9sB4PXHg0kr5k8izvpmgL FkGLqHZP4RAixcLmVVPkkZjdEikdo6ltHVr5ePtRtZlFYOuIL4M+p5CKbjww+XA61g7bud7VG qYGOC+g3DceH1zw+Cej1qwVzrMbwRKAi9HzdzSUbAs2zCPVyZ9V0MDy7lFrBCFKX5YEt0/oMU svuLAZzNico9EqbvurJH1Xod9WzWGbh7rHspSHBYhySCD1QBtFGEo/xNdESJ7RvOQlab808K8 b/8F0lIIicVJ328OC+INVLm5mbIGzoBQdiOurVms76PMUJVwWKPkcldZfk0K2SVJ5wzoZ3vXq NxxodEPi7xd/QNsSGVHrkUpV6RsA/o4JTsSi1ZUv1zWMAAsSgGqEmzhabElzas+qcSVtbPQZv bS3zSkEp0/EDzj4aR8GndSDGs9L5OO6c= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 2/3] efi_loader: SignalEvent for event in signaled state 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" If an event is already in the signaled state, SignalEvent should not queue the notification function but simply return EFI_SUCCESS. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c7e2ecbf00..74aa5f9b7c 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -221,6 +221,8 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl) */ void efi_signal_event(struct efi_event *event, bool check_tpl) { + if (event->is_signaled) + return; if (event->group) { struct efi_event *evt; From patchwork Fri Jun 7 06:22: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: 1111579 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="Ur4ZKj5G"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45KszC2HZNz9sNR for ; Fri, 7 Jun 2019 16:28:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D6DE5C21E96; Fri, 7 Jun 2019 06:27:51 +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 BD7E5C21E73; Fri, 7 Jun 2019 06:27:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4397EC21EBA; Fri, 7 Jun 2019 06:27:40 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id 62C23C21E70 for ; Fri, 7 Jun 2019 06:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559888854; bh=uYYiyH51jVkqhYladXAO/mEs+NEP/jwnk+cwfut4drQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Ur4ZKj5Ga4WhdEwnphYs3PkpajmNpf4L04UUkc6s3JYOC7o5GgrPeo6I2waEVOa6D pFqmLlxQZ0ixw0+Pk6IsVv2BsnH76hKp21wqQGdkhmwVCJDyyXpK+/pr9h0AUg78ga k5lyQU2e5hKzP1XnXHO5Fb/mfEoUyJPhWSvow8KA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0M6vSj-1gfXVu49WH-00wiYX; Fri, 07 Jun 2019 08:22:28 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Fri, 7 Jun 2019 08:22:16 +0200 Message-Id: <20190607062216.21525-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607062216.21525-1-xypron.glpk@gmx.de> References: <20190607062216.21525-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:/7rYS2LZVmOQzgKl4gHCyTGA6haiamo6fZYmKnvb0Kcs3i4R8E2 +cCXy6s/cZ/PMkxDSR/FSsR6bZJSyPujCfzm1jhWwaKGk7EabzDeM/bBr3SVGDBkeJFGXfU 4XToTR7dvpM2QJKaN5THPPdt3d/fabplBGruaKYCMKtQehnl57Ps5AIP+21c7Lnz2qsJbo1 xK7rPT1DvzWpKg5Gdq0AQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:tqoV5UfysXw=:XtytItAOQTq7ANfc/ewSrN xTAfqfsEn6ihyQqHl4CR01dq57L04ETn8qZajFX4+6RONr9PnHg6Jlot3u/B59Kmk2veiRjEN au+9tH/Xmv0hCRykabDS7D505RkASvW/Y+ApudLXs+/xWKSiZR60uiwwgVGQuXSPFEZwHBbGE daSmZsnpbxpO/2GXF1ot9XiAv9Sv81zGBSoq2rbfFdmYL70Ork5FYqGcXJo3e33DNSJLIHPDr fZfvju3nDyH77We9yabkkTrllPqITwc3/pN+QQI2ftOuhlZ+aGnbdGo4wioaAVuIAUMAOstdd ujICCr8PWQ/HBNelm30Mnwx0Te6YYK7opRIj5IVkAtIWgvwfS5p9J5NhA56w43d6ypH9mGqTd K2gpgNYdUv0vg3uAs4gHcmW0/EkdBP0R5nV1syzbuCOmQCWEtvDBox2xu/wXPFjKWDc6QLCHO ykDF17FSM6nsPseFgRBUPMxlAlmGKmkTFQqz+7IanRSIm8FtB0F2nsJZYO1ostjERg6PbRphH TiIyKVQHF9YQJgMDC0x295WwvNEH8dXsXKZ0Gs+ncaSm8Y8zy766qTK0B0tqr1HPhZDkG2vGi SVLiOtSNWsefutEuNh7BjeczpmytHhb4XgRqzcer8LitGQIq0bLHjB+2mkcOgzsEYnrDSCMoG L+Wkqmz2hmEiAwCw1Sf36EJYhFr9i4/uyk/zb75vDzqYfvOSASnBtG10Pz7vHpii2KLlx+C5E 6N0TPD5+Dp+ZyiVV1xai1EEjMi169Dp8Rx1bv7EScgvq9u8bvH4valzrDfKR0CEce7RbaCbAV 895gOwQlJOKijgfNyVGf4XeK2oCHK54cDYE6oKQnmo4O2I6X604CLAu13voL8EDTnLg72nb53 Bbiq4pjOeprn1pbISBnMlYvVhgIhzTvC9mVGPGEAeyKQd0pAKmzPASxF3lxqzQd5c6wYmBS6w aqcM/n10XkQ/Eg8Mx/OlyD6WP3tECfI8= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 3/3] efi_loader: event signaling in ExitBootServices 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" ExitBootServices() has to stop timer related activity before calling the events of the EFI_EVENT_GROUP_EXIT_BOOT_SERVICES event group. But our current implementation was stopping all other events. All events have to observe the task priority level. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 +- lib/efi_loader/efi_boottime.c | 42 ++++++++++++++++++++--------------- lib/efi_loader/efi_console.c | 4 ++-- lib/efi_loader/efi_memory.c | 2 +- lib/efi_loader/efi_runtime.c | 2 +- 5 files changed, 29 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/include/efi_loader.h b/include/efi_loader.h index 23ce732267..8a3f8fe03d 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -432,7 +432,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, uint64_t trigger_time); /* Call this to signal an event */ -void efi_signal_event(struct efi_event *event, bool check_tpl); +void efi_signal_event(struct efi_event *event); /* open file system: */ struct efi_simple_file_system_protocol *efi_simple_file_system( diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 74aa5f9b7c..c146b47128 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -27,6 +27,9 @@ LIST_HEAD(efi_obj_list); /* List of all events */ LIST_HEAD(efi_events); +/* Flag to disable timer activity in ExitBootServices() */ +static bool timers_enabled = true; + /* List of all events registered by RegisterProtocolNotify() */ LIST_HEAD(efi_register_notify_events); @@ -163,7 +166,6 @@ const char *__efi_nesting_dec(void) /** * efi_queue_event() - queue an EFI event * @event: event to signal - * @check_tpl: check the TPL level * * This function queues the notification function of the event for future * execution. @@ -174,12 +176,12 @@ const char *__efi_nesting_dec(void) * For the SignalEvent service see efi_signal_event_ext. * */ -static void efi_queue_event(struct efi_event *event, bool check_tpl) +static void efi_queue_event(struct efi_event *event) { if (event->notify_function) { event->is_queued = true; /* Check TPL */ - if (check_tpl && efi_tpl >= event->notify_tpl) + if (efi_tpl >= event->notify_tpl) return; event->is_queued = false; EFI_CALL_VOID(event->notify_function(event, @@ -211,7 +213,6 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl) /** * efi_signal_event() - signal an EFI event * @event: event to signal - * @check_tpl: check the TPL level * * This function signals an event. If the event belongs to an event group all * events of the group are signaled. If they are of type EVT_NOTIFY_SIGNAL @@ -219,7 +220,7 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl) * * For the SignalEvent service see efi_signal_event_ext. */ -void efi_signal_event(struct efi_event *event, bool check_tpl) +void efi_signal_event(struct efi_event *event) { if (event->is_signaled) return; @@ -244,12 +245,12 @@ void efi_signal_event(struct efi_event *event, bool check_tpl) if (!evt->group || guidcmp(evt->group, event->group)) continue; if (evt->is_queued) - efi_queue_event(evt, check_tpl); + efi_queue_event(evt); } } else { event->is_signaled = true; if (event->type & EVT_NOTIFY_SIGNAL) - efi_queue_event(event, check_tpl); + efi_queue_event(event); } } @@ -736,7 +737,9 @@ void efi_timer_check(void) list_for_each_entry(evt, &efi_events, link) { if (evt->is_queued) - efi_queue_event(evt, true); + efi_queue_event(evt); + if (!timers_enabled) + continue; if (!(evt->type & EVT_TIMER) || now < evt->trigger_next) continue; switch (evt->trigger_type) { @@ -750,7 +753,7 @@ void efi_timer_check(void) continue; } evt->is_signaled = false; - efi_signal_event(evt, true); + efi_signal_event(evt); } WATCHDOG_RESET(); } @@ -852,7 +855,7 @@ static efi_status_t EFIAPI efi_wait_for_event(efi_uintn_t num_events, if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL) return EFI_EXIT(EFI_INVALID_PARAMETER); if (!event[i]->is_signaled) - efi_queue_event(event[i], true); + efi_queue_event(event[i]); } /* Wait for signal */ @@ -896,7 +899,7 @@ static efi_status_t EFIAPI efi_signal_event_ext(struct efi_event *event) EFI_ENTRY("%p", event); if (efi_is_event(event) != EFI_SUCCESS) return EFI_EXIT(EFI_INVALID_PARAMETER); - efi_signal_event(event, true); + efi_signal_event(event); return EFI_EXIT(EFI_SUCCESS); } @@ -963,7 +966,7 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event) event->type & EVT_NOTIFY_SIGNAL) return EFI_EXIT(EFI_INVALID_PARAMETER); if (!event->is_signaled) - efi_queue_event(event, true); + efi_queue_event(event); if (event->is_signaled) { event->is_signaled = false; return EFI_EXIT(EFI_SUCCESS); @@ -1071,7 +1074,7 @@ efi_status_t efi_add_protocol(const efi_handle_t handle, notif->handle = handle; list_add_tail(¬if->link, &event->handles); event->event->is_signaled = false; - efi_signal_event(event->event, true); + efi_signal_event(event->event); } } @@ -1596,7 +1599,7 @@ out: /* Notify that the configuration table was changed */ list_for_each_entry(evt, &efi_events, link) { if (evt->group && !guidcmp(evt->group, guid)) { - efi_signal_event(evt, false); + efi_signal_event(evt); break; } } @@ -1902,13 +1905,13 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, if (map_key != efi_memory_map_key) return EFI_INVALID_PARAMETER; - /* Make sure that notification functions are not called anymore */ - efi_tpl = TPL_HIGH_LEVEL; - /* Check if ExitBootServices has already been called */ if (!systab.boottime) return EFI_EXIT(EFI_SUCCESS); + /* Stop all timer related activities */ + timers_enabled = false; + /* Add related events to the event group */ list_for_each_entry(evt, &efi_events, link) { if (evt->type == EVT_SIGNAL_EXIT_BOOT_SERVICES) @@ -1919,11 +1922,14 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, if (evt->group && !guidcmp(evt->group, &efi_guid_event_group_exit_boot_services)) { - efi_signal_event(evt, false); + efi_signal_event(evt); break; } } + /* Make sure that notification functions are not called anymore */ + efi_tpl = TPL_HIGH_LEVEL; + /* TODO: Should persist EFI variables here */ board_quiesce_devices(); diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3b7578f3aa..2fc25e118f 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -704,7 +704,7 @@ static void efi_cin_check(void) efi_status_t ret; if (key_available) { - efi_signal_event(efi_con_in.wait_for_key, true); + efi_signal_event(efi_con_in.wait_for_key); return; } @@ -718,7 +718,7 @@ static void efi_cin_check(void) /* Queue the wait for key event */ if (key_available) - efi_signal_event(efi_con_in.wait_for_key, true); + efi_signal_event(efi_con_in.wait_for_key); } } } diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 386cf924fe..8d76851234 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -321,7 +321,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, if (evt->group && !guidcmp(evt->group, &efi_guid_event_group_memory_map_change)) { - efi_signal_event(evt, false); + efi_signal_event(evt); break; } } diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 9c50955c9b..432551d0c8 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -130,7 +130,7 @@ static void EFIAPI efi_reset_system_boottime( if (evt->group && !guidcmp(evt->group, &efi_guid_event_group_reset_system)) { - efi_signal_event(evt, false); + efi_signal_event(evt); break; } }