]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Return EFI_INVALID_PARAMETER when Type has either EVT_NOTIFY_SIGNAL or EVT_NOTIFY_WAI...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Apr 2012 03:32:53 +0000 (03:32 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Apr 2012 03:32:53 +0000 (03:32 +0000)
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13222 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/Event/Event.c
MdeModulePkg/Core/Dxe/Event/Timer.c

index 48a57df65016e2c87280100bfe509d9602eccaa1..2a8161554a554176202533830b8e01fe089067f4 100644 (file)
@@ -1409,7 +1409,7 @@ CoreExit (
 \r
 \r
 /**\r
-  Creates a general-purpose event structure.\r
+  Creates an event.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -1439,7 +1439,7 @@ CoreCreateEvent (
 \r
 \r
 /**\r
-  Creates a general-purpose event structure\r
+  Creates an event in a group.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -1469,7 +1469,36 @@ CoreCreateEventEx (
   OUT EFI_EVENT               *Event\r
   );\r
 \r
+/**\r
+  Creates a general-purpose event structure\r
+\r
+  @param  Type                   The type of event to create and its mode and\r
+                                 attributes\r
+  @param  NotifyTpl              The task priority level of event notifications\r
+  @param  NotifyFunction         Pointer to the events notification function\r
+  @param  NotifyContext          Pointer to the notification functions context;\r
+                                 corresponds to parameter "Context" in the\r
+                                 notification function\r
+  @param  EventGroup             GUID for EventGroup if NULL act the same as\r
+                                 gBS->CreateEvent().\r
+  @param  Event                  Pointer to the newly created event if the call\r
+                                 succeeds; undefined otherwise\r
 \r
+  @retval EFI_SUCCESS            The event structure was created\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value\r
+  @retval EFI_OUT_OF_RESOURCES   The event could not be allocated\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreCreateEventInternal (\r
+  IN UINT32                   Type,\r
+  IN EFI_TPL                  NotifyTpl,\r
+  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
+  IN CONST VOID               *NotifyContext, OPTIONAL\r
+  IN CONST EFI_GUID           *EventGroup,    OPTIONAL\r
+  OUT EFI_EVENT               *Event\r
+  );\r
 \r
 /**\r
   Sets the type of timer and the trigger time for a timer event.\r
index d9fc7586a70cfcdd8ed3ff7052b1a2d1346e52e3..1a25b171786f1b5f6910327df47fc59ba6ab7447 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Event support functions implemented in this file.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -277,7 +277,7 @@ CoreNotifySignalList (
 \r
 \r
 /**\r
-  Creates a general-purpose event structure.\r
+  Creates an event.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -310,7 +310,7 @@ CoreCreateEvent (
 \r
 \r
 /**\r
-  Creates a general-purpose event structure\r
+  Creates an event in a group.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -339,6 +339,51 @@ CoreCreateEventEx (
   IN CONST EFI_GUID           *EventGroup,    OPTIONAL\r
   OUT EFI_EVENT               *Event\r
   )\r
+{\r
+  //\r
+  // If it's a notify type of event, check for invalid NotifyTpl\r
+  //\r
+  if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) != 0) {\r
+    if (NotifyTpl != TPL_APPLICATION &&\r
+        NotifyTpl != TPL_CALLBACK &&\r
+        NotifyTpl != TPL_NOTIFY) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+  }\r
+\r
+  return CoreCreateEventInternal (Type, NotifyTpl, NotifyFunction, NotifyContext, EventGroup, Event);\r
+}\r
+\r
+/**\r
+  Creates a general-purpose event structure\r
+\r
+  @param  Type                   The type of event to create and its mode and\r
+                                 attributes\r
+  @param  NotifyTpl              The task priority level of event notifications\r
+  @param  NotifyFunction         Pointer to the events notification function\r
+  @param  NotifyContext          Pointer to the notification functions context;\r
+                                 corresponds to parameter "Context" in the\r
+                                 notification function\r
+  @param  EventGroup             GUID for EventGroup if NULL act the same as\r
+                                 gBS->CreateEvent().\r
+  @param  Event                  Pointer to the newly created event if the call\r
+                                 succeeds; undefined otherwise\r
+\r
+  @retval EFI_SUCCESS            The event structure was created\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value\r
+  @retval EFI_OUT_OF_RESOURCES   The event could not be allocated\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreCreateEventInternal (\r
+  IN UINT32                   Type,\r
+  IN EFI_TPL                  NotifyTpl,\r
+  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
+  IN CONST VOID               *NotifyContext, OPTIONAL\r
+  IN CONST EFI_GUID           *EventGroup,    OPTIONAL\r
+  OUT EFI_EVENT               *Event\r
+  )\r
 {\r
   EFI_STATUS      Status;\r
   IEVENT          *IEvent;\r
index b1a5e3cdc891182e26e6611edce023b0c349645c..1b20e327cdadec1f61720d3b7009fbd71eaa90cb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Core Timer Services\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -172,11 +172,12 @@ CoreInitializeTimer (
 {\r
   EFI_STATUS  Status;\r
 \r
-  Status = CoreCreateEvent (\r
+  Status = CoreCreateEventInternal (\r
              EVT_NOTIFY_SIGNAL,\r
              TPL_HIGH_LEVEL - 1,\r
              CoreCheckTimers,\r
              NULL,\r
+             NULL,\r
              &mEfiCheckTimerEvent\r
              );\r
   ASSERT_EFI_ERROR (Status);\r