Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Do not use CreateEventEx unless required

2020-01-06 Thread Liming Gao
This change has no functionality impact. I agree to make this change in MdePkg 
library for the module development support in EFI1.10/UEFI2.7/PI1.7.

With this change, you also need to remove gEfiEventExitBootServicesGuid or 
gEfiEventVirtualAddressChangeGuid from module INF file if they are not used any 
more. 

Thanks
Liming
-Original Message-
From: devel@edk2.groups.io  On Behalf Of Vitaly Cheptsov 
via Groups.Io
Sent: 2020年1月4日 2:03
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Do not use CreateEventEx unless 
required

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2446

There are many firmwares in the wild not supporting CreateEventEx, including 
devices less than 5 years old.

Signed-off-by: Vitaly Cheptsov 
---
 MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c |  3 +--
 MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c |  5 ++---
 MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c  |  5 ++---
 MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c|  5 ++---
 MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c |  5 ++---
 MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c|  5 ++---
 MdePkg/Library/UefiRuntimeLib/RuntimeLib.c | 10 
--
 7 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c 
b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
index 862c6bff09..cc79843b1c 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
@@ -77,9 +77,8 @@ DxeRuntimeDebugLibSerialPortConstructor (
 return Status;
   }
 
-  return SystemTable->BootServices->CreateEventEx (EVT_NOTIFY_SIGNAL,
+  return SystemTable->BootServices->CreateEvent 
+ (EVT_SIGNAL_EXIT_BOOT_SERVICES,
   TPL_NOTIFY, ExitBootServicesEvent, NULL,
-  ,
   );  }
 
diff --git a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c 
b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
index 6e784763be..7e5852e641 100644
--- a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
@@ -124,12 +124,11 @@ DxeRuntimePciExpressLibConstructor (
   //
   // Register SetVirtualAddressMap () notify function
   //
-  Status = gBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
+  Status = gBS->CreateEvent (
+  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
   TPL_NOTIFY,
   DxeRuntimePciExpressLibVirtualNotify,
   NULL,
-  ,
   
   );
   ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c 
b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
index 2f503ecffe..b0dbdec0cf 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
@@ -109,12 +109,11 @@ DxeRuntimePciSegmentLibConstructor (
   //
   // Register SetVirtualAddressMap () notify function
   //
-  Status = gBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
+  Status = gBS->CreateEvent (
+  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
   TPL_NOTIFY,
   DxeRuntimePciSegmentLibVirtualNotify,
   NULL,
-  ,
   
   );
   ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
index ed73f92818..b4ac17cf55 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
@@ -64,12 +64,11 @@ DxeDebugLibConstructor(  {
   mDebugST = SystemTable;
 
-  SystemTable->BootServices->CreateEventEx (
-EVT_NOTIFY_SIGNAL,
+  SystemTable->BootServices->CreateEvent (
+EVT_SIGNAL_EXIT_BOOT_SERVICES,
 TPL_NOTIFY,
 ExitBootServicesCallback,
 NULL,
-,
 
 );
 
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
index 6ea0912f2b..96fc1c422f 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
@@ -64,12 +64,11 @@ DxeDebugLibConstructor(  {
   mDebugBS = SystemTable->BootServices;
 
-  mDebugBS->CreateEventEx (
-  E

[edk2-devel] [PATCH v1 1/1] MdePkg: Do not use CreateEventEx unless required

2020-01-03 Thread Vitaly Cheptsov via Groups.Io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2446

There are many firmwares in the wild not supporting CreateEventEx,
including devices less than 5 years old.

Signed-off-by: Vitaly Cheptsov 
---
 MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c |  3 +--
 MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c |  5 ++---
 MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c  |  5 ++---
 MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c|  5 ++---
 MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c |  5 ++---
 MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c|  5 ++---
 MdePkg/Library/UefiRuntimeLib/RuntimeLib.c | 10 
--
 7 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c 
b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
index 862c6bff09..cc79843b1c 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
@@ -77,9 +77,8 @@ DxeRuntimeDebugLibSerialPortConstructor (
 return Status;
   }
 
-  return SystemTable->BootServices->CreateEventEx (EVT_NOTIFY_SIGNAL,
+  return SystemTable->BootServices->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES,
   TPL_NOTIFY, ExitBootServicesEvent, NULL,
-  ,
   );
 }
 
diff --git a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c 
b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
index 6e784763be..7e5852e641 100644
--- a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
@@ -124,12 +124,11 @@ DxeRuntimePciExpressLibConstructor (
   //
   // Register SetVirtualAddressMap () notify function
   //
-  Status = gBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
+  Status = gBS->CreateEvent (
+  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
   TPL_NOTIFY,
   DxeRuntimePciExpressLibVirtualNotify,
   NULL,
-  ,
   
   );
   ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c 
b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
index 2f503ecffe..b0dbdec0cf 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
@@ -109,12 +109,11 @@ DxeRuntimePciSegmentLibConstructor (
   //
   // Register SetVirtualAddressMap () notify function
   //
-  Status = gBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
+  Status = gBS->CreateEvent (
+  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
   TPL_NOTIFY,
   DxeRuntimePciSegmentLibVirtualNotify,
   NULL,
-  ,
   
   );
   ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
index ed73f92818..b4ac17cf55 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
@@ -64,12 +64,11 @@ DxeDebugLibConstructor(
 {
   mDebugST = SystemTable;
 
-  SystemTable->BootServices->CreateEventEx (
-EVT_NOTIFY_SIGNAL,
+  SystemTable->BootServices->CreateEvent (
+EVT_SIGNAL_EXIT_BOOT_SERVICES,
 TPL_NOTIFY,
 ExitBootServicesCallback,
 NULL,
-,
 
 );
 
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
index 6ea0912f2b..96fc1c422f 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
@@ -64,12 +64,11 @@ DxeDebugLibConstructor(
 {
   mDebugBS = SystemTable->BootServices;
 
-  mDebugBS->CreateEventEx (
-  EVT_NOTIFY_SIGNAL,
+  mDebugBS->CreateEvent (
+  EVT_SIGNAL_EXIT_BOOT_SERVICES,
   TPL_NOTIFY,
   ExitBootServicesCallback,
   NULL,
-  ,
   
   );
 
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
index ed73f92818..b4ac17cf55 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
@@ -64,12 +64,11 @@ DxeDebugLibConstructor(
 {
   mDebugST = SystemTable;
 
-