]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c
Add capsule > 4GB support. When capsule data is put above 4GB, IA32 PEI transfers...
[mirror_edk2.git] / MdeModulePkg / Universal / CapsuleRuntimeDxe / CapsuleService.c
index 76b2a2a8fcc525c8a9794573220152ed00e05bf8..17f167c978cad91e9d45d93dc52899b9f4efaaba 100644 (file)
@@ -4,7 +4,7 @@
   It installs the Capsule Architectural Protocol defined in PI1.0a to signify \r
   the capsule runtime services are ready.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, 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
@@ -40,6 +40,15 @@ EFI_HANDLE  mNewHandle = NULL;
 //\r
 UINTN       mTimes      = 0;\r
 \r
+/**\r
+  Create the variable to save the base address of page table and stack\r
+  for transferring into long mode in IA32 PEI.\r
+**/\r
+VOID\r
+SaveLongModeContext (\r
+  VOID\r
+  );\r
+\r
 /**\r
   Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
   consumption, the firmware may process the capsule immediately. If the payload should persist\r
@@ -333,6 +342,15 @@ CapsuleServiceInitialize (
 {\r
   EFI_STATUS  Status;\r
   \r
+  //\r
+  // When PEI phase is IA32, DXE phase is X64, it is possible that capsule data are \r
+  // put above 4GB, so capsule PEI will transfer to long mode to get capsule data.\r
+  // The page table and stack is used to transfer processor mode from IA32 to long mode.\r
+  // Create the base address of page table and stack, and save them into variable.\r
+  // This is not needed when capsule with reset type is not supported.\r
+  //\r
+  SaveLongModeContext ();\r
+    \r
   //\r
   // Install capsule runtime services into UEFI runtime service tables.\r
   //\r