public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Michael Kinney <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiewen Yao <jiewen.yao@intel.com>,
	David Wei <david.wei@intel.com>, Mang Guo <mang.guo@intel.com>
Subject: [Patch 3/6] Vlv2TbltDevicePkg/PlatformInitPei: Workaround unaligned SMRAM size
Date: Tue, 29 Nov 2016 02:11:46 -0800	[thread overview]
Message-ID: <1480414309-8084-4-git-send-email-michael.d.kinney@intel.com> (raw)
In-Reply-To: <1480414309-8084-1-git-send-email-michael.d.kinney@intel.com>

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>
---
 Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c | 15 ++++++++++++++-
 Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h |  3 ++-
 Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c
index cbfe78d..f8ea09a 100644
--- a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c
+++ b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>
                                                                                    

   This program and the accompanying materials are licensed and made available under

   the terms and conditions of the BSD License that accompanies this distribution.  

@@ -820,6 +820,19 @@ PlatformEarlyInitEntry (
   EFI_PLATFORM_INFO_HOB       *PlatformInfo;
   EFI_PEI_HOB_POINTERS        Hob;
   EFI_PLATFORM_CPU_INFO       PlatformCpuInfo;
+  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *DescriptorBlock;
+  UINT64                          Size;
+
+  //
+  // Make sure last SMRAM region is aligned
+  //
+  Hob.Raw = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid);
+  if (Hob.Raw != NULL) {
+    DescriptorBlock = GET_GUID_HOB_DATA (Hob.Raw);
+    Size = DescriptorBlock->Descriptor[DescriptorBlock->NumberOfSmmReservedRegions - 1].PhysicalSize;
+    Size = LShiftU64 (1, HighBitSet64 (Size - 1) + 1);
+    DescriptorBlock->Descriptor[DescriptorBlock->NumberOfSmmReservedRegions - 1].PhysicalSize = Size;
+  }
 
   //
   // Initialize SmbusPolicy PPI
diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h
index c2cdfa3..c280fb8 100644
--- a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h
+++ b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.h
@@ -1,6 +1,6 @@
 /*++
 
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>
                                                                                    

   This program and the accompanying materials are licensed and made available under

   the terms and conditions of the BSD License that accompanies this distribution.  

@@ -83,6 +83,7 @@ Abstract:
 #include <Ppi/MasterBootMode.h>
 #include <Guid/PlatformCpuInfo.h>
 #include <Guid/OsSelection.h>
+#include <Guid/SmramMemoryReserve.h>
 
 #define SMC_LAN_ON       0x46
 #define SMC_LAN_OFF    0x47
diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf
index fc517ef..309487d 100644
--- a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf
+++ b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
+# Copyright (c)  1999  - 2016, Intel Corporation. All rights reserved
 #                                                                                  

 # This program and the accompanying materials are licensed and made available under

 # the terms and conditions of the BSD License that accompanies this distribution.  

@@ -102,6 +102,7 @@ ENTRY_POINT 				   = PlatformEarlyInitEntry
   gEfiNormalSetupGuid
   gEfiMemoryTypeInformationGuid
   gOsSelectionVariableGuid
+  gEfiSmmPeiSmramMemoryReserveGuid
 
 [Pcd.common]
   gPlatformModuleTokenSpaceGuid.PcdFlashFvMainBase
-- 
2.6.3.windows.1



  parent reply	other threads:[~2016-11-29 10:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 10:11 [Patch 0/6] Fix MinnowMax build and boot issues Michael Kinney
2016-11-29 10:11 ` [Patch 1/6] Vlv2TbltDevicePkg: Allow BaseTools to run from sources Michael Kinney
2016-11-29 10:11 ` [Patch 2/6] Vlv2TbltDevicePkg: Set CAPSULE_ENABLE to TRUE Michael Kinney
2016-11-29 10:11 ` Michael Kinney [this message]
2016-11-29 10:11 ` [Patch 4/6] Vlv2TbltDevicePkg: Remove SMM binary modules from FDF Michael Kinney
2016-11-29 10:11 ` [Patch 5/6] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Fix IA32 build issues Michael Kinney
2016-11-29 10:11 ` [Patch 6/6] Vlv2TbltDevicePkg: Fix IA32 boot timeouts Michael Kinney
2016-11-29 11:33 ` [Patch 0/6] Fix MinnowMax build and boot issues Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480414309-8084-4-git-send-email-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox