]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Vlv2TbltDevicePkg/PlatformInitPei: Workaround unaligned SMRAM size
authorMichael Kinney <michael.d.kinney@intel.com>
Tue, 29 Nov 2016 09:05:05 +0000 (01:05 -0800)
committerMichael Kinney <michael.d.kinney@intel.com>
Tue, 29 Nov 2016 16:17:50 +0000 (08:17 -0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=260

The PiSmmCPuDxeSmm module requires the SMRR base address and length
to be aligned.  The memory initialization for Vlv2TbltDevicePkg
produces an SMRAM base address that is on a 16MB boundary and an
SMRAM length of 12MB.  The SMRAM length is rounded up to 16MB.

This is a workaround until the binary module that produces the
gEfiSmmPeiSmramMemoryReserveGuid HOB is updated

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c
Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h
Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf

index cbfe78dd8958e6e42cf4050ae2baad1de03162e1..f8ea09a4385427b5f77aecd8b667fdb96688ad22 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>\r
                                                                                    \r\r
   This program and the accompanying materials are licensed and made available under\r\r
   the terms and conditions of the BSD License that accompanies this distribution.  \r\r
@@ -820,6 +820,19 @@ PlatformEarlyInitEntry (
   EFI_PLATFORM_INFO_HOB       *PlatformInfo;\r
   EFI_PEI_HOB_POINTERS        Hob;\r
   EFI_PLATFORM_CPU_INFO       PlatformCpuInfo;\r
+  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *DescriptorBlock;\r
+  UINT64                          Size;\r
+\r
+  //\r
+  // Make sure last SMRAM region is aligned\r
+  //\r
+  Hob.Raw = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid);\r
+  if (Hob.Raw != NULL) {\r
+    DescriptorBlock = GET_GUID_HOB_DATA (Hob.Raw);\r
+    Size = DescriptorBlock->Descriptor[DescriptorBlock->NumberOfSmmReservedRegions - 1].PhysicalSize;\r
+    Size = LShiftU64 (1, HighBitSet64 (Size - 1) + 1);\r
+    DescriptorBlock->Descriptor[DescriptorBlock->NumberOfSmmReservedRegions - 1].PhysicalSize = Size;\r
+  }\r
 \r
   //\r
   // Initialize SmbusPolicy PPI\r
index c2cdfa3900b2e2433467a05a992e5be49a180d06..c280fb8c4d0dfdf5a4d42ad1d60010fc038b80e7 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>\r
                                                                                    \r\r
   This program and the accompanying materials are licensed and made available under\r\r
   the terms and conditions of the BSD License that accompanies this distribution.  \r\r
@@ -83,6 +83,7 @@ Abstract:
 #include <Ppi/MasterBootMode.h>\r
 #include <Guid/PlatformCpuInfo.h>\r
 #include <Guid/OsSelection.h>\r
+#include <Guid/SmramMemoryReserve.h>\r
 \r
 #define SMC_LAN_ON       0x46\r
 #define SMC_LAN_OFF    0x47\r
index fc517ef6f39b0588d820f7de45ae0ca7b5e70142..309487d8548fde3ada2b67bbd368a6a287da8519 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #\r
-# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved\r
+# Copyright (c)  1999  - 2016, Intel Corporation. All rights reserved\r
 #                                                                                  \r\r
 # This program and the accompanying materials are licensed and made available under\r\r
 # the terms and conditions of the BSD License that accompanies this distribution.  \r\r
@@ -102,6 +102,7 @@ ENTRY_POINT                                    = PlatformEarlyInitEntry
   gEfiNormalSetupGuid\r
   gEfiMemoryTypeInformationGuid\r
   gOsSelectionVariableGuid\r
+  gEfiSmmPeiSmramMemoryReserveGuid\r
 \r
 [Pcd.common]\r
   gPlatformModuleTokenSpaceGuid.PcdFlashFvMainBase\r