From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.10435.1586939467224996094 for ; Wed, 15 Apr 2020 01:31:07 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: chandana.c.kumar@intel.com) IronPort-SDR: 0u3l0XdeV9vPLkzumOOvAeVohXyGv8VbK9AI+6WMfJ563Y+fnwR7O+f++X6a/47inkOu8t91Ie Kg1FGlTOAYvg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2020 01:31:06 -0700 IronPort-SDR: 9JKH/iKQEG1slsd/EZYLfkdBGX/Tmau7FqNjHSL37I2dvYq7sJ2xevr3Q7LoAwJvs3U1nry5QQ Yivl+kH92e/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,386,1580803200"; d="scan'208";a="277544137" Received: from cckumar-desk1.gar.corp.intel.com ([10.66.179.82]) by fmsmga004.fm.intel.com with ESMTP; 15 Apr 2020 01:31:04 -0700 From: "Kumar, Chandana C" To: devel@edk2.groups.io Cc: Sai Chaganty , Chasel Chiu , Nate DeSimone Subject: [edk2-platforms: PATCH] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib. Date: Wed, 15 Apr 2020 14:01:03 +0530 Message-Id: <20200415083103.24752-1-chandana.c.kumar@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Create an Library instance of ReportCpuHobLib from PlatformInitPei driver. PA bits reported can be overriden using Library instance in Platform. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674 Signed-off-by: Chandana Kumar Cc: Sai Chaganty Cc: Chasel Chiu Cc: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h | 23 +++++++++++++++++++++++ Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 4 +++- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 3 ++- Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c | 32 ++++++++++++++++++++++++++++++++ Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf | 27 +++++++++++++++++++++++++++ Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c | 25 ++----------------------- 6 files changed, 89 insertions(+), 25 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h new file mode 100644 index 0000000000..79e5d4efb2 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h @@ -0,0 +1,23 @@ +/** @file + + Report CPU HOB library + + This library report the CPU HOB with Physical Address bits. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _REPORT_CPU_HOB_LIB_H_ +#define _REPORT_CPU_HOB_LIB_H_ + +#include +#include + +VOID +ReportCpuHob ( + VOID + ) + +#endif diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec index 7f74ac9380..71776dfe80 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec @@ -68,7 +68,9 @@ TestPointLib|Include/Library/TestPointLib.h TestPointCheckLib|Include/Library/TestPointCheckLib.h -SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h + SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h + + ReportCpuHobLib|Include/Library/ReportCpuHobLib.h [PcdsFixedAtBuild, PcdsPatchableInModule] diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc index 13a0fda272..b62351dac6 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -1,7 +1,7 @@ ## @file # Platform description. # -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -92,6 +92,7 @@ # FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf + ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c new file mode 100644 index 0000000000..aa2565343c --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c @@ -0,0 +1,32 @@ +/** @file + Source code file for Report CPU HOB library. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +VOID +ReportCpuHob ( + VOID + ) +{ + UINT8 PhysicalAddressBits; + UINT32 RegEax; + + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); + if (RegEax >= 0x80000008) { + AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); + PhysicalAddressBits = (UINT8) RegEax; + } else { + PhysicalAddressBits = 36; + } + + /// + /// Create a CPU hand-off information + /// + BuildCpuHob (PhysicalAddressBits, 16); +} diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf new file mode 100644 index 0000000000..ae6ec901a1 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf @@ -0,0 +1,27 @@ +### @file +# Component information file for the Report CPU HOB library. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ReportCpuHobLib + FILE_GUID = F19AA754-CE24-448D-B755-1F939B00C25D + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = ReportCpuHobLib + +[LibraryClasses] + BaseLib + HobLib + +[Packages] + MdePkg/MdePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + +[Sources] + PeiReportFvLib.c diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c index efdeb6a91c..48cbe0dfbe 100644 --- a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c +++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c @@ -1,7 +1,7 @@ /** @file Source code file for Platform Init Pre-Memory PEI module -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -355,28 +356,6 @@ Done: return EFI_SUCCESS; } -VOID -ReportCpuHob ( - VOID - ) -{ - UINT8 PhysicalAddressBits; - UINT32 RegEax; - - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >= 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - PhysicalAddressBits = (UINT8) RegEax; - } else { - PhysicalAddressBits = 36; - } - - /// - /// Create a CPU hand-off information - /// - BuildCpuHob (PhysicalAddressBits, 16); -} - /** Install Firmware Volume Hob's once there is main memory -- 2.16.2.windows.1