]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix a conformance issue in gBS->CreateEvent() & gBS->CreateEventEx():
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Feb 2008 02:47:49 +0000 (02:47 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Feb 2008 02:47:49 +0000 (02:47 +0000)
1. gBS->CreateEventEx() with EventGroup = NULL should behavior like gBS->CreateEvent()
2. EVT_SIGNAL_EXIT_BOOT_SERVICES & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE are invalid parameters for gBS->CreateEventEx() if the EventGroup is not NULL.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4692 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/Event/event.c

index c4d6eeb5531ff17f41fe3dd0d59d045b5f204c84..81f0b1af10be9102bb3b42f74285acb3397c429f 100644 (file)
@@ -323,22 +323,7 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_GUID            *GuidPtr;\r
-  EFI_EVENT_NOTIFY    Function;\r
-\r
-  GuidPtr = NULL;\r
-  Function = NotifyFunction;\r
-\r
-  //\r
-  // Convert EFI 1.10 Events to their UEFI 2.0 CreateEventEx mapping\r
-  //\r
-  if (Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) {\r
-    GuidPtr = &gEfiEventExitBootServicesGuid;\r
-  } else if (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
-    GuidPtr = &gEfiEventVirtualAddressChangeGuid;\r
-  }\r
-\r
-  return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);\r
+  return CoreCreateEventEx (Type, NotifyTpl, NotifyFunction, NotifyContext, NULL, Event);\r
 }\r
 \r
 \r
@@ -363,7 +348,7 @@ Arguments:
   NotifyFunction      - Pointer to the events notification function\r
   NotifyContext       - Pointer to the notification functions context; corresponds to\r
                         parameter "Context" in the notification function\r
-  EventGrout          - GUID for EventGroup if NULL act the same as gBS->CreateEvent().\r
+  EventGroup          - GUID for EventGroup if NULL act the same as gBS->CreateEvent().\r
   Event               - Pointer to the newly created event if the call succeeds; undefined otherwise\r
 \r
 Returns:\r
@@ -396,6 +381,33 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  //\r
+  // Convert Event type for pre-defined Event groups\r
+  //\r
+  if (EventGroup != NULL) {\r
+    //\r
+    // For event group, type EVT_SIGNAL_EXIT_BOOT_SERVICES and EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE\r
+    // are not valid\r
+    //\r
+    if ((Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) || (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE)) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+    if (CompareGuid (EventGroup, &gEfiEventExitBootServicesGuid)) {\r
+      Type = EVT_SIGNAL_EXIT_BOOT_SERVICES;\r
+    } else if (CompareGuid (EventGroup, &gEfiEventVirtualAddressChangeGuid)) {\r
+      Type = EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE;\r
+    }\r
+  } else {\r
+    //\r
+    // Convert EFI 1.10 Events to their UEFI 2.0 CreateEventEx mapping\r
+    //\r
+    if (Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) {\r
+      EventGroup = &gEfiEventExitBootServicesGuid;\r
+    } else if (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
+      EventGroup = &gEfiEventVirtualAddressChangeGuid;\r
+    }\r
+  }\r
+\r
   //\r
   // If it's a notify type of event, check its parameters\r
   //\r