[edk2-devel] Fw: [PATCH] MdeModulePkg: Fix various typos
CC the maintainers. This is only a small subset of all the spelling/typo issues from MdeModulePkg. But I don't want to overload you with too much to review, so I'll only post one MdeModulePkg batch at a time. Coeur Gesendet: Samstag, 13. Juli 2019 um 12:57 Uhr Von: "Antoine Cœur" An: devel@edk2.groups.io Cc: "Antoine Cœur" Betreff: [PATCH] MdeModulePkg: Fix various typos Fix various typos in MdeModulePkg. Signed-off-by: Coeur --- .../Application/CapsuleApp/CapsuleApp.c | 2 +- .../Application/CapsuleApp/CapsuleDump.c | 6 ++--- .../PlatformVarCleanupLib/PlatVarCleanupLib.c | 10 +++ MdeModulePkg/MdeModulePkg.dec | 26 +-- MdeModulePkg/MdeModulePkg.uni | 8 +++--- .../Universal/DevicePathDxe/DevicePathDxe.uni | 4 +-- .../Disk/RamDiskDxe/RamDiskProtocol.c | 2 +- .../EbcDxe/EbcDebugger/EdbCmdSymbol.c | 10 +++ .../PlatDriOverrideDxe.uni | 10 +++ 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c index 3439ce5feb..4034714773 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c @@ -494,7 +494,7 @@ BuildGatherList ( } // - // Record descirptor header + // Record descriptor header // if (Index == 0) { BlockDescriptorsHeader = BlockDescriptors1; diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c index 58a93568d0..d623d7c809 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -38,7 +38,7 @@ DumpUxCapsule ( { EFI_DISPLAY_CAPSULE *DisplayCapsule; DisplayCapsule = (EFI_DISPLAY_CAPSULE *)CapsuleHeader; - Print(L"[UxCapusule]\n"); + Print(L"[UxCapsule]\n"); Print(L"CapsuleHeader:\n"); Print(L" CapsuleGuid - %g\n", >CapsuleHeader.CapsuleGuid); Print(L" HeaderSize - 0x%x\n", DisplayCapsule->CapsuleHeader.HeaderSize); @@ -199,7 +199,7 @@ DumpCapsule ( DumpFmpCapsule(CapsuleHeader); } if (IsNestedFmpCapsule(CapsuleHeader)) { - Print(L"[NestedCapusule]\n"); + Print(L"[NestedCapsule]\n"); Print(L"CapsuleHeader:\n"); Print(L" CapsuleGuid - %g\n", >CapsuleGuid); Print(L" HeaderSize - 0x%x\n", CapsuleHeader->HeaderSize); @@ -793,7 +793,7 @@ DumpCapsuleFromDisk ( goto Done; } - Print(L"The infomation of the capsules:\n"); + Print(L"The information of the capsules:\n"); for (Index = 0; Index < FileCount; Index++) { FileHandle = NULL; diff --git a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c index 968c044a31..d9daf7f86a 100644 --- a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c +++ b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c @@ -260,12 +260,12 @@ CreateUserVariableNode ( ASSERT (UserVariableNameNode->PromptString != NULL); UnicodeSPrint (UserVariableNameNode->PromptString, StringSize, L" %s", UserVariableNameNode->Name); // - // (33 chars of "Attribtues = 0x and DataSize = 0x" + 1 terminator + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16). + // (33 chars of "Attributes = 0x and DataSize = 0x" + 1 terminator + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16). // StringSize = (33 + 1 + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16); UserVariableNameNode->HelpString = AllocatePool (StringSize); ASSERT (UserVariableNameNode->HelpString != NULL); - UnicodeSPrint (UserVariableNameNode->HelpString, StringSize, L"Attribtues = 0x%08x and DataSize = 0x%x", UserVariableNameNode->Attributes, UserVariableNameNode->DataSize); + UnicodeSPrint (UserVariableNameNode->HelpString, StringSize, L"Attributes = 0x%08x and DataSize = 0x%x", UserVariableNameNode->Attributes, UserVariableNameNode->DataSize); UserVariableNameNode->Deleted = FALSE; InsertTailList (>NameLink, >Link); Index++; @@ -332,7 +332,7 @@ DestroyUserVariableNode ( it's caller's responsibility to free the memory after using it. @retval EFI_SUCCESS Create time based payload successfully. - @retval EFI_OUT_OF_RESOURCES There are not enough memory resourses to create time based payload. + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources to create time based payload. @retval EFI_INVALID_PARAMETER The parameter is invalid. @retval Others Unexpected error happens. @@ -416,7 +416,7 @@ CreateTimeBasedPayload ( it's caller's responsibility to free the memory after using it. @retval EFI_SUCCESS Create counter based payload successfully. - @retval EFI_OUT_OF_RESOURCES There are not enough memory resourses to create time based payload. + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources to create time based payload. @retval EFI_INVALID_PARAMETER The parameter is invalid. @retval Others Unexpected error happens. @@ -801,7 +801,7 @@ UpdateUserVariableForm ( @param[out] Progress A pointer to a string filled in with the offset of the most recent '&' before the
[edk2-devel] [PATCH] MdeModulePkg: Fix various typos
Fix various typos in MdeModulePkg. Signed-off-by: Coeur --- .../Application/CapsuleApp/CapsuleApp.c | 2 +- .../Application/CapsuleApp/CapsuleDump.c | 6 ++--- .../PlatformVarCleanupLib/PlatVarCleanupLib.c | 10 +++ MdeModulePkg/MdeModulePkg.dec | 26 +-- MdeModulePkg/MdeModulePkg.uni | 8 +++--- .../Universal/DevicePathDxe/DevicePathDxe.uni | 4 +-- .../Disk/RamDiskDxe/RamDiskProtocol.c | 2 +- .../EbcDxe/EbcDebugger/EdbCmdSymbol.c | 10 +++ .../PlatDriOverrideDxe.uni| 10 +++ 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c index 3439ce5feb..4034714773 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c @@ -494,7 +494,7 @@ BuildGatherList ( } // -// Record descirptor header +// Record descriptor header // if (Index == 0) { BlockDescriptorsHeader = BlockDescriptors1; diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c index 58a93568d0..d623d7c809 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -38,7 +38,7 @@ DumpUxCapsule ( { EFI_DISPLAY_CAPSULE *DisplayCapsule; DisplayCapsule = (EFI_DISPLAY_CAPSULE *)CapsuleHeader; - Print(L"[UxCapusule]\n"); + Print(L"[UxCapsule]\n"); Print(L"CapsuleHeader:\n"); Print(L" CapsuleGuid - %g\n", >CapsuleHeader.CapsuleGuid); Print(L" HeaderSize - 0x%x\n", DisplayCapsule->CapsuleHeader.HeaderSize); @@ -199,7 +199,7 @@ DumpCapsule ( DumpFmpCapsule(CapsuleHeader); } if (IsNestedFmpCapsule(CapsuleHeader)) { -Print(L"[NestedCapusule]\n"); +Print(L"[NestedCapsule]\n"); Print(L"CapsuleHeader:\n"); Print(L" CapsuleGuid - %g\n", >CapsuleGuid); Print(L" HeaderSize - 0x%x\n", CapsuleHeader->HeaderSize); @@ -793,7 +793,7 @@ DumpCapsuleFromDisk ( goto Done; } - Print(L"The infomation of the capsules:\n"); + Print(L"The information of the capsules:\n"); for (Index = 0; Index < FileCount; Index++) { FileHandle = NULL; diff --git a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c index 968c044a31..d9daf7f86a 100644 --- a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c +++ b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c @@ -260,12 +260,12 @@ CreateUserVariableNode ( ASSERT (UserVariableNameNode->PromptString != NULL); UnicodeSPrint (UserVariableNameNode->PromptString, StringSize, L" %s", UserVariableNameNode->Name); // - // (33 chars of "Attribtues = 0x and DataSize = 0x" + 1 terminator + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16). + // (33 chars of "Attributes = 0x and DataSize = 0x" + 1 terminator + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16). // StringSize = (33 + 1 + (sizeof (UINT32) + sizeof (UINTN)) * 2) * sizeof (CHAR16); UserVariableNameNode->HelpString = AllocatePool (StringSize); ASSERT (UserVariableNameNode->HelpString != NULL); - UnicodeSPrint (UserVariableNameNode->HelpString, StringSize, L"Attribtues = 0x%08x and DataSize = 0x%x", UserVariableNameNode->Attributes, UserVariableNameNode->DataSize); + UnicodeSPrint (UserVariableNameNode->HelpString, StringSize, L"Attributes = 0x%08x and DataSize = 0x%x", UserVariableNameNode->Attributes, UserVariableNameNode->DataSize); UserVariableNameNode->Deleted = FALSE; InsertTailList (>NameLink, >Link); Index++; @@ -332,7 +332,7 @@ DestroyUserVariableNode ( it's caller's responsibility to free the memory after using it. @retval EFI_SUCCESS Create time based payload successfully. - @retval EFI_OUT_OF_RESOURCES There are not enough memory resourses to create time based payload. + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources to create time based payload. @retval EFI_INVALID_PARAMETER The parameter is invalid. @retval OthersUnexpected error happens. @@ -416,7 +416,7 @@ CreateTimeBasedPayload ( it's caller's responsibility to free the memory after using it. @retval EFI_SUCCESS Create counter based payload successfully. - @retval EFI_OUT_OF_RESOURCES There are not enough memory resourses to create time based payload. + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources to create time based payload. @retval EFI_INVALID_PARAMETER The parameter is invalid.
Re: [edk2-devel] [edk2-platforms Patch 10/28] Vlv2TbltDevicePkg/bld_vlv.sh: Create Vlv.ROM
Mike, That make sense for me. /Zailiang -Original Message- From: Kinney, Michael D Sent: Saturday, July 13, 2019 7:42 AM To: devel@edk2.groups.io; g...@suse.com; Sun, Zailiang ; Kinney, Michael D Cc: Qian, Yi Subject: RE: [edk2-devel] [edk2-platforms Patch 10/28] Vlv2TbltDevicePkg/bld_vlv.sh: Create Vlv.ROM Zailiang, This appears to be the behavior of GIT when the Author of a patch is not the same as the person who sends the patch email. The "From:" line is shows the Author of the patch and is used to fill in the Author field when the patch email is applied to a git repo. So no edits to the commit messages are required. It will be correct when I push. It is correct in my local git repo/log. Thanks, Mike > -Original Message- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] > On Behalf Of Gary Lin > Sent: Wednesday, July 10, 2019 11:09 PM > To: devel@edk2.groups.io; Sun, Zailiang > > Cc: Kinney, Michael D ; Qian, > Yi > Subject: Re: [edk2-devel] [edk2-platforms Patch 10/28] > Vlv2TbltDevicePkg/bld_vlv.sh: Create Vlv.ROM > > On Thu, Jul 11, 2019 at 04:52:10AM +, Sun, Zailiang > wrote: > > Gary, > > > > I suggest remove the first line "From: Gary Lin > " from the description section since you > have appended the "signed-off-by" declaration. > > > Hi Zailiang, > > That is added by Mike. I'm totally fine if you remove it > when pushing the commits. > > Thanks, > > Gary Lin > > > > -Original Message- > > > From: Kinney, Michael D > > > Sent: Thursday, July 11, 2019 3:05 AM > > > To: devel@edk2.groups.io > > > Cc: Gary Lin ; Sun, Zailiang > > > ; Qian, Yi > > > > Subject: [edk2-platforms Patch 10/28] > Vlv2TbltDevicePkg/bld_vlv.sh: > > > Create Vlv.ROM > > > > > > From: Gary Lin > > > > > > The scripts for PlatformCapsuleGcc.dsc need Vlv.ROM. > > > > > > Cc: Zailiang Sun > > > Cc: Yi Qian > > > Cc: Michael D Kinney > > > Signed-off-by: Gary Lin > > > --- > > > Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git > a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > index 7fd5f44264..c68e59398a 100755 > > > --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > +++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > @@ -199,6 +199,8 @@ echo Skip "Running fce..." > > > > > > > ##*** > * > > > ** > > > ## Build Capsules > > > > > > > ##*** > * > > > ** > > > +cp -f > > > > $WORKSPACE/Build/Vlv2TbltDevicePkg/${TARGET}_${TOOL_CHAIN > _TAG}/F > > > V/VLV.fd \ > > > + > > > > $WORKSPACE/Build/Vlv2TbltDevicePkg/${TARGET}_${TOOL_CHAIN > _TAG}/F > > > V/Vlv.ROM > > > build -p $PLATFORM_PKG_PATH/PlatformCapsuleGcc.dsc > > > > > > echo > > > -- > > > 2.21.0.windows.1 > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43690): https://edk2.groups.io/g/devel/message/43690 Mute This Topic: https://groups.io/mt/32419743/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] Platform/Intel/Vlv2TbltDevicePkg: fix postbuild scripts
Add "set -e" to postbuild scripts to cause them to exit if an error occurs. Since GenCapsuleSampleColor.sh is passed arguments, it should be run directly and not sourced into the environment so it can evaluate $1, $2 etc. Otherwise, it tries to use the toolchain name passed to 'build' as the GUID string. Signed-off-by: Rebecca Cran --- .../Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh | 10 ++ .../Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh | 2 ++ .../GenerateCapsule/GenCapsuleMinnowMaxRelease.sh | 2 ++ .../Capsule/GenerateCapsule/GenCapsuleSampleColor.sh | 0 4 files changed, 10 insertions(+), 4 deletions(-) mode change 100644 => 100755 Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.sh diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh index 7b77b50c3f..22ae72c575 100755 --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh @@ -1,5 +1,5 @@ # @file -# Linux script file to generate UEFI capsules for system firmware and +# *NIX script file to generate UEFI capsules for system firmware and # firmware for sample devices # # Copyright (c) 2018, Intel Corporation. All rights reserved. @@ -7,6 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # +set -e + cd $(dirname $0) EFI_DIR=$WORKSPACE/Build/Vlv2TbltDevicePkg/${TARGET}_${TOOL_CHAIN_TAG}/X64/ @@ -28,6 +30,6 @@ else cp $EFI_DIR/CapsuleApp.efi $CAP_DIR/TestCert/CapsuleAppRelease.efi . $SCRIPT_DIR/GenCapsuleMinnowMaxRelease.sh fi -. $SCRIPT_DIR/GenCapsuleSampleColor.sh Blue 149DA854-7D19-4FAA-A91E-862EA1324BE6 -. $SCRIPT_DIR/GenCapsuleSampleColor.sh Green 79179BFD-704D-4C90-9E02-0AB8D968C18A -. $SCRIPT_DIR/GenCapsuleSampleColor.sh Red 72E2945A-00DA-448E-9AA7-075AD840F9D4 +$SCRIPT_DIR/GenCapsuleSampleColor.sh Blue 149DA854-7D19-4FAA-A91E-862EA1324BE6 +$SCRIPT_DIR/GenCapsuleSampleColor.sh Green 79179BFD-704D-4C90-9E02-0AB8D968C18A +$SCRIPT_DIR/GenCapsuleSampleColor.sh Red 72E2945A-00DA-448E-9AA7-075AD840F9D4 diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh index 114c4a3477..1c9e3613f6 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh @@ -6,6 +6,8 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # +set -e + FMP_CAPSULE_VENDOR=Intel FMP_CAPSULE_GUID=4096267B-DA0A-42EB-B5EB-FEF31D207CB4 FMP_CAPSULE_FILE=MinnowMax.cap diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh index d2619786e8..e50ef66c03 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh @@ -6,6 +6,8 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # +set -e + FMP_CAPSULE_VENDOR=Intel FMP_CAPSULE_GUID=4096267B-DA0A-42EB-B5EB-FEF31D207CB4 FMP_CAPSULE_FILE=MinnowMaxRelease.cap diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.sh b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.sh old mode 100644 new mode 100755 -- 2.22.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43689): https://edk2.groups.io/g/devel/message/43689 Mute This Topic: https://groups.io/mt/32456165/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] BaseTools: Fix python3.8 SyntaxWarning
I tested this patch on python2.7 and 3.7. It works fine. Reviewed-by: Bob Feng -Original Message- From: Laszlo Ersek [mailto:ler...@redhat.com] Sent: Saturday, July 13, 2019 5:03 AM To: Cole Robinson ; devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: Re: [PATCH] BaseTools: Fix python3.8 SyntaxWarning On 07/12/19 19:29, Cole Robinson wrote: > Building with python3.8 shows a warning like: > > SyntaxWarning: invalid escape sequence \( > GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") > > It seems harmless, but it's easy enough to fix: mark the string as raw > with the 'r' prefix like is used elsewhere in the file I think the intent is to escape the opening paren '(' so that it lose its special regex meaning. Is that correct? And, the issue is that the backslash, meant for escaping the paren, in effect introduces a *string literal* escape sequence. Is that correct? If so, would it be correct to replace '\(' with '\\('? (IOW, use the string literal escape sequence \\ to encode a raw \, and then let the raw \ escape the ( on the regex level.) Anyway, after reading up a bit on raw string literals, the patch appears to do the same, only more readably. :) Reviewed-by: Laszlo Ersek (CC'ing BaseTools maintainers Bob and Liming.) Thanks! Laszlo > > Signed-off-by: Cole Robinson > --- > BaseTools/Source/Python/build/build.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/BaseTools/Source/Python/build/build.py > b/BaseTools/Source/Python/build/build.py > index 8c3315619a..d6006b651f 100644 > --- a/BaseTools/Source/Python/build/build.py > +++ b/BaseTools/Source/Python/build/build.py > @@ -1499,7 +1499,7 @@ class Build(): > if self.Fdf: > # First get the XIP base address for FV map file. > GuidPattern = re.compile("[-a-fA-F0-9]+") > -GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") > +GuidName = re.compile(r"\(GUID=[-a-fA-F0-9]+") > for FvName in Wa.FdfProfile.FvDict: > FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map') > if not os.path.exists(FvMapBuffer): > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43688): https://edk2.groups.io/g/devel/message/43688 Mute This Topic: https://groups.io/mt/32445092/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 1/5] MdePkg/Protocol/Hash: introduce GUID for SM3 digest algorithm
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch adds GUID for SM3 digest algorithm. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Imran Desai --- MdePkg/Include/Protocol/Hash.h | 5 + 1 file changed, 5 insertions(+) diff --git a/MdePkg/Include/Protocol/Hash.h b/MdePkg/Include/Protocol/Hash.h index 931d7916ef1e..8abf1a4fa305 100644 --- a/MdePkg/Include/Protocol/Hash.h +++ b/MdePkg/Include/Protocol/Hash.h @@ -48,6 +48,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent 0xcaa4381e, 0x750c, 0x4770, {0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } \ } +#define EFI_HASH_ALGORITHM_SM3_256_GUID \ + { \ +0x251C7818, 0x0DBF, 0xE619, { 0x7F, 0xC2, 0xD6, 0xAC, 0x43, 0x42, 0x7D, 0xA3 } \ + } + #define EFI_HASH_ALGORTIHM_MD5_GUID \ { \ 0xaf7c79c, 0x65b5, 0x4319, {0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } \ -- 2.17.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43683): https://edk2.groups.io/g/devel/message/43683 Mute This Topic: https://groups.io/mt/32454898/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 3/5] SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch adds SM3 as an available digest algorithm to crypto router. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jian J Wang --- SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.c index 7f3bdab53066..aec874a9e072 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterCommon.c @@ -25,6 +25,7 @@ TPM2_HASH_MASK mTpm2HashMask[] = { {HASH_ALGORITHM_SHA256_GUID, HASH_ALG_SHA256}, {HASH_ALGORITHM_SHA384_GUID, HASH_ALG_SHA384}, {HASH_ALGORITHM_SHA512_GUID, HASH_ALG_SHA512}, + {HASH_ALGORITHM_SM3_256_GUID, HASH_ALG_SM3_256}, }; /** -- 2.17.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43685): https://edk2.groups.io/g/devel/message/43685 Mute This Topic: https://groups.io/mt/32454903/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 2/5] SecurityPkg: introduce the SM3 digest algorithm
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch add SM3 algorithm in the hashinstance library. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jiewen Yao Reviewed-by: Jian J Wang --- SecurityPkg/Include/Library/HashLib.h | 1 + SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c | 150 SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf | 41 ++ SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni | 15 ++ SecurityPkg/SecurityPkg.dsc | 3 + 5 files changed, 210 insertions(+) diff --git a/SecurityPkg/Include/Library/HashLib.h b/SecurityPkg/Include/Library/HashLib.h index 63f08398788b..a5b433d824a4 100644 --- a/SecurityPkg/Include/Library/HashLib.h +++ b/SecurityPkg/Include/Library/HashLib.h @@ -137,6 +137,7 @@ EFI_STATUS #define HASH_ALGORITHM_SHA256_GUID EFI_HASH_ALGORITHM_SHA256_GUID #define HASH_ALGORITHM_SHA384_GUID EFI_HASH_ALGORITHM_SHA384_GUID #define HASH_ALGORITHM_SHA512_GUID EFI_HASH_ALGORITHM_SHA512_GUID +#define HASH_ALGORITHM_SM3_256_GUID EFI_HASH_ALGORITHM_SM3_256_GUID typedef struct { EFI_GUID HashGuid; diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c new file mode 100644 index ..8fd95162118a --- /dev/null +++ b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c @@ -0,0 +1,150 @@ +/** @file + BaseCrypto SM3 hash instance library. + It can be registered to BaseCrypto router, to serve as hash engine. + + Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + The function set SM3 to digest list. + + @param DigestList digest list + @param Sm3DigestSM3 digest +**/ +VOID +Tpm2SetSm3ToDigestList ( + IN TPML_DIGEST_VALUES *DigestList, + IN UINT8 *Sm3Digest + ) +{ + DigestList->count = 1; + DigestList->digests[0].hashAlg = TPM_ALG_SM3_256; + CopyMem ( +DigestList->digests[0].digest.sm3_256, +Sm3Digest, +SM3_256_DIGEST_SIZE +); +} + +/** + Start hash sequence. + + @param HashHandle Hash handle. + + @retval EFI_SUCCESS Hash sequence start and HandleHandle returned. + @retval EFI_OUT_OF_RESOURCES No enough resource to start hash. +**/ +EFI_STATUS +EFIAPI +Sm3HashInit ( + OUT HASH_HANDLE*HashHandle + ) +{ + VOID *Sm3Ctx; + UINTNCtxSize; + + CtxSize = Sm3GetContextSize (); + Sm3Ctx = AllocatePool (CtxSize); + if (Sm3Ctx == NULL) { +return EFI_OUT_OF_RESOURCES; + } + + Sm3Init (Sm3Ctx); + + *HashHandle = (HASH_HANDLE)Sm3Ctx; + + return EFI_SUCCESS; +} + +/** + Update hash sequence data. + + @param HashHandleHash handle. + @param DataToHashData to be hashed. + @param DataToHashLen Data size. + + @retval EFI_SUCCESS Hash sequence updated. +**/ +EFI_STATUS +EFIAPI +Sm3HashUpdate ( + IN HASH_HANDLEHashHandle, + IN VOID *DataToHash, + IN UINTN DataToHashLen + ) +{ + VOID *Sm3Ctx; + + Sm3Ctx = (VOID *)HashHandle; + Sm3Update (Sm3Ctx, DataToHash, DataToHashLen); + + return EFI_SUCCESS; +} + +/** + Complete hash sequence complete. + + @param HashHandleHash handle. + @param DigestListDigest list. + + @retval EFI_SUCCESS Hash sequence complete and DigestList is returned. +**/ +EFI_STATUS +EFIAPI +Sm3HashFinal ( + IN HASH_HANDLE HashHandle, + OUT TPML_DIGEST_VALUES *DigestList + ) +{ + UINT8 Digest[SM3_256_DIGEST_SIZE]; + VOID *Sm3Ctx; + + Sm3Ctx = (VOID *)HashHandle; + Sm3Final (Sm3Ctx, Digest); + + FreePool (Sm3Ctx); + + Tpm2SetSm3ToDigestList (DigestList, Digest); + + return EFI_SUCCESS; +} + +HASH_INTERFACE mSm3InternalHashInstance = { + HASH_ALGORITHM_SM3_256_GUID, + Sm3HashInit, + Sm3HashUpdate, + Sm3HashFinal, +}; + +/** + The function register SM3 instance. + + @retval EFI_SUCCESS SM3 instance is registered, or system dose not support register SM3 instance +**/ +EFI_STATUS +EFIAPI +HashInstanceLibSm3Constructor ( + VOID + ) +{ + EFI_STATUS Status; + + Status = RegisterHashInterfaceLib (); + if ((Status == EFI_SUCCESS) || (Status == EFI_UNSUPPORTED)) { +// +// Unsupported means platform policy does not need this instance enabled. +// +return EFI_SUCCESS; + } + return Status; +} diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
[edk2-devel] [PATCH v6 4/5] SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch sets SM3 bit in TPM2.0 hash mask by default. Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Signed-off-by: Imran Desai Reviewed-by: Jian J Wang --- SecurityPkg/SecurityPkg.dec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec index b9c04a3d13d1..d2f6a6fd1293 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -453,9 +453,10 @@ [PcdsDynamic, PcdsDynamicEx] #BIT1 - SHA256. #BIT2 - SHA384. #BIT3 - SHA512. + #BIT4 - SM3_256. # @Prompt Hash mask for TPM 2.0 - # @ValidRange 0x8001 | 0x - 0x000F - gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x000F|UINT32|0x00010010 + # @ValidRange 0x8001 | 0x - 0x001F + gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0x001F|UINT32|0x00010010 ## This PCD indicated final BIOS supported Hash mask. #Bios may choose to register a subset of PcdTpm2HashMask. -- 2.17.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43686): https://edk2.groups.io/g/devel/message/43686 Mute This Topic: https://groups.io/mt/32454904/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 0/5] Implement SM3 measured boot
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. Cc: Michael D Kinney Cc: Liming Gao Cc: Chao Zhang Cc: Jiewen Yao Cc: Jian Wang Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Marc-André Lureau Cc: Stefan Berger Imran Desai (5): MdePkg/Protocol/Hash: introduce GUID for SM3 digest algorithm SecurityPkg: introduce the SM3 digest algorithm SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe MdePkg/Include/Protocol/Hash.h| 5 + OvmfPkg/OvmfPkgIa32.dsc | 2 + OvmfPkg/OvmfPkgIa32X64.dsc| 2 + OvmfPkg/OvmfPkgX64.dsc| 2 + SecurityPkg/Include/Library/HashLib.h | 1 + .../HashInstanceLibSm3/HashInstanceLibSm3.c | 150 ++ .../HashInstanceLibSm3/HashInstanceLibSm3.inf | 41 + .../HashInstanceLibSm3/HashInstanceLibSm3.uni | 15 ++ .../HashLibBaseCryptoRouterCommon.c | 1 + SecurityPkg/SecurityPkg.dec | 5 +- SecurityPkg/SecurityPkg.dsc | 3 + 11 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c create mode 100644 SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf create mode 100644 SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni -- 2.17.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43682): https://edk2.groups.io/g/devel/message/43682 Mute This Topic: https://groups.io/mt/32454896/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 5/5] OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781 GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6 EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR banks. This digest algorithm is part of the China Crypto algorithm suite. This integration has dependency on the openssl_1_1_1b integration into edk2. This patch links SM3 support into Tcg2Pei and Tcg2Dxe. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Marc-André Lureau Cc: Stefan Berger Signed-off-by: Imran Desai --- OvmfPkg/OvmfPkgIa32.dsc| 2 ++ OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++ OvmfPkg/OvmfPkgX64.dsc | 2 ++ 3 files changed, 6 insertions(+) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 5bbf87540ab9..6ab730018694 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -625,6 +625,7 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) == TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -906,5 +907,6 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 5015e92b6eea..f163aa267132 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -637,6 +637,7 @@ [Components.IA32] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) == TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -920,5 +921,6 @@ [Components.X64] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index dda8dac18441..fa98f16a3fb3 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -636,6 +636,7 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !if $(TPM2_CONFIG_ENABLE) == TRUE SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf @@ -918,5 +919,6 @@ [Components] NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf } !endif -- 2.17.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43687): https://edk2.groups.io/g/devel/message/43687 Mute This Topic: https://groups.io/mt/32454905/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms Patch 10/28] Vlv2TbltDevicePkg/bld_vlv.sh: Create Vlv.ROM
Zailiang, This appears to be the behavior of GIT when the Author of a patch is not the same as the person who sends the patch email. The "From:" line is shows the Author of the patch and is used to fill in the Author field when the patch email is applied to a git repo. So no edits to the commit messages are required. It will be correct when I push. It is correct in my local git repo/log. Thanks, Mike > -Original Message- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] > On Behalf Of Gary Lin > Sent: Wednesday, July 10, 2019 11:09 PM > To: devel@edk2.groups.io; Sun, Zailiang > > Cc: Kinney, Michael D ; Qian, > Yi > Subject: Re: [edk2-devel] [edk2-platforms Patch 10/28] > Vlv2TbltDevicePkg/bld_vlv.sh: Create Vlv.ROM > > On Thu, Jul 11, 2019 at 04:52:10AM +, Sun, Zailiang > wrote: > > Gary, > > > > I suggest remove the first line "From: Gary Lin > " from the description section since you > have appended the "signed-off-by" declaration. > > > Hi Zailiang, > > That is added by Mike. I'm totally fine if you remove it > when pushing the commits. > > Thanks, > > Gary Lin > > > > -Original Message- > > > From: Kinney, Michael D > > > Sent: Thursday, July 11, 2019 3:05 AM > > > To: devel@edk2.groups.io > > > Cc: Gary Lin ; Sun, Zailiang > > > ; Qian, Yi > > > > Subject: [edk2-platforms Patch 10/28] > Vlv2TbltDevicePkg/bld_vlv.sh: > > > Create Vlv.ROM > > > > > > From: Gary Lin > > > > > > The scripts for PlatformCapsuleGcc.dsc need Vlv.ROM. > > > > > > Cc: Zailiang Sun > > > Cc: Yi Qian > > > Cc: Michael D Kinney > > > Signed-off-by: Gary Lin > > > --- > > > Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git > a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > index 7fd5f44264..c68e59398a 100755 > > > --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > +++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh > > > @@ -199,6 +199,8 @@ echo Skip "Running fce..." > > > > > > > ##*** > * > > > ** > > > ## Build Capsules > > > > > > > ##*** > * > > > ** > > > +cp -f > > > > $WORKSPACE/Build/Vlv2TbltDevicePkg/${TARGET}_${TOOL_CHAIN > _TAG}/F > > > V/VLV.fd \ > > > + > > > > $WORKSPACE/Build/Vlv2TbltDevicePkg/${TARGET}_${TOOL_CHAIN > _TAG}/F > > > V/Vlv.ROM > > > build -p $PLATFORM_PKG_PATH/PlatformCapsuleGcc.dsc > > > > > > echo > > > -- > > > 2.21.0.windows.1 > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43680): https://edk2.groups.io/g/devel/message/43680 Mute This Topic: https://groups.io/mt/32419743/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 0/3] add GetMaintainer.py helper script
On 07/12/19 19:01, Leif Lindholm wrote: > Changes are available directly from: > https://git.linaro.org/people/leif.lindholm/edk2.git/log/?h=upstreaming/git-maintainer-v1 > > This series adds new tags to the Maintainers.txt format, making it possible > to describe which filesystem paths are looked after by which people, and > hence automating the extraction of a list over who should be cc:d on a patch > submission. > > Remaining shorcomings in v1: > - Will still be misparsing OvmfPkg and MdeModulePkg due to non-tag lines > interspersed with the tag lines. These lines will be removed as areas of > responsibility is formally rewritten as tags. > - * Wildcard support is not fully filesystem compliant except in first or > last position in the file pattern (it translates as regex .* elsewhere). > However, actual cases of mismatch are expected to be unlikely, and they > will be false positives rather than false negatives - so I think this is > good enough at least for a start. > - Provides no information of why certain people or meiling lists were > picked - it just bundles all recipients up, deduplicates them, and > prints them out. > > Using the script requires the gitpython module to be installed. > > Worthwhile mentioning outside the ChangeLog is the added -l flag, which > lets you look up what a given path would return in the way of matches. > E.g. "python BaseTools/Scripts/GetMaintainer.py -l Non/Existing/Path" > would return: > --- > Non/Existing/Path > "Non/Existing/Path": no maintainers found, looking for default > Andrew Fish > Laszlo Ersek > Leif Lindholm > Michael D Kinney > devel@edk2.groups.io > --- > > This series would still result in GetMaintainers.py missing some > maintainers/reviewers due to descriptions in prose rather than filename > patterns. My preferred way of handling this would be to merge 1-2/3 as > soon as found acceptable, following up and merging patches to update > ArmVirtPkg, MdeModulePkg, and OvmfPkg, and finally once the file is > consistent, proceed to merge 3/3. Sounds like a plan. Thanks Laszlo > > Changelog: > v1: > - Rebase to current Maintainers.txt. > - Fix typos and missed bits in Maintainers.txt. > - Get rid of the magic '' filename, let the single-char '*' > wildcard resolve this (_using_ the magic '' filename in the > script, but treating it as if it was a file in the top-level directory). > - Add -l flag to script to look up which maintainers would be returned for > a given path (which need not exist). > rfc: > - Split patches up > - one for new Maintainers.txt format (documentation and F: tags). > - one for adding a new wilcards responsibility area for */Arm, */AArch64 > - one for the GetMaintainer.py script > - Reworked wildcard handling based on Laszlo's explanation > - Trailing / covers everything under that directory > - Trailing * does not cover subdirectories > - Added support for X: tag > - Added support for magic '' pathname > - Also prints mailing list addresses for matching L: tags > > Cc: Andrew Fish > Cc: Laszlo Ersek > Cc: Michael D Kinney > Cc: Bob Feng > Cc: Liming Gao > Cc: Philippe Mathieu-Daude > Cc: "Wu, Hao A" > > Leif Lindholm (3): > Maintainers.txt: update for filesystem area descriptions > Maintainers.txt: add wildcard path association for Arm/AArch64 > BaseTools: add GetMaintainer.py script > > BaseTools/Scripts/GetMaintainer.py | 190 + > Maintainers.txt| 54 > 2 files changed, 244 insertions(+) > create mode 100644 BaseTools/Scripts/GetMaintainer.py > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43676): https://edk2.groups.io/g/devel/message/43676 Mute This Topic: https://groups.io/mt/32444044/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 2/3] Maintainers.txt: add wildcard path association for Arm/AArch64
On 07/12/19 19:01, Leif Lindholm wrote: > Add Ard and Leif as responsible for any path matching > F: */Arm/ > F: */AArch64/ > > Signed-off-by: Leif Lindholm > Reviewed-by: Philippe Mathieu-Daude > Tested-by: Philippe Mathieu-Daude > --- > Maintainers.txt | 8 > 1 file changed, 8 insertions(+) Reviewed-by: Laszlo Ersek -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43678): https://edk2.groups.io/g/devel/message/43678 Mute This Topic: https://groups.io/mt/32444048/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/3] Maintainers.txt: update for filesystem area descriptions
On 07/12/19 19:01, Leif Lindholm wrote: > Add comment describing new F: and X: tags for associating maintainership > sections with specific filesystem paths, including wildcards. > > Add global section associating *all* code with devel@edk2.groups.io, > with a default '*' F: tag directing all modifications that do not hit a > rule to the stewards. > > Also tag all files in top directory as maintained by the stewards. > > Signed-off-by: Leif Lindholm > Reviewed-by: Philippe Mathieu-Daude > Tested-by: Philippe Mathieu-Daude > --- > Maintainers.txt | 46 ++ > 1 file changed, 46 insertions(+) Reviewed-by: Laszlo Ersek -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43677): https://edk2.groups.io/g/devel/message/43677 Mute This Topic: https://groups.io/mt/32444045/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Simplify edksetup.sh
Hi, On 07/10/19 23:17, Rebecca Cran wrote: > o Use '$SCRIPTNAME' consistently instead of 'edksetup.sh' > > o Use the bash environment variable $PWD instead of executing the pwd > command. > > o Add quotes around variables to ensure they're evaluated correctly. > > o Simplify SetupPython3() and SetupPython() functions. On Linux, > "whereis" matches python3, python3.7, as well as man pages, libs etc. > While on macOS it only matches the specified name, and so misses > python3.7. Improve this by looping over potential version numbers and > seeing if such a binary exists and can be executed. > > o Since when parsing options '*' matches anything not already matched, > remove -?, -h and --help since they're redundant. > > o When executing arithmetic commands, $ isn't needed before variables. As long as my opinion counts... (and I totally don't insist that it do): the above task list will make for a nice 6-part patch series. :) (When someone is tempted to capture a *list* of changes in a single commit message, that frequently indicates that the patch should be split up, so that each change get its own dedicated patch.) Thanks, Laszlo > > Signed-off-by: Rebecca Cran > --- > edksetup.sh | 67 ++--- > 1 file changed, 18 insertions(+), 49 deletions(-) > > diff --git a/edksetup.sh b/edksetup.sh > index 12a3e26a67..a797ff03d2 100755 > --- a/edksetup.sh > +++ b/edksetup.sh > @@ -49,11 +49,11 @@ function SetWorkspace() > return 0 >fi > > - if [ ! ${BASH_SOURCE[0]} -ef ./edksetup.sh ] && [ -z "$PACKAGES_PATH" ] > + if [ ! ${BASH_SOURCE[0]} -ef ./$SCRIPTNAME ] && [ -z "$PACKAGES_PATH" ] >then > echo Run this script from the base of your tree. For example: > -echo " cd /Path/To/Edk/Root" > -echo " . edksetup.sh" > +echo " cd /path/to/edk2/root" > +echo " . $SCRIPTNAME" > return 1 >fi > > @@ -71,7 +71,7 @@ function SetWorkspace() ># ># Set $WORKSPACE ># > - export WORKSPACE=`pwd` > + export WORKSPACE=$PWD >return 0 > } > > @@ -107,24 +107,10 @@ function SetupEnv() > > function SetupPython3() > { > - if [ $origin_version ];then > -origin_version= > - fi > - for python in $(whereis python3) > - do > -python=$(echo $python | grep "[[:digit:]]$" || true) > -python_version=${python##*python} > -if [ -z "${python_version}" ] || (! command -v $python >/dev/null > 2>&1);then > - continue > -fi > -if [ -z $origin_version ];then > - origin_version=$python_version > - export PYTHON_COMMAND=$python > - continue > -fi > - if [[ "$origin_version" < "$python_version" ]]; then > - origin_version=$python_version > - export PYTHON_COMMAND=$python > + for python in $(seq -f "python3.%g" 15 -1 1) python3; do > +if command -v $python >/dev/null 2>&1; then > + export PYTHON_COMMAND=$(which $python) > + break > fi >done >return 0 > @@ -132,8 +118,8 @@ function SetupPython3() > > function SetupPython() > { > - if [ $PYTHON_COMMAND ] && [ -z $PYTHON3_ENABLE ];then > -if ( command -v $PYTHON_COMMAND >/dev/null 2>&1 );then > + if [ -n "$PYTHON_COMMAND" ] && [ -z "$PYTHON3_ENABLE" ]; then > +if command -v $PYTHON_COMMAND >/dev/null 2>&1; then >return 0 > else >echo $PYTHON_COMMAND Cannot be used to build or execute the python > tools. > @@ -141,32 +127,15 @@ function SetupPython() > fi >fi > > - if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ] > - then > + if [ "$PYTHON3_ENABLE" == "TRUE" ]; then > SetupPython3 >fi > > - if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE != TRUE ] > - then > -if [ $origin_version ];then > - origin_version= > -fi > -for python in $(whereis python2) > -do > - python=$(echo $python | grep "[[:digit:]]$" || true) > - python_version=${python##*python} > - if [ -z "${python_version}" ] || (! command -v $python >/dev/null > 2>&1);then > -continue > - fi > - if [ -z $origin_version ] > - then > -origin_version=$python_version > -export PYTHON_COMMAND=$python > -continue > - fi > - if [[ "$origin_version" < "$python_version" ]]; then > -origin_version=$python_version > -export PYTHON_COMMAND=$python > + if [ -n "$PYTHON3_ENABLE" ] && [ "$PYTHON3_ENABLE" != "TRUE" ]; then > +for python in $(seq -f "python2.%g" 10 -1 1) python2; do > + if command -v $python >/dev/null 2>&1; then > +export PYTHON_COMMAND=$(which $python) > +break >fi > done > return 0 > @@ -194,12 +163,12 @@ do >RECONFIG=TRUE >shift > ;; > --?|-h|--help|*) > +*) >HelpMsg >break > ;; >esac > - I=$(($I - 1)) > + I=$((I - 1)) > done > > if [ $I -gt 0 ] > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group.
Re: [edk2-devel] [Patch 0/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service.
On 07/12/19 03:53, Eric Dong wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1972 > > AP calls CollectProcessorData() to collect processor info. > CollectProcessorData function finally calls PcdGetSize function to > get DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use gBS > which caused ASSERT. > This patch serial fixes the issue and enhances the related code to avoid > later report this issue again. > > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Cc: Star Zeng > > Eric Dong (2): > UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service. > UefiCpuPkg/Library/RegisterCpuFeaturesLib: avoid use dynamic PCD. > > .../CpuFeaturesInitialize.c | 77 ++--- > .../RegisterCpuFeatures.h | 10 +- > .../RegisterCpuFeaturesLib.c | 109 +++--- > 3 files changed, 85 insertions(+), 111 deletions(-) > Will have to skip this one too. Thanks Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43674): https://edk2.groups.io/g/devel/message/43674 Mute This Topic: https://groups.io/mt/32437606/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] UefiCpuPkg CpuCommonFeaturesLib: Enhance Ppin code
On 07/12/19 12:12, Star Zeng wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1961 > Enhance Ppin code to enable and unlock for TRUE State, > and disable and lock for FALSE State. > Note: enable and lock could not be set both. > > Cc: Laszlo Ersek > Cc: Eric Dong > Cc: Ray Ni > Cc: Chandana Kumar > Cc: Kevin Li > Signed-off-by: Star Zeng > --- > .../CpuCommonFeaturesLib/CpuCommonFeatures.h | 15 + > .../CpuCommonFeaturesLib.c| 2 +- > .../Library/CpuCommonFeaturesLib/Ppin.c | 65 +++ > 3 files changed, 70 insertions(+), 12 deletions(-) I'll skip this patch. Thanks Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43673): https://edk2.groups.io/g/devel/message/43673 Mute This Topic: https://groups.io/mt/32440401/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] BaseTools: Fix python3.8 SyntaxWarning
On 07/12/19 19:29, Cole Robinson wrote: > Building with python3.8 shows a warning like: > > SyntaxWarning: invalid escape sequence \( > GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") > > It seems harmless, but it's easy enough to fix: mark the string as > raw with the 'r' prefix like is used elsewhere in the file I think the intent is to escape the opening paren '(' so that it lose its special regex meaning. Is that correct? And, the issue is that the backslash, meant for escaping the paren, in effect introduces a *string literal* escape sequence. Is that correct? If so, would it be correct to replace '\(' with '\\('? (IOW, use the string literal escape sequence \\ to encode a raw \, and then let the raw \ escape the ( on the regex level.) Anyway, after reading up a bit on raw string literals, the patch appears to do the same, only more readably. :) Reviewed-by: Laszlo Ersek (CC'ing BaseTools maintainers Bob and Liming.) Thanks! Laszlo > > Signed-off-by: Cole Robinson > --- > BaseTools/Source/Python/build/build.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/BaseTools/Source/Python/build/build.py > b/BaseTools/Source/Python/build/build.py > index 8c3315619a..d6006b651f 100644 > --- a/BaseTools/Source/Python/build/build.py > +++ b/BaseTools/Source/Python/build/build.py > @@ -1499,7 +1499,7 @@ class Build(): > if self.Fdf: > # First get the XIP base address for FV map file. > GuidPattern = re.compile("[-a-fA-F0-9]+") > -GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") > +GuidName = re.compile(r"\(GUID=[-a-fA-F0-9]+") > for FvName in Wa.FdfProfile.FvDict: > FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map') > if not os.path.exists(FvMapBuffer): > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43671): https://edk2.groups.io/g/devel/message/43671 Mute This Topic: https://groups.io/mt/32445092/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH edk2-platfoms devel-IntelAtomProcessorE3900] Fix the Core Version string in the Platform Setup
Since .uni files are Unicode and git treats them as binary, I've pushed my change to a fork on GitHub: it's at https://github.com/bcran/edk2-platforms/commit/7c914946bd014dc1f3cf0a0ef189e7c2d33d382f . The current/latest E3900 builds use UEFI 2.70 while the Platform Setup screen still reports "Core Version: UEFI 2.3.1". -- Rebecca Cran -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43670): https://edk2.groups.io/g/devel/message/43670 Mute This Topic: https://groups.io/mt/32445906/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 2/3] MdePkg/BaseLib: rewrite Base64Decode()
On 07/12/19 04:31, Gao, Zhichao wrote: > Sorry for late respond. > The whole code is OK for me. And I write a tiny test for it without the > memory address check. See > https://github.com/ZhichaoGao/edk2/commit/615356ba32d3147957d215debd844e7709f06849 > . It is tested in Emulator environment. If it is OK, I think you can take my > Tested-by for this patch. If there are some missing, please let me know. Thanks for writing that test app. It seems to have pretty good coverage. I like that it covers the exit points systematically. Mike, Liming: I intend to pick up Zhichao's T-b, from above. If you are aware of another test suite (perhaps used in conjunction with the originally contributed Base64Decode() impl), please let me know. > Base64Decode parameter Source is indicate as OPTIONAL. Although it is OK to > be NULL, and return DestinationSize to be zero with success status to > indicate no decode occurred . I don't know if it is meaningful to report the > result as that. In my opinion, NULL Source is an invalid input. Just my > opinion, if the maintainer is OK with that, I am OK too. I think that it is helpful. It is similar to the standard C function free() accepting NULL (it is a no-op). Edk2's FreePool() doesn't accept NULL, and that is inconvenient sometimes. Consider the following use case. There is some code that optionally receives data and then decodes it from base64. By default that data is represented as a NULL pointer, with size 0. If Base64Decode() does not accept NULL input with size 0, then the code in question has to implement a separate check for that. But it keeps the call site simpler if Base64Decode() explicitly specifies "do nothing", for those parameter values. Consider CopyMem() and CompareMem() too. In practice, if you pass Length=0, they will work just fine, even in case the buffers are NULL. These functions will exhibit the expected / intuitive behavior -- they will not dereference NULL. However, because their interface contracts don't spell out this case as valid (i.e. OPTIONAL), *technically* such calls are not permitted, and so every CopyMem() and CompareMem() call site has to be surrounded with if's, if NULL buffers with size 0 are otherwise possible there. That's a waste -- it duplicates checks and it makes the call site inconvenient. NULL input with nonzero size is caught and rejected (as described in the function's specification). "OPTIONAL" does not mean that the buffer can be NULL under *any* circumstances -- it means that it can be NULL under *some* (specified) circumstances. > > Some other minor comment about the block scope variable blow. > >> -Original Message- >> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >> Laszlo Ersek >> Sent: Tuesday, July 2, 2019 6:29 PM >> To: edk2-devel-groups-io >> Cc: Gao, Liming ; Marvin Häuser >> ; Kinney, Michael D ; >> Philippe Mathieu-Daudé ; Gao, Zhichao >> >> Subject: [edk2-devel] [PATCH 2/3] MdePkg/BaseLib: rewrite Base64Decode() >> >> Rewrite Base64Decode() from scratch, due to reasons listed in the second >> reference below. >> >> Implement Base64Decode() according to the specification added in the >> previous patch. The decoder scans the input buffer once, it has no inner >> loop(s), and it spills each output byte as soon as the output byte is >> complete. >> >> Cc: Liming Gao >> Cc: Marvin Häuser >> Cc: Michael D Kinney >> Cc: Philippe Mathieu-Daudé >> Cc: Zhichao Gao >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1891 >> Ref: http://mid.mail-archive.com/c495bd0b-ea4d-7206-8a4f- >> a7149760d...@redhat.com >> Signed-off-by: Laszlo Ersek >> --- >> MdePkg/Library/BaseLib/String.c | 249 +++- >> 1 file changed, 247 insertions(+), 2 deletions(-) >> >> diff --git a/MdePkg/Library/BaseLib/String.c >> b/MdePkg/Library/BaseLib/String.c index f8397035c32a..6198ccbc9672 >> 100644 >> --- a/MdePkg/Library/BaseLib/String.c >> +++ b/MdePkg/Library/BaseLib/String.c >> @@ -1973,8 +1973,253 @@ Base64Decode ( >>IN OUT UINTN *DestinationSize >>) >> { >> - ASSERT (FALSE); >> - return RETURN_INVALID_PARAMETER; >> + BOOLEAN PaddingMode; >> + UINTN SixBitGroupsConsumed; >> + UINT32 Accumulator; >> + UINTN OriginalDestinationSize; >> + UINTN SourceIndex; >> + >> + if (DestinationSize == NULL) { >> +return RETURN_INVALID_PARAMETER; >> + } >> + >> + // >> + // Check Source array validity. >> + // >> + if (Source == NULL) { >> +if (SourceSize > 0) { >> + // >> + // At least one CHAR8 element at NULL Source. >> + // >> + return RETURN_INVALID_PARAMETER; >> +} >> + } else if (SourceSize > MAX_ADDRESS - (UINTN)Source) { >> +// >> +// Non-NULL Source, but it wraps around. >> +// >> +return RETURN_INVALID_PARAMETER; >> + } >> + >> + // >> + // Check Destination array validity. >> + // >> + if (Destination == NULL) { >> +if (*DestinationSize > 0) { >> + // >> + // At least one
[edk2-devel] [PATCH] BaseTools: Fix python3.8 SyntaxWarning
Building with python3.8 shows a warning like: SyntaxWarning: invalid escape sequence \( GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") It seems harmless, but it's easy enough to fix: mark the string as raw with the 'r' prefix like is used elsewhere in the file Signed-off-by: Cole Robinson --- BaseTools/Source/Python/build/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 8c3315619a..d6006b651f 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1499,7 +1499,7 @@ class Build(): if self.Fdf: # First get the XIP base address for FV map file. GuidPattern = re.compile("[-a-fA-F0-9]+") -GuidName = re.compile("\(GUID=[-a-fA-F0-9]+") +GuidName = re.compile(r"\(GUID=[-a-fA-F0-9]+") for FvName in Wa.FdfProfile.FvDict: FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map') if not os.path.exists(FvMapBuffer): -- 2.21.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43668): https://edk2.groups.io/g/devel/message/43668 Mute This Topic: https://groups.io/mt/32445092/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 3/3] BaseTools: add GetMaintainer.py script
Add a new script GetMaintainer.py that uses the new Maintainer.txt format to determine which addresses to cc on patch submission. Signed-off-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude Tested-by: Philippe Mathieu-Daude --- BaseTools/Scripts/GetMaintainer.py | 190 + 1 file changed, 190 insertions(+) create mode 100644 BaseTools/Scripts/GetMaintainer.py diff --git a/BaseTools/Scripts/GetMaintainer.py b/BaseTools/Scripts/GetMaintainer.py new file mode 100644 index ..fbc63522db77 --- /dev/null +++ b/BaseTools/Scripts/GetMaintainer.py @@ -0,0 +1,190 @@ +## @file +# Retrieves the people to request review from on submission of a commit. +# +# Copyright (c) 2019, Linaro Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +from __future__ import print_function +from collections import defaultdict +from collections import OrderedDict +import argparse +import os +import re +import SetupGit + +EXPRESSIONS = { +'exclude':re.compile(r'^X:\s*(?P.*?)\r*$'), +'file': re.compile(r'^F:\s*(?P.*?)\r*$'), +'list': re.compile(r'^L:\s*(?P.*?)\r*$'), +'maintainer': re.compile(r'^M:\s*(?P.*<.*?>)\r*$'), +'reviewer': re.compile(r'^R:\s*(?P.*?)\r*$'), +'status': re.compile(r'^S:\s*(?P.*?)\r*$'), +'tree': re.compile(r'^T:\s*(?P.*?)\r*$'), +'webpage':re.compile(r'^W:\s*(?P.*?)\r*$') +} + +def printsection(section): +"""Prints out the dictionary describing a Maintainers.txt section.""" +print('===') +for key in section.keys(): +print("Key: %s" % key) +for item in section[key]: +print(' %s' % item) + +def pattern_to_regex(pattern): +"""Takes a string containing regular UNIX path wildcards + and returns a string suitable for matching with regex.""" + +pattern = pattern.replace('.', r'\.') +pattern = pattern.replace('?', r'.') +pattern = pattern.replace('*', r'.*') + +if pattern.endswith('/'): +pattern += r'.*' +elif pattern.endswith('.*'): +pattern = pattern[:-2] +pattern += r'(?!.*?/.*?)' + +return pattern + +def path_in_section(path, section): +"""Returns True of False indicating whether the path is covered by + the current section.""" +if not 'file' in section: +return False + +for pattern in section['file']: +regex = pattern_to_regex(pattern) + +match = re.match(regex, path) +if match: +# Check if there is an exclude pattern that applies +for pattern in section['exclude']: +regex = pattern_to_regex(pattern) + +match = re.match(regex, path) +if match: +return False + +return True + +return False + +def get_section_maintainers(path, section): +"""Returns a list with email addresses to any M: and R: entries + matching the provided path in the provided section.""" +maintainers = [] +lists = [] + +if path_in_section(path, section): +for address in section['maintainer'], section['reviewer']: +# Convert to list if necessary +if isinstance(address, list): +maintainers += address +else: +lists += [address] +for address in section['list']: +# Convert to list if necessary +if isinstance(address, list): +lists += address +else: +lists += [address] + +return maintainers, lists + +def get_maintainers(path, sections, level=0): +"""For 'path', iterates over all sections, returning maintainers + for matching ones.""" +maintainers = [] +lists = [] +for section in sections: +tmp_maint, tmp_lists = get_section_maintainers(path, section) +if tmp_maint: +maintainers += tmp_maint +if tmp_lists: +lists += tmp_lists + +if not maintainers: +# If no match found, look for match for (nonexistent) file +# REPO.working_dir/ +print('"%s": no maintainers found, looking for default' % path) +if level == 0: +maintainers = get_maintainers('', sections, level=level + 1) +else: +print("No maintainers set for project.") +if not maintainers: +return None + +return maintainers + lists + +def parse_maintainers_line(line): +"""Parse one line of Maintainers.txt, returning any match group and its key.""" +for key, expression in EXPRESSIONS.items(): +match = expression.match(line) +if match: +return key, match.group(key) +return None, None + +def parse_maintainers_file(filename): +"""Parse the Maintainers.txt from top-level of repo and + return a list containing dictionaries of all sections.""" +with open(filename, 'r') as text: +line = text.readline() +sectionlist =
[edk2-devel] [PATCH 1/3] Maintainers.txt: update for filesystem area descriptions
Add comment describing new F: and X: tags for associating maintainership sections with specific filesystem paths, including wildcards. Add global section associating *all* code with devel@edk2.groups.io, with a default '*' F: tag directing all modifications that do not hit a rule to the stewards. Also tag all files in top directory as maintained by the stewards. Signed-off-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude Tested-by: Philippe Mathieu-Daude --- Maintainers.txt | 46 ++ 1 file changed, 46 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index eb41dba7b128..3102b16b2f06 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -36,6 +36,22 @@ Descriptions of section entries: Obsolete: Old code. Something tagged obsolete generally means it has been replaced by a better system and you should be using that. + F: Files and directories with wildcard patterns. + A trailing slash includes all files and subdirectory files. + F: MdeModulePkg/ all files in and below MdeModulePkg + F: MdeModulePkg/* all files in MdeModulePkg, but not below + F: */Pci/* all files in a directory called Pci, at any depth in + the hierarchy, but not below + One pattern per line. Multiple F: lines per section acceptable. + X: Files and directories that are NOT maintained, same rules as F: + Files exclusions are tested after file matches. + Can be useful for excluding a specific subdirectory, for instance: + F: NetworkPkg/ + X: NetworkPkg/Ip6Dxe/ + matches all files in and below NetworkPkg excluding NetworkPkg/Ip6Dxe/ + Filenames not caught by any F: rule get matched as being located in the top- + level directory. (Internally, the script looks for a match called '', + so please don't add a file called that in the top-level directory.) EDK II -- @@ -44,8 +60,14 @@ L: https://edk2.groups.io/g/devel/ T: git - https://github.com/tianocore/edk2.git T: git (mirror) - https://bitbucket.org/tianocore/edk2.git +All patches CC:d here +L: devel@edk2.groups.io +F: * +F: */ + Tianocore Stewards -- +F: * M: Andrew Fish M: Laszlo Ersek M: Leif Lindholm @@ -63,16 +85,19 @@ M: Liming Gao EDK II Packages: ArmPkg +F: ArmPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmPkg M: Leif Lindholm M: Ard Biesheuvel ArmPlatformPkg +F: ArmPlatformPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmPlatformPkg M: Leif Lindholm M: Ard Biesheuvel ArmVirtPkg +F: ArmVirtPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg M: Laszlo Ersek M: Ard Biesheuvel @@ -81,26 +106,31 @@ R: Julien Grall R: Leif Lindholm BaseTools +F: BaseTools/ W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools M: Bob Feng M: Liming Gao CryptoPkg +F: CryptoPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/CryptoPkg M: Jian Wang R: Ting Ye DynamicTablesPkg +F: DynamicTablesPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg M: Sami Mujawar M: Alexei Fedorov EmbeddedPkg +F: EmbeddedPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/EmbeddedPkg M: Leif Lindholm M: Ard Biesheuvel EmulatorPkg +F: EmulatorPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg M: Jordan Justen M: Andrew Fish @@ -108,29 +138,34 @@ M: Ray Ni S: Maintained FatPkg +F: FatPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/Edk2-fat-driver M: Ray Ni T: svn - https://svn.code.sf.net/p/edk2-fatdriver2/code/trunk/EnhancedFat T: git - https://github.com/tianocore/edk2-FatPkg.git FmpDevicePkg +F: FmpDevicePkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/FmpDevicePkg M: Liming Gao M: Michael D Kinney IntelFsp2Pkg +F: IntelFsp2Pkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/IntelFsp2Pkg M: Chasel Chiu R: Nate DeSimone R: Star Zeng IntelFsp2WrapperPkg +F: IntelFsp2WrapperPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/IntelFsp2WrapperPkg M: Chasel Chiu R: Nate DeSimone R: Star Zeng MdeModulePkg +F: MdeModulePkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg M: Jian J Wang M: Hao A Wu @@ -140,16 +175,19 @@ R: Ray Ni R: Star Zeng MdePkg +F: MdePkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg M: Michael D Kinney M: Liming Gao NetworkPkg +F: NetworkPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg M: Siyuan Fu M: Jiaxin Wu OvmfPkg +F: OvmfPkg/ W: http://www.tianocore.org/ovmf/ M: Jordan Justen M: Laszlo Ersek @@ -167,16 +205,19 @@ R: David Woodhouse S: Maintained PcAtChipsetPkg +F: PcAtChipsetPkg/ W: https://github.com/tianocore/tianocore.github.io/wiki/PcAtChipsetPkg M: Ray Ni
[edk2-devel] [PATCH 2/3] Maintainers.txt: add wildcard path association for Arm/AArch64
Add Ard and Leif as responsible for any path matching F: */Arm/ F: */AArch64/ Signed-off-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude Tested-by: Philippe Mathieu-Daude --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index 3102b16b2f06..52d8215691b1 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -82,6 +82,14 @@ EDK II Releases: W: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning M: Liming Gao +EDK II Architectures: +- +ARM, AARCH64 +F: */AArch64/ +F: */Arm/ +M: Leif Lindholm +M: Ard Biesheuvel + EDK II Packages: ArmPkg -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43665): https://edk2.groups.io/g/devel/message/43665 Mute This Topic: https://groups.io/mt/32444048/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/3] add GetMaintainer.py helper script
Changes are available directly from: https://git.linaro.org/people/leif.lindholm/edk2.git/log/?h=upstreaming/git-maintainer-v1 This series adds new tags to the Maintainers.txt format, making it possible to describe which filesystem paths are looked after by which people, and hence automating the extraction of a list over who should be cc:d on a patch submission. Remaining shorcomings in v1: - Will still be misparsing OvmfPkg and MdeModulePkg due to non-tag lines interspersed with the tag lines. These lines will be removed as areas of responsibility is formally rewritten as tags. - * Wildcard support is not fully filesystem compliant except in first or last position in the file pattern (it translates as regex .* elsewhere). However, actual cases of mismatch are expected to be unlikely, and they will be false positives rather than false negatives - so I think this is good enough at least for a start. - Provides no information of why certain people or meiling lists were picked - it just bundles all recipients up, deduplicates them, and prints them out. Using the script requires the gitpython module to be installed. Worthwhile mentioning outside the ChangeLog is the added -l flag, which lets you look up what a given path would return in the way of matches. E.g. "python BaseTools/Scripts/GetMaintainer.py -l Non/Existing/Path" would return: --- Non/Existing/Path "Non/Existing/Path": no maintainers found, looking for default Andrew Fish Laszlo Ersek Leif Lindholm Michael D Kinney devel@edk2.groups.io --- This series would still result in GetMaintainers.py missing some maintainers/reviewers due to descriptions in prose rather than filename patterns. My preferred way of handling this would be to merge 1-2/3 as soon as found acceptable, following up and merging patches to update ArmVirtPkg, MdeModulePkg, and OvmfPkg, and finally once the file is consistent, proceed to merge 3/3. Changelog: v1: - Rebase to current Maintainers.txt. - Fix typos and missed bits in Maintainers.txt. - Get rid of the magic '' filename, let the single-char '*' wildcard resolve this (_using_ the magic '' filename in the script, but treating it as if it was a file in the top-level directory). - Add -l flag to script to look up which maintainers would be returned for a given path (which need not exist). rfc: - Split patches up - one for new Maintainers.txt format (documentation and F: tags). - one for adding a new wilcards responsibility area for */Arm, */AArch64 - one for the GetMaintainer.py script - Reworked wildcard handling based on Laszlo's explanation - Trailing / covers everything under that directory - Trailing * does not cover subdirectories - Added support for X: tag - Added support for magic '' pathname - Also prints mailing list addresses for matching L: tags Cc: Andrew Fish Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Bob Feng Cc: Liming Gao Cc: Philippe Mathieu-Daude Cc: "Wu, Hao A" Leif Lindholm (3): Maintainers.txt: update for filesystem area descriptions Maintainers.txt: add wildcard path association for Arm/AArch64 BaseTools: add GetMaintainer.py script BaseTools/Scripts/GetMaintainer.py | 190 + Maintainers.txt| 54 2 files changed, 244 insertions(+) create mode 100644 BaseTools/Scripts/GetMaintainer.py -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43663): https://edk2.groups.io/g/devel/message/43663 Mute This Topic: https://groups.io/mt/32444044/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms Patch 02/28] Vlv2TbltDevicePkg/Build_IFWI.sh: Change the root directory path
On 2019-07-12 10:23, Michael D Kinney wrote: > Hi Rebecca, > > Vlv2 is already in edk2-platforms/master. This patch series is fixing some > Linux/GCC build issues. > > I have a few more queued up after this to make it even better by > removing the use of the FCE tool in the build script. Oh, thanks! -- Rebecca Cran -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43662): https://edk2.groups.io/g/devel/message/43662 Mute This Topic: https://groups.io/mt/32419729/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms Patch 02/28] Vlv2TbltDevicePkg/Build_IFWI.sh: Change the root directory path
Hi Rebecca, Vlv2 is already in edk2-platforms/master. This patch series is fixing some Linux/GCC build issues. I have a few more queued up after this to make it even better by removing the use of the FCE tool in the build script. Mike > -Original Message- > From: Rebecca Cran [mailto:rebe...@bsdio.com] > Sent: Thursday, July 11, 2019 8:03 PM > To: devel@edk2.groups.io; Kinney, Michael D > > Subject: Re: [edk2-devel] [edk2-platforms Patch 02/28] > Vlv2TbltDevicePkg/Build_IFWI.sh: Change the root > directory path > > On 2019-07-10 13:04, Michael D Kinney wrote: > > echo "Build_IFWI: Calling BIOS build Script..." > > -./$PLATFORM_PACKAGE/bld_vlv.sh $Build_Flags > $Platform_Type > > $Build_Target > > +./Platform/Intel/$PLATFORM_PACKAGE/bld_vlv.sh > $Build_Flags > > +$Platform_Type $Build_Target > > > It looks like these changes are for getting ready to move > the code into master. > > I've just started working on porting the > BroxtonPlatformPkg over to master too, and just wanted to > check if you know if anyone's already working on it? If > so, I'll stop my work to avoid the duplication of effort. > > > -- > Rebecca Cran -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43661): https://edk2.groups.io/g/devel/message/43661 Mute This Topic: https://groups.io/mt/32419729/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Simplify edksetup.sh
On 2019-07-10 15:17, Rebecca Cran wrote: > o Use '$SCRIPTNAME' consistently instead of 'edksetup.sh' > > o Use the bash environment variable $PWD instead of executing the pwd > command. > > o Add quotes around variables to ensure they're evaluated correctly. > > o Simplify SetupPython3() and SetupPython() functions. On Linux, > "whereis" matches python3, python3.7, as well as man pages, libs etc. > While on macOS it only matches the specified name, and so misses > python3.7. Improve this by looping over potential version numbers and > seeing if such a binary exists and can be executed. > > o Since when parsing options '*' matches anything not already matched, > remove -?, -h and --help since they're redundant. > > o When executing arithmetic commands, $ isn't needed before variables. > > Signed-off-by: Rebecca Cran Ping? Added the TianoCore Stewards to cc list, since the file is in the root of the repo and not a package. -- Rebecca Cran -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43660): https://edk2.groups.io/g/devel/message/43660 Mute This Topic: https://groups.io/mt/32421563/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 01/11] ShellPkg: acpiview: FADT: Validate global pointers before use
I think it would be easier to see/review these changes logically if the functional changes (1 and 3) were separate from the refactoring change (2). Reviewed-by: Jaben Carsey > -Original Message- > From: Krzysztof Koch [mailto:krzysztof.k...@arm.com] > Sent: Thursday, July 11, 2019 11:53 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray ; > Gao, Zhichao ; sami.muja...@arm.com; > matteo.carl...@arm.com; n...@arm.com > Subject: [PATCH v1 01/11] ShellPkg: acpiview: FADT: Validate global pointers > before use > > 1. Check if the global pointer have been successfully updated before > they are later used to control the parsing logic in the FADT acpiview > parser. > > 2. Remove redundant forward function declarations by repositioning > blocks of code. > > 3. Allow silencing ACPI table content validation errors which do not > cause table parsing to fail. > > Signed-off-by: Krzysztof Koch > --- > > Changes can be seen at: > https://github.com/KrzysztofKoch1/edk2/commit/49cc41430775fb93205e302 > 590a7d31f080c3952 > > Notes: > v1: > - improve the logic in the parser [Krzysztof] > > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c > | 131 > 1 file changed, 51 insertions(+), 80 deletions(-) > > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > index > cee7ee0770433da96d6042d2f5d687903f4b5495..600d3b16d7b22b61c1a1fd21 > ecb93f16c7f8fa1a 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > @@ -1,7 +1,7 @@ > /** @file >FADT table parser > > - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. > + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. >SPDX-License-Identifier: BSD-2-Clause-Patent > >@par Reference(s): > @@ -12,6 +12,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiTableParser.h" > +#include "AcpiView.h" > > // Local variables > STATIC CONST UINT32* DsdtAddress; > @@ -46,7 +47,17 @@ EFIAPI > ValidateFirmwareCtrl ( >IN UINT8* Ptr, >IN VOID* Context > - ); > +) > +{ > +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > + if (*(UINT32*)Ptr != 0) { > +IncrementErrorCount (); > +Print ( > + L"\nERROR: Firmware Control must be zero for ARM platforms." > +); > + } > +#endif > +} > > /** >This function validates the X_Firmware Control Field. > @@ -61,7 +72,17 @@ EFIAPI > ValidateXFirmwareCtrl ( >IN UINT8* Ptr, >IN VOID* Context > - ); > +) > +{ > +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > + if (*(UINT64*)Ptr != 0) { > +IncrementErrorCount (); > +Print ( > + L"\nERROR: X Firmware Control must be zero for ARM platforms." > +); > + } > +#endif > +} > > /** >This function validates the flags. > @@ -76,7 +97,17 @@ EFIAPI > ValidateFlags ( >IN UINT8* Ptr, >IN VOID* Context > - ); > +) > +{ > +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > + if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) { > +IncrementErrorCount (); > +Print ( > + L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms." > +); > + } > +#endif > +} > > /** >An ACPI_PARSER array describing the ACPI FADT Table. > @@ -142,81 +173,6 @@ STATIC CONST ACPI_PARSER FadtParser[] = { >{L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL} > }; > > -/** > - This function validates the Firmware Control Field. > - > - @param [in] Ptr Pointer to the start of the field data. > - @param [in] Context Pointer to context specific information e.g. this > - could be a pointer to the ACPI table header. > -**/ > -STATIC > -VOID > -EFIAPI > -ValidateFirmwareCtrl ( > - IN UINT8* Ptr, > - IN VOID* Context > -) > -{ > -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > - if (*(UINT32*)Ptr != 0) { > -IncrementErrorCount (); > -Print ( > - L"\nERROR: Firmware Control must be zero for ARM platforms." > -); > - } > -#endif > -} > - > -/** > - This function validates the X_Firmware Control Field. > - > - @param [in] Ptr Pointer to the start of the field data. > - @param [in] Context Pointer to context specific information e.g. this > - could be a pointer to the ACPI table header. > -**/ > -STATIC > -VOID > -EFIAPI > -ValidateXFirmwareCtrl ( > - IN UINT8* Ptr, > - IN VOID* Context > -) > -{ > -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > - if (*(UINT64*)Ptr != 0) { > -IncrementErrorCount (); > -Print ( > - L"\nERROR: X Firmware Control must be zero for ARM platforms." > -); > - } > -#endif > -} > - > -/** > - This function validates the flags. > - > - @param [in] Ptr Pointer to the start of the field data. > - @param [in] Context
Re: [edk2-devel] [PATCH] [MdePkg/Protocols]: New interface, EFI encodings to PCI Plat protocol
I am anxiously waiting for the review comments. Thanks Ashraf > -Original Message- > From: devel@edk2.groups.io On Behalf Of Javeed, > Ashraf > Sent: Friday, July 5, 2019 4:42 PM > To: Ni, Ray ; Gao, Liming ; > devel@edk2.groups.io; ler...@redhat.com > Cc: Kinney, Michael D > Subject: Re: [edk2-devel] [PATCH] [MdePkg/Protocols]: New interface, EFI > encodings to PCI Plat protocol > > Please let me know if this is good enough? > > Thanks > Ashraf > > > -Original Message- > > From: Ni, Ray > > Sent: Friday, July 5, 2019 4:02 PM > > To: Javeed, Ashraf ; Gao, Liming > > ; devel@edk2.groups.io; ler...@redhat.com > > Cc: Kinney, Michael D > > Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New interface, > > EFI encodings to PCI Plat protocol > > > > Ashraf, > > Can you please attach the patch in the mail? > > I failed to extract the patch content from the mail. > > > > Thanks, > > Ray > > > > > -Original Message- > > > From: Javeed, Ashraf > > > Sent: Friday, July 5, 2019 1:24 PM > > > To: Gao, Liming ; Ni, Ray ; > > > devel@edk2.groups.io; ler...@redhat.com > > > Cc: Kinney, Michael D > > > Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New interface, > > > EFI encodings to PCI Plat protocol > > > > > > Hi, > > > Please note that these 2 tags are automatically added when the mail > > > is sent with the formatted patch of the commit > > > [edk2-devel] [PATCH] > > > > > > I could add the branch name tag when I sent the commit in the > > > Edk2-staging branch for review with the community - > > > [Edk2-staging\Branch name]. This tags will be preceded with the > > > above > > > 2 tags in the subject line of that mail (too many prefix tags). > > > > > > Can I get Reviewed-By to move this in to the Edk2-staging branch? > > > Please note that this would require a PI Spec update. > > > > > > Thanks > > > Ashraf > > > > > > > -Original Message- > > > > From: Gao, Liming > > > > Sent: Friday, July 5, 2019 8:53 AM > > > > To: Ni, Ray ; devel@edk2.groups.io; > > > > ler...@redhat.com; Javeed, Ashraf > > > > Cc: Kinney, Michael D > > > > Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New > > > > interface, EFI encodings to PCI Plat protocol > > > > > > > > Ray: > > > > > > > > > -Original Message- > > > > > From: Ni, Ray > > > > > Sent: Friday, July 5, 2019 11:14 AM > > > > > To: Gao, Liming ; devel@edk2.groups.io; > > > > > ler...@redhat.com; Javeed, Ashraf > > > > > Cc: Kinney, Michael D > > > > > Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New > > > > > interface, EFI encodings to PCI Plat protocol > > > > > > > > > > Some unclear parts in the document: > > > > > 1. Document says title begins with "staging/branch". The "branch" > > > > > means the > > > > "branch" word itself > > > > > or should be replaced with a concrete branch name? I prefer > > > > > "branch" > > > word. > > > > Reasons in previous mail. > > > > > NOTE: this affects the individual patch owner. > > > > I understand here is the specific branch name. The patch is > > > > required to be pushed into the specific branch instead of 'branch'. > > > > I think the patch owner should propose which branch to include his > > > > patch. He can propose new branch or use the existing branch. > > > > > > > > > 2. Who owns the staging/master branch sync to edk2/master? > > > > > Document says > > > > the staging/branch is > > > > > based on staging/master but I guess usually staging patch > > > > > owner creates > > > > staging/branch based on edk2/master. > > > > Yes. I think so. > > > > > > > > Thanks > > > > Liming > > > > > > > > > > Thanks, > > > > > Ray > > > > > > > > > > > -Original Message- > > > > > > From: Gao, Liming > > > > > > Sent: Friday, July 5, 2019 10:49 AM > > > > > > To: Ni, Ray ; devel@edk2.groups.io; > > > > > > ler...@redhat.com; Javeed, Ashraf > > > > > > Cc: Kinney, Michael D > > > > > > Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New > > > > > > interface, EFI encodings to PCI Plat protocol > > > > > > > > > > > > Ray: > > > > > > Yes. Please see https://github.com/tianocore/edk2-staging > > > > > > > > > > > > Thanks > > > > > > Liming > > > > > > >-Original Message- > > > > > > >From: Ni, Ray > > > > > > >Sent: Friday, July 05, 2019 10:39 AM > > > > > > >To: Gao, Liming ; devel@edk2.groups.io; > > > > > > >ler...@redhat.com; Javeed, Ashraf > > > > > > >Cc: Kinney, Michael D > > > > > > >Subject: RE: [edk2-devel] [PATCH] [MdePkg/Protocols]: New > > > > > > >interface, EFI encodings to PCI Plat protocol > > > > > > > > > > > > > >Liming, > > > > > > >I understand Laszlo's comment requiring repo name in the > > > > > > >patch title to tell everyone where the code will be. > > > > > > >But before the patch is pushed, the patch owner in theory > > > > > > >cannot guarantee the branch can be successfully created after > > > > > > >the R-b is > > got. > > > > > > >Because someone may create a branch with the same
Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
Push @a79841a0244ab2afd1efc3b9d4cc91e27fa90d71 > -Original Message- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming > Gao > Sent: Tuesday, July 9, 2019 2:26 PM > To: Yao, Jiewen ; Lu, XiaoyuX ; > devel@edk2.groups.io > Cc: Feng, Bob C > Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION > module type. > > OK. I have no other comments. Reviewed-by: Liming Gao > > Thanks > Liming > > -Original Message- > > From: Yao, Jiewen > > Sent: Monday, July 8, 2019 10:10 AM > > To: Gao, Liming ; Lu, XiaoyuX ; > > devel@edk2.groups.io > > Cc: Feng, Bob C > > Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type. > > > > Right. So far we just duplicate what USER_DEFINED does. > > > > With more and more example, we will see if and how we enhance that. > > But it is good enough now. > > > > Thank you > > Yao Jiewen > > > > > -Original Message- > > > From: Gao, Liming > > > Sent: Monday, July 8, 2019 9:15 AM > > > To: Yao, Jiewen ; Lu, XiaoyuX > > > ; devel@edk2.groups.io > > > Cc: Feng, Bob C > > > Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module > > > type. > > > > > > I see the change in build_rule.txt. I understand its output file is > > > decided by > > > this rule. Right? > > > > > > [Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION] > > > > > > *.lib > > > > > > > > > $(MAKE_FILE) > > > > > > > > > $(DEBUG_DIR)(+)$(MODULE_NAME) > > > > > > > > > "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) > > > @$(STATIC_LIBRARY_FILES_LIST) > > > > > > > > > "$(DLINK)" $(DLINK_FLAGS) > > > -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group > > > $(DLINK2_FLAGS) > > > > > > > > > "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via > > > $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) > > > > > > > > > #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin > > > "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) > > > $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS) > > > > > > > > > "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist > > > $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) > > > > > > > > > Thanks > > > Liming > > > >-Original Message- > > > >From: Yao, Jiewen > > > >Sent: Monday, July 08, 2019 8:53 AM > > > >To: Gao, Liming ; Lu, XiaoyuX > > > ; > > > >devel@edk2.groups.io > > > >Cc: Feng, Bob C > > > >Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module > > > type. > > > > > > > >Currently, it is xxx.efi. > > > > > > > >Thank you > > > >Yao Jiewen > > > > > > > >> -Original Message- > > > >> From: Gao, Liming > > > >> Sent: Monday, July 8, 2019 8:43 AM > > > >> To: Lu, XiaoyuX ; devel@edk2.groups.io > > > >> Cc: Feng, Bob C ; Yao, Jiewen > > > >> > > > >> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module > > > >> type. > > > >> > > > >> Xiaoyu: > > > >> I want to confirm what output for HOST_APPLICATION module will be > > > >> used. Xxx.dll or xxx.efi? > > > >> > > > >> Thanks > > > >> Liming > > > >> >-Original Message- > > > >> >From: Lu, XiaoyuX > > > >> >Sent: Monday, July 01, 2019 6:13 PM > > > >> >To: devel@edk2.groups.io > > > >> >Cc: Lu, XiaoyuX ; Feng, Bob C > > > >> ; > > > >> >Gao, Liming ; Yao, Jiewen > > > >> > > > >> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module > > > type. > > > >> > > > > >> >From: Jiewen Yao > > > >> > > > > >> >It can be used to indicate a module can be build to run > > > >> >as OS application and run in OS environment. > > > >> > > > > >> >Cc: Bob Feng > > > >> >Cc: Liming Gao > > > >> >Cc: Jiewen Yao > > > >> >Signed-off-by: Xiaoyu Lu > > > >> >--- > > > >> > BaseTools/Conf/build_rule.template| 2 +- > > > >> > BaseTools/Source/Python/AutoGen/AutoGen.py| 6 ++--- > > > >> > BaseTools/Source/Python/AutoGen/GenC.py | 23 > > > >> ++- > > > >> > BaseTools/Source/Python/Common/DataType.py| 3 ++- > > > >> > BaseTools/Source/Python/GenFds/FdfParser.py | 2 +- > > > >> > .../Source/Python/GenFds/FfsInfStatement.py | 7 +++--- > > > >> > .../Source/Python/Workspace/InfBuildData.py | 2 +- > > > >> > .../Python/Workspace/WorkspaceCommon.py | 5 ++-- > > > >> > 8 files changed, 27 insertions(+), 23 deletions(-) > > > >> > > > > >> >diff --git a/BaseTools/Conf/build_rule.template > > > >> >b/BaseTools/Conf/build_rule.template > > > >> >index 030e74c35a65..db06d3a6b45a 100755 > > > >> >--- a/BaseTools/Conf/build_rule.template > > > >> >+++ b/BaseTools/Conf/build_rule.template > > > >> >@@ -321,7 +321,7 @@ > > > >> > "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} > > > >> > > > > >> > > > > >> >-[Static-Library-File.USER_DEFINED] > > > >> >+[Static-Library-File.USER_DEFINED, > > > >> Static-Library-File.HOST_APPLICATION] > > > >> > > > > >> > *.lib > > > >> > > > > >> >diff --git
Re: [edk2-devel] [PATCH] FmpDevicePkg: Fix various typos
Push @43622317c67f031f9b2e33c3320f2c89484bd506 From: Cœur [mailto:co...@gmx.fr] Sent: Tuesday, July 9, 2019 1:08 AM To: Gao; Gao, Liming ; devel@edk2.groups.io Subject: Re: [edk2-devel] [PATCH] FmpDevicePkg: Fix various typos On Mon, Jul 8, 2019 at 09:21 AM, Liming Gao wrote: Please add Signed-off-by: your name. I'll do that in the future. Consider it's the following for past emails/patches: Signed-off-by: Cœur mailto:co...@gmx.fr>> -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43656): https://edk2.groups.io/g/devel/message/43656 Mute This Topic: https://groups.io/mt/32317809/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch 2/2] UefiCpuPkg/Library/RegisterCpuFeaturesLib: avoid use dynamic PCD.
4 comments are added inline. > -Original Message- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Dong, Eric > Sent: Friday, July 12, 2019 9:53 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Laszlo Ersek ; Kumar, > Chandana C ; Zeng, Star > > Subject: [edk2-devel] [Patch 2/2] > UefiCpuPkg/Library/RegisterCpuFeaturesLib: avoid use dynamic PCD. > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1972 > > Function in this library may be used by APs. Assert will be trig if AP uses > dynamic pcd. > This patch enhance the current code, remove the unnecessary usage of > dynamic PCD. This change try to avoid report this issue again later. > > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Cc: Star Zeng > Signed-off-by: Eric Dong > --- > .../CpuFeaturesInitialize.c | 64 +- > .../RegisterCpuFeatures.h | 10 +- > .../RegisterCpuFeaturesLib.c | 114 ++ > 3 files changed, 77 insertions(+), 111 deletions(-) > > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index 87bfc64250..16b99c0c27 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -21,16 +21,12 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR", > L"MMIO", L"CACHE", L"SEMAP", L"INVA VOID SetCapabilityPcd ( >IN UINT8 *SupportedFeatureMask, > - IN UINT32 FeatureMaskSize > + IN UINTN FeatureMaskSize 1. How about using BitMaskSize to be aligned with other places? Notice, the function header also needs to be updated if using BitMaskSize. >) > { >EFI_STATUS Status; > - UINTN BitMaskSize; > > - BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability); > - ASSERT (FeatureMaskSize == BitMaskSize); > - > - Status = PcdSetPtrS (PcdCpuFeaturesCapability, , > SupportedFeatureMask); > + Status = PcdSetPtrS (PcdCpuFeaturesCapability, , > + SupportedFeatureMask); >ASSERT_EFI_ERROR (Status); > } > > @@ -38,16 +34,16 @@ SetCapabilityPcd ( >Worker function to save PcdCpuFeaturesSetting. > >@param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer > + @param[in] FeatureMaskSize CPU feature bits mask buffer size. 2. Need use BitMaskSize to be matched with function parameter name. > **/ > VOID > SetSettingPcd ( > - IN UINT8 *SupportedFeatureMask > + IN UINT8 *SupportedFeatureMask, > + IN UINTN BitMaskSize >) > { >EFI_STATUS Status; > - UINTN BitMaskSize; > > - BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting); >Status = PcdSetPtrS (PcdCpuFeaturesSetting, , > SupportedFeatureMask); >ASSERT_EFI_ERROR (Status); > } > @@ -272,19 +268,20 @@ SupportedMaskOr ( > >@param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer >@param[in] AndFeatureBitMask The feature bit mask to do AND > operation > + @param[in] BitMaskSize CPU feature bits mask buffer size. > + > **/ > VOID > SupportedMaskAnd ( >IN UINT8 *SupportedFeatureMask, > - IN CONST UINT8 *AndFeatureBitMask > + IN CONST UINT8 *AndFeatureBitMask, > + IN UINT32 BitMaskSize >) > { >UINTN Index; > - UINTN BitMaskSize; >UINT8 *Data1; >CONST UINT8*Data2; > > - BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting); >Data1 = SupportedFeatureMask; >Data2 = AndFeatureBitMask; >for (Index = 0; Index < BitMaskSize; Index++) { @@ -297,19 +294,19 @@ > SupportedMaskAnd ( > >@param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer >@param[in] AndFeatureBitMask The feature bit mask to do XOR > operation > + @param[in] BitMaskSize CPU feature bits mask buffer size. > **/ > VOID > SupportedMaskCleanBit ( >IN UINT8 *SupportedFeatureMask, > - IN UINT8 *AndFeatureBitMask > + IN UINT8 *AndFeatureBitMask, > + IN UINT32 BitMaskSize >) > { >UINTN Index; > - UINTN BitMaskSize; >UINT8 *Data1; >UINT8 *Data2; > > - BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting); >Data1 = SupportedFeatureMask; >Data2 = AndFeatureBitMask; >for (Index = 0; Index < BitMaskSize; Index++) { @@ -323,6 +320,7 @@ > SupportedMaskCleanBit ( > >@param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer >@param[in] ComparedFeatureBitMask The feature bit mask to be > compared > + @param[in] BitMaskSizeCPU feature bits mask buffer size. > >@retval TRUE
Re: [edk2-devel] [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service.
Some minor comments inline. > -Original Message- > From: Dong, Eric > Sent: Friday, July 12, 2019 9:53 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Laszlo Ersek ; Kumar, > Chandana C ; Zeng, Star > > Subject: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS > service. "gBS service" is not match with the assertion information, gBS is the concept in DXE phase. So here, please "PEI service" to be accurate. > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1972 > > AP calls CollectProcessorData() to collect processor info. > CollectProcessorData function finally calls PcdGetSize function to > get DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use gBS Same comments with above. > which caused below assert info: > Processor Info: Package: 1, MaxCore : 4, MaxThread: 1 > Package: 0, Valid Core : 4 > ASSERT [CpuFeaturesPei] c:\projects\jsl\jsl_v1193\Edk2\MdePkg\Library > \PeiServicesTablePointerLibIdt\PeiServicesTablePointer.c(48): > PeiServices != ((void *) 0) > > This change uses saved global pcd size instead of calls PcdGetSize to > fix this issue. > > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Cc: Star Zeng > Signed-off-by: Eric Dong > --- > .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 13 - > .../RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 5 + > 2 files changed, 13 insertions(+), 5 deletions(-) > > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index aff7ad600c..87bfc64250 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -246,19 +246,20 @@ CpuInitDataInitialize ( > >@param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer >@param[in] OrFeatureBitMask The feature bit mask to do OR operation > + @param[in] BitMaskSize The CPU feature bits mask buffer size. > + > **/ > VOID > SupportedMaskOr ( >IN UINT8 *SupportedFeatureMask, > - IN UINT8 *OrFeatureBitMask > + IN UINT8 *OrFeatureBitMask, > + IN UINT32 BitMaskSize >) > { >UINTN Index; > - UINTN BitMaskSize; >UINT8 *Data1; >UINT8 *Data2; > > - BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting); >Data1 = SupportedFeatureMask; >Data2 = OrFeatureBitMask; >for (Index = 0; Index < BitMaskSize; Index++) { > @@ -384,12 +385,14 @@ CollectProcessorData ( >// >SupportedMaskOr ( > CpuFeaturesData- > >InitOrder[ProcessorNumber].FeaturesSupportedMask, > -CpuFeature->FeatureMask > +CpuFeature->FeatureMask, > +CpuFeaturesData->BitMaskSize > ); > } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, > CpuFeature->ConfigData)) { >SupportedMaskOr ( > CpuFeaturesData- > >InitOrder[ProcessorNumber].FeaturesSupportedMask, > -CpuFeature->FeatureMask > +CpuFeature->FeatureMask, > +CpuFeaturesData->BitMaskSize > ); > } > Entry = Entry->ForwardLink; > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > index fa0f0b41e2..36aabd7267 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > @@ -658,6 +658,11 @@ RegisterCpuFeatureWorker ( > InitializeListHead (>FeatureList); > InitializeSpinLock (>CpuFlags.MemoryMappedLock); > InitializeSpinLock (>CpuFlags.ConsoleLogLock); > +// > +// Driver has assumption that these three PCD should has same buffer > size. It is library, not driver. So how about "The code has assumption that these three PCDs should have same buffer size."? The proposed sentence also uses 'PCDs' and 'have'. With the comments handled, Reviewed-by: Star Zeng Thanks, Star > +// > +ASSERT (PcdGetSize (PcdCpuFeaturesSetting) == PcdGetSize > (PcdCpuFeaturesCapability)); > +ASSERT (PcdGetSize (PcdCpuFeaturesSetting) == PcdGetSize > (PcdCpuFeaturesSupport)); > CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize; >} >ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize); > -- > 2.21.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43654): https://edk2.groups.io/g/devel/message/43654 Mute This Topic: https://groups.io/mt/32437607/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] UefiCpuPkg CpuCommonFeaturesLib: Enhance Ppin code
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1961 Enhance Ppin code to enable and unlock for TRUE State, and disable and lock for FALSE State. Note: enable and lock could not be set both. Cc: Laszlo Ersek Cc: Eric Dong Cc: Ray Ni Cc: Chandana Kumar Cc: Kevin Li Signed-off-by: Star Zeng --- .../CpuCommonFeaturesLib/CpuCommonFeatures.h | 15 + .../CpuCommonFeaturesLib.c| 2 +- .../Library/CpuCommonFeaturesLib/Ppin.c | 65 +++ 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h index 9e784e916a85..8406c6c1619f 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h @@ -863,6 +863,21 @@ FeatureControlGetConfigData ( IN UINTN NumberOfProcessors ); +/** + Prepares for the data used by CPU feature detection and initialization. + + @param[in] NumberOfProcessors The number of CPUs in the platform. + + @return Pointer to a buffer of CPU related configuration data. + + @note This service could be called by BSP only. +**/ +VOID * +EFIAPI +PpinGetConfigData ( + IN UINTN NumberOfProcessors + ); + /** Detects if Protected Processor Inventory Number feature supported on current processor. diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c index 7cc692efb649..fd43b8d66290 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c @@ -203,7 +203,7 @@ CpuCommonFeaturesLibConstructor ( if (IsCpuFeatureSupported (CPU_FEATURE_PPIN)) { Status = RegisterCpuFeature ( "PPIN", - NULL, + PpinGetConfigData, PpinSupport, PpinInitialize, CPU_FEATURE_PPIN, diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c index e8a4de8dcf60..8067cf44d015 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c @@ -8,6 +8,28 @@ #include "CpuCommonFeatures.h" +/** + Prepares for the data used by CPU feature detection and initialization. + + @param[in] NumberOfProcessors The number of CPUs in the platform. + + @return Pointer to a buffer of CPU related configuration data. + + @note This service could be called by BSP only. +**/ +VOID * +EFIAPI +PpinGetConfigData ( + IN UINTN NumberOfProcessors + ) +{ + VOID *ConfigData; + + ConfigData = AllocateZeroPool (sizeof (MSR_IVY_BRIDGE_PPIN_CTL_REGISTER) * NumberOfProcessors); + ASSERT (ConfigData != NULL); + return ConfigData; +} + /** Detects if Protected Processor Inventory Number feature supported on current processor. @@ -34,6 +56,7 @@ PpinSupport ( ) { MSR_IVY_BRIDGE_PLATFORM_INFO_1_REGISTERPlatformInfo; + MSR_IVY_BRIDGE_PPIN_CTL_REGISTER *MsrPpinCtrl; if ((CpuInfo->DisplayFamily == 0x06) && ((CpuInfo->DisplayModel == 0x3E) || // Xeon E5 V2 @@ -47,7 +70,12 @@ PpinSupport ( // Check whether platform support this feature. // PlatformInfo.Uint64 = AsmReadMsr64 (MSR_IVY_BRIDGE_PLATFORM_INFO_1); -return (PlatformInfo.Bits.PPIN_CAP != 0); +if (PlatformInfo.Bits.PPIN_CAP != 0) { + MsrPpinCtrl = (MSR_IVY_BRIDGE_PPIN_CTL_REGISTER *) ConfigData; + ASSERT (MsrPpinCtrl != NULL); + MsrPpinCtrl[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IVY_BRIDGE_PPIN_CTL); + return TRUE; +} } return FALSE; @@ -73,6 +101,7 @@ PpinSupport ( @retval RETURN_DEVICE_ERROR Device can't change state because it has been locked. + @note This service could be called by BSP only. **/ RETURN_STATUS EFIAPI @@ -83,16 +112,18 @@ PpinInitialize ( IN BOOLEAN State ) { - MSR_IVY_BRIDGE_PPIN_CTL_REGISTER MsrPpinCtrl; + MSR_IVY_BRIDGE_PPIN_CTL_REGISTER *MsrPpinCtrl; + + MsrPpinCtrl = (MSR_IVY_BRIDGE_PPIN_CTL_REGISTER *) ConfigData; + ASSERT (MsrPpinCtrl != NULL); // - // Check whether device already lock this register. - // If already locked, just base on the request state and + // Check whether processor already lock this register. + // If already locked, just based on the request state and // the current state to return the status. // - MsrPpinCtrl.Uint64 = AsmReadMsr64 (MSR_IVY_BRIDGE_PPIN_CTL); - if (MsrPpinCtrl.Bits.LockOut != 0) { -return MsrPpinCtrl.Bits.Enable_PPIN == State ? RETURN_SUCCESS : RETURN_DEVICE_ERROR; + if (MsrPpinCtrl[ProcessorNumber].Bits.LockOut != 0) { +return MsrPpinCtrl[ProcessorNumber].Bits.Enable_PPIN == State ? RETURN_SUCCESS : RETURN_DEVICE_ERROR; } //
Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
Push @2d100d1d73a9f9a38f224e87c48276ba1e84d8ce > -Original Message- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming > Gao > Sent: Thursday, July 11, 2019 2:54 PM > To: devel@edk2.groups.io; Feng, Bob C > Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when > ToolDefinitionFile is not generated > > Reviewed-by: Liming Gao > > >-Original Message- > >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > >Bob Feng > >Sent: Thursday, July 11, 2019 8:58 AM > >To: devel@edk2.groups.io > >Cc: Gao, Liming ; Feng, Bob C > >Subject: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when > >ToolDefinitionFile is not generated > > > >ToolDefinitionFile is generated by PlatformAutoGen.ToolDefinition() > >Code assume ToolDefinition is always called before using > >ToolDefinitionFile, but in some cases, it's not true. > > > >This patch is to fix this issue. > > > >Cc: Liming Gao > >Signed-off-by: Bob Feng > >--- > > BaseTools/Source/Python/AutoGen/AutoGen.py | 9 ++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py > >b/BaseTools/Source/Python/AutoGen/AutoGen.py > >index c0d0ca15867b..5cfaf2141af0 100644 > >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py > >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py > >@@ -1910,22 +1910,25 @@ class PlatformAutoGen(AutoGen): > > if Attr == "FLAGS": > > MakeFlags = Value > > else: > > ToolsDef += "%s_%s = %s\n" % (Tool, Attr, Value) > > ToolsDef += "\n" > >- > >-SaveFileOnChange(self.ToolDefinitionFile, ToolsDef, False) > >+tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + > >self.Arch) > >+SaveFileOnChange(tool_def_file, ToolsDef, False) > > for DllPath in DllPathList: > > os.environ["PATH"] = DllPath + os.pathsep + os.environ["PATH"] > > os.environ["MAKE_FLAGS"] = MakeFlags > > > > return RetVal > > > > ## Return the paths of tools > > @cached_property > > def ToolDefinitionFile(self): > >-return os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch) > >+tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + > >self.Arch) > >+if not os.path.exists(tool_def_file): > >+self.ToolDefinition > >+return tool_def_file > > > > ## Retrieve the toolchain family of given toolchain tag. Default to > > 'MSFT'. > > @cached_property > > def ToolChainFamily(self): > > ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase > >-- > >2.20.1.windows.1 > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43652): https://edk2.groups.io/g/devel/message/43652 Mute This Topic: https://groups.io/mt/32422788/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v1 10/11] ShellPkg: acpiview: GTDT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Test against buffer overruns. 3. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. 4. Remove redundant forward function declarations by repositioning blocks of code. 5. Convert a 'do-while' loop for parsing GTDT table body into a 'while' block for consistency with other table parsers. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/8c2ed18c7f1c44620eb86e1c9117cbccee8938ce Notes: v1: - improve the logic in the GTDT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 294 +++- 1 file changed, 170 insertions(+), 124 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index 3b05ff3015d4a3af62dd9fab057c32369a456267..4e8e6f3eb50596823827d20dbb72314a583d0931 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -12,6 +12,10 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" + +// "The number of GT Block Timers must be less than or equal to 8" +#define GT_BLOCK_TIMER_COUNT_MAX 8 // Local variables STATIC CONST UINT32* GtdtPlatformTimerCount; @@ -20,7 +24,6 @@ STATIC CONST UINT8* PlatformTimerType; STATIC CONST UINT16* PlatformTimerLength; STATIC CONST UINT32* GtBlockTimerCount; STATIC CONST UINT32* GtBlockTimerOffset; -STATIC CONST UINT16* GtBlockLength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /** @@ -36,7 +39,21 @@ EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + UINT32 BlockTimerCount; + + BlockTimerCount = *(UINT32*)Ptr; + + if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) { +IncrementErrorCount (); +Print ( + L"\nERROR: Timer Count = %d. Max Timer Count is %d.", + BlockTimerCount, + GT_BLOCK_TIMER_COUNT_MAX + ); + } +} /** This function validates the GT Frame Number. @@ -51,7 +68,21 @@ EFIAPI ValidateGtFrameNumber ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + UINT8 FrameNumber; + + FrameNumber = *(UINT8*)Ptr; + + if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) { +IncrementErrorCount (); +Print ( + L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-%d.", + FrameNumber, + GT_BLOCK_TIMER_COUNT_MAX - 1 + ); + } +} /** An ACPI_PARSER array describing the ACPI GTDT Table. @@ -96,7 +127,7 @@ STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = { **/ STATIC CONST ACPI_PARSER GtBlockParser[] = { {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, - {L"Length", 2, 1, L"%d", NULL, (VOID**), NULL, NULL}, + {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Timer Count", 4, 12, L"%d", NULL, (VOID**), @@ -134,115 +165,71 @@ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = { {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL} }; -/** - This function validates the GT Block timer count. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtBlockTimerCount ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT32 BlockTimerCount; - - BlockTimerCount = *(UINT32*)Ptr; - - if (BlockTimerCount > 8) { -IncrementErrorCount (); -Print ( - L"\nERROR: Timer Count = %d. Max Timer Count is 8.", - BlockTimerCount - ); - } -} - -/** - This function validates the GT Frame Number. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtFrameNumber ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT8 FrameNumber; - - FrameNumber = *(UINT8*)Ptr; - - if (FrameNumber > 7) { -IncrementErrorCount (); -Print ( - L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-7.", - FrameNumber - ); - } -} - /** This function parses the Platform GT Block. - @param [in] Ptr Pointer to the start of the GT Block data. - @param [in] Length Length of the GT Block structure. + @param [in] Ptr Pointer to the start of the GT Block data. + @param [in] LengthLength of the GT Block structure. **/ STATIC VOID DumpGTBlock ( IN UINT8* Ptr, - IN UINT32 Length + IN
[edk2-devel] [PATCH v1 11/11] ShellPkg: acpiview: DBG2: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Remove redundant forward function declarations by repositioning blocks of code. 3. Test against buffer overruns. 4. Introduce a ACPI_PARSER array for parsing the header of the debug device information structure. This way, the length of the buffer storing a debug device information structure instance can be passed to DumpDbgDeviceInfo(). Consequently, the parsing logic becomes consistent with other ACPI table parsers and tests against buffer overrruns are simpler to implement. 5. Modify the signature of DumpGasStruct() function inside AcpiParser.c to facilitate protection against buffer overruns in the DBG2 parser. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/530b059a9fe4aa9f1df36b407f97d76acaab8b74 Notes: v1: - improve the logic in the DBG2 parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 26 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | 298 ++-- 3 files changed, 225 insertions(+), 107 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 8b3153516d2b7d9b920ab2de0344c17798ac572c..2d6ff80e299eebe7853061d3db89332197c0dc0e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -589,23 +589,27 @@ STATIC CONST ACPI_PARSER GasParser[] = { @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8*Ptr, - IN UINT32Indent + IN UINT32Indent, + IN UINT32Length ) { Print (L"\n"); - ParseAcpi ( -TRUE, -Indent, -NULL, -Ptr, -GAS_LENGTH, -PARSER_PARAMS (GasParser) -); + return ParseAcpi ( + TRUE, + Indent, + NULL, + Ptr, + Length, + PARSER_PARAMS (GasParser) + ); } /** @@ -621,7 +625,7 @@ DumpGas ( IN UINT8*Ptr ) { - DumpGasStruct (Ptr, 2); + DumpGasStruct (Ptr, 2, GAS_LENGTH); } /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 7657892d9fd2e2e14c6578611ff0cf1b6f6cd750..20ca358bddfa5953bfb1d1bebaebbf3079eaba01 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -405,12 +405,16 @@ ParseAcpi ( @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8*Ptr, - IN UINT32Indent + IN UINT32Indent, + IN UINT32Length ); /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index 8de5ebf74775bab8e765849cba6ef4eb6f659a5a..2bbd622ffb7cec0a340de3e10bdcd01ba4d330df 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -12,6 +12,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local variables pointing to the table fields STATIC CONST UINT32* OffsetDbgDeviceInfo; @@ -27,7 +28,7 @@ STATIC CONST UINT16* AddrSizeOffset; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /** - This function Validates the NameSpace string length. + This function validates the NameSpace string length. @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this @@ -37,24 +38,23 @@ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( - IN UINT8* Ptr, - IN VOID* Context - ); + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT16 NameSpaceStrLen; -/** - This function parses the debug device information structure. + NameSpaceStrLen = *(UINT16*)Ptr; - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Length Pointer in which the length of the debug - device information is returned. -**/ -STATIC -VOID -EFIAPI -DumpDbgDeviceInfo ( - IN UINT8* Ptr, - OUT UINT32* Length - ); + if (NameSpaceStrLen < 2) { +IncrementErrorCount (); +Print ( + L"\nERROR:
[edk2-devel] [PATCH v1 09/11] ShellPkg: acpiview: IORT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Remove redundant forward function declarations by repositioning blocks of code. 3. Test against buffer overruns. 4. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. 5. Move ID mapping count validation for the PMCG node to the IortNodePmcgParser[] ACPI_PARSER array. This check does not affect the flow of IORT parsing and is limited to a single table field in scope. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/0b398f116f7aed99dbec4090b5c2c0ed93273ef7 Notes: v1: - improve the logic in the IORT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 419 +--- 1 file changed, 279 insertions(+), 140 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 93f78e1a9786ed53f6b5529f478b72a220b4f8df..f09e7aeeb34bf4c3d9564240b53539c8d6811f66 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @@ -45,7 +46,35 @@ EFIAPI ValidateItsIdMappingCount ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + if (*(UINT32*)Ptr != 0) { +IncrementErrorCount (); +Print (L"\nERROR: IORT ID Mapping count must be zero."); + } +} + +/** + This function validates the ID Mapping array count for the Performance + Monitoring Counter Group (PMCG) node. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePmcgIdMappingCount ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT32*)Ptr > 1) { +IncrementErrorCount (); +Print (L"\nERROR: IORT ID Mapping count must not be greater than 1."); + } +} /** This function validates the ID Mapping array offset for the ITS node. @@ -60,7 +89,13 @@ EFIAPI ValidateItsIdArrayReference ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + if (*(UINT32*)Ptr != 0) { +IncrementErrorCount (); +Print (L"\nERROR: IORT ID Mapping offset must be zero."); + } +} /** Helper Macro for populating the IORT Node header in the ACPI_PARSER array. @@ -204,95 +239,65 @@ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { An ACPI_PARSER array describing the IORT PMCG node. **/ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), + PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, }; -/** - This function validates the ID Mapping array count for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdMappingCount ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 0) { -IncrementErrorCount (); -Print (L"\nERROR: IORT ID Mapping count must be zero."); - } -} - -/** - This function validates the ID Mapping array offset for the ITS node. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateItsIdArrayReference ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 0) { -IncrementErrorCount (); -Print (L"\nERROR: IORT ID Mapping offset must be zero."); - } -} - /** This function parses the IORT Node Id Mapping array. - @param [in] PtrPointer to the start of the IORT Table. + @param [in] PtrPointer to the start of the ID mapping array. + @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. - @param [in] MappingOffset The offset of the ID Mapping array - from the start of the IORT table. **/ STATIC VOID DumpIortNodeIdMappings ( IN UINT8* Ptr, - IN UINT32 MappingCount, - IN UINT32 MappingOffset + IN UINT32 Length, + IN UINT32 MappingCount ) { - UINT8* IdMappingPtr; UINT32 Index; UINT32 Offset; CHAR8 Buffer[40]; //
[edk2-devel] [PATCH v1 08/11] ShellPkg: acpiview: PPTT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Give forward progress guarantee when parsing the PPTT table. Report an error if a PPTT structure is too small to be valid. Without this check, there is a possibility for the parser to enter an ifninite loop. 3. Test against buffer overruns. 4. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/e4789351e111fa1ed6a2c55759f190166b08fc8c Notes: v1: - improve the logic in the PPTT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 95 1 file changed, 76 insertions(+), 19 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c index cec57be55e77096f9448f637ea129af2b42111ad..8d8760940b493eb94c91da3d46f9a844930c1738 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -252,7 +252,6 @@ DumpProcessorHierarchyNodeStructure ( ) { UINT32 Offset; - UINT8* PrivateResourcePtr; UINT32 Index; CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; @@ -265,8 +264,34 @@ DumpProcessorHierarchyNodeStructure ( PARSER_PARAMS (ProcessorHierarchyNodeStructureParser) ); - PrivateResourcePtr = Ptr + Offset; + // Check if the values used to control the parsing logic have been + // successfully read. + if (NumberOfPrivateResources == NULL) { +IncrementErrorCount (); +Print ( + L"ERROR: Insufficient Processor Hierarchy Node length. Length = %d.\n", + Length + ); +return; + } + + // Make sure the Private Resource array lies inside this structure + if (Offset + (*NumberOfPrivateResources * sizeof (UINT32)) > Length) { +IncrementErrorCount (); +Print ( + L"ERROR: Invalid Number of Private Resources. " \ +L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \ +L"Parsing of this structure aborted.\n", + *NumberOfPrivateResources, + Length - Offset + ); +return; + } + Index = 0; + + // Parse the specified number of private resource references or the Processor + // Hierarchy Node length. Whichever is minimum. while (Index < *NumberOfPrivateResources) { UnicodeSPrint ( Buffer, @@ -278,10 +303,10 @@ DumpProcessorHierarchyNodeStructure ( PrintFieldName (4, Buffer); Print ( L"0x%x\n", - *((UINT32*) PrivateResourcePtr) + *((UINT32*)(Ptr + Offset)) ); -PrivateResourcePtr += sizeof(UINT32); +Offset += sizeof (UINT32); Index++; } } @@ -373,6 +398,7 @@ ParseAcpiPptt ( AcpiTableLength, PARSER_PARAMS (PpttParser) ); + ProcessorTopologyStructurePtr = Ptr + Offset; while (Offset < AcpiTableLength) { @@ -382,19 +408,47 @@ ParseAcpiPptt ( 0, NULL, ProcessorTopologyStructurePtr, - 4, // Length of the processor topology structure header is 4 bytes + AcpiTableLength - Offset, PARSER_PARAMS (ProcessorTopologyStructureHeaderParser) ); -if ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength) { +// Check if the values used to control the parsing logic have been +// successfully read. +if ((ProcessorTopologyStructureType == NULL) || +(ProcessorTopologyStructureLength == NULL)) { IncrementErrorCount (); Print ( -L"ERROR: Invalid processor topology structure length:" - L" Type = %d, Length = %d\n", -*ProcessorTopologyStructureType, -*ProcessorTopologyStructureLength +L"ERROR: Insufficient remaining table buffer length to read the " \ + L"processor topology structure header. Length = %d.\n", +AcpiTableLength - Offset ); - break; + return; +} + +// Make sure forward progress is made. +if (*ProcessorTopologyStructureLength < 2) { + IncrementErrorCount (); + Print ( +L"ERROR: Structure length is too small: " \ + L"ProcessorTopologyStructureLength = %d. " \ + L"ProcessorTopologyStructureType = %d. PPTT parsing aborted.\n", +*ProcessorTopologyStructureLength, +*ProcessorTopologyStructureType +); + return; +} + +// Make sure the PPTT structure lies inside the table +if ((Offset + *ProcessorTopologyStructureLength) > AcpiTableLength) { + IncrementErrorCount (); + Print ( +L"ERROR: Invalid PPTT structure length. " \ + L"ProcessorTopologyStructureLength = %d. " \ + L"RemainingTableBufferLength = %d. PPTT parsing aborted.\n", +
[edk2-devel] [PATCH v1 07/11] ShellPkg: acpiview: MADT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Give forward progress guarantee when parsing the MADT table. Report an error if a MADT structure is too small to be valid. Without this check, there is a possibility for the parser to enter an ifninite loop. 3. Test against buffer overruns. 4. Remove redundant forward function declarations by repositioning blocks of code. 5. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/ef11738efc94a9c3d7270d376a2cb273bbadbba2 Notes: v1: - improve the logic in the MADT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 187 ++-- 1 file changed, 94 insertions(+), 93 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 59c3df0cc8a080497b517baf36fc63f1e4ab866f..54f9fddc5426de5383b747ec7afd21396bcccfc9 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -15,6 +15,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" #include "MadtParser.h" // Local Variables @@ -35,7 +36,15 @@ EFIAPI ValidateGICDSystemVectorBase ( IN UINT8* Ptr, IN VOID* Context - ); +) +{ + if (*(UINT32*)Ptr != 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: System Vector Base must be zero." +); + } +} /** This function validates the SPE Overflow Interrupt in the GICC. @@ -50,7 +59,41 @@ EFIAPI ValidateSpeOverflowInterrupt ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + UINT16 SpeOverflowInterrupt; + + SpeOverflowInterrupt = *(UINT16*)Ptr; + + // SPE not supported by this processor + if (SpeOverflowInterrupt == 0) { +return; + } + + if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) || + ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) && + (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) || + (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) { +IncrementErrorCount (); +Print ( + L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID " +L"ranges of %d-%d or %d-%d (for GICv3.1 or later).", + SpeOverflowInterrupt, + ARM_PPI_ID_MIN, + ARM_PPI_ID_MAX, + ARM_PPI_ID_EXTENDED_MIN, + ARM_PPI_ID_EXTENDED_MAX +); + } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) { +IncrementWarningCount(); +Print ( + L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA " +L"Level 3 PPI ID assignment: %d.", + SpeOverflowInterrupt, + ARM_PPI_ID_PMBIRQ +); + } +} /** An ACPI_PARSER array describing the GICC Interrupt Controller Structure. @@ -158,78 +201,6 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL} }; -/** - This function validates the System Vector Base in the GICD. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGICDSystemVectorBase ( - IN UINT8* Ptr, - IN VOID* Context -) -{ - if (*(UINT32*)Ptr != 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: System Vector Base must be zero." -); - } -} - -/** - This function validates the SPE Overflow Interrupt in the GICC. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateSpeOverflowInterrupt ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT16 SpeOverflowInterrupt; - - SpeOverflowInterrupt = *(UINT16*)Ptr; - - // SPE not supported by this processor - if (SpeOverflowInterrupt == 0) { -return; - } - - if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) || - ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) && - (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) || - (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) { -IncrementErrorCount (); -Print ( - L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID " -L"ranges of %d-%d or %d-%d (for GICv3.1 or later).", - SpeOverflowInterrupt, - ARM_PPI_ID_MIN, - ARM_PPI_ID_MAX, - ARM_PPI_ID_EXTENDED_MIN, - ARM_PPI_ID_EXTENDED_MAX -); - } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) { -IncrementWarningCount(); -Print ( - L"\nWARNING: SPE Overflow Interrupt ID of
[edk2-devel] [PATCH v1 06/11] ShellPkg: acpiview: SRAT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Give forward progress guarantee when parsing the SRAT table. Report an error if a SRAT structure is too small to be valid. Without this check, there is a possibility for the parser to enter an ifninite loop. 3. Test against buffer overruns. 4. Remove redundant forward function declarations by repositioning blocks of code. 5. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/d46d682d28654b1c6263be2f4fd961c35e80e5cb Notes: v1: - improve the logic in the SRAT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 113 +++- 1 file changed, 63 insertions(+), 50 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index 075ff2a141a82b522e8aaedb7ad79249aaf5eaac..a12aceb70d273a628387b72437819dc05ad7301e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -1,7 +1,7 @@ /** @file SRAT table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local Variables STATIC CONST UINT8* SratRAType; @@ -32,7 +33,13 @@ EFIAPI ValidateSratReserved ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + if (*(UINT32*)Ptr != 1) { +IncrementErrorCount (); +Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); + } +} /** This function traces the APIC Proximity Domain field. @@ -44,9 +51,16 @@ STATIC VOID EFIAPI DumpSratApicProximity ( - IN CONST CHAR16* Format, - IN UINT8* Ptr - ); + IN CONST CHAR16* Format, + IN UINT8*Ptr + ) +{ + UINT32 ProximityDomain; + + ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + + Print (Format, ProximityDomain); +} /** An ACPI_PARSER array describing the SRAT Table. @@ -139,47 +153,6 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL} }; -/** This function validates the Reserved field in the SRAT table header. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateSratReserved ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - if (*(UINT32*)Ptr != 1) { -IncrementErrorCount (); -Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); - } -} - -/** - This function traces the APIC Proximity Domain field. - - @param [in] Format Format string for tracing the data. - @param [in] Ptr Pointer to the start of the buffer. -**/ -STATIC -VOID -EFIAPI -DumpSratApicProximity ( - IN CONST CHAR16* Format, - IN UINT8*Ptr - ) -{ - UINT32 ProximityDomain; - - ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); - - Print (Format, ProximityDomain); -} - /** This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and @@ -234,6 +207,7 @@ ParseAcpiSrat ( AcpiTableLength, PARSER_PARAMS (SratParser) ); + ResourcePtr = Ptr + Offset; while (Offset < AcpiTableLength) { @@ -242,10 +216,47 @@ ParseAcpiSrat ( 0, NULL, ResourcePtr, - 2, // The length is 1 byte at offset 1 + AcpiTableLength - Offset, PARSER_PARAMS (SratResourceAllocationParser) ); +// Check if the values used to control the parsing logic have been +// successfully read. +if ((SratRAType == NULL) || +(SratRALength == NULL)) { + IncrementErrorCount (); + Print ( +L"ERROR: Insufficient remaining table buffer length to read the " \ + L"Static Resource Allocation structure header. Length = %d.\n", +AcpiTableLength - Offset +); + return; +} + +// Make sure forward progress is made. +if (*SratRALength < 2) { + IncrementErrorCount (); + Print ( +L"ERROR: Structure length is too small: SratRALength = %d. " \ + L"SratRAType = %d. SRAT parsing aborted.\n", +*SratRALength, +*SratRAType +); + return; +} + +// Make sure the SRAT structure lies inside the table +if ((Offset + *SratRALength) > AcpiTableLength) { +
[edk2-devel] [PATCH v1 01/11] ShellPkg: acpiview: FADT: Validate global pointers before use
1. Check if the global pointer have been successfully updated before they are later used to control the parsing logic in the FADT acpiview parser. 2. Remove redundant forward function declarations by repositioning blocks of code. 3. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/49cc41430775fb93205e302590a7d31f080c3952 Notes: v1: - improve the logic in the parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 131 1 file changed, 51 insertions(+), 80 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index cee7ee0770433da96d6042d2f5d687903f4b5495..600d3b16d7b22b61c1a1fd21ecb93f16c7f8fa1a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -1,7 +1,7 @@ /** @file FADT table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -12,6 +12,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local variables STATIC CONST UINT32* DsdtAddress; @@ -46,7 +47,17 @@ EFIAPI ValidateFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context - ); +) +{ +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + if (*(UINT32*)Ptr != 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: Firmware Control must be zero for ARM platforms." +); + } +#endif +} /** This function validates the X_Firmware Control Field. @@ -61,7 +72,17 @@ EFIAPI ValidateXFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context - ); +) +{ +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + if (*(UINT64*)Ptr != 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: X Firmware Control must be zero for ARM platforms." +); + } +#endif +} /** This function validates the flags. @@ -76,7 +97,17 @@ EFIAPI ValidateFlags ( IN UINT8* Ptr, IN VOID* Context - ); +) +{ +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms." +); + } +#endif +} /** An ACPI_PARSER array describing the ACPI FADT Table. @@ -142,81 +173,6 @@ STATIC CONST ACPI_PARSER FadtParser[] = { {L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL} }; -/** - This function validates the Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (*(UINT32*)Ptr != 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: Firmware Control must be zero for ARM platforms." -); - } -#endif -} - -/** - This function validates the X_Firmware Control Field. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXFirmwareCtrl ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (*(UINT64*)Ptr != 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: X Firmware Control must be zero for ARM platforms." -); - } -#endif -} - -/** - This function validates the flags. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateFlags ( - IN UINT8* Ptr, - IN VOID* Context -) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms." -); - } -#endif -} - /** This function parses the ACPI FADT table. This function parses the FADT table and optionally traces the ACPI table fields. @@ -248,12 +204,27 @@ ParseAcpiFadt ( PARSER_PARAMS (FadtParser) ); + // Check if the values used to control the parsing logic have been + // successfully read. + if ((DsdtAddress == NULL) || + (FadtMinorRevision == NULL) || + (X_DsdtAddress == NULL)) { +
[edk2-devel] [PATCH v1 03/11] ShellPkg: acpiview: RSDP: Make printing table checksum optional
1. Don't validate Root System Description Pointer (RSDP) structure checksum if the '-q' command line flag is used with the acpiview UEFI shell tool. This change makes the RSDP parser consistent with the parsers for other ACPI tables. 2. Check if XsdtAddress pointer has been successfully updated before it is used for further table parsing. 3. Remove redundant forward function declarations by repositioning blocks of code. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/73e6d7e117da244f8f4065620115a47f7f66d372 Notes: v1: - make RSDP parser behavior consistent with other tables [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 144 +--- 1 file changed, 68 insertions(+), 76 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index 586de7cbfb12f856c0c735b6e295c1cc32eb2ceb..952517cd09aaff601bb363fd73331c750a9e97ff 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -1,7 +1,7 @@ /** @file RSDP table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -11,6 +11,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local Variables STATIC CONST UINT64* XsdtAddress; @@ -28,7 +29,27 @@ EFIAPI ValidateRsdtAddress ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ +#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + // Reference: Server Base Boot Requirements System Software on ARM Platforms + // Section: 4.2.1.1 RSDP + // Root System Description Pointer (RSDP), ACPI ? 5.2.5. + // - Within the RSDP, the RsdtAddress field must be null (zero) and the + // XsdtAddresss MUST be a valid, non-null, 64-bit value. + UINT32 RsdtAddr; + + RsdtAddr = *(UINT32*)Ptr; + + if (RsdtAddr != 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.", + RsdtAddr + ); + } +#endif +} /** This function validates the XSDT Address. @@ -43,7 +64,27 @@ EFIAPI ValidateXsdtAddress ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ +#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + // Reference: Server Base Boot Requirements System Software on ARM Platforms + // Section: 4.2.1.1 RSDP + // Root System Description Pointer (RSDP), ACPI ? 5.2.5. + // - Within the RSDP, the RsdtAddress field must be null (zero) and the + // XsdtAddresss MUST be a valid, non-null, 64-bit value. + UINT64 XsdtAddr; + + XsdtAddr = *(UINT64*)Ptr; + + if (XsdtAddr == 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.", + XsdtAddr + ); + } +#endif +} /** An array describing the ACPI RSDP Table. @@ -61,76 +102,6 @@ STATIC CONST ACPI_PARSER RsdpParser[] = { {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** - This function validates the RSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateRsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: Server Base Boot Requirements System Software on ARM Platforms - // Section: 4.2.1.1 RSDP - // Root System Description Pointer (RSDP), ACPI ? 5.2.5. - // - Within the RSDP, the RsdtAddress field must be null (zero) and the - // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT32 RsdtAddr; - - RsdtAddr = *(UINT32*)Ptr; - - if (RsdtAddr != 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.", - RsdtAddr - ); - } -#endif -} - -/** - This function validates the XSDT Address. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateXsdtAddress ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - // Reference: Server Base Boot Requirements System Software on ARM Platforms - // Section: 4.2.1.1 RSDP - // Root System Description Pointer (RSDP), ACPI ? 5.2.5. - // - Within the RSDP, the RsdtAddress field must be null (zero) and the - // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT64 XsdtAddr; - -
[edk2-devel] [PATCH v1 00/11] Add security checks in the Acpiview table parsers
The following patches modify existing ACPI table parsers to add checks which prevent many potential security issues. These include: 1. Entering infinite loops when ACPI structure lengths are zero. 2. Use of pointers which failed to be initialized because of invalid ACPI table/structure lengths. 3. Buffer overruns caused by structures which have a too large value of the 'Length' field given the size of the buffer in which they are located. Other changes added in this patchset include: 1. Removal of redundant forward STATIC function declarations for reducing the code size. 2. Extension of the use of the -q flag to make ACPI table content validation optional. ACPI table content consistency checks which do not affect the flow control in the parsing logic can now be disabled. The remaining validation checks are enforced as they also prevent the security issues listed above. Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/612_enhance_parser_logic_v1 Krzysztof Koch (11): ShellPkg: acpiview: FADT: Validate global pointers before use ShellPkg: acpiview: SPCR: Remove redundant forward declaration ShellPkg: acpiview: RSDP: Make printing table checksum optional ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call ShellPkg: acpiview: SLIT: Add error-checking in the parsing logic ShellPkg: acpiview: SRAT: Add error-checking in the parsing logic ShellPkg: acpiview: MADT: Add error-checking in the parsing logic ShellPkg: acpiview: PPTT: Add error-checking in the parsing logic ShellPkg: acpiview: IORT: Add error-checking in the parsing logic ShellPkg: acpiview: GTDT: Add error-checking in the parsing logic ShellPkg: acpiview: DBG2: Add error-checking in the parsing logic ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 26 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | 298 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 131 +++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 294 -- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 419 +--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 187 - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 95 - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 144 --- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c | 115 -- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c | 98 ++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 113 +++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 22 +- 13 files changed, 1150 insertions(+), 800 deletions(-) -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43640): https://edk2.groups.io/g/devel/message/43640 Mute This Topic: https://groups.io/mt/32439501/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v1 04/11] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
1. Remove a call to ParseAcpi responsible for getting the XSDT table length. This call is not needed because the ACPI table buffer length is provided as an input argument to the ParseAcpiXsdt() function. 2. Use ParseAcpiXsdt function argument instead of a global variable to check against table buffer overruns. 3. Allow suppressing errors about invalid ACPI table poiners inside the XSDT table. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/27b4ae23c4f230225d6bcb27598b42edcf329512 Notes: v1: - Remove a redundant call to ParseAcpi() [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 22 +++- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c index 4196168bff47d70c67f79f3fc1f4cdee302d460e..b7d8f4215a71ef429fb88d6f2d998d8f38250716 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -1,7 +1,7 @@ /** @file XSDT table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @@ -60,22 +61,12 @@ ParseAcpiXsdt ( UINTN EntryIndex; CHAR16Buffer[32]; - // Parse the ACPI header to get the length - ParseAcpi ( -FALSE, -0, -"XSDT", -Ptr, -ACPI_DESCRIPTION_HEADER_LENGTH, -PARSER_PARAMS (XsdtParser) -); - Offset = ParseAcpi ( Trace, 0, "XSDT", Ptr, - *AcpiHdrInfo.Length, + AcpiTableLength, PARSER_PARAMS (XsdtParser) ); @@ -84,7 +75,7 @@ ParseAcpiXsdt ( if (Trace) { EntryIndex = 0; TablePointer = (UINT64*)(Ptr + TableOffset); -while (Offset < (*AcpiHdrInfo.Length)) { +while (Offset < AcpiTableLength) { CONST UINT32* Signature; CONST UINT32* Length; CONST UINT8* Revision; @@ -124,7 +115,8 @@ ParseAcpiXsdt ( Print (L"0x%lx\n", *TablePointer); // Validate the table pointers are not NULL - if ((UINT64*)(UINTN)(*TablePointer) == NULL) { + if (GetConsistencyChecking () && + ((UINT64*)(UINTN)(*TablePointer) == NULL)) { IncrementErrorCount (); Print ( L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n", @@ -140,7 +132,7 @@ ParseAcpiXsdt ( // Process the tables Offset = TableOffset; TablePointer = (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { + while (Offset < AcpiTableLength) { if ((UINT64*)(UINTN)(*TablePointer) != NULL) { ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer)); } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43645): https://edk2.groups.io/g/devel/message/43645 Mute This Topic: https://groups.io/mt/32439507/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v1 02/11] ShellPkg: acpiview: SPCR: Remove redundant forward declaration
Reposition blocks of code to remove redundant forward function declarations in order to reduce the code size. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/9be55a64f804c3d99e7c692208c8086d5b9ca553 Notes: v1: - remove redundant forward declarations [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c | 98 +++- 1 file changed, 34 insertions(+), 64 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index 1974a9c046e4a3bc55cf758184af097b2420..3b06b05dee8c056c6e009b9e485ccd35d4194e95 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -1,7 +1,7 @@ /** @file SPCR table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -31,7 +31,23 @@ EFIAPI ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + UINT8 InterruptType; + + InterruptType = *Ptr; + + if (InterruptType != +EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { +IncrementErrorCount (); +Print ( + L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms", + InterruptType + ); + } +#endif +} /** This function validates the Irq. @@ -46,7 +62,22 @@ EFIAPI ValidateIrq ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ +#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) + UINT8 Irq; + + Irq = *Ptr; + + if (Irq != 0) { +IncrementErrorCount (); +Print ( + L"\nERROR: Irq = %d. This must be zero on ARM Platforms\n", + Irq + ); + } +#endif +} /** An ACPI_PARSER array describing the ACPI SPCR Table. @@ -76,67 +107,6 @@ STATIC CONST ACPI_PARSER SpcrParser[] = { {L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL} }; -/** - This function validates the Interrupt Type. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateInterruptType ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 InterruptType; - - InterruptType = *Ptr; - - if (InterruptType != -EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { -IncrementErrorCount (); -Print ( - L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms", - InterruptType - ); - } -#endif -} - -/** - This function validates the Irq. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateIrq ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ -#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 Irq; - - Irq = *Ptr; - - if (Irq != 0) { -IncrementErrorCount (); -Print ( - L"\nERROR: Irq = %d. This must be zero on ARM Platforms\n", - Irq - ); - } -#endif -} - /** This function parses the ACPI SPCR table. When trace is enabled this function parses the SPCR table and -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43643): https://edk2.groups.io/g/devel/message/43643 Mute This Topic: https://groups.io/mt/32439504/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v1 05/11] ShellPkg: acpiview: SLIT: Add error-checking in the parsing logic
1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Test against buffer overruns. 3. Allow silencing ACPI table content validation errors which do not cause table parsing to fail. 4. Check if the 'Number of System Localities' provided can be represented in a SLIT table. The table 'Length' field is a 32-bit value while the 'Number of System Localities' is a 64-bit value. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/2f1ffd1a74d06c23c01971be965d856f0a0e3ac4 Notes: v1: - improve the logic in the SLIT parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c | 115 ++-- 1 file changed, 83 insertions(+), 32 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index 1f9dac66eea5b0f4366a7a9584ac6702a74beaac..dd5f039b67326acc710ee703a6b132a1e280dcaa 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -1,7 +1,7 @@ /** @file SLIT table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local Variables STATIC CONST UINT64* SlitSystemLocalityCount; @@ -59,7 +60,7 @@ ParseAcpiSlit ( UINT32 Offset; UINT64 Count; UINT64 Index; - UINT64 LocalityCount; + UINT32 LocalityCount; UINT8* LocalityPtr; CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi @@ -77,7 +78,55 @@ ParseAcpiSlit ( ); LocalityPtr = Ptr + Offset; - LocalityCount = *SlitSystemLocalityCount; + // Check if the values used to control the parsing logic have been + // successfully read. + if (SlitSystemLocalityCount == NULL) { +IncrementErrorCount (); +Print ( + L"ERROR: Insufficient table length. AcpiTableLength = %d.\n", + AcpiTableLength + ); +return; + } + + /* +Despite the 'Number of System Localities' being a 64-bit field in SLIT, +the maximum number of localities that can be represented in SLIT is limited +by the 'Length' field of the ACPI table. + +Since the ACPI table length field is 32-bit wide. The maximum number of +localities that can be represented in SLIT can be calculated as: + +MaxLocality = sqrt (MAX_UINT32 - sizeof (EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER)) += 65535 += MAX_UINT16 + */ + if (*SlitSystemLocalityCount > MAX_UINT16) { +IncrementErrorCount (); +Print ( + L"ERROR: The Number of System Localities provided can't be represented " \ +L"in the SLIT table. SlitSystemLocalityCount = %ld. " \ +L"MaxLocalityCountAllowed = %d.\n", + *SlitSystemLocalityCount, + MAX_UINT16 + ); +return; + } + + LocalityCount = (UINT32)*SlitSystemLocalityCount; + + // Make sure system localities fit in the table buffer provided + if (Offset + (LocalityCount * LocalityCount) > AcpiTableLength) { +IncrementErrorCount (); +Print ( + L"ERROR: Invalid Number of System Localities. " \ +L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n", + *SlitSystemLocalityCount, + AcpiTableLength + ); +return; + } + // We only print the Localities if the count is less than 16 // If the locality count is more than 16 then refer to the // raw data dump. @@ -96,7 +145,7 @@ ParseAcpiSlit ( Print (L" (%3d) ", Index); } Print (L"\n"); -for (Count = 0; Count< LocalityCount; Count++) { +for (Count = 0; Count < LocalityCount; Count++) { Print (L" (%3d) ", Count); for (Index = 0; Index < LocalityCount; Index++) { Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); @@ -106,34 +155,36 @@ ParseAcpiSlit ( } // Validate - for (Count = 0; Count < LocalityCount; Count++) { -for (Index = 0; Index < LocalityCount; Index++) { - // Element[x][x] must be equal to 10 - if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) { -IncrementErrorCount (); -Print ( - L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." -L" Normalized Value is not 10\n", - Count, - Index, - SLIT_ELEMENT (LocalityPtr, Count, Index) - ); - } - // Element[i][j] must be equal to Element[j][i] - if (SLIT_ELEMENT (LocalityPtr, Count, Index) != - SLIT_ELEMENT (LocalityPtr, Index, Count)) { -IncrementErrorCount (); -Print ( -