V1: There is a race condition in CoreWaitForEvent function: 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 gEfiCpu2ProtocolGuid to fix that. The protocol include one interface to enable interrupt and put the cpu to sleep.
Add a event protocol gEdkiiCommonEventProtocolGuid to support all TPL event. It is require for PI drivers that use HW interrput. V2: Move EnableInterruptsAndSleep to UefiCpuPkg/CpuDxe. It is inappropiate to add it to MdePkg which should only contain code base on the UEFI spec. Change the name gEfiCpu2ProtocolGuid to gEdkiiCpu2ProtocolGuid. Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> cc: Ray Ni <ray...@intel.com> Cc: Star Zeng <star.z...@intel.com> Cc: Liming gao <liming....@intel.com> Cc: Sean Brogan <sean.bro...@microsoft.com> Cc: Michael Turner <michael.tur...@microsoft.com> Cc: Bret Barkelew <bret.barke...@microsoft.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Sean Brogan (3): MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file UefiCpuPkg/CpuDxe: Implement Cpu2 protocol MdeModulePkg/DxeMain: Implement common event protocol Zhichao Gao (1): MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event 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/CommonEvent.h | 18 ++++ MdeModulePkg/Include/Protocol/Cpu2.h | 43 ++++++++ MdeModulePkg/MdeModulePkg.dec | 6 ++ UefiCpuPkg/CpuDxe/CpuDxe.c | 38 +++++++ UefiCpuPkg/CpuDxe/CpuDxe.h | 25 +++++ UefiCpuPkg/CpuDxe/CpuDxe.inf | 3 + .../CpuDxe/Ia32/EnableInterruptsAndSleep.c | 24 +++++ .../CpuDxe/X64/EnableInterruptsAndSleep.nasm | 31 ++++++ 14 files changed, 368 insertions(+), 13 deletions(-) create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h create mode 100644 MdeModulePkg/Include/Protocol/Cpu2.h create mode 100644 UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c create mode 100644 UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm -- 2.21.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43426): https://edk2.groups.io/g/devel/message/43426 Mute This Topic: https://groups.io/mt/32403448/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-