]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add more assert to check table pointer.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Dec 2006 02:35:17 +0000 (02:35 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Dec 2006 02:35:17 +0000 (02:35 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2071 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c

index 0cef1f7ffc67390b8395af60f32830dc78cb2624..1b11dfb5fa4a7f288f8680ba83f5005c8471a40a 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
+/**@file\r
+  Library utility functions for Runtime driver.\r
+  \r
+Copyright (c) 2006 Intel Corporation. <BR>\r
 All rights reserved. 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
 All rights reserved. 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
@@ -9,46 +10,31 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-    RuntimeLib.c\r
-\r
---*/\r
+**/\r
 \r
 #include <RuntimeLibInternal.h>\r
 \r
 \r
 #include <RuntimeLibInternal.h>\r
 \r
-//\r
-// Driver Lib Module Globals\r
-//\r
+///\r
+/// Driver Lib Module Globals\r
+///\r
 \r
 STATIC EFI_EVENT              mEfiVirtualNotifyEvent;\r
 STATIC BOOLEAN                mEfiGoneVirtual         = FALSE;\r
 STATIC BOOLEAN                mEfiAtRuntime           = FALSE;\r
 EFI_RUNTIME_SERVICES          *mRT;\r
 \r
 \r
 STATIC EFI_EVENT              mEfiVirtualNotifyEvent;\r
 STATIC BOOLEAN                mEfiGoneVirtual         = FALSE;\r
 STATIC BOOLEAN                mEfiAtRuntime           = FALSE;\r
 EFI_RUNTIME_SERVICES          *mRT;\r
 \r
+/**\r
+  Set AtRuntime flag as TRUE after ExitBootServices\r
+  \r
+  @param[in]  Event   The Event that is being processed\r
+  @param[in]  Context Event Context\r
+**/\r
 VOID\r
 EFIAPI\r
 RuntimeDriverExitBootServices (\r
   IN EFI_EVENT        Event,\r
   IN VOID             *Context\r
   )\r
 VOID\r
 EFIAPI\r
 RuntimeDriverExitBootServices (\r
   IN EFI_EVENT        Event,\r
   IN VOID             *Context\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Set AtRuntime flag as TRUE after ExitBootServices\r
-\r
-Arguments:\r
-\r
-  Event   - The Event that is being processed\r
-  \r
-  Context - Event Context\r
-\r
-Returns: \r
-\r
-  None\r
-\r
---*/\r
 {\r
   //\r
   // Clear out BootService globals\r
 {\r
   //\r
   // Clear out BootService globals\r
@@ -58,6 +44,14 @@ Returns:
   mEfiAtRuntime = TRUE;\r
 }\r
 \r
   mEfiAtRuntime = TRUE;\r
 }\r
 \r
+/**\r
+  Fixup internal data so that EFI can be call in virtual mode.\r
+  Call the passed in Child Notify event and convert any pointers in \r
+  lib to virtual mode.\r
+  \r
+  @param[in]    Event   The Event that is being processed\r
+  @param[in]    Context Event Context\r
+**/\r
 STATIC\r
 VOID\r
 EFIAPI\r
 STATIC\r
 VOID\r
 EFIAPI\r
@@ -65,25 +59,6 @@ RuntimeLibVirtualNotifyEvent (
   IN EFI_EVENT        Event,\r
   IN VOID             *Context\r
   )\r
   IN EFI_EVENT        Event,\r
   IN VOID             *Context\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Fixup internal data so that EFI can be call in virtual mode.\r
-  Call the passed in Child Notify event and convert any pointers in \r
-  lib to virtual mode.\r
-\r
-Arguments:\r
-\r
-  Event   - The Event that is being processed\r
-  \r
-  Context - Event Context\r
-\r
-Returns: \r
-\r
-  None\r
-\r
---*/\r
 {\r
   UINTN Index;\r
   EFI_EVENT_NOTIFY  ChildNotifyEventHandler;\r
 {\r
   UINTN Index;\r
   EFI_EVENT_NOTIFY  ChildNotifyEventHandler;\r
@@ -103,77 +78,59 @@ Returns:
   mEfiGoneVirtual = TRUE;\r
 }\r
 \r
   mEfiGoneVirtual = TRUE;\r
 }\r
 \r
+/**\r
+  Intialize runtime Driver Lib if it has not yet been initialized. \r
+  \r
+  @param[in]  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param[in]  SystemTable   A pointer to the EFI System Table.\r
+  \r
+  @return     EFI_STATUS    always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibConstruct (\r
   IN EFI_HANDLE           ImageHandle,\r
   IN EFI_SYSTEM_TABLE     *SystemTable\r
   )\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibConstruct (\r
   IN EFI_HANDLE           ImageHandle,\r
   IN EFI_SYSTEM_TABLE     *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Intialize runtime Driver Lib if it has not yet been initialized. \r
-\r
-Arguments:\r
-\r
-  ImageHandle     - The firmware allocated handle for the EFI image.\r
-  \r
-  SystemTable     - A pointer to the EFI System Table.\r
-\r
-  GoVirtualChildEvent - Caller can register a virtual notification event.\r
-\r
-Returns: \r
-\r
-  EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
 \r
 {\r
   EFI_STATUS  Status;\r
 \r
+  ASSERT (SystemTable != NULL);\r
   mRT = SystemTable->RuntimeServices;\r
   mRT = SystemTable->RuntimeServices;\r
-\r
+  ASSERT (mRT != NULL);\r
+  \r
   //\r
   // Register SetVirtualAddressMap () notify function\r
   // \r
   if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
   //\r
   // Register SetVirtualAddressMap () notify function\r
   // \r
   if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
-  Status = gBS->CreateEvent (\r
-                  EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
-                  EFI_TPL_NOTIFY,\r
-                  RuntimeLibVirtualNotifyEvent,\r
-                  NULL,\r
-                  &mEfiVirtualNotifyEvent\r
-                  );\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+    ASSERT (gBS != NULL);\r
+    Status = gBS->CreateEvent (\r
+                    EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
+                    EFI_TPL_NOTIFY,\r
+                    RuntimeLibVirtualNotifyEvent,\r
+                    NULL,\r
+                    &mEfiVirtualNotifyEvent\r
+                    );\r
+\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  This routine will free some resources which have been allocated in\r
+  EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
+  it must call this routine to free the allocated resource before the exiting.\r
+\r
+  @retval     EFI_SUCCESS       Shutdown the Runtime Driver Lib successfully\r
+  @retval     EFI_UNSUPPORTED   Runtime Driver lib was not initialized at all\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
   VOID\r
   )\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeDriverLibDeconstruct (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine will free some resources which have been allocated in\r
-  EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
-  it must call this routine to free the allocated resource before the exiting.\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns: \r
-\r
-  EFI_SUCCESS     - Shotdown the Runtime Driver Lib successfully\r
-  EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
 \r
 {\r
   EFI_STATUS  Status;\r
 \r
@@ -181,51 +138,38 @@ Returns:
   // Close SetVirtualAddressMap () notify function\r
   //\r
   if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
   // Close SetVirtualAddressMap () notify function\r
   //\r
   if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
-  Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
-  ASSERT_EFI_ERROR (Status);\r
+    ASSERT (gBS != NULL);\r
+    Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Return TRUE if ExitBootServices () has been called\r
+  \r
+  @retval TRUE If ExitBootServices () has been called\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 EfiAtRuntime (\r
   VOID\r
   )\r
 BOOLEAN\r
 EFIAPI\r
 EfiAtRuntime (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Return TRUE if ExitBootServices () has been called\r
-\r
-Arguments:\r
-  NONE\r
-\r
-Returns: \r
-  TRUE - If ExitBootServices () has been called\r
-\r
---*/\r
 {\r
   return mEfiAtRuntime;\r
 }\r
 \r
 {\r
   return mEfiAtRuntime;\r
 }\r
 \r
+/**\r
+  Return TRUE if SetVirtualAddressMap () has been called\r
+  \r
+  @retval TRUE  If SetVirtualAddressMap () has been called\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 EfiGoneVirtual (\r
   VOID\r
   )\r
 BOOLEAN\r
 EFIAPI\r
 EfiGoneVirtual (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Return TRUE if SetVirtualAddressMap () has been called\r
-\r
-Arguments:\r
-  NONE\r
-\r
-Returns: \r
-  TRUE - If SetVirtualAddressMap () has been called\r
-\r
---*/\r
 {\r
   return mEfiGoneVirtual;\r
 }\r
 {\r
   return mEfiGoneVirtual;\r
 }\r