]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/RuntimeDxe/Runtime.c
Clean up DEC files:
[mirror_edk2.git] / MdeModulePkg / Core / RuntimeDxe / Runtime.c
index 936565e60018661031a7c68fc2def457889f01fe..26cd42b890b3d3ee0be46e018e6f282df1081929 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  Runtime Architectural Protocol as defined in the DXE CIS.\r
+  This file implements Runtime Architectural Protocol as defined in the\r
+  Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.\r
 \r
   This code is used to produce the EFI runtime virtual switch over\r
 \r
@@ -14,7 +15,7 @@
   So here is the concept. The code in this module will never ever be called in\r
   virtual mode. This is the code that collects the information needed to convert\r
   to virtual mode (DXE core registers runtime stuff with this code). Since this\r
-  code is used to fixup all runtime images, it CAN NOT fix it's self up. So some\r
+  code is used to fix up all runtime images, it CAN NOT fix it's self up. So some\r
   code has to stay behind and that is us.\r
 \r
   Also you need to be careful about when you allocate memory, as once we are in\r
@@ -34,8 +35,8 @@ Revision History:
   Table now contains an item named CalculateCrc32.\r
 \r
 \r
-Copyright (c) 2006, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -86,7 +87,7 @@ EFI_RUNTIME_ARCH_PROTOCOL     mRuntime = {
 //\r
 /**\r
 \r
-  Calcualte the 32-bit CRC in a EFI table using the Runtime Drivers\r
+  Calculate the 32-bit CRC in a EFI table using the Runtime Drivers\r
   internal function.  The EFI Boot Services Table can not be used because\r
   the EFI Boot Services Table was destroyed at ExitBootServices().\r
   This is a internal function.\r
@@ -151,17 +152,17 @@ RuntimeDriverConvertPointer (
   // If this is a null pointer, return if it's allowed\r
   //\r
   if (Address == 0) {\r
-    if ((DebugDisposition & EFI_OPTIONAL_POINTER) != 0) {\r
+    if ((DebugDisposition & EFI_OPTIONAL_PTR) != 0) {\r
       return EFI_SUCCESS;\r
     }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  VirtEntry             = mVirtualMap;\r
+  VirtEntry = mVirtualMap;\r
   for (Index = 0; Index < mVirtualMapMaxIndex; Index++) {\r
     //\r
-    // To prevent the inclusion of 64-bit math functions a UINTN was placed in\r
+    //  To prevent the inclusion of 64-bit math functions a UINTN was placed in\r
     //  front of VirtEntry->NumberOfPages to cast it to a 32-bit thing on IA-32\r
     //  platforms. If you get this ASSERT remove the UINTN and do a 64-bit\r
     //  multiply.\r
@@ -274,18 +275,16 @@ RuntimeDriverSetVirtualAddressMap (
   mVirtualMap               = VirtualMap;\r
 \r
   //\r
-  // Currently the bug in StatusCode/RuntimeLib has been fixed, it will\r
-  // check whether in Runtime or not (this is judged by looking at\r
-  // mEfiAtRuntime global So this ReportStatusCode will work\r
+  // ReporstStatusCodeLib will check and make sure this service can be called in runtime mode.\r
   //\r
-  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PcdGet32 (PcdStatusCodeValueSetVirtualAddressMap));\r
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP));\r
 \r
   //\r
   // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.\r
   // All runtime events are stored in a list in Runtime AP.\r
   //\r
   for (Link = mRuntime.EventHead.ForwardLink; Link != &mRuntime.EventHead; Link = Link->ForwardLink) {\r
-    RuntimeEvent = _CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);\r
+    RuntimeEvent = BASE_CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);\r
     if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
       RuntimeEvent->NotifyFunction (\r
                       RuntimeEvent->Event,\r
@@ -298,7 +297,7 @@ RuntimeDriverSetVirtualAddressMap (
   // Relocate runtime images. All runtime images are stored in a list in Runtime AP.\r
   //\r
   for (Link = mRuntime.ImageHead.ForwardLink; Link != &mRuntime.ImageHead; Link = Link->ForwardLink) {\r
-    RuntimeImage = _CR (Link, EFI_RUNTIME_IMAGE_ENTRY, Link);\r
+    RuntimeImage = BASE_CR (Link, EFI_RUNTIME_IMAGE_ENTRY, Link);\r
     //\r
     // We don't want to relocate our selves, as we only run in physical mode.\r
     //\r
@@ -315,7 +314,7 @@ RuntimeDriverSetVirtualAddressMap (
         RuntimeImage->RelocationData\r
         );\r
 \r
-      InvalidateInstructionCacheRange (RuntimeImage->ImageBase, (UINTN)RuntimeImage->ImageSize);\r
+      InvalidateInstructionCacheRange (RuntimeImage->ImageBase, (UINTN) RuntimeImage->ImageSize);\r
     }\r
   }\r
 \r
@@ -362,17 +361,16 @@ RuntimeDriverSetVirtualAddressMap (
 }\r
 \r
 /**\r
-  Install Runtime AP. This code includes the EfiDriverLib, but it functions at\r
-  RT in physical mode. The only Lib services are gBS, gRT, and the DEBUG and\r
-  ASSERT macros (they do ReportStatusCode).\r
+  Entry Point for Runtime driver.\r
 \r
+  This function installs Runtime Architectural Protocol and registers CalculateCrc32 boot services table,\r
+  SetVirtualAddressMap & ConvertPointer runtime services table.\r
 \r
   @param ImageHandle     Image handle of this driver.\r
-  @param SystemTable     Pointer to the EFI System Table.\r
+  @param SystemTable     Pointer to the EFI System Table.\r
 \r
-  @retval  EFI_SUCEESS  Runtime Driver Architectural Protocol Installed\r
-  @return  Other value if gBS->InstallMultipleProtocolInterfaces fails. Check\r
-           gBS->InstallMultipleProtocolInterfaces for details.\r
+  @retval  EFI_SUCEESS  Runtime Driver Architectural Protocol is successfully installed\r
+  @return  Others       Some error occurs when installing Runtime Driver Architectural Protocol.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -386,7 +384,7 @@ RuntimeDriverInitialize (
   EFI_LOADED_IMAGE_PROTOCOL *MyLoadedImage;\r
 \r
   //\r
-  // This image needs to be exclued from relocation for virtual mode, so cache\r
+  // This image needs to be excluded from relocation for virtual mode, so cache\r
   // a copy of the Loaded Image protocol to test later.\r
   //\r
   Status = gBS->HandleProtocol (\r
@@ -420,5 +418,5 @@ RuntimeDriverInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  return EFI_SUCCESS;\r
+  return Status;\r
 }\r