]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Convert the capsule image address installed in Configuration table to virtual address.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 16 Nov 2007 10:26:51 +0000 (10:26 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 16 Nov 2007 10:26:51 +0000 (10:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4300 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/RuntimeDxe/Runtime.c
MdeModulePkg/Core/RuntimeDxe/Runtime.h
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf

index 74d93f5c22fb22797e118c3db563f4dadad3465f..a36dc938bd70e3219db14d8612e7dd7f50babf09 100644 (file)
@@ -274,6 +274,12 @@ Returns:
   EFI_RUNTIME_IMAGE_ENTRY       *RuntimeImage;\r
   LIST_ENTRY                    *Link;\r
   EFI_PHYSICAL_ADDRESS          VirtImageBase;\r
+  UINTN                         Index;\r
+  UINTN                         Index1;\r
+  UINTN                         Index2;\r
+  UINTN                         Index3;\r
+  EFI_CAPSULE_TABLE             *CapsuleTable; \r
+  EFI_CAPSULE_INFO_TABLE        *CapsuleInfoTable; \r
 \r
   //\r
   // Can only switch to virtual addresses once the memory map is locked down,\r
@@ -369,6 +375,41 @@ Returns:
   // BugBug: PI requires System Configuration Tables Conversion.\r
   // Currently, we do not implement it.\r
   //\r
+  for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {\r
+    //\r
+    // CapsuleInfoGuid in ConfigTable refers to an array of CapsuleGuid, it is information\r
+    // from which you can tell which vendorGuids in ConfigTable are related to CapsuleTable.\r
+    // Each CapsuleTable points to a array of capsules across a system reset. Then convert \r
+    // the array contents to make these capsules visiable in Runtime.\r
+    //\r
+\r
+    //\r
+    // Firstly, Get CapsulInfoGuid in ConfigTable, it points to CapsuleInfoTable, which\r
+    // gather all the installed capsules' guids.\r
+    //\r
+    if (CompareGuid (&gEfiCapsuleInfoGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {\r
+      CapsuleInfoTable = gST->ConfigurationTable[Index].VendorTable;\r
+      //\r
+      // For each known CapsuleGuid in CapsuleInfoTable, loop the whole ConfigTable to\r
+      // find out this guid related to CapsuleTable.\r
+      //\r
+      for (Index1 = 0; Index1 < CapsuleInfoTable->CapsuleGuidNumber; Index1++) {\r
+        for (Index2 = 0; Index2 < gST->NumberOfTableEntries; Index2++) {\r
+          //\r
+          // Find out certain CapsuleTable, go through its contents array, and convert them.\r
+          //\r
+          if (CompareGuid (&CapsuleInfoTable->CapsuleGuidPtr[Index1], &(gST->ConfigurationTable[Index2].VendorGuid))) {\r
+            CapsuleTable = gST->ConfigurationTable[Index2].VendorTable;\r
+            for (Index3 = 0; Index3 < CapsuleTable->CapsuleArrayNumber; Index3++) {\r
+              RuntimeDriverConvertInternalPointer ((VOID **) &CapsuleTable->CapsulePtr[Index3]);\r
+            }     \r
+            RuntimeDriverConvertInternalPointer ((VOID **) &(gST->ConfigurationTable[Index2].VendorTable));\r
+          }\r
+        }\r
+      }\r
+      break;\r
+    }\r
+  }\r
 \r
   //\r
   // Convert the runtime fields of the EFI System Table and recompute the CRC-32\r
index 0078da2b9102d54c61fc163cd64b2e80c8ea8c5f..f9e4f1d3751e22341732576ba2b7f88317b60efb 100644 (file)
@@ -25,6 +25,7 @@ Abstract:
 #define _RUNTIME_H_\r
 \r
 #include <PiDxe.h>\r
+#include <Guid/CapsuleInfo.h>\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/Runtime.h>\r
 #include <Library/BaseLib.h>\r
index 7a348d683ffa53161668aa0bc3515e283d62ee05..8519cc84fba02fea09b86f991389812ad6a60c2c 100644 (file)
@@ -38,6 +38,7 @@
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
 \r
 [LibraryClasses]\r
   PeCoffLib\r
@@ -51,6 +52,7 @@
   BaseLib\r
 \r
 [Guids]\r
+  gEfiCapsuleInfoGuid\r
 \r
 [Protocols]\r
   gEfiRuntimeArchProtocolGuid                   # PROTOCOL ALWAYS_PRODUCED\r