Re: [edk2] [PATCH v2] SecurityPkg: Fix assert when setting key from eMMC/SD/USB
Yes, it is being taking care of. On Mon, Jul 16, 2018 at 8:50 AM, Yao, Jiewen wrote: > Laszlo already filed one - https://bugzilla.tianocore. > org/show_bug.cgi?id=1008 > > I suggest we add to UefiLib instead of fixing all individual driver. > > Thank you > Yao Jiewen > > > > -Original Message- > > From: Zhang, Chao B > > Sent: Monday, July 16, 2018 11:10 PM > > To: rba...@gmail.com; edk2-devel@lists.01.org > > Cc: Yao, Jiewen ; Laszlo Ersek >; > > Vladimir Olovyannikov > > Subject: RE: [PATCH v2] SecurityPkg: Fix assert when setting key from > > eMMC/SD/USB > > > > Hi Bacik: > >Tks for the fix. Would you please file another report in Bugzilla for > RamDisk > > & Tls Configuration driver? They have same issue as SecureBootConfig > driver > > > > -Original Message- > > From: rba...@gmail.com [mailto:rba...@gmail.com] > > Sent: Wednesday, July 11, 2018 6:51 AM > > To: edk2-devel@lists.01.org > > Cc: Zhang, Chao B ; Yao, Jiewen > > ; Laszlo Ersek ; Vladimir > > Olovyannikov > > Subject: [PATCH v2] SecurityPkg: Fix assert when setting key from > > eMMC/SD/USB > > > > From: Roman Bacik > > > > When secure boot is enabled, if one loads keys from a FAT formatted > > eMMC/SD/USB when trying to provision PK/KEK/DB keys via the menu, an > > assert in StrLen() occurs. > > This is because the filename starts on odd address, which is not a uint16 > > aligned boundary: https://bugzilla.tianocore.org/show_bug.cgi?id=1003 > > > > Cc: Chao Zhang > > Cc: Jiewen Yao > > Cc: Laszlo Ersek > > Cc: Vladimir Olovyannikov > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Roman Bacik > > --- > > > > SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/ > SecureBootConfigFil > > eExplorer.c | 13 +++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git > > a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > > FileExplorer.c > > b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > > FileExplorer.c > > index 1b6f88804275..19b13a5569a6 100644 > > --- > > a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > > FileExplorer.c > > +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo > > +++ nfigFileExplorer.c > > @@ -123,6 +123,8 @@ OpenFileByDevicePath( > >EFI_FILE_PROTOCOL *Handle1; > >EFI_FILE_PROTOCOL *Handle2; > >EFI_HANDLE DeviceHandle; > > + CHAR16 *PathName; > > + UINTN PathLength; > > > >if ((FilePath == NULL || FileHandle == NULL)) { > > return EFI_INVALID_PARAMETER; > > @@ -173,6 +175,11 @@ OpenFileByDevicePath( > > // > > Handle2 = Handle1; > > Handle1 = NULL; > > +PathLength = DevicePathNodeLength(*FilePath) - > > sizeof(EFI_DEVICE_PATH_PROTOCOL); > > +PathName = AllocateCopyPool(PathLength, > > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName); > > +if (PathName == NULL) { > > + return EFI_OUT_OF_RESOURCES; > > +} > > > > // > > // Try to test opening an existing file @@ -180,7 +187,7 @@ > > OpenFileByDevicePath( > > Status = Handle2->Open ( > >Handle2, > >, > > - > > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, > > + PathName, > >OpenMode &~EFI_FILE_MODE_CREATE, > >0 > > ); > > @@ -192,7 +199,7 @@ OpenFileByDevicePath( > >Status = Handle2->Open ( > > Handle2, > > , > > - > > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, > > +PathName, > > OpenMode, > > Attributes > > ); > > @@ -202,6 +209,8 @@ OpenFileByDevicePath( > > // > > Handle2->Close (Handle2); > > > > +FreePool (PathName); > > + > > if (EFI_ERROR(Status)) { > >return (Status); > > } > > -- > > 2.17.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools Script: Add the script to generate Structure PCD setting
Here is this script usage. 1. Build one platform. 2. Use FCE tool to read HII config from the generated FD image. FCE read -i Platform.fd > Config.txt 3. Call the script to generate StructurePcd setting. ConvertFceToStructurePcd.py -p Build\PlatformPkg\DEBUG_VS2015x86 -c Config.txt -o OutputDir OutputDir directory have StructurePcd.dec, StructurePcd.dsc, StructurePcd.inf. 4. Refer to wiki https://github.com/lgao4/edk2/wiki/StructurePcd-Enable-Steps to enable structure pcd in this platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 675 ++ 1 file changed, 675 insertions(+) create mode 100644 BaseTools/Scripts/ConvertFceToStructurePcd.py diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py new file mode 100644 index 000..6ca51c4 --- /dev/null +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -0,0 +1,675 @@ +#!/usr/bin/python +## @file +# Firmware Configuration Editor (FCE) from https://firmware.intel.com/develop +# can parse BIOS image and generate Firmware Configuration file. +# This script bases on Firmware Configuration file, and generate the structure +# PCD setting in DEC/DSC/INF files. +# +# Copyright (c) 2018, 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 +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +ConvertFceToStructurePcd +''' + +import re +import os +import datetime +import argparse + +# +# Globals for help information +# +__prog__= 'ConvertFceToStructurePcd' +__version__ = '%s Version %s' % (__prog__, '0.1 ') +__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.' +__description__ = 'Generate Structure PCD in DEC/DSC/INF based on Firmware Configuration.\n' + + +dscstatement='''[Defines] + VPD_TOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08 + +[SkuIds] + 0|DEFAULT # The entry: 0|DEFAULT is reserved and always required. + +[DefaultStores] + 0|STANDARD # UEFI Standard default 0|STANDARD is reserved. + 1|MANUFACTURING# UEFI Manufacturing default 1|MANUFACTURING is reserved. + +[PcdsDynamicExVpd.common.DEFAULT] + gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer|* +''' + +decstatement = '''[Guids] + gStructPcdTokenSpaceGuid = {0x3f1406f4, 0x2b, 0x487a, {0x8b, 0x69, 0x74, 0x29, 0x1b, 0x36, 0x16, 0xf4}} + +[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] +''' + +infstatement = '''[Pcd] +''' + +SECTION='PcdsDynamicHii' +PCD_NAME='gStructPcdTokenSpaceGuid.Pcd' + +WARNING=[] +ERRORMSG=[] + +class parser_lst(object): + + def __init__(self,filelist): +self._ignore=['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT64'] +self.file=filelist +self.text=self.megre_lst()[0] +self.content=self.megre_lst()[1] + + def megre_lst(self): +alltext='' +content={} +for file in self.file: + with open(file,'r') as f: +read =f.read() + alltext += read + content[file]=read +return alltext,content + + def struct_lst(self):#{struct:lst file} +structs_file={} +name_format = re.compile(r'(?') +name_format = re.compile(r'(?> m * 8 & 0xff)) +else: + tmp.append('0x%s' % i) + for i in tmp: +line += '%s,' % i + value = '{%s}' % line[:-1] +else: + value = "0x%01x" % int(list1[-1], 16) +return value + + +#parser Guid file, get guid name form guid value +class GUID(object): + + def __init__(self,path): +self.path = path +self.guidfile = self.gfile() +self.guiddict = self.guid_dict() + + def gfile(self): +for root, dir, file in os.walk(self.path, topdown=True, followlinks=False): + if 'FV' in dir: +gfile = os.path.join(root,'Fv','Guid.xref') +if os.path.isfile(gfile): + return gfile +else: + print("ERROR: Guid.xref file not found") + ERRORMSG.append("ERROR: Guid.xref file not found") + exit() + + def guid_dict(self): +guiddict={} +with open(self.guidfile,'r') as file: + lines = file.readlines() +guidinfo=lines +for line in guidinfo: + list=line.strip().split(' ') + if list: +if len(list)>1: + guiddict[list[0].upper()]=list[1] +elif list[0] != ''and len(list)==1: + print("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile)) + ERRORMSG.append("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile)) + else: +print("ERROR: No data in %s"
[edk2] [Patch V3] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
From: Yunhua Feng V3: Add some invalid type and datum check V2: limit the PCD used in the [Depex] section should be used in the module The PCD item used in INF [Depex] section must be defined as FixedAtBuild type and VOID* datum type, and the size of the PCD must be 16 bytes. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=443 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py| 32 +-- BaseTools/Source/Python/AutoGen/GenDepex.py | 6 + BaseTools/Source/Python/Workspace/InfBuildData.py | 20 ++ BaseTools/Source/Python/build/BuildReport.py | 7 - 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index c5ab334..9bbf6e1 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2750,10 +2750,14 @@ class ModuleAutoGen(AutoGen): ## Store the FixedAtBuild Pcds # self._FixedAtBuildPcds = [] self.ConstPcd = {} +##Store the VOID* type FixedAtBuild Pcds +# +self._FixedPcdVoidTypeDict = {} + def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) # Get FixedAtBuild Pcds of this Module def _GetFixedAtBuildPcds(self): @@ -2765,10 +2769,19 @@ class ModuleAutoGen(AutoGen): if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) return self._FixedAtBuildPcds +def _GetFixedAtBuildVoidTypePcds(self): +if self._FixedPcdVoidTypeDict: +return self._FixedPcdVoidTypeDict +for Pcd in self.ModulePcdList: +if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID: +if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict: + self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue +return self._FixedPcdVoidTypeDict + def _GetUniqueBaseName(self): BaseName = self.Name for Module in self.PlatformInfo.ModuleAutoGenList: if Module.MetaFile == self.MetaFile: continue @@ -3034,11 +3047,11 @@ class ModuleAutoGen(AutoGen): self._DepexDict = {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: return self._DepexDict self._DepexDict[self.ModuleType] = [] - +self._GetFixedAtBuildVoidTypePcds() for ModuleType in self._DepexDict: DepexList = self._DepexDict[ModuleType] # # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # @@ -3046,11 +3059,25 @@ class ModuleAutoGen(AutoGen): Inherited = False for D in M.Depex[self.Arch, ModuleType]: if DepexList != []: DepexList.append('AND') DepexList.append('(') -DepexList.extend(D) +#replace D with value if D is FixedAtBuild PCD +NewList = [] +for item in D: +if '.' not in item: +NewList.append(item) +else: +if item not in self._FixedPcdVoidTypeDict: +EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) +else: +Value = self._FixedPcdVoidTypeDict[item] +if len(Value.split(',')) != 16: +EdkLogger.error("build", FORMAT_INVALID, +"{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) +NewList.append(Value) +DepexList.extend(NewList) if DepexList[-1] == 'END': # no need of a END at this time DepexList.pop() DepexList.append(')') Inherited = True if Inherited: @@ -4418,10 +4445,11 @@ class ModuleAutoGen(AutoGen): BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildCommand= property(_GetBuildCommand) FixedAtBuildPcds = property(_GetFixedAtBuildPcds) UniqueBaseName =
[edk2] [PATCH edk2-platforms 0/3] Add Platform-Generic Packages to support Windows IoT Core
REF: https://github.com/christopherco/edk2-platforms/tree/import_mspkg_v1 This patch adds a Platform/Microsoft directory to hold libraries and drivers that are specific to supporting Windows IoT Core but not necessarily specific to a Platform or Silicon. SdMmc DXE driver enables Windows IoT Core boot from SD or eMMC. It also contains feature enhancements that were missing from the derived Mmc driver. Lauterbach debug library is not Windows-specific but was a useful debug library during our initial Windows IoT Core platform enabling. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co Christopher Co (3): Platform/Microsoft: Add SdMmc Dxe Driver Platform/Microsoft: Add MsPkg Platform/Microsoft: Add Lauterbach debug library Platform/Microsoft/Drivers/SdMmcDxe/BlockIo.c | 526 ++ Platform/Microsoft/Drivers/SdMmcDxe/Debug.c | 358 Platform/Microsoft/Drivers/SdMmcDxe/Protocol.c | 1774 Platform/Microsoft/Drivers/SdMmcDxe/Protocol.h | 231 +++ Platform/Microsoft/Drivers/SdMmcDxe/RpmbIo.c | 611 +++ Platform/Microsoft/Drivers/SdMmcDxe/SdMmc.c | 892 ++ Platform/Microsoft/Drivers/SdMmcDxe/SdMmc.h | 529 ++ Platform/Microsoft/Drivers/SdMmcDxe/SdMmcDxe.inf | 50 + Platform/Microsoft/Drivers/SdMmcDxe/SdMmcHw.h | 506 ++ Platform/Microsoft/Include/Protocol/RpmbIo.h | 262 +++ Platform/Microsoft/Include/Protocol/Sdhc.h | 197 +++ Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c | 142 ++ Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.inf | 41 + Platform/Microsoft/MsPkg.dec | 42 + Platform/Microsoft/MsPkg.dsc | 32 + 15 files changed, 6193 insertions(+) create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/BlockIo.c create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/Debug.c create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/Protocol.c create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/Protocol.h create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/RpmbIo.c create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/SdMmc.c create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/SdMmc.h create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/SdMmcDxe.inf create mode 100644 Platform/Microsoft/Drivers/SdMmcDxe/SdMmcHw.h create mode 100644 Platform/Microsoft/Include/Protocol/RpmbIo.h create mode 100644 Platform/Microsoft/Include/Protocol/Sdhc.h create mode 100644 Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c create mode 100644 Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.inf create mode 100644 Platform/Microsoft/MsPkg.dec create mode 100644 Platform/Microsoft/MsPkg.dsc -- 2.16.2.gvfs.1.33.gf5370f1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms 2/3] Platform/Microsoft: Add MsPkg
MsPkg is a collection of libraries and drivers that are specific to supporting Windows IoT Core but are not Platform/Silicon specific. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co --- Platform/Microsoft/MsPkg.dec | 42 Platform/Microsoft/MsPkg.dsc | 32 +++ 2 files changed, 74 insertions(+) diff --git a/Platform/Microsoft/MsPkg.dec b/Platform/Microsoft/MsPkg.dec new file mode 100644 index ..ff17a016943c --- /dev/null +++ b/Platform/Microsoft/MsPkg.dec @@ -0,0 +1,42 @@ +#/** @file +# A package that contains generic headers and components. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = MsPkg + PACKAGE_GUID = DC909FB7-F45E-4D7F-BF10-327BD9BFA21C + PACKAGE_VERSION= 0.1 + +[Includes.common] + Include# Root include for the package + +[LibraryClasses.common] + +[Guids.common] + gMsPkgTokenSpaceGuid = { 0x3ecb4bb9, 0xb80a, 0x4efd, { 0x92, 0xb8, 0x3a, 0x16, 0xe0, 0xc8, 0x19, 0xb } } + +[PcdsFixedAtBuild.common] + gMsPkgTokenSpaceGuid.PcdSecureBootEnable|FALSE|BOOLEAN|0x00 + + # + # The DevicePath to a partition on a writeable media used for logging and misc + # storage purposes. SD card DevicePath example: + # gMsPkgTokenSpaceGuid.PcdStorageMediaPartitionDevicePath|L"VenHw(AAFB8DAA-7340-43AC-8D49-0CCE14812489,0300)/SD(0x0)/HD(1,MBR,0xAE420040,0x1000,0x2)" + # + gMsPkgTokenSpaceGuid.PcdStorageMediaPartitionDevicePath|L""|VOID*|0x03 + +[Protocols.common] + gEfiSdhcProtocolGuid = { 0x46055b0f, 0x992a, 0x4ad7, { 0x8f, 0x81, 0x14, 0x81, 0x86, 0xff, 0xdf, 0x72 } } + gEfiRpmbIoProtocolGuid = { 0xfbaee5b2, 0x8b0, 0x41b8, { 0xb0, 0xb0, 0x86, 0xb7, 0x2e, 0xed, 0x1b, 0xb6 } } diff --git a/Platform/Microsoft/MsPkg.dsc b/Platform/Microsoft/MsPkg.dsc new file mode 100644 index ..b43902cbb04d --- /dev/null +++ b/Platform/Microsoft/MsPkg.dsc @@ -0,0 +1,32 @@ +## @file +# A package that contains generic headers and components. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +## + +[Defines] + PLATFORM_NAME = MsPkg + PLATFORM_GUID = 2F78367E-9C74-4FBE-82E7-1D2DAAF18CC6 + PLATFORM_VERSION = 0.01 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/MsPkg + SUPPORTED_ARCHITECTURES= ARM|AARCH64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + +[LibraryClasses] + +[Components] + Platform/Microsoft/Drivers/SdMmcDxe/SdMmcDxe.inf -- 2.16.2.gvfs.1.33.gf5370f1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms 3/3] Platform/Microsoft: Add Lauterbach debug library
This debug library provides support for importing symbols to debug using Lauterbach. Derived from: ArmPkg\Library\DebugPeCoffExtraActionLib Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co --- Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c | 142 Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.inf | 41 ++ 2 files changed, 183 insertions(+) diff --git a/Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c b/Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c new file mode 100644 index ..0adfacdbe5cf --- /dev/null +++ b/Platform/Microsoft/Library/LauterbachPeCoffExtraActionLib/LauterbachPeCoffExtraActionLib.c @@ -0,0 +1,142 @@ +/**@file + +Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved. +Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved. +Portions copyright (c) 2011 - 2012, ARM Ltd. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include + +#include +#include +#include +#include +#include + + +/** + If the build is done on cygwin the paths are cygpaths. + /cygdrive/c/tmp.txt vs c:\tmp.txt so we need to convert + them to work with RVD commands + + @param Name Path to convert if needed + +**/ +CHAR8 * +DeCygwinPathIfNeeded ( + IN CHAR8 *Name, + IN CHAR8 *Temp, + IN UINTN Size + ) +{ + CHAR8 *Ptr; + UINTN Index; + UINTN Index2; + + Ptr = AsciiStrStr (Name, "/cygdrive/"); + if (Ptr == NULL) { +return Name; + } + + for (Index = 9, Index2 = 0; (Index < (Size + 9)) && (Ptr[Index] != '\0'); Index++, Index2++) { +Temp[Index2] = Ptr[Index]; +if (Temp[Index2] == '/') { + Temp[Index2] = '\\' ; + } + +if (Index2 == 1) { + Temp[Index2 - 1] = Ptr[Index]; + Temp[Index2] = ':'; +} + } + + return Temp; +} + + +/** + Performs additional actions after a PE/COFF image has been loaded and relocated. + + If ImageContext is NULL, then ASSERT(). + + @param ImageContext Pointer to the image context structure that describes the +PE/COFF image that has already been loaded and relocated. + +**/ +VOID +EFIAPI +PeCoffLoaderRelocateImageExtraAction ( + IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext + ) +{ +#if !defined(MDEPKG_NDEBUG) + CHAR8 Temp[512]; +#endif + + if (ImageContext->PdbPointer) { +#ifdef __CC_ARM +#if (__ARMCC_VERSION < 50) +// Print out the command for the RVD debugger to load symbols for this image +DEBUG ((DEBUG_LOAD | DEBUG_INFO, "load /a /ni /np %a &0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); +#else +// Print out the command for the DS-5 to load symbols for this image +DEBUG ((DEBUG_LOAD | DEBUG_INFO, "add-symbol-file %a 0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); +#endif +#elif __GNUC__ +// This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required +DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Data.load.elf %a /reloc .text at 0x%p /nocode /noclear\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); +#else +DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); +#endif + } else { +DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); + } +} + + + +/** + Performs additional actions just before a PE/COFF image is unloaded. Any resources + that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed. + + If ImageContext is NULL, then ASSERT(). + + @param ImageContext Pointer to the image context structure that describes the +PE/COFF image that is being unloaded. + +**/ +VOID +EFIAPI +PeCoffLoaderUnloadImageExtraAction ( + IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext + ) +{ +#if !defined(MDEPKG_NDEBUG) + CHAR8 Temp[512]; +#endif + +
[edk2] [Patch] BaseTools: Remove the duplicate Pcd items
The case is the Pcd item both used in 1 module inf and 1 lib inf, and in the DSC component section, it override the Pcd value. In the module, the pcd value is the override value, but in the lib inf the pcd value is the value that in the DSC PCD section's value, then it cause the Pcd value is different in the module and lib. but actually we only need use the Pcd value in the module to decide whether it use the same value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 289309f..cf53c2b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1289,11 +1289,11 @@ class PlatformAutoGen(AutoGen): def CollectFixedAtBuildPcds(self): for LibAuto in self.LibraryAutoGenList: FixedAtBuildPcds = {} ShareFixedAtBuildPcdsSameValue = {} for Module in LibAuto._ReferenceModules: -for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds: +for Pcd in set(Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds): DefaultValue = Pcd.DefaultValue # Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib if Pcd in Module.LibraryPcdList: Index = Module.LibraryPcdList.index(Pcd) DefaultValue = Module.LibraryPcdList[Index].DefaultValue -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] DMAR Table Installation.
Move DMAR table into a separate FFS file to make it easier to be located and installed at proper time by VT-d library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: David Wei CC: Mang Guo --- .../Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c | 4 +- .../Common/Acpi/AcpiTablesPCAT/AcpiTables.inf | 4 +- .../PlatformDsc/Components.IA32.dsc| 8 +- .../BroxtonPlatformPkg/PlatformDsc/Components.dsc | 18 +- Platform/BroxtonPlatformPkg/PlatformPkg.fdf| 6 + Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec | 2 + .../SouthCluster/AcpiTableDmar/AcpiTableDmar.inf | 32 +++ .../SouthCluster/AcpiTableDmar}/Dmar.aslc | 2 +- .../SouthCluster/AcpiTableDmar}/Dmar.h | 2 +- .../SouthCluster/Library/DxeVtdLib/DxeVtdLib.c | 260 + .../SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf | 12 +- 11 files changed, 294 insertions(+), 56 deletions(-) create mode 100644 Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar => Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.aslc (95%) rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar => Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.h (90%) diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c index c18753b61c..6a4d675eb2 100644 --- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c +++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c @@ -1,7 +1,7 @@ /** @file ACPI Platform Driver. - Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved. + Copyright (c) 2012 - 2018, 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 @@ -1081,7 +1081,7 @@ OnReadyToBoot ( // // Update the DMAR Table // - UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable); + // UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable); // // Publish ACPI 1.0 or 2.0 Tables diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf index 1e456e3405..ea5da05602 100644 --- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf +++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf @@ -1,7 +1,7 @@ ## @file # Component information file for the ACPI tables. # -# Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved. +# Copyright (c) 1999 - 2018, 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 @@ -29,8 +29,6 @@ Madt/Madt30.aslc Mcfg/Mcfg.aslc Hpet/Hpet.aslc - Dmar/Dmar.aslc - Dmar/Dmar.h Lpit/Lpit.aslc Lpit/Lpit.h SsdtRtd3/RvpRtd3.asl diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc index 8615ebc5c0..1aec4a9244 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc @@ -210,4 +210,10 @@ !if $(SOURCE_DEBUG_ENABLE) == TRUE SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf -!endif \ No newline at end of file +!endif + +# +# VT-d for DMA Protection +# +$(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformVTdInfoPei/PlatformVTdInfoPei.inf +IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf \ No newline at end of file diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc index f1bb26b9d9..15b75be4a5 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc @@ -18,7 +18,7 @@ # MdeModulePkg/Core/Dxe/DxeMain.inf { - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8046 + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8047 !if $(DXE_CRC32_SECTION_ENABLE) == TRUE NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf @@ -26,7 +26,6 @@ !if $(LZMA_ENABLE) == TRUE NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf !endif - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf } MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { @@ -544,4 +543,17 @@ # Application # $(PLATFORM_PACKAGE_COMMON)/Application/FirmwareUpdate/FirmwareUpdate.inf - + MdeModulePkg/Application/VariableInfo/VariableInfo.inf + + # + # VT-d for DMA Protection + # +
[edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] Enhance Implementation of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
Enhance implementation of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL by introducing EDKII_IOMMU_PROTOCOL to support DMA remapping when VT-d is enabled. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: David Wei CC: Mang Guo --- .../NorthCluster/PciHostBridge/Dxe/PciHostBridge.c | 34 +++ .../PciHostBridge/Dxe/PciHostBridge.inf| 2 + .../NorthCluster/PciHostBridge/Dxe/PciRootBridge.h | 1 + .../PciHostBridge/Dxe/PciRootBridgeIo.c| 71 +++--- 4 files changed, 99 insertions(+), 9 deletions(-) diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.c b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.c index 3f7a51d275..2cace7be07 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.c @@ -22,6 +22,9 @@ #include #include +EDKII_IOMMU_PROTOCOL*mIoMmuProtocol; +EFI_EVENT mIoMmuEvent; +VOID*mIoMmuRegistration; // // Support 64 K IO space // @@ -75,6 +78,28 @@ static PCI_ROOT_BRIDGE_RESOURCE_APPETURE mResAppeture[1][1] = { {{ 0, 255, 0, 0 static EFI_HANDLE mDriverImageHandle; +/** + Event notification that is fired when IOMMU protocol is installed. + + @param Event The Event that is being processed. + @param Context Event Context. + +**/ +VOID +EFIAPI +IoMmuProtocolCallback ( + IN EFI_EVENT Event, + IN VOID*Context + ) +{ + EFI_STATUS Status; + + Status = gBS->LocateProtocol (, NULL, (VOID **)); + if (!EFI_ERROR(Status)) { +gBS->CloseEvent (mIoMmuEvent); + } +} + // // Implementation // @@ -241,6 +266,15 @@ PciHostBridgeEntryPoint ( ASSERT_EFI_ERROR (Status); DEBUG ((EFI_D_INFO, "Successfully changed memory attribute for PCIe\n")); + + mIoMmuEvent = EfiCreateProtocolNotifyEvent ( + , + TPL_CALLBACK, + IoMmuProtocolCallback, + NULL, + + ); + return EFI_SUCCESS; } diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.inf b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.inf index de77fd1552..ec0c593d5b 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.inf +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciHostBridge.inf @@ -35,6 +35,7 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec BroxtonSiPkg/BroxtonSiPkg.dec [LibraryClasses] @@ -55,6 +56,7 @@ gEfiPciHostBridgeResourceAllocationProtocolGuid ## PRODUCES gEfiMetronomeArchProtocolGuid ## CONSUMES gEfiCpuIo2ProtocolGuid ## CONSUMES + gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES [Depex] gEfiCpuIo2ProtocolGuid AND diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridge.h b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridge.h index 81c143e6d1..1db17fc2da 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridge.h +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridge.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridgeIo.c b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridgeIo.c index e5e2e8605f..d8bdc20de1 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridgeIo.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/PciHostBridge/Dxe/PciRootBridgeIo.c @@ -16,6 +16,8 @@ #include "PciRootBridge.h" #include +extern EDKII_IOMMU_PROTOCOL*mIoMmuProtocol; + typedef struct { EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR SpaceDesp[TypeMax]; EFI_ACPI_END_TAG_DESCRIPTOR EndDesp; @@ -1093,11 +1095,29 @@ RootBridgeIoMap ( if (Operation < 0 || Operation >= EfiPciOperationMaximum) { return EFI_INVALID_PARAMETER; } - // - // Most PCAT like chipsets can not handle performing DMA above 4GB. - // If any part of the DMA transfer being mapped is above 4GB, then - // map the DMA transfer to a buffer below 4GB. - // + + if (mIoMmuProtocol != NULL) { +// +// Clear 64bit support +// +if (Operation > EfiPciOperationBusMasterCommonBuffer) { + Operation = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) (Operation - EfiPciOperationBusMasterRead64); +} +return mIoMmuProtocol->Map ( + mIoMmuProtocol, + (EDKII_IOMMU_OPERATION) Operation, + HostAddress, +
[edk2] [Patch v3 2/3] UefiCpuPkg/MpInitLib: Use BSP uCode for APs if possible.
Search uCode costs much time, if AP has same processor type with BSP, AP can use BSP saved uCode info to get better performance. This change enables this solution. Cc: Laszlo Ersek Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/Library/MpInitLib/Microcode.c | 34 +--- UefiCpuPkg/Library/MpInitLib/MpLib.c | 4 ++-- UefiCpuPkg/Library/MpInitLib/MpLib.h | 11 +-- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c b/UefiCpuPkg/Library/MpInitLib/Microcode.c index e47f9f4f8f..351975e2a2 100644 --- a/UefiCpuPkg/Library/MpInitLib/Microcode.c +++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c @@ -35,11 +35,13 @@ GetCurrentMicrocodeSignature ( /** Detect whether specified processor can find matching microcode patch and load it. - @param[in] CpuMpData The pointer to CPU MP Data structure. + @param[in] CpuMpDataThe pointer to CPU MP Data structure. + @param[in] IsBspCallIn Indicate whether the caller is BSP or not. **/ VOID MicrocodeDetect ( - IN CPU_MP_DATA *CpuMpData + IN CPU_MP_DATA *CpuMpData, + IN BOOLEAN IsBspCallIn ) { UINT32 ExtendedTableLength; @@ -58,6 +60,7 @@ MicrocodeDetect ( BOOLEAN CorrectMicrocode; VOID*MicrocodeData; MSR_IA32_PLATFORM_ID_REGISTER PlatformIdMsr; + UINT32 ProcessorFlags; if (CpuMpData->MicrocodePatchRegionSize == 0) { // @@ -67,7 +70,7 @@ MicrocodeDetect ( } CurrentRevision = GetCurrentMicrocodeSignature (); - if (CurrentRevision != 0) { + if (CurrentRevision != 0 && !IsBspCallIn) { // // Skip loading microcode if it has been loaded successfully // @@ -87,6 +90,19 @@ MicrocodeDetect ( PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID); PlatformId = (UINT8) PlatformIdMsr.Bits.PlatformId; + // + // Check whether AP has same processor with BSP. + // If yes, direct use microcode info saved by BSP. + // + if (!IsBspCallIn) { +if ((CpuMpData->ProcessorSignature == Eax.Uint32) && +(CpuMpData->ProcessorFlags & (1 << PlatformId)) != 0) { +MicrocodeData = (VOID *)(UINTN) CpuMpData->MicrocodeDataAddress; +LatestRevision = CpuMpData->MicrocodeRevision; +goto Done; +} + } + LatestRevision = 0; MicrocodeData = NULL; MicrocodeEnd = (UINTN) (CpuMpData->MicrocodePatchAddress + CpuMpData->MicrocodePatchRegionSize); @@ -117,6 +133,7 @@ MicrocodeDetect ( } if (CheckSum32 == 0) { CorrectMicrocode = TRUE; + ProcessorFlags = MicrocodeEntryPoint->ProcessorFlags; } } else if ((MicrocodeEntryPoint->DataSize != 0) && (MicrocodeEntryPoint->UpdateRevision > LatestRevision)) { @@ -151,6 +168,7 @@ MicrocodeDetect ( // Find one // CorrectMicrocode = TRUE; +ProcessorFlags = ExtendedTable->ProcessorFlag; break; } } @@ -188,6 +206,7 @@ MicrocodeDetect ( MicrocodeEntryPoint = (CPU_MICROCODE_HEADER *) (((UINTN) MicrocodeEntryPoint) + TotalSize); } while (((UINTN) MicrocodeEntryPoint < MicrocodeEnd)); +Done: if (LatestRevision > CurrentRevision) { // // BIOS only authenticate updates that contain a numerically larger revision @@ -211,4 +230,13 @@ MicrocodeDetect ( ReleaseSpinLock(>MpLock); } } + + if (IsBspCallIn && (LatestRevision != 0)) { +CpuMpData->ProcessorSignature = Eax.Uint32; +CpuMpData->ProcessorFlags = ProcessorFlags; +CpuMpData->MicrocodeDataAddress = (UINTN) MicrocodeData; +CpuMpData->MicrocodeRevision = LatestRevision; +DEBUG ((DEBUG_INFO, "BSP Microcode:: signature [0x%08x], ProcessorFlags [0x%08x], \ + MicroData [0x%08x], Revision [0x%08x]\n", Eax.Uint32, ProcessorFlags, (UINTN) MicrocodeData, LatestRevision)); + } } diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index d8b56f149f..722db2a01f 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -410,7 +410,7 @@ ApInitializeSync ( // // Load microcode on AP // - MicrocodeDetect (CpuMpData); + MicrocodeDetect (CpuMpData, FALSE); // // Sync BSP's MTRR table to AP // @@ -1658,7 +1658,7 @@ MpInitLibInitialize ( // // Load Microcode on BSP // - MicrocodeDetect (CpuMpData); + MicrocodeDetect (CpuMpData, TRUE); // // Store BSP's MTRR setting // diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index 9aedb52636..6958080ac1 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -245,6 +245,11 @@
[edk2] [Patch v3 1/3] UefiCpuPkg/MpInitLib: Relocate uCode to memory to save time.
Read uCode from memory has better performance than from flash. But it needs extra effort to let BSP copy uCode from flash to memory. Also BSP already enable cache in SEC phase, so it use less time to relocate uCode from flash to memory. After verification, if system has more than one processor, it will reduce some time if load uCode from memory. This change enable this optimization. V3 changes: Remove the ASSERT which is not correct. Cc: Laszlo Ersek Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index 108eea0a6f..d8b56f149f 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1520,6 +1520,7 @@ MpInitLibInitialize ( UINTNApResetVectorSize; UINTNBackupBufferAddr; UINTNApIdtBase; + VOID *MicrocodePatchInRam; OldCpuMpData = GetCpuMpDataFromGuidedHob (); if (OldCpuMpData == NULL) { @@ -1587,8 +1588,38 @@ MpInitLibInitialize ( CpuMpData->SwitchBspFlag= FALSE; CpuMpData->CpuData = (CPU_AP_DATA *) (CpuMpData + 1); CpuMpData->CpuInfoInHob = (UINT64) (UINTN) (CpuMpData->CpuData + MaxLogicalProcessorNumber); - CpuMpData->MicrocodePatchAddress= PcdGet64 (PcdCpuMicrocodePatchAddress); CpuMpData->MicrocodePatchRegionSize = PcdGet64 (PcdCpuMicrocodePatchRegionSize); + // + // If platform has more than one CPU, relocate microcode to memory to reduce + // loading microcode time. + // + MicrocodePatchInRam = NULL; + if (MaxLogicalProcessorNumber > 1) { +MicrocodePatchInRam = AllocatePages ( +EFI_SIZE_TO_PAGES ( + (UINTN)CpuMpData->MicrocodePatchRegionSize + ) +); + } + if (MicrocodePatchInRam == NULL) { +// +// there is only one processor, or no microcode patch is available, or +// memory allocation failed +// +CpuMpData->MicrocodePatchAddress = PcdGet64 (PcdCpuMicrocodePatchAddress); + } else { +// +// there are multiple processors, and a microcode patch is available, and +// memory allocation succeeded +// +CopyMem ( + MicrocodePatchInRam, + (VOID *)(UINTN)PcdGet64 (PcdCpuMicrocodePatchAddress), + (UINTN)CpuMpData->MicrocodePatchRegionSize + ); +CpuMpData->MicrocodePatchAddress = (UINTN)MicrocodePatchInRam; + } + InitializeSpinLock(>MpLock); // -- 2.15.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch v3 0/3] Optimize load uCode performance
Use below three rules to optimize load uCode performance: 1. Let BSP relocate uCode from flash to memory for better performance. 2. BSP caches the CPU ID and address of uCode so AP doesnt need to look for the uCode again if the CPU ID is same as BSPs. 3. Only apply uCode in one thread of a core when hyper threading is enabled. v2 changes: Fix potential issue if allocate memory failed. V3 Changes: Remove the ASSERT code which is not correct. Test: Use an sample platform which has 1 socket, 4 core, 8 threads, the CpuMpPei driver cost time reduce from 108.4ms to 27.2ms Eric Dong (3): UefiCpuPkg/MpInitLib: Use BSP uCode for APs if possible. UefiCpuPkg/MpInitLib: Load uCode once for each core. UefiCpuPkg/MpInitLib: Relocate uCode to memory to save time. UefiCpuPkg/Library/MpInitLib/Microcode.c | 43 +--- UefiCpuPkg/Library/MpInitLib/MpLib.c | 38 +--- UefiCpuPkg/Library/MpInitLib/MpLib.h | 11 ++-- 3 files changed, 84 insertions(+), 8 deletions(-) -- 2.15.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [staging/FmpDevicePkg-master][PATCH] BaseTools GenerateCapsule: Change property to executable for Linux
Reviewed-by: Michael D Kinney Mike > -Original Message- > From: edk2-devel [mailto:edk2-devel- > boun...@lists.01.org] On Behalf Of Star Zeng > Sent: Monday, July 16, 2018 3:42 AM > To: edk2-devel@lists.01.org > Cc: Kinney, Michael D ; > Zeng, Star > Subject: [edk2] [staging/FmpDevicePkg-master][PATCH] > BaseTools GenerateCapsule: Change property to > executable for Linux > > Cc: Michael D Kinney > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > BaseTools/BinWrappers/PosixLike/GenerateCapsule | 0 > 1 file changed, 0 insertions(+), 0 deletions(-) > mode change 100644 => 100755 > BaseTools/BinWrappers/PosixLike/GenerateCapsule > > diff --git > a/BaseTools/BinWrappers/PosixLike/GenerateCapsule > b/BaseTools/BinWrappers/PosixLike/GenerateCapsule > old mode 100644 > new mode 100755 > -- > 2.7.4 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] SecurityPkg: Fix assert when setting key from eMMC/SD/USB
Laszlo already filed one - https://bugzilla.tianocore.org/show_bug.cgi?id=1008 I suggest we add to UefiLib instead of fixing all individual driver. Thank you Yao Jiewen > -Original Message- > From: Zhang, Chao B > Sent: Monday, July 16, 2018 11:10 PM > To: rba...@gmail.com; edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Laszlo Ersek ; > Vladimir Olovyannikov > Subject: RE: [PATCH v2] SecurityPkg: Fix assert when setting key from > eMMC/SD/USB > > Hi Bacik: >Tks for the fix. Would you please file another report in Bugzilla for > RamDisk > & Tls Configuration driver? They have same issue as SecureBootConfig driver > > -Original Message- > From: rba...@gmail.com [mailto:rba...@gmail.com] > Sent: Wednesday, July 11, 2018 6:51 AM > To: edk2-devel@lists.01.org > Cc: Zhang, Chao B ; Yao, Jiewen > ; Laszlo Ersek ; Vladimir > Olovyannikov > Subject: [PATCH v2] SecurityPkg: Fix assert when setting key from > eMMC/SD/USB > > From: Roman Bacik > > When secure boot is enabled, if one loads keys from a FAT formatted > eMMC/SD/USB when trying to provision PK/KEK/DB keys via the menu, an > assert in StrLen() occurs. > This is because the filename starts on odd address, which is not a uint16 > aligned boundary: https://bugzilla.tianocore.org/show_bug.cgi?id=1003 > > Cc: Chao Zhang > Cc: Jiewen Yao > Cc: Laszlo Ersek > Cc: Vladimir Olovyannikov > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Roman Bacik > --- > > SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFil > eExplorer.c | 13 +++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git > a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > FileExplorer.c > b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > FileExplorer.c > index 1b6f88804275..19b13a5569a6 100644 > --- > a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig > FileExplorer.c > +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo > +++ nfigFileExplorer.c > @@ -123,6 +123,8 @@ OpenFileByDevicePath( >EFI_FILE_PROTOCOL *Handle1; >EFI_FILE_PROTOCOL *Handle2; >EFI_HANDLE DeviceHandle; > + CHAR16 *PathName; > + UINTN PathLength; > >if ((FilePath == NULL || FileHandle == NULL)) { > return EFI_INVALID_PARAMETER; > @@ -173,6 +175,11 @@ OpenFileByDevicePath( > // > Handle2 = Handle1; > Handle1 = NULL; > +PathLength = DevicePathNodeLength(*FilePath) - > sizeof(EFI_DEVICE_PATH_PROTOCOL); > +PathName = AllocateCopyPool(PathLength, > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName); > +if (PathName == NULL) { > + return EFI_OUT_OF_RESOURCES; > +} > > // > // Try to test opening an existing file @@ -180,7 +187,7 @@ > OpenFileByDevicePath( > Status = Handle2->Open ( >Handle2, >, > - > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, > + PathName, >OpenMode &~EFI_FILE_MODE_CREATE, >0 > ); > @@ -192,7 +199,7 @@ OpenFileByDevicePath( >Status = Handle2->Open ( > Handle2, > , > - > ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, > +PathName, > OpenMode, > Attributes > ); > @@ -202,6 +209,8 @@ OpenFileByDevicePath( > // > Handle2->Close (Handle2); > > +FreePool (PathName); > + > if (EFI_ERROR(Status)) { >return (Status); > } > -- > 2.17.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] SecurityPkg: Fix assert when setting key from eMMC/SD/USB
Hi Bacik: Tks for the fix. Would you please file another report in Bugzilla for RamDisk & Tls Configuration driver? They have same issue as SecureBootConfig driver -Original Message- From: rba...@gmail.com [mailto:rba...@gmail.com] Sent: Wednesday, July 11, 2018 6:51 AM To: edk2-devel@lists.01.org Cc: Zhang, Chao B ; Yao, Jiewen ; Laszlo Ersek ; Vladimir Olovyannikov Subject: [PATCH v2] SecurityPkg: Fix assert when setting key from eMMC/SD/USB From: Roman Bacik When secure boot is enabled, if one loads keys from a FAT formatted eMMC/SD/USB when trying to provision PK/KEK/DB keys via the menu, an assert in StrLen() occurs. This is because the filename starts on odd address, which is not a uint16 aligned boundary: https://bugzilla.tianocore.org/show_bug.cgi?id=1003 Cc: Chao Zhang Cc: Jiewen Yao Cc: Laszlo Ersek Cc: Vladimir Olovyannikov Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Roman Bacik --- SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c index 1b6f88804275..19b13a5569a6 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigFileExplorer.c @@ -123,6 +123,8 @@ OpenFileByDevicePath( EFI_FILE_PROTOCOL *Handle1; EFI_FILE_PROTOCOL *Handle2; EFI_HANDLE DeviceHandle; + CHAR16 *PathName; + UINTN PathLength; if ((FilePath == NULL || FileHandle == NULL)) { return EFI_INVALID_PARAMETER; @@ -173,6 +175,11 @@ OpenFileByDevicePath( // Handle2 = Handle1; Handle1 = NULL; +PathLength = DevicePathNodeLength(*FilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); +PathName = AllocateCopyPool(PathLength, ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName); +if (PathName == NULL) { + return EFI_OUT_OF_RESOURCES; +} // // Try to test opening an existing file @@ -180,7 +187,7 @@ OpenFileByDevicePath( Status = Handle2->Open ( Handle2, , - ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, + PathName, OpenMode &~EFI_FILE_MODE_CREATE, 0 ); @@ -192,7 +199,7 @@ OpenFileByDevicePath( Status = Handle2->Open ( Handle2, , -((FILEPATH_DEVICE_PATH*)*FilePath)->PathName, +PathName, OpenMode, Attributes ); @@ -202,6 +209,8 @@ OpenFileByDevicePath( // Handle2->Close (Handle2); +FreePool (PathName); + if (EFI_ERROR(Status)) { return (Status); } -- 2.17.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v4 6/9] ArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
> On 16 Jul 2018, at 17:07, Ni, Ruiyu wrote: > > Can someone give a r-b for this patch? > Is Ack-by enough for a check-in? Hi Ray, Please go ahead and merge this patch with my ack. Ard. > >> -Original Message- >> From: Ard Biesheuvel >> Sent: Wednesday, July 11, 2018 10:21 PM >> To: Ni, Ruiyu >> Cc: edk2-devel@lists.01.org; Leif Lindholm >> Subject: Re: [PATCH v4 6/9] ArmPkg/PlatformBDS: Implement >> PlatformBootManagerUnableToBoot >> >>> On 4 July 2018 at 03:50, Ruiyu Ni wrote: >>> Contributed-under: TianoCore Contribution Agreement 1.1 >>> Signed-off-by: Ruiyu Ni >>> Cc: Leif Lindholm >>> Cc: Ard Biesheuvel >> >> Acked-by: Ard Biesheuvel >> >>> --- >>> ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 18 >>> +- >>> 1 file changed, 17 insertions(+), 1 deletion(-) >>> >>> diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c >>> b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c >>> index 079f1552d5..f9c71d430c 100644 >>> --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c >>> +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c >>> @@ -3,7 +3,7 @@ >>> >>> Copyright (C) 2015-2016, Red Hat, Inc. >>> Copyright (c) 2014, ARM Ltd. All rights reserved. >>> - Copyright (c) 2004 - 2016, Intel Corporation. All rights >>> reserved. >>> + Copyright (c) 2004 - 2018, Intel Corporation. All rights >>> + reserved. >>> Copyright (c) 2016, Linaro Ltd. All rights reserved. >>> >>> This program and the accompanying materials are licensed and made >>> available @@ -766,3 +766,19 @@ PlatformBootManagerWaitCallback ( >>> Print (L"."); >>> } >>> } >>> + >>> +/** >>> + The function is called when no boot option could be launched, >>> + including platform recovery options and options pointing to >>> +applications >>> + built into firmware volumes. >>> + >>> + If this function returns, BDS attempts to enter an infinite loop. >>> +**/ >>> +VOID >>> +EFIAPI >>> +PlatformBootManagerUnableToBoot ( >>> + VOID >>> + ) >>> +{ >>> + return; >>> +} >>> -- >>> 2.16.1.windows.1 >>> ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [staging/FmpDevicePkg-master][PATCH] BaseTools GenerateCapsule: Change property to executable for Linux
Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- BaseTools/BinWrappers/PosixLike/GenerateCapsule | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 BaseTools/BinWrappers/PosixLike/GenerateCapsule diff --git a/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/BaseTools/BinWrappers/PosixLike/GenerateCapsule old mode 100644 new mode 100755 -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Fixed build Ovmfpkg failed issue.
This patch fixes the regression issues caused by 543f5ac30facfbb40eafb2b4908649a427784080. Without this fix, OvmfPkg will build failure. Thanks Liming >-Original Message- >From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >BobCF >Sent: Monday, July 16, 2018 5:39 PM >To: edk2-devel@lists.01.org >Cc: Gao, Liming >Subject: [edk2] [Patch] BaseTools: Fixed build Ovmfpkg failed issue. > >Fixed a code bug. > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Bob Feng >Cc: Liming Gao >--- > BaseTools/Source/Python/Workspace/DscBuildData.py | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index 804eafa619..e8b36a3868 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -1293,14 +1293,14 @@ class DscBuildData(PlatformBuildClassObject): > def OverrideByFdfOverAll(self,AllPcds): > > if GlobalData.gFdfParser is None: > return AllPcds > NoFiledValues = GlobalData.gFdfParser.Profile.PcdDict >-for Guid,Name,Field in NoFiledValues: >+for Name,Guid,Field in NoFiledValues: > if len(Field): > continue >-Value = NoFiledValues[(Guid,Name,Field)] >+Value = NoFiledValues[(Name,Guid,Field)] > if (Name,Guid) in AllPcds: > Pcd = AllPcds.get((Name,Guid)) > if >isinstance(self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName), >None),StructurePcd): > >self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName)).PcdValu >eFromComm = Value > else: >@@ -1323,11 +1323,11 @@ class DscBuildData(PlatformBuildClassObject): > MaxSize = max(CurrentSize, OptionSize) > Pcd.MaxDatumSize = str(MaxSize) > else: > PcdInDec = self.DecPcds.get((Name,Guid)) > if PcdInDec: >-PcdInDec.PcdValueFromComm = Value >+PcdInDec.PcdValueFromFdf = Value > if PcdInDec.Type in >[self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > >self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE], > >self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG]]: > self.Pcds[Name, Guid] = copy.deepcopy(PcdInDec) > self.Pcds[Name, Guid].DefaultValue = Value >-- >2.16.2.windows.1 > >___ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fixed build Ovmfpkg failed issue.
Fixed a code bug. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao --- BaseTools/Source/Python/Workspace/DscBuildData.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 804eafa619..e8b36a3868 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1293,14 +1293,14 @@ class DscBuildData(PlatformBuildClassObject): def OverrideByFdfOverAll(self,AllPcds): if GlobalData.gFdfParser is None: return AllPcds NoFiledValues = GlobalData.gFdfParser.Profile.PcdDict -for Guid,Name,Field in NoFiledValues: +for Name,Guid,Field in NoFiledValues: if len(Field): continue -Value = NoFiledValues[(Guid,Name,Field)] +Value = NoFiledValues[(Name,Guid,Field)] if (Name,Guid) in AllPcds: Pcd = AllPcds.get((Name,Guid)) if isinstance(self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName), None),StructurePcd): self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName)).PcdValueFromComm = Value else: @@ -1323,11 +1323,11 @@ class DscBuildData(PlatformBuildClassObject): MaxSize = max(CurrentSize, OptionSize) Pcd.MaxDatumSize = str(MaxSize) else: PcdInDec = self.DecPcds.get((Name,Guid)) if PcdInDec: -PcdInDec.PcdValueFromComm = Value +PcdInDec.PcdValueFromFdf = Value if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE], self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG]]: self.Pcds[Name, Guid] = copy.deepcopy(PcdInDec) self.Pcds[Name, Guid].DefaultValue = Value -- 2.16.2.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v4 6/9] ArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Can someone give a r-b for this patch? Is Ack-by enough for a check-in? Thanks/Ray > -Original Message- > From: Ard Biesheuvel > Sent: Wednesday, July 11, 2018 10:21 PM > To: Ni, Ruiyu > Cc: edk2-devel@lists.01.org; Leif Lindholm > Subject: Re: [PATCH v4 6/9] ArmPkg/PlatformBDS: Implement > PlatformBootManagerUnableToBoot > > On 4 July 2018 at 03:50, Ruiyu Ni wrote: > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ruiyu Ni > > Cc: Leif Lindholm > > Cc: Ard Biesheuvel > > Acked-by: Ard Biesheuvel > > > --- > > ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 18 > > +- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > index 079f1552d5..f9c71d430c 100644 > > --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > @@ -3,7 +3,7 @@ > > > >Copyright (C) 2015-2016, Red Hat, Inc. > >Copyright (c) 2014, ARM Ltd. All rights reserved. > > - Copyright (c) 2004 - 2016, Intel Corporation. All rights > > reserved. > > + Copyright (c) 2004 - 2018, Intel Corporation. All rights > > + reserved. > >Copyright (c) 2016, Linaro Ltd. All rights reserved. > > > >This program and the accompanying materials are licensed and made > > available @@ -766,3 +766,19 @@ PlatformBootManagerWaitCallback ( > > Print (L"."); > >} > > } > > + > > +/** > > + The function is called when no boot option could be launched, > > + including platform recovery options and options pointing to > > +applications > > + built into firmware volumes. > > + > > + If this function returns, BDS attempts to enter an infinite loop. > > +**/ > > +VOID > > +EFIAPI > > +PlatformBootManagerUnableToBoot ( > > + VOID > > + ) > > +{ > > + return; > > +} > > -- > > 2.16.1.windows.1 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: fix incorrect check of SMM mode
Reviewed-by: Eric Dong > -Original Message- > From: Wang, Jian J > Sent: Friday, July 13, 2018 1:54 PM > To: edk2-devel@lists.01.org > Cc: Dong, Eric ; Laszlo Ersek ; > Yao, Jiewen ; Zeng, Star > Subject: [PATCH] UefiCpuPkg/CpuDxe: fix incorrect check of SMM mode > > Current IsInSmm() method makes use of gEfiSmmBase2ProtocolGuid.InSmm() > to check if current processor is in SMM mode or not. But this is not correct > because gEfiSmmBase2ProtocolGuid.InSmm() can only detect if the caller is > running in SMRAM or from SMM driver. It cannot guarantee if the caller is > running in SMM mode. Because SMM mode will load its own page table, > adding an extra check of saved DXE page table base address against current > CR3 register value can help to get the correct answer for sure (in SMM mode > or not in SMM mode). > > This is an issue caused by check-in at > > d106cf71eabaacff63c14626a4a87346b93074dd > > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Jiewen Yao > Cc: Star Zeng > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > UefiCpuPkg/CpuDxe/CpuPageTable.c | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c > b/UefiCpuPkg/CpuDxe/CpuPageTable.c > index 850eed60e7..df021798c0 100644 > --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c > +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c > @@ -136,7 +136,14 @@ IsInSmm ( > mSmmBase2->InSmm (mSmmBase2, ); >} > > - return InSmm; > + // > + // mSmmBase2->InSmm() can only detect if the caller is running in > + SMRAM // or from SMM driver. It cannot tell if the caller is running in > SMM mode. > + // Check page table base address to guarantee that because SMM mode > + willl // load its own page table. > + // > + return (InSmm && > + mPagingContext.ContextData.X64.PageTableBase != > + (UINT64)AsmReadCr3()); > } > > /** > -- > 2.16.2.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] SecurityPkg:Tcg: Fix comment typos
Reviewed-by: Long Qin (BTW: Please remove the extra "Signed-off-by" signature) Best Regards & Thanks, LONG, Qin > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Zhang, Chao B > Sent: Monday, July 16, 2018 3:21 PM > To: edk2-devel@lists.01.org > Cc: Long Qin ; Yao, Jiewen ; > Zhang, Chao B > Subject: [edk2] [Patch] SecurityPkg:Tcg: Fix comment typos > > "Triggle" is a typo. Fix it with "Trigger" > > Cc: Long Qin > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chao Zhang > Signed-off-by: Zhang, Chao B > --- > SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 16 > SecurityPkg/Tcg/TcgSmm/Tpm.asl | 16 > 2 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl > b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 50dea0ab9a..471b6b1fa1 100644 > --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl > +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl > @@ -257,16 +257,16 @@ DefinitionBlock ( >// Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. >// >If (LNot (And (MORD, 0x10))) >{ > // > -// Triggle the SMI through ACPI _PTS method. > +// Trigger the SMI through ACPI _PTS method. > // > Store (0x02, MCIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (MCIN, IOB2) >} > } > Return (0) > @@ -363,11 +363,11 @@ DefinitionBlock ( > Store (DerefOf (Index (Arg2, 0x00)), PPRQ) > Store (0, PPRM) > Store (0x02, PPIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (PPIN, IOB2) > Return (FRET) > > > @@ -394,11 +394,11 @@ DefinitionBlock ( > // e) Return TPM Operation Response to OS Environment > // > Store (0x05, PPIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (PPIN, IOB2) > > Store (LPPR, Index (TPM3, 0x01)) > Store (PPRP, Index (TPM3, 0x02)) @@ -426,11 +426,11 @@ > DefinitionBlock ( > If (LEqual (PPRQ, 23)) { >Store (DerefOf (Index (Arg2, 0x01)), PPRM) > } > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (PPIN, IOB2) > Return (FRET) >} >Case (8) > @@ -440,11 +440,11 @@ DefinitionBlock ( > // > Store (8, PPIP) > Store (DerefOf (Index (Arg2, 0x00)), UCRQ) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (PPIN, IOB2) > > Return (FRET) >} > @@ -474,16 +474,16 @@ DefinitionBlock ( > // Save the Operation Value of the Request to MORD (reserved > memory) > // > Store (DerefOf (Index (Arg2, 0x00)), MORD) > > // > -// Triggle the SMI through ACPI _DSM method. > +// Trigger the SMI through ACPI _DSM method. > // > Store (0x01, MCIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (MCIN, IOB2) > Return (MRET) >} >Default {BreakPoint} > diff --git a/SecurityPkg/Tcg/TcgSmm/Tpm.asl > b/SecurityPkg/Tcg/TcgSmm/Tpm.asl index 12f24f3996..2114283b45 100644 > --- a/SecurityPkg/Tcg/TcgSmm/Tpm.asl > +++ b/SecurityPkg/Tcg/TcgSmm/Tpm.asl > @@ -93,16 +93,16 @@ DefinitionBlock ( >// Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. >// >If (LNot (And (MORD, 0x10))) >{ > // > -// Triggle the SMI through ACPI _PTS method. > +// Trigger the SMI through ACPI _PTS method. > // > Store (0x02, MCIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (MCIN, IOB2) >} > } > Return (0) > @@ -198,11 +198,11 @@ DefinitionBlock ( > > Store (DerefOf (Index (Arg2, 0x00)), PPRQ) > Store (0x02, PPIP) > > // > -// Triggle the SMI interrupt > +// Trigger the SMI interrupt > // > Store (PPIN, IOB2) > Return (FRET) > > > @@ -229,11 +229,11 @@ DefinitionBlock ( > // e) Return TPM Operation Response to OS Environment > // >
Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI
Hello Ting, As you recommended with shell based IP assignment we are able to use the IP6 Static IP bases ISCSI connection. Thanks for your detailed clarification. -Siva -Original Message- From: Ye, Ting [mailto:ting...@intel.com] Sent: Wednesday, July 4, 2018 1:17 PM To: Sivaraman Nainar; edk2-devel@lists.01.org Subject: RE: reg: IP6 based Static IP Configuration in ISCSI Hi Siva, Yes iSCSI UI does not allow the user to configure static IP address for initiator. But it does not mean iSCSI initiator cannot use existing IPv6 address which is previously configured by using "ifconfig6" in Shell. You may have a try. Thanks, Ting -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Sivaraman Nainar Sent: Wednesday, July 4, 2018 3:04 PM To: Ye, Ting ; edk2-devel@lists.01.org Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI Hello Ting, What I am trying to do is setting STATIC IP for Initiator. But as per below VFR content, when we choose IP6 the controls to accept Static IP will be disabled. Right? suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG; -Siva -Original Message- From: Ye, Ting [mailto:ting...@intel.com] Sent: Wednesday, July 4, 2018 12:12 PM To: Sivaraman Nainar; edk2-devel@lists.01.org Subject: RE: reg: IP6 based Static IP Configuration in ISCSI Hi Siva, No, it is not correct. In iSCSI UI, if you choose IP6 mode, you still have chance to use static address. Just NOT click the checkbox of "Enable DHCP". Thanks, Ting -Original Message- From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in] Sent: Wednesday, July 4, 2018 2:32 PM To: Ye, Ting ; edk2-devel@lists.01.org Subject: RE: reg: IP6 based Static IP Configuration in ISCSI Ting, Let me clarify in detail. When we have IP4 mode selection in ISCSI we can set both Initiator and Target with Static Addresses. But if we choose the IP6 mode by default no setup options available to choose static and it take DHCP as default. In this case even if we configure IP6 using IfConfig6, it will override by ISCSI. Is my understanding correct? Thanks Siva -Original Message- From: Ye, Ting [mailto:ting...@intel.com] Sent: Wednesday, July 4, 2018 7:37 AM To: Sivaraman Nainar; edk2-devel@lists.01.org Subject: RE: reg: IP6 based Static IP Configuration in ISCSI Hi Siva, We don't have such plan as I known. For IPv6, we leave it to IP6 driver to perform source address selection to best match the iSCSI target address. You could use ifconfig6 to set static IP6 address before you configure iSCSI. Thanks, Ting -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Sivaraman Nainar Sent: Tuesday, July 3, 2018 6:44 PM To: edk2-devel@lists.01.org Subject: [edk2] reg: IP6 based Static IP Configuration in ISCSI Hello, At present in the ISCSI configuration we are able to specify the Static IP configuration for IP4 protocol. Is there any plan to support IP6 static IP configuration in ISCSI Configuration? -Siva ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] SecurityPkg:Tcg: Fix comment typos
"Triggle" is a typo. Fix it with "Trigger" Cc: Long Qin Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang Signed-off-by: Zhang, Chao B --- SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 16 SecurityPkg/Tcg/TcgSmm/Tpm.asl | 16 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 50dea0ab9a..471b6b1fa1 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl @@ -257,16 +257,16 @@ DefinitionBlock ( // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. // If (LNot (And (MORD, 0x10))) { // -// Triggle the SMI through ACPI _PTS method. +// Trigger the SMI through ACPI _PTS method. // Store (0x02, MCIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (MCIN, IOB2) } } Return (0) @@ -363,11 +363,11 @@ DefinitionBlock ( Store (DerefOf (Index (Arg2, 0x00)), PPRQ) Store (0, PPRM) Store (0x02, PPIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Return (FRET) @@ -394,11 +394,11 @@ DefinitionBlock ( // e) Return TPM Operation Response to OS Environment // Store (0x05, PPIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Store (LPPR, Index (TPM3, 0x01)) Store (PPRP, Index (TPM3, 0x02)) @@ -426,11 +426,11 @@ DefinitionBlock ( If (LEqual (PPRQ, 23)) { Store (DerefOf (Index (Arg2, 0x01)), PPRM) } // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Return (FRET) } Case (8) @@ -440,11 +440,11 @@ DefinitionBlock ( // Store (8, PPIP) Store (DerefOf (Index (Arg2, 0x00)), UCRQ) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Return (FRET) } @@ -474,16 +474,16 @@ DefinitionBlock ( // Save the Operation Value of the Request to MORD (reserved memory) // Store (DerefOf (Index (Arg2, 0x00)), MORD) // -// Triggle the SMI through ACPI _DSM method. +// Trigger the SMI through ACPI _DSM method. // Store (0x01, MCIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (MCIN, IOB2) Return (MRET) } Default {BreakPoint} diff --git a/SecurityPkg/Tcg/TcgSmm/Tpm.asl b/SecurityPkg/Tcg/TcgSmm/Tpm.asl index 12f24f3996..2114283b45 100644 --- a/SecurityPkg/Tcg/TcgSmm/Tpm.asl +++ b/SecurityPkg/Tcg/TcgSmm/Tpm.asl @@ -93,16 +93,16 @@ DefinitionBlock ( // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect. // If (LNot (And (MORD, 0x10))) { // -// Triggle the SMI through ACPI _PTS method. +// Trigger the SMI through ACPI _PTS method. // Store (0x02, MCIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (MCIN, IOB2) } } Return (0) @@ -198,11 +198,11 @@ DefinitionBlock ( Store (DerefOf (Index (Arg2, 0x00)), PPRQ) Store (0x02, PPIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Return (FRET) @@ -229,11 +229,11 @@ DefinitionBlock ( // e) Return TPM Operation Response to OS Environment // Store (0x05, PPIP) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Store (LPPR, Index (TPM3, 0x01)) Store (PPRP, Index (TPM3, 0x02)) @@ -257,11 +257,11 @@ DefinitionBlock ( // Store (7, PPIP) Store (DerefOf (Index (Arg2, 0x00)), PPRQ) // -// Triggle the SMI interrupt +// Trigger the SMI interrupt // Store (PPIN, IOB2) Return (FRET) } Case (8) @@ -271,11 +271,11 @@ DefinitionBlock ( //
[edk2] [staging/FmpDevicePkg-UDK2018] staging/FmpDevicePkg-UDK2018: Update Readme.MD for new branch
Update Readme.MD for the FmpDevicePkg-UDK2018 branch in the edk2-staging repository. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- CryptoPkg/Library/OpensslLib/openssl | 2 +- Readme.md| 159 +++ 2 files changed, 160 insertions(+), 1 deletion(-) diff --git a/CryptoPkg/Library/OpensslLib/openssl b/CryptoPkg/Library/OpensslLib/openssl index b2758a2292..d4e4bd2a81 16 --- a/CryptoPkg/Library/OpensslLib/openssl +++ b/CryptoPkg/Library/OpensslLib/openssl @@ -1 +1 @@ -Subproject commit b2758a2292aceda93e9f44c219b94fe21bb9a650 +Subproject commit d4e4bd2a8163f355fa8a3884077eaec7adc75ff7 diff --git a/Readme.md b/Readme.md index 1ef0780ee0..300047b435 100644 --- a/Readme.md +++ b/Readme.md @@ -27,3 +27,162 @@ are listed in [Maintainers.txt](Maintainers.txt). * [Mailing Lists](https://github.com/tianocore/tianocore.github.io/wiki/Mailing-Lists) * [TianoCore Bugzilla](https://bugzilla.tianocore.org) * [How To Contribute](https://github.com/tianocore/tianocore.github.io/wiki/How-To-Contribute) + +# FmpDevicePkg-UDK2018 edk2-staging branch + +The FmpDevicePkg provides a simple method to support UEFI Capsules for firmware +update of system firmware or devices using the Firmware Management Protocol. + +The content in this edk2-staging branch is based on content from the following: + + https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg + +The Firmware Management Protocol advertises that a component supports a firmware +update using a UEFI capsule. The FmpDevicePkg provides library classes and PCDs +used to customize the behavior of a Firmware Management Protocol instance. + +## Goals +The goal of this branch in edk2-staging is to provide a version of the source +code that can be used to validate the functionality before it is added to +edk2/master. The target date for integration into edk2/master is early August +2018. + +## Developers +* Michael D Kinney +* Sean Brogan +* Jiewen Yao +* Yonghong Zhu +* Liming Gao +* Ruiyu Ni +* Star Zeng +* Eric Dong +* David Wei +* Mang Guo + +## Library Classes +* FmpDeviceLib - Provides firmware device specific services + to support updates of a firmware image stored in a firmware + device. +* CapsuleUpdatePolicyLib - Provides platform policy services + used during a capsule update. +* FmpPayloadHeaderLib - Provides services to retrieve values + from a capsule's FMP Payload Header. The structure is not + included in the library class. Instead, services are + provided to retrieve information from the FMP Payload Header. + If information is added to the FMP Payload Header, then new + services may be added to this library class to retrieve the + new information. + +## PCDs set per module +* PcdFmpDeviceSystemResetRequired - Indicates if a full + system reset is required before a firmware update to a + firmware devices takes effect +* PcdFmpDeviceTestKeySha256Digest - The SHA-256 hash of a + PKCS7 test key that is used to detect if a test key is + being used to authenticate capsules. Test key detection + is disabled by setting the value to {0}. +* PcdFmpDeviceProgressColor - The color of the progress bar + during a firmware update. +* PcdFmpDeviceImageIdName - The Null-terminated Unicode + string used to fill in the ImageIdName field of the + EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned + by the GetImageInfo() service of the Firmware Management + Protocol for the firmware device. +* PcdFmpDeviceBuildTimeLowestSupportedVersion - The build + time value used to fill in the LowestSupportedVersion field + of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is + returned by the GetImageInfo() service of the Firmware + Management Protocol. +* PcdFmpDeviceProgressWatchdogTimeInSeconds - The time in + seconds to arm a watchdog timer during the update of a + firmware device. + +## PCDs set per module or for entire platform +* PcdFmpDevicePkcs7CertBufferXdr - One or more PKCS7 + certificates used to verify a firmware device capsule + update image. +* PcdFmpDeviceLockEventGuid - An event GUID that locks + the firmware device when the event is signaled. + +## GenerateCapsule tool to create UEFI Capsules +* GenerateCapsule is a new standalone tool that is used to create a UEFI + capsule that can be processed by an FmpDxe module from the FmpDevicePkg. + +``` +usage: GenerateCapsule [-h] [-o OUTPUTFILE] (-e | -d | --dump-info) + [--capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}] + [--capoemflag CAPSULEOEMFLAG] [--guid GUID] + [--hardware-instance HARDWAREINSTANCE] + [--monotonic-count MONOTONICCOUNT] + [--fw-version FWVERSION] [--lsv LOWESTSUPPORTEDVERSION] + [--pfx-file SIGNTOOLPFXFILE] +