From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: jian.j.wang@intel.com) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Wed, 10 Jul 2019 18:26:22 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 18:26:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,476,1557212400"; d="scan'208";a="193241412" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 10 Jul 2019 18:26:22 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 10 Jul 2019 18:26:22 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 10 Jul 2019 18:26:21 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 10 Jul 2019 18:26:21 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.162]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.134]) with mapi id 14.03.0439.000; Thu, 11 Jul 2019 09:26:19 +0800 From: "Wang, Jian J" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: Sean Brogan , "Wu, Hao A" , "Ni, Ray" , "Zeng, Star" , "Gao, Liming" , Michael Turner , Bret Barkelew Subject: Re: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol Thread-Topic: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol Thread-Index: AQHVNjH4GNKrPmGfpk6/dVExl5ZN5KbCAaEwgAB3eoCAARIiQIAAfzmAgACX7cA= Date: Thu, 11 Jul 2019 01:26:19 +0000 Message-ID: References: <20190709083956.13024-1-zhichao.gao@intel.com> <20190709083956.13024-5-zhichao.gao@intel.com> <3CE959C139B4C44DBEA1810E3AA6F9000B806D6F@SHSMSX101.ccr.corp.intel.com> <3CE959C139B4C44DBEA1810E3AA6F9000B8070F7@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <3CE959C139B4C44DBEA1810E3AA6F9000B8070F7@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDgwNzIyZmQtZWExMS00MWZmLTk2ZjItY2M2ZGNiNjI5NTc1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQTVKU1hLZlphWlM4NnRSTFF3RkswRWxWckFLNlM1S3lCcytkQlBIUVhZSzBqdVNOS2VmNXhWeG0xanYzaCtLNSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhichao, Understood now. Thanks for the information. Regards, Jian > -----Original Message----- > From: Gao, Zhichao > Sent: Thursday, July 11, 2019 8:21 AM > To: Wang, Jian J ; devel@edk2.groups.io > Cc: Sean Brogan ; Wu, Hao A > ; Ni, Ray ; Zeng, Star > ; Gao, Liming ; Michael > Turner ; Bret Barkelew > > Subject: RE: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common > event protocol >=20 >=20 >=20 > > -----Original Message----- > > From: Wang, Jian J > > Sent: Wednesday, July 10, 2019 4:47 PM > > To: Gao, Zhichao ; devel@edk2.groups.io > > Cc: Sean Brogan ; Wu, Hao A > > ; Ni, Ray ; Zeng, Star > > ; Gao, Liming ; Michael > Turner > > ; Bret Barkelew > > > > Subject: RE: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement > common > > event protocol > > > > Zhichao, > > > > > -----Original Message----- > > > From: Gao, Zhichao > > > Sent: Wednesday, July 10, 2019 8:24 AM > > > To: Wang, Jian J ; devel@edk2.groups.io > > > Cc: Sean Brogan ; Wu, Hao A > > > ; Ni, Ray ; Zeng, Star > > > ; Gao, Liming ; Michael > > > Turner ; Bret Barkelew > > > > > > Subject: RE: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement > > common > > > event protocol > > > > > > > > > > > > > -----Original Message----- > > > > From: Wang, Jian J > > > > Sent: Tuesday, July 9, 2019 5:24 PM > > > > To: Gao, Zhichao ; devel@edk2.groups.io > > > > Cc: Sean Brogan ; Wu, Hao A > > > > ; Ni, Ray ; Zeng, Star > > > > ; Gao, Liming ; Michael > > > Turner > > > > ; Bret Barkelew > > > > > > > > Subject: RE: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement > > > common > > > > event protocol > > > > > > > > Hi Zhichao, > > > > > > > > One common comment: please update copy right year. > > > > > > I got the copyright remind before. Refer to > > > https://edk2.groups.io/g/devel/topic/31828852#41576. > > > This patch is almost provided from MU project and contributed by > > > Microsoft developers, 'From:...' is the author. And they didn't add > > > their copyright. So I think it is fine to keep the copyright. > > > > > > > I mean the *year* in Intel copyright not the whole copyright. >=20 > https://edk2.groups.io/g/devel/message/41599 > https://edk2.groups.io/g/devel/message/41753 > See above message. Maybe updating the year means you are making a legal > claim to the intellectual > property provided by the patch on behalf of the company. >=20 > Thanks, > Zhichao >=20 > > > > Regards, > > Jian > > > > > > > > > > See another comment at the almost the end of the email. > > > > > > > > > -----Original Message----- > > > > > From: Gao, Zhichao > > > > > Sent: Tuesday, July 09, 2019 4:40 PM > > > > > To: devel@edk2.groups.io > > > > > Cc: Sean Brogan ; Wang, Jian J > > > > > ; Wu, Hao A ; Ni, Ray > > > > > ; Zeng, Star ; Gao, Liming > > > > > ; Michael Turner > > > > ; > > > > > Bret Barkelew > > > > > Subject: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement > > common > > > > event > > > > > protocol > > > > > > > > > > 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 require= d > > > > > 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 | 2 + > > > > > 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 +- > > > > > MdeModulePkg/Include/Protocol/Cpu2.h | 2 +- > > > > > 7 files changed, 181 insertions(+), 14 deletions(-) > > > > > > > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h > > > > > b/MdeModulePkg/Core/Dxe/DxeMain.h index > > > 6a64852730..38907bfe8d > > > > 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 > > > > *gMetronome; > > > > > extern EFI_TIMER_ARCH_PROTOCOL *gTimer; > > > > > extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; > > > > > extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2; > > > > > +extern EDKII_CPU2_PROTOCOL *gCpu2; > > > > > extern EFI_BDS_ARCH_PROTOCOL *gBds; > > > > > extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; > > > > > > > > > > -extern EFI_TPL gEfiCurrentTpl; > > > > > +extern volatile EFI_TPL gEfiCurrentTpl; > > > > > > > > > > extern EFI_GUID *gDxeCoreFileNam= e; > > > > > extern EFI_LOADED_IMAGE_PROTOCOL > > > *gDxeCoreLoadedImage; > > > > > @@ -1714,6 +1717,65 @@ CoreCheckEvent ( > > > > > ); > > > > > > > > > > > > > > > +/** > > > > > + Stops execution until an event is signaled. > > > > > + > > > > > + Support all TPL. > > > > > + > > > > > + @param NumberOfEvents The number of events in the > > > UserEvents > > > > > array > > > > > + @param UserEvents An array of EFI_EVENT > > > > > + @param UserIndex Pointer to the index of the eve= nt > which > > > > > + satisfied the wait condition > > > > > + > > > > > + @retval EFI_SUCCESS The event indicated by Index wa= s > > > signaled. > > > > > + @retval EFI_INVALID_PARAMETER The event indicated by Index > has > > > > > + a > > > > > notification > > > > > + function or Event was not a val= id 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 even= t > > > notifications > > > > > + @param NotifyFunction Pointer to the events notificat= ion > > > function > > > > > + @param NotifyContext Pointer to the notification fun= ctions > > > context; > > > > > + corresponds to parameter "Conte= xt" in the > > > > > + notification function > > > > > + @param EventGroup GUID for EventGroup if NULL act= the > > > same > > > > > as > > > > > + gBS->CreateEvent(). > > > > > + @param Event Pointer to the newly created ev= ent 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 the > > > > > global coherency domain of the processor. > > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf > > > > > b/MdeModulePkg/Core/Dxe/DxeMain.inf > > > > > index 61161bee28..44f90bcf4b 100644 > > > > > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf > > > > > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf > > > > > @@ -171,6 +171,8 @@ > > > > > gEfiVariableArchProtocolGuid ## CONSUMES > > > > > gEfiCapsuleArchProtocolGuid ## CONSUMES > > > > > gEfiWatchdogTimerArchProtocolGuid ## CONSUMES > > > > > + gEdkiiCommonEventProtocolGuid ## > > > SOMETIMES_CONSUMES > > > > > + gEdkiiCpu2ProtocolGuid ## CONSUMES > > > > > > > > > > [Pcd] > > > > > > > > > > > > > > > > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePage > > > > > Number ## SOMETIMES_CONSUMES > > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > > > > > b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > > > > > index 514d1aa75a..8196d96daa 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; > > > > > > > > > > +// > > > > > +// 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; > > > > > +EDKII_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 > > > > > }; > > > > > > > > > > +// > > > > > +// Common event protocol > > > > > +// > > > > > +EDKII_COMMON_EVENT_PROTOCOL gEdkiiCommonEvent =3D { > > > > > + CommonCreateEventEx, > > > > > + CommonWaitForEvent > > > > > +}; > > > > > + > > > > > // > > > > > // For Loading modules at fixed address feature, the > > > > > configuration table is to cache the top address below which to > > > > > load // Runtime code&boot time code @@ -475,6 +489,14 @@ > > DxeMain ( > > > > > // > > > > > CoreNotifyOnProtocolInstallation (); > > > > > > > > > > + 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/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c > > > > > index 29a55d02e6..57d52c250d 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 }, > > > > > + { &gEdkiiCpu2ProtocolGuid, (VOID **)&gCpu2, = NULL, > > > NULL, > > > > > FALSE }, > > > > > { NULL, (VOID **)NULL, = NULL, NULL, > FALSE } > > > > > }; > > > > > > > > > > diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c > > > > > b/MdeModulePkg/Core/Dxe/Event/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_TP= L > > > > > gEfiCurrentTpl =3D TPL_APPLICATION; > > > > > +volatile EFI_TPL gEfiCurrentTpl =3D TPL_APPLICATION; > > > > > > > > > > /// > > > > > /// gEventQueueLock - Protects the event queues > > > > > @@ -29,7 +29,7 @@ LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL > + 1]; > > > > > /// > > > > > /// gEventPending - A bitmask of the EventQueues that are pendin= g > > > > > /// > > > > > -UINTN gEventPending =3D 0; > > > > > +volatile UINTN gEventPending =3D 0; > > > > > > > > > > /// > > > > > /// 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; > > > > > } > > > > > > > > > > + return CommonWaitForEvent (NumberOfEvents, UserEvents, > > > > UserIndex); > > > > > +} > > > > > + > > > > > + > > > > > +/** > > > > > + Stops execution until an event is signaled. > > > > > + > > > > > + Support all TPL. > > > > > + > > > > > + @param NumberOfEvents The number of events in the > > > UserEvents > > > > > array > > > > > + @param UserEvents An array of EFI_EVENT > > > > > + @param UserIndex Pointer to the index of the eve= nt > which > > > > > + satisfied the wait condition > > > > > + > > > > > + @retval EFI_SUCCESS The event indicated by Index wa= s > > > signaled. > > > > > + @retval EFI_INVALID_PARAMETER The event indicated by Index > has > > > > > + a > > > > > notification > > > > > + function or Event was not a val= id 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 ( > > > > > > > > > > for(;;) { > > > > > > > > > > - for(Index =3D 0; Index < NumberOfEvents; Index++) { > > > > > + for (Index =3D 0; Index < NumberOfEvents; Index++) { > > > > > > > > > > Status =3D CoreCheckEvent (UserEvents[Index]); > > > > > > > > > > @@ -693,14 +721,66 @@ CoreWaitForEvent ( > > > > > } > > > > > } > > > > > > > > > > - // > > > > > - // 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 even= ts > > > > > + // > > > > > + gCpu->DisableInterrupt (gCpu); > > > > > + > > > > > + if (((UINTN) HighBitSet64 (gEventPending)) > gEfiCurrentTp= l) { > > > > > + // > > > > > + // 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 wait > > > > > for an interrupt > > > > > + // > > > > > + gCpu2->EnableAndWaitForInterrupt (gCpu2); > > > > > + } > > > > > + } > > > > > } > > > > > } > > > > > > > > > > > > > > > +/** > > > > > + 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 even= t > > > notifications > > > > > + @param NotifyFunction Pointer to the events notificat= ion > > > function > > > > > + @param NotifyContext Pointer to the notification fun= ctions > > > context; > > > > > + corresponds to parameter "Conte= xt" in the > > > > > + notification function > > > > > + @param EventGroup GUID for EventGroup if NULL act= the > > > same > > > > > as > > > > > + gBS->CreateEvent(). > > > > > + @param Event Pointer to the newly created ev= ent 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, > > > > > NotifyContext, EventGroup, Event); > > > > > +} > > > > > + > > > > > + > > > > > /** > > > > > Closes an event and frees the event structure. > > > > > > > > > > diff --git a/MdeModulePkg/Core/Dxe/Event/Event.h > > > > > b/MdeModulePkg/Core/Dxe/Event/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 > > > > > > > > > > > > > > > #define VALID_TPL(a) ((a) <=3D TPL_HIGH_LEVEL) > > > > > -extern UINTN gEventPending; > > > > > +extern volatile UINTN gEventPending; > > > > > > > > > > /// > > > > > /// Set if Event is part of an event group diff --git > > > > > a/MdeModulePkg/Include/Protocol/Cpu2.h > > > > > b/MdeModulePkg/Include/Protocol/Cpu2.h > > > > > index 14464a38c8..81c5c8e424 100644 > > > > > --- a/MdeModulePkg/Include/Protocol/Cpu2.h > > > > > +++ b/MdeModulePkg/Include/Protocol/Cpu2.h > > > > > @@ -37,7 +37,7 @@ EFI_STATUS > > > > > /// Foundation. > > > > > /// > > > > > struct _EDKII_CPU2_PROTOCOL { > > > > > - EDKII_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT > > > > > EnableAndForWaitInterrupt; > > > > > + EDKII_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT > > > > > EnableAndWaitForInterrupt; > > > > > }; > > > > > > > > > > > > > I think this change should belong to patch 1. > > > > > > Yes. You are right. I would move the change to 1/4. > > > > > > Thanks, > > > Zhichao > > > > > > > > > > > Regards, > > > > Jian > > > > > > > > > #endif > > > > > -- > > > > > 2.21.0.windows.1