From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 11CF081EC9 for ; Tue, 29 Nov 2016 02:11:57 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 29 Nov 2016 02:11:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,568,1473145200"; d="scan'208";a="196887436" Received: from mdkinney-mobl.amr.corp.intel.com ([10.254.72.205]) by fmsmga004.fm.intel.com with ESMTP; 29 Nov 2016 02:11:56 -0800 From: Michael Kinney To: edk2-devel@lists.01.org Cc: Jiewen Yao , David Wei , Mang Guo Date: Tue, 29 Nov 2016 02:11:46 -0800 Message-Id: <1480414309-8084-4-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 In-Reply-To: <1480414309-8084-1-git-send-email-michael.d.kinney@intel.com> References: <1480414309-8084-1-git-send-email-michael.d.kinney@intel.com> Subject: [Patch 3/6] Vlv2TbltDevicePkg/PlatformInitPei: Workaround unaligned SMRAM size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 10:11:57 -0000 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 Cc: David Wei Cc: Mang Guo Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney --- 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.
+ Copyright (c) 2004 - 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. @@ -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.
+ Copyright (c) 2004 - 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. @@ -83,6 +83,7 @@ Abstract: #include #include #include +#include #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