From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41303+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41303+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674285; cv=none; d=zoho.com; s=zohoarc; b=YRGKFoi8H4YHm1020lu2GnLXuaEcqWHZSGV+Sz2yXGJqrMyKYd2lT4xFX1I+32TWw38X+dIbow4lIeGrIOClcuWr3RzczAbtw0R2ogRmbeZ16QN9437by2rY6q227v3SrOkTPtzKh2Ud0doUQTcOMornn1G/vyVi8km4sMfEMx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674285; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=0QWlWmXxytr3lLZv1L3+drcxg8j/tj60pL4PIApru+A=; b=Djn9HztNH87mErFKln2y+BlMMP66FpKvr1fyGHUL4RjeTjDPF7CU14E4yoIkCOxxwWVf7ZGdUwZex+Rhzxdli688IYwb79be/XNtUB8UfHBN2Dt1qSUjRMasPB9ojPgOzzwuy1TPUL78f0XMfQ7ZQ20ZhrleKNpa6oz9N7pKJPM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41303+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15586742857481003.5278025871092; Thu, 23 May 2019 22:04:45 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:44 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:44 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:42 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Sean Brogan , Jian J Wang , Hao A Wu , Ray Ni , Star Zeng , Liming gao , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 1/6] MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for event Date: Fri, 24 May 2019 13:04:32 +0800 Message-Id: <20190524050437.38616-2-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674285; bh=mJ6uHH6SFuz9/6iWtPyd9lAxGfWxNzNVmIXwZNa6rgA=; h=Cc:Date:From:Reply-To:Subject:To; b=fFKy0XkybCf49mhI0TJJZXcc9RehUL/XV6F+6/LJaR6xR9xf/F3NUZDh73fCBpP9aip 06dZ/yWzaKceLsUrVYc1D4p9xxFDX5KUll6xJFCvF4Du0J1msIiyqxA1EQWni4RPZfjsB ecTOsTEIQv0gWSKYM8/IyVSPrg5yHORtX94= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Sean Brogan REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 Add common event protocol to support all TPL event: Add the guid and header file of it. Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Star Zeng Cc: Liming gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdeModulePkg/Include/Protocol/CommonEvent.h | 18 ++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h diff --git a/MdeModulePkg/Include/Protocol/CommonEvent.h b/MdeModulePkg/Inc= lude/Protocol/CommonEvent.h new file mode 100644 index 0000000000..176be14101 --- /dev/null +++ b/MdeModulePkg/Include/Protocol/CommonEvent.h @@ -0,0 +1,18 @@ +/** @file + Common event protocol would provide a service of event. + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef __COMMON_EVENT_H__ +#define __COMMON_EVENT_H__ + +#include + +typedef struct { + EFI_CREATE_EVENT_EX CreateEventEx; + EFI_WAIT_FOR_EVENT WaitForEvent; +} EDKII_COMMON_EVENT_PROTOCOL; + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 0a9fcddecc..ff4337f235 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -630,6 +630,9 @@ ## Include/Protocol/PeCoffImageEmulator.h gEdkiiPeCoffImageEmulatorProtocolGuid =3D { 0x96f46153, 0x97a7, 0x4793, = { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } } =20 + ## Include/Protocole/CommonEvent.h + gEdkiiCommonEventProtocolGuid =3D { 0x8bfb3718, 0xdb10, 0x4cc1, { 0xa9, = 0xf5, 0x84, 0xae, 0xce, 0xce, 0x99, 0x55 } } + # # [Error.gEfiMdeModulePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41303): https://edk2.groups.io/g/devel/message/41303 Mute This Topic: https://groups.io/mt/31741728/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41304+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41304+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674286; cv=none; d=zoho.com; s=zohoarc; b=lAlDcmZgUIn1YRORv0fRnwpNMkSUIsWulZtNQ3MmD7+m6IbkwZr2HlYhfRwjkvZRD1eniykryOVsVByrVwh9sW3gkHoVMSDPyzOjnZrlmBu9Ouql+j5Zb/FasSOqAOCEOSscPJ1S272+7cnEytAP6NMAm1dRsfsSUEGbSR7AmWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674286; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=acP1SSJlzhvtML1NW7x8EiXg9IYUpGsXT8Onf7IrCqk=; b=K9CytF7n190q9GNjI19mCOJKNG1nvR38k7hzer6pc5VaoiQDbR+UFBG0wydgSelvJjyEgFVptcDaZQLJU5NasdtA9mnWtwuovDOklj+z+oyG+GKcRjXn1VXRhpKch+BlZO1AUy2yy3a618l5R1xRwvcbDvIg66DXFV/DMh77FC8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41304+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558674286807880.7017323843945; Thu, 23 May 2019 22:04:46 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:46 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:45 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:43 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Sean Brogan , Michael D Kinney , Liming Gao , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 2/6] MdePkg/BaseLib.h: Add EnableInterruptsAndSleep function declare Date: Fri, 24 May 2019 13:04:33 +0800 Message-Id: <20190524050437.38616-3-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674286; bh=2t0WtHJb68ZCXZi/cxrXikgtceN6muxVkQVc6KYmOwo=; h=Cc:Date:From:Reply-To:Subject:To; b=sTx3jKb386RU73Wrsehpk/izHNdipWN1TO9layhVPm8qAcqIaWseXA/BDs5mhfRGzRM mpJhPMbBa6PZrebf7kiyBMsEEVA7s7Ej6YDXgwK0kTvqKvMp/oDJQkxeVTAmuseG3kAAa xOX0wsDj7T65cGBcR04brS6528Le0Hr/7Ps= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Sean Brogan REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 Add EnableInterruptsAndSleep function. Cc: Michael D Kinney Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdePkg/Include/Library/BaseLib.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/Base= Lib.h index ebd7dd274c..8ab2c12328 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -5033,6 +5033,17 @@ LongJump ( ); =20 =20 +/** + Enables CPU interrupts and then waits for an interrupt to arrive. + +**/ +VOID +EFIAPI +EnableInterruptsAndSleep ( + VOID + ); + + /** Enables CPU interrupts. =20 --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41304): https://edk2.groups.io/g/devel/message/41304 Mute This Topic: https://groups.io/mt/31741729/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41305+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41305+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674289; cv=none; d=zoho.com; s=zohoarc; b=PlUwOeBDFonraZdCQ0uvRyn+cmUO43ysKfiiLxEJB3NxgLUkplYkHGsjlfLhsZI/XeTtUadxPi6uJE+pJz7PH5SEnVA5lFAaKEG4y8RVnp07A839Y/BpxwtwKf3DCarvJHI39dlsmO5LDpjLNZg2MTeWPrKpS/cDzlhc6K6eQtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674289; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=nkIsRngCqtYv1PgWfov8E3yWvXel5w5RaK3Ta+w4tDA=; b=e/UIKV1cKAXmjdwtuENppuw+Hoeym6Q/RSdVWhJyUwiQVmHSuWKKDwVKEesN6DsiOnMzLdKxIRoBOLpleSs/r6ahHBgq2yT1mH9Uhx2BhMpnr0LSN9tKLn0slpH69IXMeUxHWu+UlUIghWzj7RattQMkswPBvBedLzlqTC3+tnk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41305+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558674289142297.2288748298299; Thu, 23 May 2019 22:04:49 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:48 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:47 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:44 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Sean Brogan , Michael D Kinney , Liming Gao , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 3/6] MdePkg/BaseLib: Implement EnableInterruptsAndSleep Date: Fri, 24 May 2019 13:04:34 +0800 Message-Id: <20190524050437.38616-4-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674288; bh=z0eAUdznU57USo9npSnid8BMtd5yaOsyppPhPR1x1d8=; h=Cc:Date:From:Reply-To:Subject:To; b=p96RuyOzXW1EX8v7hXfK+zkHGPSe8KDUgKexQLNHWQC5GjkPLn5wcvUQjddJt5W8P8E Mpdlvko1qe9MMeHC9BEO9IvFSYt5GUpxcQpKPLFgK2GOL7waw3MD7bEjgUE/nLFKkxoeZ segjwgqIZ+I0UZUmIjwaM/sV5PEqwp9t5do= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Sean Brogan REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 Implement EnableInterruptsAndSleep. Cc: Michael D Kinney Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c | 18 +++++++++++++++++- .../Library/BaseLib/Ia32/EnableInterrupts.nasm | 15 ++++++++++++++- .../Library/BaseLib/X64/EnableInterrupts.nasm | 15 ++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c b/MdePkg/Librar= y/BaseLib/Ia32/EnableInterrupts.c index bc03144c42..c2a84342b1 100644 --- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c +++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c @@ -1,7 +1,7 @@ /** @file EnableInterrupts function =20 - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -24,3 +24,19 @@ EnableInterrupts ( } } =20 +/** + Enables CPU interrupts and then waits for an interrupt to arrive. + +**/ +VOID +EFIAPI +EnableInterruptsAndSleep ( + VOID + ) +{ + _asm { + sti + hlt + } +} + diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm b/MdePkg/Lib= rary/BaseLib/Ia32/EnableInterrupts.nasm index 979e708207..86902f61b6 100644 --- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm +++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= ----- ; -; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: @@ -29,3 +29,16 @@ ASM_PFX(EnableInterrupts): sti ret =20 +;-------------------------------------------------------------------------= ----- +; VOID +; EFIAPI +; EnableInterruptsAndSleep ( +; VOID +; ); +;-------------------------------------------------------------------------= ----- +global ASM_PFX(EnableInterruptsAndSleep) +ASM_PFX(EnableInterruptsAndSleep): + sti + hlt + ret + diff --git a/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm b/MdePkg/Libr= ary/BaseLib/X64/EnableInterrupts.nasm index 6057afd626..de8f2ad434 100644 --- a/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm +++ b/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= ----- ; -; Copyright (c) 2006, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: @@ -30,3 +30,16 @@ ASM_PFX(EnableInterrupts): sti ret =20 +;-------------------------------------------------------------------------= ----- +; VOID +; EFIAPI +; EnableInterruptsAndSleep ( +; VOID +; ); +;-------------------------------------------------------------------------= ----- +global ASM_PFX(EnableInterruptsAndSleep) +ASM_PFX(EnableInterruptsAndSleep): + sti + hlt + ret + --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41305): https://edk2.groups.io/g/devel/message/41305 Mute This Topic: https://groups.io/mt/31741730/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41306+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41306+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674290; cv=none; d=zoho.com; s=zohoarc; b=BGfwP/4P9WnalF9txuPu0GFNV263MwKYshDDWO46NspDyZG0WjjJMLdcnvqUhTcAhSziiBZOvIFA9M07YBmThJTtrbRSdil3byaMXYGrtqDcKFQEeAWVkhU8E1QoZDIdroHpzU+uu9YD91npXvXTb7HZaPQejCMlTyTPmNnM9eE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674290; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=uuUQzmV0+Lr2vdkJJLVgOBmNvYA0sFR5QTEAD1FQrjc=; b=CV4VxhjRgubotEpOIg6cpdXeYJZE02vNKZl3ZQ9Ayh6jXiKZwEql4ASwtu5CHedNeYAZIs831KopJuPJtqkS+cA9xXnwE5ZEj9TJE4hK620fjti209O6IOAT4QAtrgqehGHTCGcp3LSO7/gGj3qmJzw6o5rG2UqouUOVNLuYe4g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41306+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558674290104175.38914877556147; Thu, 23 May 2019 22:04:50 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:49 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:49 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:46 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Sean Brogan , Michael D Kinney , Liming Gao , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 4/6] MdePkg: Add gEfiCpu2ProtocolGuid and header file Date: Fri, 24 May 2019 13:04:35 +0800 Message-Id: <20190524050437.38616-5-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674289; bh=LNBPMZ2f56sgJNFjZOb2z2UZ3ftNbRYcG8YvTiW7l2Y=; h=Cc:Date:From:Reply-To:Subject:To; b=cj2qlkO4He+Tryxz8GVurIk8TRey9h+9dADPv6hjB3xmqifsoE1NfaMvmkgIPjIgT0z D9PvZj7URiTrOU9zQ9RmHraHUU3b/oUSkLkC/gfAkprelHNwDmZtxv1roWtB7sEOh2X6b kxqJv6mavDFsWZCvC8QQzOWgOW9kb5aKqTo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Sean Brogan REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 Add gEfiCpu2ProtocolGuid to MdePkg.dec. Add the header file of Cpu2 protocol: it has one interface to enable interrupt and put cpu to sleep to wait for an interrupt. Cc: Michael D Kinney Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdePkg/Include/Protocol/Cpu2.h | 43 ++++++++++++++++++++++++++++++++++ MdePkg/MdePkg.dec | 3 +++ 2 files changed, 46 insertions(+) create mode 100644 MdePkg/Include/Protocol/Cpu2.h diff --git a/MdePkg/Include/Protocol/Cpu2.h b/MdePkg/Include/Protocol/Cpu2.h new file mode 100644 index 0000000000..cacd948140 --- /dev/null +++ b/MdePkg/Include/Protocol/Cpu2.h @@ -0,0 +1,43 @@ +/** @file + CPU2 Protocol + + This code abstracts the DXE core from processor implementation details. + + Copyright (c) 2006 - 2018, Microsoft Corporation. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PROTOCOL_CPU2_H__ +#define __PROTOCOL_CPU2_H__ + +#include + +typedef struct _EFI_CPU2_PROTOCOL EFI_CPU2_PROTOCOL; + + +/** + This function enables CPU interrupts and then waits for an interrupt to = arrive. + + @param This The EFI_CPU2_PROTOCOL instance. + + @retval EFI_SUCCESS Interrupts are enabled on the processor. + @retval EFI_DEVICE_ERROR Interrupts could not be enabled on the pro= cessor. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT)( + IN EFI_CPU2_PROTOCOL *This + ); + +// +// The EFI_CPU2_PROTOCOL is used to abstract processor-specific functions = from the DXE +// Foundation. +// +struct _EFI_CPU2_PROTOCOL { + EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT EnableAndWaitForInterru= pt; +}; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 6c563375ee..e8c6939849 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -1803,6 +1803,9 @@ ## Include/Protocol/ShellDynamicCommand.h gEfiShellDynamicCommandProtocolGuid =3D { 0x3c7200e9, 0x005f, 0x4ea4, {= 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }} =20 + ## Include/Protocol/Cpu2.h + gEfiCpu2ProtocolGuid =3D { 0x55198405, 0x26C0, 0x4765, {= 0x8B, 0x7D, 0xBE, 0x1D, 0xF5, 0xF9, 0x97, 0x12 }} + # # [Error.gEfiMdePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41306): https://edk2.groups.io/g/devel/message/41306 Mute This Topic: https://groups.io/mt/31741731/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41307+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41307+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674291; cv=none; d=zoho.com; s=zohoarc; b=n4aPa8KR8t5u/5A8XCV+etyV+V3hC7RiYzTHjKUussZroNi/e5RwKZ6tuJF0BbKeivLnSrxpbE0ZKd9bf5oNTK1a/G1TPgIWWFAp125dJKI1PXmHaqlYzj6bgkorJgG4L8Vw/pWSSoOpOOoOcQi6HQrJDCjByL316a4atww6EGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674291; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=V1M943qU0sgSnEqxiQy8WRNB6NAztPAkcKeqypqOcFQ=; b=BSwAak/lS0A8/F52WJ1ec3CPFnFQ0aDW8Tlj98f0nrZEv0VS/ALOpKxXAyF8DBvrB6IS/UC4FYuAW7uQuOZwq+0gqHkOe0NbYMhS8/bzGK90uKzHTaUS/WpPyLifyWvz4d5QB5Bon9oDd1QjLnVb7D6OcsPTdiq6n2RPTUqrkEs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41307+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558674291698929.6540976403636; Thu, 23 May 2019 22:04:51 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:51 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:50 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:48 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Liming Gao , Sean Brogan , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 5/6] UefiCpuPkg/CpuDxe: Implement Cpu2 protocol Date: Fri, 24 May 2019 13:04:36 +0800 Message-Id: <20190524050437.38616-6-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674291; bh=ORYlEGcPWyx9yNirKApek275aVKaJPz1VIseSVWWCLs=; h=Cc:Date:From:Reply-To:Subject:To; b=nKm106xwyKu9RYSj067Xw4En19RRlmSCpaBrdpkFZztNAY5LmfOzC5Nj94JghPo0mf+ vMq56tUvxxdCuAH4aJ5uQO68Xf64nZJKxTlbI5VV45OTFULCACXKVZVZww6ukBcMXXhny UG4FTJk+wf3AsXXf3nQGzuj3B6e3bl+DX1w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 Implement Cp2 protocol: it has one interface to enable the interrupt and put cpu to sleep and wait for an interrupt. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- UefiCpuPkg/CpuDxe/CpuDxe.c | 40 +++++++++++++++++++++++++++++++++++- UefiCpuPkg/CpuDxe/CpuDxe.h | 15 ++++++++++++++ UefiCpuPkg/CpuDxe/CpuDxe.inf | 3 ++- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 7d7270e10b..0d0cdf6f86 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.c +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c @@ -1,7 +1,7 @@ /** @file CPU DXE Module to produce CPU ARCH Protocol. =20 - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -18,6 +18,7 @@ // BOOLEAN InterruptState =3D FALSE; EFI_HANDLE mCpuHandle =3D NULL; +EFI_HANDLE mCpu2Handle =3D NULL; BOOLEAN mIsFlushingGCD; BOOLEAN mIsAllocatingPageTable =3D FALSE; UINT64 mValidMtrrAddressMask; @@ -96,6 +97,10 @@ EFI_CPU_ARCH_PROTOCOL gCpu =3D { 4 // DmaBufferAlignment }; =20 +EFI_CPU2_PROTOCOL gCpu2 =3D { + CpuEnableAndWaitForInterrupt +}; + // // CPU Arch Protocol Functions // @@ -499,6 +504,28 @@ CpuSetMemoryAttributes ( return AssignMemoryPageAttributes (NULL, BaseAddress, Length, MemoryAttr= ibutes, NULL); } =20 +// +// CPU2 Protocol Functions +// +/** + This function enables CPU interrupts and then waits for an interrupt to = arrive. + + @param This The EFI_CPU2_PROTOCOL instance. + + @retval EFI_SUCCESS Interrupts are enabled on the processor. + @retval EFI_DEVICE_ERROR Interrupts could not be enabled on the pro= cessor. + +**/ +EFI_STATUS +CpuEnableAndWaitForInterrupt ( + IN EFI_CPU2_PROTOCOL *This + ) +{ + EnableInterruptsAndSleep (); + + return EFI_SUCCESS; +} + /** Initializes the valid bits mask and valid address mask for MTRRs. =20 @@ -1211,6 +1238,17 @@ InitializeCpu ( ); ASSERT_EFI_ERROR (Status); =20 + // + // Install CPU2 Protocol + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mCpu2Handle, + &gEfiCpu2ProtocolGuid, + &gCpu2, + NULL + ); + ASSERT_EFI_ERROR (Status); + InitializeMpSupport (); =20 return Status; diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h index b029be430b..8698ff78eb 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.h +++ b/UefiCpuPkg/CpuDxe/CpuDxe.h @@ -12,6 +12,7 @@ #include =20 #include +#include #include #include =20 @@ -305,6 +306,20 @@ PageFaultExceptionHandler ( IN EFI_SYSTEM_CONTEXT SystemContext ); =20 +/** + This function enables CPU interrupts and then waits for an interrupt to = arrive. + + @param This The EFI_CPU2_PROTOCOL instance. + + @retval EFI_SUCCESS Interrupts are enabled on the processor. + @retval EFI_DEVICE_ERROR Interrupts could not be enabled on the pro= cessor. + +**/ +EFI_STATUS +CpuEnableAndWaitForInterrupt ( + IN EFI_CPU2_PROTOCOL *This + ); + extern BOOLEAN mIsAllocatingPageTable; extern UINTN mNumberOfProcessors; =20 diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf index 57381dbc85..d4ff562d89 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.inf +++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf @@ -1,7 +1,7 @@ ## @file # CPU driver installs CPU Architecture Protocol and CPU MP protocol. # -# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -62,6 +62,7 @@ gEfiCpuArchProtocolGuid ## PRODUCES gEfiMpServiceProtocolGuid ## PRODUCES gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES + gEfiCpu2ProtocolGuid ## PRODUCES =20 [Guids] gIdleLoopEventGuid ## CONSUMES ## E= vent --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41307): https://edk2.groups.io/g/devel/message/41307 Mute This Topic: https://groups.io/mt/31741732/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue Apr 30 19:42:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41308+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41308+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558674293; cv=none; d=zoho.com; s=zohoarc; b=ogUQOPBuwpOmiSXiMkPOi8xM4fYvgoDpax5CYNkAD38YBUR+uEWwqqRhzzhj5WSPaAGkuDF3Cwsr6mMQc4z8iOFS7s0JqxgRpL5FDBmO7Obd6AFklDZ6lWklUzj8q6LrVgSfJ5qRm5ejU6bVTaWczAFyexhuBW811+eRt1eDyQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558674293; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=R2xOpEKq2otz58E1blE42iDZqX/ewN9JPzGV7mbkjqA=; b=M76XKdWm6pnfv5OuHdfhpMydfiPvUW7pUVyREvDyWFz2uVQ2GeNfhxnG09tZXGE2V1HAD7yPt/zgoZ/nfqPEmFFPDXI0AHksJwMS1yXpU05lkyo+kQ7VPl/VBVe3n5bJOpL5xIXyj4HBQ4T+1EB9N139zkDyNXPOyndp/C+xigc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41308+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558674293557201.4189259936835; Thu, 23 May 2019 22:04:53 -0700 (PDT) Return-Path: X-Received: from mga03.intel.com (mga03.intel.com []) by groups.io with SMTP; Thu, 23 May 2019 22:04:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 22:04:52 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2019 22:04:49 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Sean Brogan , Jian J Wang , Hao A Wu , Ray Ni , Star Zeng , Liming gao , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH 6/6] MdeModulePkg/DxeMain: Implement common event protocol Date: Fri, 24 May 2019 13:04:37 +0800 Message-Id: <20190524050437.38616-7-zhichao.gao@intel.com> In-Reply-To: <20190524050437.38616-1-zhichao.gao@intel.com> References: <20190524050437.38616-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558674293; bh=64fv7gKszH32bQqCl1QalSBskkcWGaOABG324RjHIV8=; h=Cc:Date:From:Reply-To:Subject:To; b=jW7rG2W4o6rJJtenZydZuvVuZ3aoUCRsEAqP4bbhcexcUP6ekat9lAst4/bR4kGe+Mt LZ2IsoYLUG9ianMScbzVibZC6CZvoQrM4NAd9baijlAN2GsI+J3Ecl0O87ocT1ZPA+9wU yUB/S/2DjXT2rXrR83NhKryc57yuIU8Zpls= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Sean Brogan REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1400 If an interrupt happens between CheckEvent and gIdleLoopEvent, there would be a event pending during cpu sleep. So it is required to check the gEventPending with the interrupt disabled. Implement a protocol gEdkiiCommonEventProtocolGuid to support all TPL event for PI drivers that use HW interrput. It has two interface, one is to create event and the other one is to wait for event. Add 'volatile' specifier for gEfiCurrentTpl and gEventPending because they may be changed out of the context (interrupt context). Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Star Zeng Cc: Liming gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdeModulePkg/Core/Dxe/DxeMain.h | 64 ++++++++++- MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 22 ++++ .../Core/Dxe/DxeMain/DxeProtocolNotify.c | 1 + MdeModulePkg/Core/Dxe/Event/Event.c | 102 ++++++++++++++++-- MdeModulePkg/Core/Dxe/Event/Event.h | 2 +- 6 files changed, 179 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMai= n.h index 6a64852730..355f66bc44 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -274,10 +276,11 @@ extern EFI_METRONOME_ARCH_PROTOCOL *gMet= ronome; extern EFI_TIMER_ARCH_PROTOCOL *gTimer; extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; +extern EFI_CPU2_PROTOCOL *gCpu2; extern EFI_BDS_ARCH_PROTOCOL *gBds; extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; =20 -extern EFI_TPL gEfiCurrentTpl; +extern volatile EFI_TPL gEfiCurrentTpl; =20 extern EFI_GUID *gDxeCoreFileName; extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage; @@ -1714,6 +1717,65 @@ CoreCheckEvent ( ); =20 =20 +/** + Stops execution until an event is signaled. + + Support all TPL. + + @param NumberOfEvents The number of events in the UserEvents ar= ray + @param UserEvents An array of EFI_EVENT + @param UserIndex Pointer to the index of the event which + satisfied the wait condition + + @retval EFI_SUCCESS The event indicated by Index was signaled. + @retval EFI_INVALID_PARAMETER The event indicated by Index has a notifi= cation + function or Event was not a valid type + @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION + +**/ +EFI_STATUS +EFIAPI +CommonWaitForEvent ( + IN UINTN NumberOfEvents, + IN EFI_EVENT *UserEvents, + OUT UINTN *UserIndex + ); + + +/** + Creates an event in a group. + + Support all TPL. + + @param Type The type of event to create and its mode = and + attributes + @param NotifyTpl The task priority level of event notifica= tions + @param NotifyFunction Pointer to the events notification functi= on + @param NotifyContext Pointer to the notification functions con= text; + corresponds to parameter "Context" in the + notification function + @param EventGroup GUID for EventGroup if NULL act the same = as + gBS->CreateEvent(). + @param Event Pointer to the newly created event if the= call + succeeds; undefined otherwise + + @retval EFI_SUCCESS The event structure was created + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value + @retval EFI_OUT_OF_RESOURCES The event could not be allocated + +**/ +EFI_STATUS +EFIAPI +CommonCreateEventEx ( + IN UINT32 Type, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL + IN CONST VOID *NotifyContext, OPTIONAL + IN CONST EFI_GUID *EventGroup, OPTIONAL + OUT EFI_EVENT *Event + ); + + /** Adds reserved memory, system memory, or memory-mapped I/O resources to t= he global coherency domain of the processor. diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeM= ain.inf index 61161bee28..d758ee431e 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -171,6 +171,7 @@ gEfiVariableArchProtocolGuid ## CONSUMES gEfiCapsuleArchProtocolGuid ## CONSUMES gEfiWatchdogTimerArchProtocolGuid ## CONSUMES + gEdkiiCommonEventProtocolGuid ## SOMETIMES_CONSUMES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePageNumber = ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dx= e/DxeMain/DxeMain.c index 514d1aa75a..0e6a4b2ec5 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -13,12 +13,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // EFI_HANDLE mDecompressHandle =3D NULL; =20 +// +// Common event protocol +// +EFI_HANDLE mCommonEventHalde =3D NULL; + // // DXE Core globals for Architecture Protocols // EFI_SECURITY_ARCH_PROTOCOL *gSecurity =3D NULL; EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2 =3D NULL; EFI_CPU_ARCH_PROTOCOL *gCpu =3D NULL; +EFI_CPU2_PROTOCOL *gCpu2 =3D NULL; EFI_METRONOME_ARCH_PROTOCOL *gMetronome =3D NULL; EFI_TIMER_ARCH_PROTOCOL *gTimer =3D NULL; EFI_BDS_ARCH_PROTOCOL *gBds =3D NULL; @@ -211,6 +217,14 @@ EFI_DECOMPRESS_PROTOCOL gEfiDecompress =3D { DxeMainUefiDecompress }; =20 +// +// Common event protocol +// +EDKII_COMMON_EVENT_PROTOCOL gEdkiiCommonEvent =3D { + CommonCreateEventEx, + CommonWaitForEvent +}; + // // For Loading modules at fixed address feature, the configuration table i= s to cache the top address below which to load // Runtime code&boot time code @@ -475,6 +489,14 @@ DxeMain ( // CoreNotifyOnProtocolInstallation (); =20 + Status =3D CoreInstallProtocolInterface ( + &mCommonEventHalde, + &gEdkiiCommonEventProtocolGuid, + EFI_NATIVE_INTERFACE, + &gEdkiiCommonEvent + ); + ASSERT_EFI_ERROR (Status); + // // Produce Firmware Volume Protocols, one for each FV in the HOB list. // diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModuleP= kg/Core/Dxe/DxeMain/DxeProtocolNotify.c index 29a55d02e6..77af8185b8 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -41,6 +41,7 @@ EFI_CORE_PROTOCOL_NOTIFY_ENTRY mArchProtocols[] =3D { EFI_CORE_PROTOCOL_NOTIFY_ENTRY mOptionalProtocols[] =3D { { &gEfiSecurity2ArchProtocolGuid, (VOID **)&gSecurity2, NULL,= NULL, FALSE }, { &gEfiSmmBase2ProtocolGuid, (VOID **)&gSmmBase2, NULL,= NULL, FALSE }, + { &gEdkiiCommonEventProtocolGuid, (VOID **)&gCpu2, NULL,= NULL, FALSE }, { NULL, (VOID **)NULL, NULL,= NULL, FALSE } }; =20 diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Ev= ent/Event.c index 21db38aaf0..d271d2faf3 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent /// /// gEfiCurrentTpl - Current Task priority level /// -EFI_TPL gEfiCurrentTpl =3D TPL_APPLICATION; +volatile EFI_TPL gEfiCurrentTpl =3D TPL_APPLICATION; =20 /// /// gEventQueueLock - Protects the event queues @@ -29,7 +29,7 @@ LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL + 1]; /// /// gEventPending - A bitmask of the EventQueues that are pending /// -UINTN gEventPending =3D 0; +volatile UINTN gEventPending =3D 0; =20 /// /// gEventSignalQueue - A list of events to signal based on EventGroup type @@ -658,16 +658,44 @@ CoreWaitForEvent ( OUT UINTN *UserIndex ) { - EFI_STATUS Status; - UINTN Index; - - // + // // Can only WaitForEvent at TPL_APPLICATION // if (gEfiCurrentTpl !=3D TPL_APPLICATION) { return EFI_UNSUPPORTED; } =20 + return CommonWaitForEvent (NumberOfEvents, UserEvents, UserIndex); +} + + +/** + Stops execution until an event is signaled. + + Support all TPL. + + @param NumberOfEvents The number of events in the UserEvents ar= ray + @param UserEvents An array of EFI_EVENT + @param UserIndex Pointer to the index of the event which + satisfied the wait condition + + @retval EFI_SUCCESS The event indicated by Index was signaled. + @retval EFI_INVALID_PARAMETER The event indicated by Index has a notifi= cation + function or Event was not a valid type + @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION + +**/ +EFI_STATUS +EFIAPI +CommonWaitForEvent ( + IN UINTN NumberOfEvents, + IN EFI_EVENT *UserEvents, + OUT UINTN *UserIndex + ) +{ + EFI_STATUS Status; + UINTN Index; + if (NumberOfEvents =3D=3D 0) { return EFI_INVALID_PARAMETER; } @@ -678,7 +706,7 @@ CoreWaitForEvent ( =20 for(;;) { =20 - for(Index =3D 0; Index < NumberOfEvents; Index++) { + for (Index =3D 0; Index < NumberOfEvents; Index++) { =20 Status =3D CoreCheckEvent (UserEvents[Index]); =20 @@ -693,14 +721,66 @@ CoreWaitForEvent ( } } =20 - // - // Signal the Idle event - // - CoreSignalEvent (gIdleLoopEvent); + if (gCpu !=3D NULL && gCpu2 !=3D NULL) { + // + // None of the events checked above are ready/signaled yet, + // disable interrupts before checking for all pending events + // + gCpu->DisableInterrupt (gCpu); + + if (((UINTN) HighBitSet64 (gEventPending)) > gEfiCurrentTpl) { + // + // There are pending events, enable interrupts for these events to= be processed + // + gCpu->EnableInterrupt (gCpu); + } else { + // + // No events are pending, enable interrupts, sleep the CPU and wai= t for an interrupt + // + gCpu2->EnableAndWaitForInterrupt (gCpu2); + } + } } } =20 =20 +/** + Creates an event in a group. + + Support all TPL. + + @param Type The type of event to create and its mode = and + attributes + @param NotifyTpl The task priority level of event notifica= tions + @param NotifyFunction Pointer to the events notification functi= on + @param NotifyContext Pointer to the notification functions con= text; + corresponds to parameter "Context" in the + notification function + @param EventGroup GUID for EventGroup if NULL act the same = as + gBS->CreateEvent(). + @param Event Pointer to the newly created event if the= call + succeeds; undefined otherwise + + @retval EFI_SUCCESS The event structure was created + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value + @retval EFI_OUT_OF_RESOURCES The event could not be allocated + +**/ +EFI_STATUS +EFIAPI +CommonCreateEventEx ( + IN UINT32 Type, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL + IN CONST VOID *NotifyContext, OPTIONAL + IN CONST EFI_GUID *EventGroup, OPTIONAL + OUT EFI_EVENT *Event + ) +{ + return CoreCreateEventInternal (Type, NotifyTpl, NotifyFunction, NotifyC= ontext, EventGroup, Event); +} + + /** Closes an event and frees the event structure. =20 diff --git a/MdeModulePkg/Core/Dxe/Event/Event.h b/MdeModulePkg/Core/Dxe/Ev= ent/Event.h index 8141c5003e..050df26ec9 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.h +++ b/MdeModulePkg/Core/Dxe/Event/Event.h @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 =20 #define VALID_TPL(a) ((a) <=3D TPL_HIGH_LEVEL) -extern UINTN gEventPending; +extern volatile UINTN gEventPending; =20 /// /// Set if Event is part of an event group --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41308): https://edk2.groups.io/g/devel/message/41308 Mute This Topic: https://groups.io/mt/31741733/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-