diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-08 02:35:17 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-08 02:35:17 +0000 |
commit | f62485d39a5a797fc13689d0d16a5fed6a89b508 (patch) | |
tree | 06ef781c4cccb7acd7c5ba0690cf477dd5ba241f | |
parent | 83a4143f53facbc1f9a9eb6d6ebe2be3c44ec91b (diff) | |
download | edk2-platforms-f62485d39a5a797fc13689d0d16a5fed6a89b508.tar.xz |
Add more assert to check table pointer.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2071 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c | 184 |
1 files changed, 64 insertions, 120 deletions
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c index 0cef1f7ffc..1b11dfb5fa 100644 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c +++ b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c @@ -1,6 +1,7 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
+/**@file
+ Library utility functions for Runtime driver.
+
+Copyright (c) 2006 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -9,46 +10,31 @@ http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module Name:
-
- RuntimeLib.c
-
---*/
+**/
#include <RuntimeLibInternal.h>
-//
-// Driver Lib Module Globals
-//
+///
+/// Driver Lib Module Globals
+///
STATIC EFI_EVENT mEfiVirtualNotifyEvent;
STATIC BOOLEAN mEfiGoneVirtual = FALSE;
STATIC BOOLEAN mEfiAtRuntime = FALSE;
EFI_RUNTIME_SERVICES *mRT;
+/**
+ Set AtRuntime flag as TRUE after ExitBootServices
+
+ @param[in] Event The Event that is being processed
+ @param[in] Context Event Context
+**/
VOID
EFIAPI
RuntimeDriverExitBootServices (
IN EFI_EVENT Event,
IN VOID *Context
)
-/*++
-
-Routine Description:
-
- Set AtRuntime flag as TRUE after ExitBootServices
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
{
//
// Clear out BootService globals
@@ -58,6 +44,14 @@ Returns: mEfiAtRuntime = TRUE;
}
+/**
+ Fixup internal data so that EFI can be call in virtual mode.
+ Call the passed in Child Notify event and convert any pointers in
+ lib to virtual mode.
+
+ @param[in] Event The Event that is being processed
+ @param[in] Context Event Context
+**/
STATIC
VOID
EFIAPI
@@ -65,25 +59,6 @@ RuntimeLibVirtualNotifyEvent ( IN EFI_EVENT Event,
IN VOID *Context
)
-/*++
-
-Routine Description:
-
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
{
UINTN Index;
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
@@ -103,77 +78,59 @@ Returns: mEfiGoneVirtual = TRUE;
}
+/**
+ Intialize runtime Driver Lib if it has not yet been initialized.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
+**/
EFI_STATUS
EFIAPI
RuntimeDriverLibConstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-/*++
-
-Routine Description:
-
- Intialize runtime Driver Lib if it has not yet been initialized.
-
-Arguments:
-
- ImageHandle - The firmware allocated handle for the EFI image.
-
- SystemTable - A pointer to the EFI System Table.
-
- GoVirtualChildEvent - Caller can register a virtual notification event.
-
-Returns:
-
- EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
-
---*/
{
EFI_STATUS Status;
+ ASSERT (SystemTable != NULL);
mRT = SystemTable->RuntimeServices;
-
+ ASSERT (mRT != NULL);
+
//
// Register SetVirtualAddressMap () notify function
//
if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CreateEvent (
- EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- EFI_TPL_NOTIFY,
- RuntimeLibVirtualNotifyEvent,
- NULL,
- &mEfiVirtualNotifyEvent
- );
-
- ASSERT_EFI_ERROR (Status);
+ ASSERT (gBS != NULL);
+ Status = gBS->CreateEvent (
+ EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
+ EFI_TPL_NOTIFY,
+ RuntimeLibVirtualNotifyEvent,
+ NULL,
+ &mEfiVirtualNotifyEvent
+ );
+
+ ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
}
+/**
+ This routine will free some resources which have been allocated in
+ EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
+ it must call this routine to free the allocated resource before the exiting.
+
+ @retval EFI_SUCCESS Shutdown the Runtime Driver Lib successfully
+ @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized at all
+**/
EFI_STATUS
EFIAPI
RuntimeDriverLibDeconstruct (
VOID
)
-/*++
-
-Routine Description:
-
- This routine will free some resources which have been allocated in
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
- it must call this routine to free the allocated resource before the exiting.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
- EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
-
---*/
{
EFI_STATUS Status;
@@ -181,51 +138,38 @@ Returns: // Close SetVirtualAddressMap () notify function
//
if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
- ASSERT_EFI_ERROR (Status);
+ ASSERT (gBS != NULL);
+ Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
+ ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
}
+/**
+ Return TRUE if ExitBootServices () has been called
+
+ @retval TRUE If ExitBootServices () has been called
+**/
BOOLEAN
EFIAPI
EfiAtRuntime (
VOID
)
-/*++
-
-Routine Description:
- Return TRUE if ExitBootServices () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If ExitBootServices () has been called
-
---*/
{
return mEfiAtRuntime;
}
+/**
+ Return TRUE if SetVirtualAddressMap () has been called
+
+ @retval TRUE If SetVirtualAddressMap () has been called
+**/
BOOLEAN
EFIAPI
EfiGoneVirtual (
VOID
)
-/*++
-
-Routine Description:
- Return TRUE if SetVirtualAddressMap () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If SetVirtualAddressMap () has been called
-
---*/
{
return mEfiGoneVirtual;
}
|