]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe: Add support for PCD PcdPteMemoryEn...
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / BootScriptExecutorDxe / ScriptExecute.c
index f8b27822447fa3c3de2b0794a485b405a9458128..22d434914befa9c96700791af381fda4276ee1d2 100644 (file)
@@ -4,7 +4,8 @@
   This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory\r
   in the entry point. The functionality is to interpret and restore the S3 boot script\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -23,6 +24,7 @@ EFI_GUID              mBootScriptExecutorImageGuid = {
 };\r
 \r
 BOOLEAN               mPage1GSupport = FALSE;\r
+UINT64                mAddressEncMask = 0;\r
 \r
 /**\r
   Entry function of Boot script exector. This function will be executed in\r
@@ -322,7 +324,7 @@ ReadyToLockEventNotify (
   ASSERT_EFI_ERROR (Status);\r
   ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer;\r
   //\r
-  // Align buffer on section boundry\r
+  // Align buffer on section boundary\r
   //\r
   ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;\r
   ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));\r
@@ -403,6 +405,15 @@ BootScriptExecutorEntryPoint (
   UINT32                                        RegEax;\r
   UINT32                                        RegEdx;\r
 \r
+  if (!PcdGetBool (PcdAcpiS3Enable)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  //\r
+  // Make sure AddressEncMask is contained to smallest supported address field.\r
+  //\r
+  mAddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) & PAGING_1G_ADDRESS_MASK_64;\r
+\r
   //\r
   // Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry\r
   // point is loaded by DXE code which is the first time loaded. or else, it is already\r