summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/RuntimeDxe
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-16 10:26:51 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-16 10:26:51 +0000
commit10e2e070c9f62e884d7b18752ff91ca9d0b74fb2 (patch)
tree692104b0f0d78eb18ec53e2c40dda45e9f33774f /MdeModulePkg/Core/RuntimeDxe
parentd12f75fee2579c7d6087f02bdca4715786f67d70 (diff)
downloadedk2-platforms-10e2e070c9f62e884d7b18752ff91ca9d0b74fb2.tar.xz
Convert the capsule image address installed in Configuration table to virtual address.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4300 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/RuntimeDxe')
-rw-r--r--MdeModulePkg/Core/RuntimeDxe/Runtime.c41
-rw-r--r--MdeModulePkg/Core/RuntimeDxe/Runtime.h1
-rw-r--r--MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf2
3 files changed, 44 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
index 74d93f5c22..a36dc938bd 100644
--- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c
+++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
@@ -274,6 +274,12 @@ Returns:
EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage;
LIST_ENTRY *Link;
EFI_PHYSICAL_ADDRESS VirtImageBase;
+ UINTN Index;
+ UINTN Index1;
+ UINTN Index2;
+ UINTN Index3;
+ EFI_CAPSULE_TABLE *CapsuleTable;
+ EFI_CAPSULE_INFO_TABLE *CapsuleInfoTable;
//
// Can only switch to virtual addresses once the memory map is locked down,
@@ -369,6 +375,41 @@ Returns:
// BugBug: PI requires System Configuration Tables Conversion.
// Currently, we do not implement it.
//
+ for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
+ //
+ // CapsuleInfoGuid in ConfigTable refers to an array of CapsuleGuid, it is information
+ // from which you can tell which vendorGuids in ConfigTable are related to CapsuleTable.
+ // Each CapsuleTable points to a array of capsules across a system reset. Then convert
+ // the array contents to make these capsules visiable in Runtime.
+ //
+
+ //
+ // Firstly, Get CapsulInfoGuid in ConfigTable, it points to CapsuleInfoTable, which
+ // gather all the installed capsules' guids.
+ //
+ if (CompareGuid (&gEfiCapsuleInfoGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
+ CapsuleInfoTable = gST->ConfigurationTable[Index].VendorTable;
+ //
+ // For each known CapsuleGuid in CapsuleInfoTable, loop the whole ConfigTable to
+ // find out this guid related to CapsuleTable.
+ //
+ for (Index1 = 0; Index1 < CapsuleInfoTable->CapsuleGuidNumber; Index1++) {
+ for (Index2 = 0; Index2 < gST->NumberOfTableEntries; Index2++) {
+ //
+ // Find out certain CapsuleTable, go through its contents array, and convert them.
+ //
+ if (CompareGuid (&CapsuleInfoTable->CapsuleGuidPtr[Index1], &(gST->ConfigurationTable[Index2].VendorGuid))) {
+ CapsuleTable = gST->ConfigurationTable[Index2].VendorTable;
+ for (Index3 = 0; Index3 < CapsuleTable->CapsuleArrayNumber; Index3++) {
+ RuntimeDriverConvertInternalPointer ((VOID **) &CapsuleTable->CapsulePtr[Index3]);
+ }
+ RuntimeDriverConvertInternalPointer ((VOID **) &(gST->ConfigurationTable[Index2].VendorTable));
+ }
+ }
+ }
+ break;
+ }
+ }
//
// Convert the runtime fields of the EFI System Table and recompute the CRC-32
diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.h b/MdeModulePkg/Core/RuntimeDxe/Runtime.h
index 0078da2b91..f9e4f1d375 100644
--- a/MdeModulePkg/Core/RuntimeDxe/Runtime.h
+++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.h
@@ -25,6 +25,7 @@ Abstract:
#define _RUNTIME_H_
#include <PiDxe.h>
+#include <Guid/CapsuleInfo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/Runtime.h>
#include <Library/BaseLib.h>
diff --git a/MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf b/MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
index 7a348d683f..8519cc84fb 100644
--- a/MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+++ b/MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
@@ -38,6 +38,7 @@
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
PeCoffLib
@@ -51,6 +52,7 @@
BaseLib
[Guids]
+ gEfiCapsuleInfoGuid
[Protocols]
gEfiRuntimeArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED