Re: [edk2-devel] [PATCH v1 11/11] ShellPkg: acpiview: DBG2: Add error-checking in the parsing logic

2019-07-18 Thread Gao, Zhichao
Two comments with this patch.

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Friday, July 12, 2019 2: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 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/530b059a9fe4aa9f1df36b4
> 07f97d76acaab8b74
> 
> 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..2d6ff80e299eebe7853061d3
> db89332197c0dc0e 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..20ca358bddfa5953bfb1d1beba
> ebbf3079eaba01 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/Dbg2Parse
> r.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse
> r.c
> index
> 8de5ebf74775bab8e765849cba6ef4eb6f659a5a..2bbd622ffb7cec0a340de3e10
> bdcd01ba4d330df 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse
> r.c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pars
> +++ er.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. 

Re: [edk2-devel] [Patch 1/1 V2] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Liming Gao
Reviewed-by: Liming Gao 

>-Original Message-
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Bob Feng
>Sent: Friday, July 19, 2019 10:24 AM
>To: devel@edk2.groups.io
>Cc: Feng, Bob C ; Kinney, Michael D
>; Gao, Liming 
>Subject: [edk2-devel] [Patch 1/1 V2] BaseTools: Create ".cache" folder when
>initialize Build object
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986
>
>Create "Conf/.cache" folder as early as possible
>so that the later code do need to check
>if it exits and then create it.
>
>Signed-off-by: Bob Feng 
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>---
>V2: Remove the ".cache" creation action in other place.
> BaseTools/Source/Python/Common/Misc.py | 7 +--
> BaseTools/Source/Python/build/build.py | 3 ++-
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Common/Misc.py
>b/BaseTools/Source/Python/Common/Misc.py
>index 9a63463913d0..27dbdace4252 100644
>--- a/BaseTools/Source/Python/Common/Misc.py
>+++ b/BaseTools/Source/Python/Common/Misc.py
>@@ -244,17 +244,12 @@ def ProcessDuplicatedInf(Path, BaseName,
>Workspace):
> if '.' in Filename:
> Filename = BaseName + Path.BaseName + Filename[Filename.rfind('.'):]
> else:
> Filename = BaseName + Path.BaseName
>
>-#
>-# If -N is specified on command line, cache is disabled
>-# The directory has to be created
>-#
> DbDir = os.path.split(GlobalData.gDatabasePath)[0]
>-if not os.path.exists(DbDir):
>-os.makedirs(DbDir)
>+
> #
> # A temporary INF is copied to database path which must have write
>permission
> # The temporary will be removed at the end of build
> # In case of name conflict, the file name is
> # FILE_GUIDBaseName (0D1B936F-68F3-4589-AFCC-
>FB8B7AEBC836module.inf)
>diff --git a/BaseTools/Source/Python/build/build.py
>b/BaseTools/Source/Python/build/build.py
>index d6006b651f77..6bc528974db1 100644
>--- a/BaseTools/Source/Python/build/build.py
>+++ b/BaseTools/Source/Python/build/build.py
>@@ -771,11 +771,12 @@ class Build():
> else:
> # Get standard WORKSPACE/Conf use the absolute path to the
>WORKSPACE/Conf
> ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
> GlobalData.gConfDirectory = ConfDirectoryPath
> GlobalData.gDatabasePath =
>os.path.normpath(os.path.join(ConfDirectoryPath,
>GlobalData.gDatabasePath))
>-
>+if not os.path.exists(os.path.join(GlobalData.gConfDirectory, 
>'.cache')):
>+os.makedirs(os.path.join(GlobalData.gConfDirectory, '.cache'))
> self.Db = WorkspaceDatabase()
> self.BuildDatabase = self.Db.BuildObject
> self.Platform = None
> self.ToolChainFamily = None
> self.LoadFixAddress = 0
>--
>2.20.1.windows.1
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44003): https://edk2.groups.io/g/devel/message/44003
Mute This Topic: https://groups.io/mt/32522427/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/1 V2] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Michael D Kinney
Bob,

Thanks for the quick fix.  I have tested this change with
the Vlv2TbltDevicePkg updates that are under review that
include the use of a PREBUILD script.  It works when the
.cache dir is not present.

Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, July 18, 2019 7:24 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Kinney, Michael
> D ; Gao, Liming
> 
> Subject: [Patch 1/1 V2] BaseTools: Create ".cache"
> folder when initialize Build object
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986
> 
> Create "Conf/.cache" folder as early as possible so that
> the later code do need to check if it exits and then
> create it.
> 
> Signed-off-by: Bob Feng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> ---
> V2: Remove the ".cache" creation action in other place.
>  BaseTools/Source/Python/Common/Misc.py | 7 +--
> BaseTools/Source/Python/build/build.py | 3 ++-
>  2 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index 9a63463913d0..27dbdace4252 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -244,17 +244,12 @@ def ProcessDuplicatedInf(Path,
> BaseName, Workspace):
>  if '.' in Filename:
>  Filename = BaseName + Path.BaseName +
> Filename[Filename.rfind('.'):]
>  else:
>  Filename = BaseName + Path.BaseName
> 
> -#
> -# If -N is specified on command line, cache is
> disabled
> -# The directory has to be created
> -#
>  DbDir = os.path.split(GlobalData.gDatabasePath)[0]
> -if not os.path.exists(DbDir):
> -os.makedirs(DbDir)
> +
>  #
>  # A temporary INF is copied to database path which
> must have write permission
>  # The temporary will be removed at the end of build
>  # In case of name conflict, the file name is
>  # FILE_GUIDBaseName (0D1B936F-68F3-4589-AFCC-
> FB8B7AEBC836module.inf)
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index d6006b651f77..6bc528974db1 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -771,11 +771,12 @@ class Build():
>  else:
>  # Get standard WORKSPACE/Conf use the
> absolute path to the WORKSPACE/Conf
>  ConfDirectoryPath =
> mws.join(self.WorkspaceDir, 'Conf')
>  GlobalData.gConfDirectory = ConfDirectoryPath
>  GlobalData.gDatabasePath =
> os.path.normpath(os.path.join(ConfDirectoryPath,
> GlobalData.gDatabasePath))
> -
> +if not
> os.path.exists(os.path.join(GlobalData.gConfDirectory,
> '.cache')):
> +
> os.makedirs(os.path.join(GlobalData.gConfDirectory,
> + '.cache'))
>  self.Db = WorkspaceDatabase()
>  self.BuildDatabase = self.Db.BuildObject
>  self.Platform = None
>  self.ToolChainFamily = None
>  self.LoadFixAddress = 0
> --
> 2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44002): https://edk2.groups.io/g/devel/message/44002
Mute This Topic: https://groups.io/mt/32522427/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 4/5] Vlv2TbltDevicePkg: Convert BAT/sh Capsule scripts to Python

2019-07-18 Thread Sun, Zailiang
Reviewed-By: Zailiang Sun 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Friday, July 19, 2019 7:00 AM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang ; Qian, Yi ;
> Gary Lin 
> Subject: [edk2-devel] [edk2-platforms Patch 4/5] Vlv2TbltDevicePkg: Convert
> BAT/sh Capsule scripts to Python
> 
> Convert all the BAT/sh files used to generate capsules to
> OS independent Python script.
> 
> Cc: Zailiang Sun 
> Cc: Yi Qian 
> Cc: Gary Lin 
> Signed-off-by: Michael D Kinney 
> ---
>  .../Capsule/GenerateCapsule/GenCapsuleAll.bat |  35 --
>  .../Capsule/GenerateCapsule/GenCapsuleAll.py  | 397
> ++
>  .../Capsule/GenerateCapsule/GenCapsuleAll.sh  |  33 --
>  .../GenerateCapsule/GenCapsuleMinnowMax.bat   | 131 --
>  .../GenerateCapsule/GenCapsuleMinnowMax.sh|  59 ---
>  .../GenCapsuleMinnowMaxRelease.bat| 131 --
>  .../GenCapsuleMinnowMaxRelease.sh |  64 ---
>  .../GenerateCapsule/GenCapsuleSampleColor.bat | 137 --
>  .../GenerateCapsule/GenCapsuleSampleColor.sh  |  70 ---
>  .../Feature/Capsule/GenerateCapsule/Lvfs.ddf  |  14 -
>  .../LvfsGenCapsuleMinnowMax.bat   | 139 --
>  .../LvfsGenCapsuleMinnowMaxRelease.bat| 139 --
>  .../LvfsGenCapsuleSampleColor.bat | 145 ---
>  .../GenerateCapsule/template.metainfo.xml |  27 --
>  .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |   2 +-
>  .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |   2 +-
>  16 files changed, 399 insertions(+), 1126 deletions(-)
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleAll.bat
>  create mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleAll.py
>  delete mode 100755
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleAll.sh
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleMinnowMax.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleMinnowMax.sh
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleMinnowMaxRelease.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleMinnowMaxRelease.sh
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleSampleColor.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenC
> apsuleSampleColor.sh
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/Lvfs.d
> df
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsG
> enCapsuleMinnowMax.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsG
> enCapsuleMinnowMaxRelease.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsG
> enCapsuleSampleColor.bat
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/templ
> ate.metainfo.xml
> 
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/Ge
> nCapsuleAll.bat
> b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/Ge
> nCapsuleAll.bat
> deleted file mode 100644
> index 8f589565fa..00
> ---
> a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/Ge
> nCapsuleAll.bat
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -@REM @file
> -@REM   Windows batch file to generate UEFI capsules for system firmware
> and
> -@REM   firmware for sample devices
> -@REM
> -@REM Copyright (c) 2018, Intel Corporation. All rights reserved.
> -@REM SPDX-License-Identifier: BSD-2-Clause-Patent
> -@REM
> -
> -@echo off
> -setlocal
> -cd /d %~dp0
> -
> -rmdir /s /q %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
> -mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
> -
> mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopm
> ent
> -mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert
> -mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert
> -
> copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\Cap
> suleApp.efi %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDeve
> lopment\CapsuleApp.efi
> -
> copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\Ca
> psuleApp.efi %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDev
> elopment\CapsuleAppRelease.efi
> -
> copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\Cap
> suleApp.efi %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\Ca
> psuleApp.efi
> -
> copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\Ca
> psuleApp.efi %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\C
> apsuleAppRelease.efi
> -
> copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\Cap
> suleApp.efi 

Re: [edk2-devel] [edk2-platforms Patch 1/5] Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection

2019-07-18 Thread Sun, Zailiang
Reviewed-By: Zailiang Sun 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Friday, July 19, 2019 7:00 AM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang ; Qian, Yi ;
> Gary Lin 
> Subject: [edk2-devel] [edk2-platforms Patch 1/5]
> Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection
> 
> Add boot mode detection back into PlatformPei that was inadvertently
> removed in the following commit:
> 
> https://github.com/tianocore/edk2-
> platforms/commit/d6211390793fbd0a89b14001c43e0ef942c85425
> 
> Boot mode detection at this point is required to detect the boot mode of
> BOOT_ON_FLASH_UPDATE that is required to detect, coalesce, and process
> UEFI Capsules.
> 
> Cc: Zailiang Sun 
> Cc: Yi Qian 
> Cc: Gary Lin 
> Signed-off-by: Michael D Kinney 
> ---
>  .../Vlv2TbltDevicePkg/PlatformPei/BootMode.c  | 92
> ++-  .../Vlv2TbltDevicePkg/PlatformPei/Platform.c  |  6
> ++  .../Vlv2TbltDevicePkg/PlatformPei/Platform.h  | 17 
>  3 files changed, 114 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
> index 5269b1ed39..4c0e660b7f 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
> @@ -82,7 +82,7 @@ CapsulePpiNotifyCallback (
>  if (Status == EFI_SUCCESS) {
>if (Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES**)PeiServices) ==
> EFI_SUCCESS) {
>  BootMode = BOOT_ON_FLASH_UPDATE;
> -DEBUG ((EFI_D_ERROR, "Setting BootMode to
> BOOT_ON_FLASH_UPDATE\n"));
> +DEBUG ((DEBUG_ERROR, "Setting BootMode to
> + BOOT_ON_FLASH_UPDATE\n"));
>  Status = (*PeiServices)->SetBootMode((const EFI_PEI_SERVICES
> **)PeiServices, BootMode);
>  ASSERT_EFI_ERROR (Status);
>}
> @@ -92,6 +92,96 @@ CapsulePpiNotifyCallback (
>return Status;
>  }
> 
> +EFI_STATUS
> +UpdateBootMode (
> +  IN CONST EFI_PEI_SERVICES **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  EFI_BOOT_MODE   BootMode;
> +  UINT16  SleepType;
> +  CHAR16  *strBootMode;
> +
> +  Status = (*PeiServices)->GetBootMode(PeiServices, );
> + ASSERT_EFI_ERROR (Status);  if (BootMode  ==
> BOOT_IN_RECOVERY_MODE){
> +return Status;
> +  }
> +
> +  //
> +  // Let's assume things are OK if not told otherwise  //  BootMode =
> + BOOT_WITH_FULL_CONFIGURATION;
> +
> +  if (GetSleepTypeAfterWakeup (PeiServices, )) {
> +switch (SleepType) {
> +  case V_PCH_ACPI_PM1_CNT_S3:
> +BootMode = BOOT_ON_S3_RESUME;
> +Status = (*PeiServices)->NotifyPpi (PeiServices,
> [0]);
> +ASSERT_EFI_ERROR (Status);
> +break;
> +
> +  case V_PCH_ACPI_PM1_CNT_S4:
> +BootMode = BOOT_ON_S4_RESUME;
> +break;
> +
> +  case V_PCH_ACPI_PM1_CNT_S5:
> +BootMode = BOOT_ON_S5_RESUME;
> +break;
> +} // switch (SleepType)
> +  }
> +
> +  if (IsFastBootEnabled (PeiServices)) {
> +DEBUG ((DEBUG_INFO, "Prioritizing Boot mode to
> BOOT_WITH_MINIMAL_CONFIGURATION\n"));
> +PrioritizeBootMode (,
> BOOT_WITH_MINIMAL_CONFIGURATION);  }
> +
> +  switch (BootMode) {
> +case BOOT_WITH_FULL_CONFIGURATION:
> +  strBootMode = L"BOOT_WITH_FULL_CONFIGURATION";
> +  break;
> +case BOOT_WITH_MINIMAL_CONFIGURATION:
> +  strBootMode = L"BOOT_WITH_MINIMAL_CONFIGURATION";
> +  break;
> +case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
> +  strBootMode = L"BOOT_ASSUMING_NO_CONFIGURATION_CHANGES";
> +  break;
> +case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
> +  strBootMode =
> L"BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS";
> +  break;
> +case BOOT_WITH_DEFAULT_SETTINGS:
> +  strBootMode = L"BOOT_WITH_DEFAULT_SETTINGS";
> +  break;
> +case BOOT_ON_S4_RESUME:
> +  strBootMode = L"BOOT_ON_S4_RESUME";
> +  break;
> +case BOOT_ON_S5_RESUME:
> +  strBootMode = L"BOOT_ON_S5_RESUME";
> +  break;
> +case BOOT_ON_S2_RESUME:
> +  strBootMode = L"BOOT_ON_S2_RESUME";
> +  break;
> +case BOOT_ON_S3_RESUME:
> +  strBootMode = L"BOOT_ON_S3_RESUME";
> +
> +  break;
> +case BOOT_ON_FLASH_UPDATE:
> +  strBootMode = L"BOOT_ON_FLASH_UPDATE";
> +  break;
> +case BOOT_IN_RECOVERY_MODE:
> +  strBootMode = L"BOOT_IN_RECOVERY_MODE";
> +  break;
> +default:
> +  strBootMode = L"Unknown boot mode";  } // switch (BootMode)
> +
> +  DEBUG ((DEBUG_ERROR, "Setting BootMode to %s\n", strBootMode));
> + Status = (*PeiServices)->SetBootMode(PeiServices, BootMode);
> + ASSERT_EFI_ERROR (Status);
> +
> +  return Status;
> +}
> +
>  /**
>Get sleep type after wakeup
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
> index 90998871dc..1b23bc9740 100644
> --- 

Re: [edk2-devel] [PATCH v7 0/4] Implement SM3 measured boot

2019-07-18 Thread Wang, Jian J
For patch1-3,
Reviewed-by: Jian J Wang 

> -Original Message-
> From: Desai, Imran
> Sent: Friday, July 19, 2019 6:53 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming
> ; Zhang, Chao B ; Yao,
> Jiewen ; Wang, Jian J ;
> Justen, Jordan L ; Laszlo Ersek
> ; Ard Biesheuvel ; Marc-
> André Lureau ; Stefan Berger
> 
> Subject: [PATCH v7 0/4] 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_v7
> 
> 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.
> 
> Delta in v7:
> 1. Dropped 95a040cff from v6 to address
> https://edk2.groups.io/g/devel/topic/
> 32454898?p=,,,20,0,0,0::Created,,sm3,20,2,0,32454898,ct=1=1
> 2. Relocated SM3 GUID definition from MdePkg to SecurityPkg in
> 9728b54f4
> 
> 
> 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 (4):
>   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
> 
>  OvmfPkg/OvmfPkgIa32.dsc   |   2 +
>  OvmfPkg/OvmfPkgIa32X64.dsc|   2 +
>  OvmfPkg/OvmfPkgX64.dsc|   2 +
>  SecurityPkg/Include/Library/HashLib.h |   4 +
>  .../HashInstanceLibSm3/HashInstanceLibSm3.c   | 150
> ++
>  .../HashInstanceLibSm3/HashInstanceLibSm3.inf |  41 +
>  .../HashInstanceLibSm3/HashInstanceLibSm3.uni |  15 ++
>  .../HashLibBaseCryptoRouterCommon.c   |   1 +
>  SecurityPkg/SecurityPkg.dec   |   5 +-
>  SecurityPkg/SecurityPkg.dsc   |   3 +
>  10 files changed, 223 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 (#43996): https://edk2.groups.io/g/devel/message/43996
Mute This Topic: https://groups.io/mt/32520440/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/1] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Bob Feng
Yes. I only see ".cache" folder is created in one place, in "Misc.py".

Thanks,
Bob

-Original Message-
From: Kinney, Michael D 
Sent: Friday, July 19, 2019 9:32 AM
To: Feng, Bob C ; devel@edk2.groups.io; Kinney, Michael D 

Cc: Gao, Liming 
Subject: RE: [Patch 1/1] BaseTools: Create ".cache" folder when initialize 
Build object

Hi Bob,

If you create the .cache dir here, can you remove the .cache dir creation in 
other places, such as Misc.py?

Mike

> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, July 18, 2019 6:13 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Kinney, Michael D 
> ; Gao, Liming 
> Subject: [Patch 1/1] BaseTools: Create ".cache" folder when initialize 
> Build object
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986
> 
> Create "Conf/.cache" folder as early as possible so that the later 
> code do need to check if it exits and then create it.
> 
> Signed-off-by: Bob Feng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/build/build.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index d6006b651f77..6bc528974db1 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -771,11 +771,12 @@ class Build():
>  else:
>  # Get standard WORKSPACE/Conf use the absolute path 
> to the WORKSPACE/Conf
>  ConfDirectoryPath =
> mws.join(self.WorkspaceDir, 'Conf')
>  GlobalData.gConfDirectory = ConfDirectoryPath
>  GlobalData.gDatabasePath =
> os.path.normpath(os.path.join(ConfDirectoryPath,
> GlobalData.gDatabasePath))
> -
> +if not
> os.path.exists(os.path.join(GlobalData.gConfDirectory,
> '.cache')):
> +
> os.makedirs(os.path.join(GlobalData.gConfDirectory,
> + '.cache'))
>  self.Db = WorkspaceDatabase()
>  self.BuildDatabase = self.Db.BuildObject
>  self.Platform = None
>  self.ToolChainFamily = None
>  self.LoadFixAddress = 0
> --
> 2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43995): https://edk2.groups.io/g/devel/message/43995
Mute This Topic: https://groups.io/mt/32521628/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [Patch 1/1 V2] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986

Create "Conf/.cache" folder as early as possible
so that the later code do need to check
if it exits and then create it.

Signed-off-by: Bob Feng 
Cc: Michael D Kinney 
Cc: Liming Gao 
---
V2: Remove the ".cache" creation action in other place.
 BaseTools/Source/Python/Common/Misc.py | 7 +--
 BaseTools/Source/Python/build/build.py | 3 ++-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 9a63463913d0..27dbdace4252 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -244,17 +244,12 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
 if '.' in Filename:
 Filename = BaseName + Path.BaseName + Filename[Filename.rfind('.'):]
 else:
 Filename = BaseName + Path.BaseName
 
-#
-# If -N is specified on command line, cache is disabled
-# The directory has to be created
-#
 DbDir = os.path.split(GlobalData.gDatabasePath)[0]
-if not os.path.exists(DbDir):
-os.makedirs(DbDir)
+
 #
 # A temporary INF is copied to database path which must have write 
permission
 # The temporary will be removed at the end of build
 # In case of name conflict, the file name is
 # FILE_GUIDBaseName (0D1B936F-68F3-4589-AFCC-FB8B7AEBC836module.inf)
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index d6006b651f77..6bc528974db1 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -771,11 +771,12 @@ class Build():
 else:
 # Get standard WORKSPACE/Conf use the absolute path to the 
WORKSPACE/Conf
 ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
 GlobalData.gConfDirectory = ConfDirectoryPath
 GlobalData.gDatabasePath = 
os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
-
+if not os.path.exists(os.path.join(GlobalData.gConfDirectory, 
'.cache')):
+os.makedirs(os.path.join(GlobalData.gConfDirectory, '.cache'))
 self.Db = WorkspaceDatabase()
 self.BuildDatabase = self.Db.BuildObject
 self.Platform = None
 self.ToolChainFamily = None
 self.LoadFixAddress = 0
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43994): https://edk2.groups.io/g/devel/message/43994
Mute This Topic: https://groups.io/mt/32522427/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/1] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Michael D Kinney
Hi Bob,

If you create the .cache dir here, can you remove the 
.cache dir creation in other places, such as Misc.py?

Mike

> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, July 18, 2019 6:13 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Kinney, Michael
> D ; Gao, Liming
> 
> Subject: [Patch 1/1] BaseTools: Create ".cache" folder
> when initialize Build object
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986
> 
> Create "Conf/.cache" folder as early as possible so that
> the later code do need to check if it exits and then
> create it.
> 
> Signed-off-by: Bob Feng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/build/build.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index d6006b651f77..6bc528974db1 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -771,11 +771,12 @@ class Build():
>  else:
>  # Get standard WORKSPACE/Conf use the
> absolute path to the WORKSPACE/Conf
>  ConfDirectoryPath =
> mws.join(self.WorkspaceDir, 'Conf')
>  GlobalData.gConfDirectory = ConfDirectoryPath
>  GlobalData.gDatabasePath =
> os.path.normpath(os.path.join(ConfDirectoryPath,
> GlobalData.gDatabasePath))
> -
> +if not
> os.path.exists(os.path.join(GlobalData.gConfDirectory,
> '.cache')):
> +
> os.makedirs(os.path.join(GlobalData.gConfDirectory,
> + '.cache'))
>  self.Db = WorkspaceDatabase()
>  self.BuildDatabase = self.Db.BuildObject
>  self.Platform = None
>  self.ToolChainFamily = None
>  self.LoadFixAddress = 0
> --
> 2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43993): https://edk2.groups.io/g/devel/message/43993
Mute This Topic: https://groups.io/mt/32521628/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

2019-07-18 Thread Gao, Zhichao
Sorry for late review.

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Friday, July 12, 2019 2: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: [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/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/FadtPars
> +++ er.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 

Re: [edk2-devel] [PATCH v1 1/6] ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()

2019-07-18 Thread Gao, Zhichao



> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Thursday, July 18, 2019 8:32 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 1/6] ShellPkg: acpiview: Allow passing buffer length to
> DumpGasStruct()
> 
> Modify the signature of the DumpGasStruct() function to include the buffer
> length parameter and to return the number of bytes parsed by the function.
> 
> This way it becomes possible to prevent buffer overruns when dumping
> Generic Address Structure's (GAS) fields in the acpiview table parsers.
> 
> Update all existing DumpGasStruct() calls in acpiview to add the length
> argument.
> 
> Signed-off-by: Krzysztof Koch 
> ---
> 
> Notes:
> v1:
> - Modify DumpGasStruct() signature [Krzysztof]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26
> +++-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8
> --
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
> |  2 +-
>  3 files changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> index
> 8b3153516d2b7d9b920ab2de0344c17798ac572c..2d6ff80e299eebe7853061d3
> db89332197c0dc0e 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..20ca358bddfa5953bfb1d1beba
> ebbf3079eaba01 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/Dbg2Parse
> r.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse
> r.c
> index
> 8de5ebf74775bab8e765849cba6ef4eb6f659a5a..2c47a3f848aa2dd512c53343e
> cf1c3c285173dd6 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse
> r.c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pars
> +++ er.c
> @@ -164,7 +164,7 @@ DumpDbgDeviceInfo (
>AddrSize = (UINT32*)(Ptr + (*AddrSizeOffset));
>while (Index < (*GasCount)) {
>  PrintFieldName (4, L"BaseAddressRegister");
> -DumpGasStruct (DataPtr, 4);
> +DumpGasStruct (DataPtr, 4, *DbgDevInfoLen);

This input length should be GAS_LENGTH. *DbgDevInfoLen is the length of the 
whole structure and the DataPtr is increased during the loop. Inputing such a 
length would give the ParseAcpi function a chance to overrun the DataPtr.

Thanks,
Zhichao

>  PrintFieldName (4, L"Address Size");
>  Print (L"0x%x\n", AddrSize[Index]);
>  DataPtr += GAS_LENGTH;
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43991): https://edk2.groups.io/g/devel/message/43991
Mute This Topic: https://groups.io/mt/32514379/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [Patch 1/1] BaseTools: Create ".cache" folder when initialize Build object

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1986

Create "Conf/.cache" folder as early as possible
so that the later code do need to check
if it exits and then create it.

Signed-off-by: Bob Feng 
Cc: Michael D Kinney 
Cc: Liming Gao 
---
 BaseTools/Source/Python/build/build.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index d6006b651f77..6bc528974db1 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -771,11 +771,12 @@ class Build():
 else:
 # Get standard WORKSPACE/Conf use the absolute path to the 
WORKSPACE/Conf
 ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
 GlobalData.gConfDirectory = ConfDirectoryPath
 GlobalData.gDatabasePath = 
os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
-
+if not os.path.exists(os.path.join(GlobalData.gConfDirectory, 
'.cache')):
+os.makedirs(os.path.join(GlobalData.gConfDirectory, '.cache'))
 self.Db = WorkspaceDatabase()
 self.BuildDatabase = self.Db.BuildObject
 self.Platform = None
 self.ToolChainFamily = None
 self.LoadFixAddress = 0
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43990): https://edk2.groups.io/g/devel/message/43990
Mute This Topic: https://groups.io/mt/32521628/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 0/6] Acpiview table parsers code style enhancements and refactoring

2019-07-18 Thread Gao, Zhichao
One comment on 1/6. Others are good for me.
For 2-6,
Reviewed-by: Zhichao Gao 

Thanks,
Zhichao
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Thursday, July 18, 2019 8:32 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: [edk2-devel] [PATCH v1 0/6] Acpiview table parsers code style
> enhancements and refactoring
> 
> This set of patches consists of a number of changes which make the code
> structure consistent across the existing ACPI table parsers. These are all
> refactoring changes which do not modify the existing functionality of the
> acpiview UEFI shell tool.
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/612_acpiview_code_style_e
> nhance_v1
> 
> Krzysztof Koch (6):
>   ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()
>   ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
>   ShellPkg: acpiview: RSDP: Make code consistent with other parsers
>   ShellPkg: acpiview: SRAT: Minor code style enhancements
>   ShellPkg: acpiview: MADT: Split structure length validation
>   ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26
> +---
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8
> +++--
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
> |  2 +-
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |
> 32 ++--
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 30 +-
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
> | 11 +--
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |
> 3 +-
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
> | 18 +++
>  8 files changed, 82 insertions(+), 48 deletions(-)
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43989): https://edk2.groups.io/g/devel/message/43989
Mute This Topic: https://groups.io/mt/32514378/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 0/8] Remove redundant forward declarations in acpiview

2019-07-18 Thread Gao, Zhichao
I am reviewing your previous patch "Add security checks in the Acpiview table 
parsers". That takes times and I didn't finish reviewing them yet.
You do a pretty good separation. That makes the review more easier. I would 
give some comments on your previous one 10/10 patches to help your further work 
after I finish reviewing them.
This patch set is good for me. 
Reviewed-by: Zhichao Gao 

Thanks,
Zhichao

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Thursday, July 18, 2019 6:05 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 0/8] Remove redundant forward declarations in acpiview
> 
> This patch series removes forward static function declarations in the acpiview
> table parsers. After repositioning blocks of code, these forward declarations
> are no longer needed and they increase the code size.
> 
> What is more, some of the existing ACPI table parsers don't have these
> duplicate declarations, so this set of patches makes the code structure
> consistent across all acpiview parsers.
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/612_remove_forward_decl_
> v1
> 
> Krzysztof Koch (8):
>   ShellPkg: acpiview: RSDP: Remove redundant forward declarations
>   ShellPkg: acpiview: FADT: Remove redundant forward declarations
>   ShellPkg: acpiview: SPCR: Remove redundant forward declaration
>   ShellPkg: acpiview: SRAT: Remove redundant forward declarations
>   ShellPkg: acpiview: MADT: Remove redundant forward declarations
>   ShellPkg: acpiview: IORT: Remove redundant forward declarations
>   ShellPkg: acpiview: GTDT: Remove redundant forward declarations
>   ShellPkg: acpiview: DBG2: Remove redundant forward declarations
> 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
> |  62 +++---
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
> | 113 ++-
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> |  91 ++-
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |
> 58 +++---
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 118 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
> | 116 +++
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c |
> 98 ++--
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |
> 64 +++
>  8 files changed, 236 insertions(+), 484 deletions(-)
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43988): https://edk2.groups.io/g/devel/message/43988
Mute This Topic: https://groups.io/mt/32513487/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 4/4] Maintainers.txt: split out section "OvmfPkg: CSM modules"

2019-07-18 Thread Cetola, Stephano
> -Original Message-
> From: David Woodhouse [mailto:dw...@infradead.org]
> Sent: Thursday, July 18, 2019 12:31 AM
> To: devel@edk2.groups.io; ler...@redhat.com; Philippe Mathieu-Daudé
> ; Cetola, Stephano 
> Cc: Andrew Fish ; Ard Biesheuvel
> ; Justen, Jordan L ;
> Leif Lindholm ; Kinney, Michael D
> 
> Subject: Re: [edk2-devel] [PATCH 4/4] Maintainers.txt: split out section
> "OvmfPkg: CSM modules"
> 
> I apparently stopped receiving messages on 2019-06-28. Looking at my
> MTA logs, I was receiving messages just fine from addresses of the form
> bounce+27952+43034+1459038+4027...@groups.io until at 20:55:37 GMT
> there was a message from an invalid address which got rejected:

Interesting. Looking at the logs that I have access to (admittedly limited), 
there
were a few bounces back in June:

Jun 15
[edk2-devel] [edk2-platforms] [patch 0/2] Add UserInterfaceFeaturePkg and 
UserAuthentication modules
550 Invalid address in message header. Consult RFC2822.

... then a few more of those until June 28th:

Jun 28
(message) Bounce probe
550 Verification failed for 
Called: 45.79.81.153 
Sent: RCPT TO: 
Response: 510 The group 'bounceprobe+1459038+8818881604274358745' does not 
exist. 
Sender verify failed

I get more of those on July 2nd, 6th, 9th, 13th, then finally this bounce:

Jul 16
[edk2-devel] Cancelled Event: TianoCore Design / Bug Triage - EMEA - Wednesday, 
17 July 2019
550 Invalid address in message header. Consult RFC2822.

> 
> After rejecting that invalid mail, nothing else from the list was received.

I'll have to dig into this more to see what might be going on.

Let me know if anything jumps out here.

Cheers,
Stephano

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43987): https://edk2.groups.io/g/devel/message/43987
Mute This Topic: https://groups.io/mt/32480696/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v7 0/4] Implement SM3 measured boot

2019-07-18 Thread Yao, Jiewen
Patch 1~3, reviewed-by: jiewen@intel.com
Patch 4, acked-by: jiewen@intel.com


> -Original Message-
> From: Desai, Imran
> Sent: Friday, July 19, 2019 6:53 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming
> ; Zhang, Chao B ; Yao,
> Jiewen ; Wang, Jian J ;
> Justen, Jordan L ; Laszlo Ersek
> ; Ard Biesheuvel ;
> Marc-André Lureau ; Stefan Berger
> 
> Subject: [PATCH v7 0/4] 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_v7
> 
> 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.
> 
> Delta in v7:
> 1. Dropped 95a040cff from v6 to address
> https://edk2.groups.io/g/devel/topic/
> 32454898?p=,,,20,0,0,0::Created,,sm3,20,2,0,32454898,ct=1=1
> 2. Relocated SM3 GUID definition from MdePkg to SecurityPkg in 9728b54f4
> 
> 
> 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 (4):
>   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
> 
>  OvmfPkg/OvmfPkgIa32.dsc   |   2 +
>  OvmfPkg/OvmfPkgIa32X64.dsc|   2 +
>  OvmfPkg/OvmfPkgX64.dsc|   2 +
>  SecurityPkg/Include/Library/HashLib.h |   4 +
>  .../HashInstanceLibSm3/HashInstanceLibSm3.c   | 150
> ++
>  .../HashInstanceLibSm3/HashInstanceLibSm3.inf |  41 +
>  .../HashInstanceLibSm3/HashInstanceLibSm3.uni |  15 ++
>  .../HashLibBaseCryptoRouterCommon.c   |   1 +
>  SecurityPkg/SecurityPkg.dec   |   5 +-
>  SecurityPkg/SecurityPkg.dsc   |   3 +
>  10 files changed, 223 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 (#43986): https://edk2.groups.io/g/devel/message/43986
Mute This Topic: https://groups.io/mt/32520440/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 0/5] Vlv2Tbl2DevicePkg: Remove Linux/Windows differences

2019-07-18 Thread Michael D Kinney
I have also posted a branch with these changes for review at:

https://github.com/mdkinney/edk2-platforms/tree/Bug_xxx_Vlv2_Remove_FCE_BAT_sh

Mike

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io]
> On Behalf Of Michael D Kinney
> Sent: Thursday, July 18, 2019 4:00 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [edk2-platforms Patch 0/5]
> Vlv2Tbl2DevicePkg: Remove Linux/Windows differences
> 
> Remove all BAT/sh scripts and use OS independent python
> scripts for PREBULD and POSTBUILD operations and use
> standard EDK II build command to build MinnowMax FW
> images and capsules.
> 
> The use of FCE has also been removed and replaced with a
> Structured PCD.  The default values for Setup forms are
> now in the file PlatformSetupDefaults.dsc.
> 
> A regression bug introduced by a recent commit that
> broke the detection of the BOOT_ON_FLASH_UPDATE boot
> mode has also been fixed.  Capsules are detected and
> processed correctly again.
> 
> Michael D Kinney (5):
>   Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection
>   Vlv2TbltDevicePkg: Convert use of FCE tool to
> Structured PCD
>   Vlv2TbltDevicePkg: Remove Linux/GCC specific DSC/FDF
> files
>   Vlv2TbltDevicePkg: Convert BAT/sh Capsule scripts to
> Python
>   Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to
> Python
> 
>  Platform/Intel/Vlv2TbltDevicePkg/BfmLib.exe   |  Bin
> 499712 -> 0 bytes
>  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat|  118 --
>  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh |  100 --
>  Platform/Intel/Vlv2TbltDevicePkg/FCE.exe  |  Bin
> 632832 -> 0 bytes
>  .../Capsule/GenerateCapsule/GenCapsuleAll.bat |   35 -
>  .../Capsule/GenerateCapsule/GenCapsuleAll.py  |  397
> +
>  .../Capsule/GenerateCapsule/GenCapsuleAll.sh  |   33 -
>  .../GenerateCapsule/GenCapsuleMinnowMax.bat   |  131 --
>  .../GenerateCapsule/GenCapsuleMinnowMax.sh|   59 -
>  .../GenCapsuleMinnowMaxRelease.bat|  131 --
>  .../GenCapsuleMinnowMaxRelease.sh |   64 -
>  .../GenerateCapsule/GenCapsuleSampleColor.bat |  137 --
>  .../GenerateCapsule/GenCapsuleSampleColor.sh  |   70 -
>  .../Feature/Capsule/GenerateCapsule/Lvfs.ddf  |   14 -
>  .../LvfsGenCapsuleMinnowMax.bat   |  139 --
>  .../LvfsGenCapsuleMinnowMaxRelease.bat|  139 --
>  .../LvfsGenCapsuleSampleColor.bat |  145 --
>  .../GenerateCapsule/template.metainfo.xml |   27 -
>  .../SystemFirmwareDescriptor.aslc |   83 --
>  .../SystemFirmwareDescriptor.inf  |   40 -
>  .../SystemFirmwareDescriptorPei.c |   60 -
>  .../SystemFirmwareUpdateConfig.ini|   66 -
>  .../SystemFirmwareUpdateConfigGcc.ini |   66 -
>  .../Vlv2TbltDevicePkg/PlatformCapsule.dsc |   39 -
>  .../Vlv2TbltDevicePkg/PlatformCapsule.fdf |   52 -
>  .../Vlv2TbltDevicePkg/PlatformCapsuleGcc.dsc  |   38 -
>  .../Vlv2TbltDevicePkg/PlatformCapsuleGcc.fdf  |   52 -
>  .../PlatformInitPei/PlatformEarlyInit.c   |   40 +-
>  .../PlatformInitPei/PlatformInitPei.inf   |2 +
>  .../Vlv2TbltDevicePkg/PlatformPei/BootMode.c  |   92 +-
>  .../Vlv2TbltDevicePkg/PlatformPei/Platform.c  |6 +
>  .../Vlv2TbltDevicePkg/PlatformPei/Platform.h  |   17 +
>  .../Intel/Vlv2TbltDevicePkg/PlatformPkg.dec   |   12 +
>  .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |   52 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgGcc.fdf  |  914 --
> --
>  .../Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc  | 1272 --
> --
>  .../Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   | 1289 --
> ---
>  .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc |   91 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc  |   89 +-
>  .../PlatformSetupDefaults.dsc |  130 ++
>  .../PlatformSetupDxe/PlatformSetupDxe.c   |   12 +-
>  .../PlatformSetupDxe/Vfr.vfr  |   17 +-
>  Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  |  348
> +
>  Platform/Intel/Vlv2TbltDevicePkg/Readme.md|   62 +-
>  .../Stitch/Gcc/NvStorageFtwSpare.bin  |  Bin
> 262144 -> 0 bytes
>  .../Stitch/Gcc/NvStorageFtwWorking.bin|  Bin
> 8192 -> 0 bytes
>  .../Stitch/Gcc/NvStorageVariable.bin  |  Bin
> 253952 -> 0 bytes
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  |  322 --
> --
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   |  235 --
> -
>  49 files changed, 1231 insertions(+), 6006 deletions(-)
> delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/BfmLib.exe
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
>  delete mode 100755
> Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/FCE.exe
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Generat
> eCapsule/GenCapsuleAll.bat
>  create mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Generat
> eCapsule/GenCapsuleAll.py
>  delete mode 100755
> 

[edk2-devel] [edk2-platforms Patch 0/5] Vlv2Tbl2DevicePkg: Remove Linux/Windows differences

2019-07-18 Thread Michael D Kinney
Remove all BAT/sh scripts and use OS independent python
scripts for PREBULD and POSTBUILD operations and use
standard EDK II build command to build MinnowMax FW 
images and capsules.

The use of FCE has also been removed and replaced with
a Structured PCD.  The default values for Setup forms
are now in the file PlatformSetupDefaults.dsc.

A regression bug introduced by a recent commit that broke
the detection of the BOOT_ON_FLASH_UPDATE boot mode
has also been fixed.  Capsules are detected and processed
correctly again.

Michael D Kinney (5):
  Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection
  Vlv2TbltDevicePkg: Convert use of FCE tool to Structured PCD
  Vlv2TbltDevicePkg: Remove Linux/GCC specific DSC/FDF files
  Vlv2TbltDevicePkg: Convert BAT/sh Capsule scripts to Python
  Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python

 Platform/Intel/Vlv2TbltDevicePkg/BfmLib.exe   |  Bin 499712 -> 0 bytes
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat|  118 --
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh |  100 --
 Platform/Intel/Vlv2TbltDevicePkg/FCE.exe  |  Bin 632832 -> 0 bytes
 .../Capsule/GenerateCapsule/GenCapsuleAll.bat |   35 -
 .../Capsule/GenerateCapsule/GenCapsuleAll.py  |  397 +
 .../Capsule/GenerateCapsule/GenCapsuleAll.sh  |   33 -
 .../GenerateCapsule/GenCapsuleMinnowMax.bat   |  131 --
 .../GenerateCapsule/GenCapsuleMinnowMax.sh|   59 -
 .../GenCapsuleMinnowMaxRelease.bat|  131 --
 .../GenCapsuleMinnowMaxRelease.sh |   64 -
 .../GenerateCapsule/GenCapsuleSampleColor.bat |  137 --
 .../GenerateCapsule/GenCapsuleSampleColor.sh  |   70 -
 .../Feature/Capsule/GenerateCapsule/Lvfs.ddf  |   14 -
 .../LvfsGenCapsuleMinnowMax.bat   |  139 --
 .../LvfsGenCapsuleMinnowMaxRelease.bat|  139 --
 .../LvfsGenCapsuleSampleColor.bat |  145 --
 .../GenerateCapsule/template.metainfo.xml |   27 -
 .../SystemFirmwareDescriptor.aslc |   83 --
 .../SystemFirmwareDescriptor.inf  |   40 -
 .../SystemFirmwareDescriptorPei.c |   60 -
 .../SystemFirmwareUpdateConfig.ini|   66 -
 .../SystemFirmwareUpdateConfigGcc.ini |   66 -
 .../Vlv2TbltDevicePkg/PlatformCapsule.dsc |   39 -
 .../Vlv2TbltDevicePkg/PlatformCapsule.fdf |   52 -
 .../Vlv2TbltDevicePkg/PlatformCapsuleGcc.dsc  |   38 -
 .../Vlv2TbltDevicePkg/PlatformCapsuleGcc.fdf  |   52 -
 .../PlatformInitPei/PlatformEarlyInit.c   |   40 +-
 .../PlatformInitPei/PlatformInitPei.inf   |2 +
 .../Vlv2TbltDevicePkg/PlatformPei/BootMode.c  |   92 +-
 .../Vlv2TbltDevicePkg/PlatformPei/Platform.c  |6 +
 .../Vlv2TbltDevicePkg/PlatformPei/Platform.h  |   17 +
 .../Intel/Vlv2TbltDevicePkg/PlatformPkg.dec   |   12 +
 .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |   52 +-
 .../Vlv2TbltDevicePkg/PlatformPkgGcc.fdf  |  914 
 .../Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc  | 1272 
 .../Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   | 1289 -
 .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc |   91 +-
 .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc  |   89 +-
 .../PlatformSetupDefaults.dsc |  130 ++
 .../PlatformSetupDxe/PlatformSetupDxe.c   |   12 +-
 .../PlatformSetupDxe/Vfr.vfr  |   17 +-
 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  |  348 +
 Platform/Intel/Vlv2TbltDevicePkg/Readme.md|   62 +-
 .../Stitch/Gcc/NvStorageFtwSpare.bin  |  Bin 262144 -> 0 bytes
 .../Stitch/Gcc/NvStorageFtwWorking.bin|  Bin 8192 -> 0 bytes
 .../Stitch/Gcc/NvStorageVariable.bin  |  Bin 253952 -> 0 bytes
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  |  322 
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   |  235 ---
 49 files changed, 1231 insertions(+), 6006 deletions(-)
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/BfmLib.exe
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
 delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/FCE.exe
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
 create mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
 delete mode 100755 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.bat
 delete mode 100644 

[edk2-devel] [edk2-platforms Patch 1/5] Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection

2019-07-18 Thread Michael D Kinney
Add boot mode detection back into PlatformPei that was
inadvertently removed in the following commit:

https://github.com/tianocore/edk2-platforms/commit/d6211390793fbd0a89b14001c43e0ef942c85425

Boot mode detection at this point is required to detect
the boot mode of BOOT_ON_FLASH_UPDATE that is required
to detect, coalesce, and process UEFI Capsules.

Cc: Zailiang Sun 
Cc: Yi Qian 
Cc: Gary Lin 
Signed-off-by: Michael D Kinney 
---
 .../Vlv2TbltDevicePkg/PlatformPei/BootMode.c  | 92 ++-
 .../Vlv2TbltDevicePkg/PlatformPei/Platform.c  |  6 ++
 .../Vlv2TbltDevicePkg/PlatformPei/Platform.h  | 17 
 3 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c 
b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
index 5269b1ed39..4c0e660b7f 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
@@ -82,7 +82,7 @@ CapsulePpiNotifyCallback (
 if (Status == EFI_SUCCESS) {
   if (Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES**)PeiServices) == 
EFI_SUCCESS) {
 BootMode = BOOT_ON_FLASH_UPDATE;
-DEBUG ((EFI_D_ERROR, "Setting BootMode to BOOT_ON_FLASH_UPDATE\n"));
+DEBUG ((DEBUG_ERROR, "Setting BootMode to BOOT_ON_FLASH_UPDATE\n"));
 Status = (*PeiServices)->SetBootMode((const EFI_PEI_SERVICES 
**)PeiServices, BootMode);
 ASSERT_EFI_ERROR (Status);
   }
@@ -92,6 +92,96 @@ CapsulePpiNotifyCallback (
   return Status;
 }
 
+EFI_STATUS
+UpdateBootMode (
+  IN CONST EFI_PEI_SERVICES **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  EFI_BOOT_MODE   BootMode;
+  UINT16  SleepType;
+  CHAR16  *strBootMode;
+
+  Status = (*PeiServices)->GetBootMode(PeiServices, );
+  ASSERT_EFI_ERROR (Status);
+  if (BootMode  == BOOT_IN_RECOVERY_MODE){
+return Status;
+  }
+
+  //
+  // Let's assume things are OK if not told otherwise
+  //
+  BootMode = BOOT_WITH_FULL_CONFIGURATION;
+
+  if (GetSleepTypeAfterWakeup (PeiServices, )) {
+switch (SleepType) {
+  case V_PCH_ACPI_PM1_CNT_S3:
+BootMode = BOOT_ON_S3_RESUME;
+Status = (*PeiServices)->NotifyPpi (PeiServices, 
[0]);
+ASSERT_EFI_ERROR (Status);
+break;
+
+  case V_PCH_ACPI_PM1_CNT_S4:
+BootMode = BOOT_ON_S4_RESUME;
+break;
+
+  case V_PCH_ACPI_PM1_CNT_S5:
+BootMode = BOOT_ON_S5_RESUME;
+break;
+} // switch (SleepType)
+  }
+
+  if (IsFastBootEnabled (PeiServices)) {
+DEBUG ((DEBUG_INFO, "Prioritizing Boot mode to 
BOOT_WITH_MINIMAL_CONFIGURATION\n"));
+PrioritizeBootMode (, BOOT_WITH_MINIMAL_CONFIGURATION);
+  }
+
+  switch (BootMode) {
+case BOOT_WITH_FULL_CONFIGURATION:
+  strBootMode = L"BOOT_WITH_FULL_CONFIGURATION";
+  break;
+case BOOT_WITH_MINIMAL_CONFIGURATION:
+  strBootMode = L"BOOT_WITH_MINIMAL_CONFIGURATION";
+  break;
+case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
+  strBootMode = L"BOOT_ASSUMING_NO_CONFIGURATION_CHANGES";
+  break;
+case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
+  strBootMode = L"BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS";
+  break;
+case BOOT_WITH_DEFAULT_SETTINGS:
+  strBootMode = L"BOOT_WITH_DEFAULT_SETTINGS";
+  break;
+case BOOT_ON_S4_RESUME:
+  strBootMode = L"BOOT_ON_S4_RESUME";
+  break;
+case BOOT_ON_S5_RESUME:
+  strBootMode = L"BOOT_ON_S5_RESUME";
+  break;
+case BOOT_ON_S2_RESUME:
+  strBootMode = L"BOOT_ON_S2_RESUME";
+  break;
+case BOOT_ON_S3_RESUME:
+  strBootMode = L"BOOT_ON_S3_RESUME";
+
+  break;
+case BOOT_ON_FLASH_UPDATE:
+  strBootMode = L"BOOT_ON_FLASH_UPDATE";
+  break;
+case BOOT_IN_RECOVERY_MODE:
+  strBootMode = L"BOOT_IN_RECOVERY_MODE";
+  break;
+default:
+  strBootMode = L"Unknown boot mode";
+  } // switch (BootMode)
+
+  DEBUG ((DEBUG_ERROR, "Setting BootMode to %s\n", strBootMode));
+  Status = (*PeiServices)->SetBootMode(PeiServices, BootMode);
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
 /**
   Get sleep type after wakeup
 
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c 
b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
index 90998871dc..1b23bc9740 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
@@ -813,6 +813,12 @@ PeiInitPlatform (
 sizeof (EFI_PLATFORM_INFO_HOB)
 );
 
+  //
+  // Set the new boot mode for MRC
+  //
+  Status = UpdateBootMode (PeiServices);
+  ASSERT_EFI_ERROR (Status);
+
   DEBUG((EFI_D_INFO, "Setup MMIO size ... \n\n"));
 
   //
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h 
b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h
index 4f71e519e0..e2e07dc446 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h
+++ 

[edk2-devel] [edk2-platforms Patch 5/5] Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python

2019-07-18 Thread Michael D Kinney
Convert Build_IFWI and bld_vlv BAT/sh scripts to OS
independent python script PeBuild.py.  This script
generates the BiosId file.  Standard EDK II build
commands are used to build FW images and capsules.

* Sample VS2015x86 commands for IA32/X64 and DEBUG/RELEASE
  build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  build -a IA32-t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
  build -a IA32-t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc

* Sample GCC5 commands for IA32/X64 and DEBUG/RELEASE
  build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
  build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
  build -a IA32-n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
  build -a IA32-n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc

Cc: Zailiang Sun 
Cc: Yi Qian 
Cc: Gary Lin 
Signed-off-by: Michael D Kinney 
---
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat| 118 --
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh | 100 -
 .../Vlv2TbltDevicePkg/PlatformCapsule.fdf |  48 ---
 .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |  39 --
 .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |  39 --
 .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  30 +-
 .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc |  13 +-
 .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc  |  13 +-
 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  | 348 ++
 Platform/Intel/Vlv2TbltDevicePkg/Readme.md|  62 ++--
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 303 ---
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 222 ---
 12 files changed, 432 insertions(+), 903 deletions(-)
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
 delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
 create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
 delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat 
b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
deleted file mode 100644
index f65aa61f4a..00
--- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ /dev/null
@@ -1,118 +0,0 @@
-@REM @file
-@REM   Windows batch file to build BIOS ROM
-@REM
-@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
-@REM SPDX-License-Identifier: BSD-2-Clause-Patent
-@REM
-
-@echo off
-
-SetLocal EnableDelayedExpansion EnableExtensions
-
-:: Assign initial values
-set exitCode=0
-set "Build_Flags= "
-set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
-
-set PLATFORM_PATH=%WORKSPACE%
-if not exist %PLATFORM_PATH%\%PLATFORM_PACKAGE% (
-  if defined PACKAGES_PATH (
-for %%i IN (%PACKAGES_PATH%) DO (
-  if exist %%~fi\%PLATFORM_PACKAGE% (
-set PLATFORM_PATH=%%~fi
-goto PlatformPackageFound
-  )
-)
-  ) else (
-echo.
-echo !!! ERROR !!! Cannot find %PLATFORM_PACKAGE% !!!
-echo.
-goto Exit
-  )
-)
-:PlatformPackageFound
-
-:: Parse Optional arguments
-:OptLoop
-if /i "%~1"=="/?" goto Usage
-
-if /i "%~1"=="/l" (
-set Build_Flags=%Build_Flags% /l
-shift
-goto OptLoop
-)
-if /i "%~1"=="/y" (
-set Build_Flags=%Build_Flags% /y
-shift
-goto OptLoop
-)
-if /i "%~1"=="/m" (
-set Build_Flags=%Build_Flags% /m
-shift
-goto OptLoop
-)
-if /i "%~1" == "/c" (
-set Build_Flags=%Build_Flags% /c
-shift
-goto OptLoop
-)
-if /i "%~1"=="/x64" (
-set Build_Flags=%Build_Flags% /x64
-shift
-goto OptLoop
-)
-if /i "%~1"=="/IA32" (
-set Build_Flags=%Build_Flags% /IA32
-shift
-goto OptLoop
-)
-
-:: Require 2 input parameters
-if "%~2"=="" goto Usage
-
-:: Assign required arguments
-set Platform_Type=%~1
-set Build_Target=%~2
-
-:: Build BIOS
-echo ==
-echo Build_IFWI:  Calling BIOS build Script...
-
-call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags% 
%Platform_Type% %Build_Target%
-
-if %ERRORLEVEL% NEQ 0 (
-echo echo  -- Error Building BIOS  & echo.
-set exitCode=1
-goto exit
-)
-echo.
-echo Finished Building BIOS.
-goto Exit
-
-:Usage
-echo Script to build BIOS firmware and stitch the entire IFWI.
-echo.
-echo Usage: Build_IFWI.bat [options]  PlatformType  BuildTarget
-echo.
-echo/cCleanAll
-echo/lGenerate build log file
-echo/yGenerate build report file
-echo/mEnable multi-processor build
-echo/IA32 Set Arch to IA32 (default: X64)
-echo/X64  Set Arch to X64 (default: X64)
-echo.
-echoPlatform Types:  MNW2
-echo

[edk2-devel] [edk2-platforms Patch 4/5] Vlv2TbltDevicePkg: Convert BAT/sh Capsule scripts to Python

2019-07-18 Thread Michael D Kinney
Convert all the BAT/sh files used to generate capsules to
OS independent Python script.

Cc: Zailiang Sun 
Cc: Yi Qian 
Cc: Gary Lin 
Signed-off-by: Michael D Kinney 
---
 .../Capsule/GenerateCapsule/GenCapsuleAll.bat |  35 --
 .../Capsule/GenerateCapsule/GenCapsuleAll.py  | 397 ++
 .../Capsule/GenerateCapsule/GenCapsuleAll.sh  |  33 --
 .../GenerateCapsule/GenCapsuleMinnowMax.bat   | 131 --
 .../GenerateCapsule/GenCapsuleMinnowMax.sh|  59 ---
 .../GenCapsuleMinnowMaxRelease.bat| 131 --
 .../GenCapsuleMinnowMaxRelease.sh |  64 ---
 .../GenerateCapsule/GenCapsuleSampleColor.bat | 137 --
 .../GenerateCapsule/GenCapsuleSampleColor.sh  |  70 ---
 .../Feature/Capsule/GenerateCapsule/Lvfs.ddf  |  14 -
 .../LvfsGenCapsuleMinnowMax.bat   | 139 --
 .../LvfsGenCapsuleMinnowMaxRelease.bat| 139 --
 .../LvfsGenCapsuleSampleColor.bat | 145 ---
 .../GenerateCapsule/template.metainfo.xml |  27 --
 .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |   2 +-
 .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |   2 +-
 16 files changed, 399 insertions(+), 1126 deletions(-)
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
 create mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
 delete mode 100755 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.sh
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/Lvfs.ddf
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsGenCapsuleMinnowMax.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsGenCapsuleMinnowMaxRelease.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/LvfsGenCapsuleSampleColor.bat
 delete mode 100644 
Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/template.metainfo.xml

diff --git 
a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
 
b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
deleted file mode 100644
index 8f589565fa..00
--- 
a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
+++ /dev/null
@@ -1,35 +0,0 @@
-@REM @file
-@REM   Windows batch file to generate UEFI capsules for system firmware and
-@REM   firmware for sample devices
-@REM
-@REM Copyright (c) 2018, Intel Corporation. All rights reserved.
-@REM SPDX-License-Identifier: BSD-2-Clause-Patent
-@REM
-
-@echo off
-setlocal
-cd /d %~dp0
-
-rmdir /s /q %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
-mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
-mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment
-mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert
-mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment\CapsuleApp.efi
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment\CapsuleAppRelease.efi
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\CapsuleApp.efi
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\CapsuleAppRelease.efi
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert\CapsuleApp.efi
-copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert\CapsuleAppRelease.efi
-
-call GenCapsuleMinnowMax.bat
-call GenCapsuleMinnowMaxRelease.bat
-call GenCapsuleSampleColor.bat Blue  149da854-7d19-4faa-a91e-862ea1324be6
-call GenCapsuleSampleColor.bat Green 79179bfd-704d-4c90-9e02-0ab8d968c18a
-call GenCapsuleSampleColor.bat Red   72e2945a-00da-448e-9aa7-075ad840f9d4
-
-call LvfsGenCapsuleMinnowMax.bat
-call LvfsGenCapsuleMinnowMaxRelease.bat
-call LvfsGenCapsuleSampleColor.bat Blue  

[edk2-devel] [PATCH v7 2/4] SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm

2019-07-18 Thread Imran Desai


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 (#43976): https://edk2.groups.io/g/devel/message/43976
Mute This Topic: https://groups.io/mt/32520442/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 1/4] SecurityPkg: introduce the SM3 digest algorithm

2019-07-18 Thread Imran Desai
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.

Delta in v7:
1. Dropped 95a040cff from v6 to address https://edk2.groups.io/g/devel/topic/
32454898?p=,,,20,0,0,0::Created,,sm3,20,2,0,32454898,ct=1=1
2. Relocated SM3 GUID definition from MdePkg to SecurityPkg in 9728b54f4

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 

Signed-off-by: Imran Desai 
---
 SecurityPkg/Include/Library/HashLib.h |   4 +
 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, 213 insertions(+)

diff --git a/SecurityPkg/Include/Library/HashLib.h 
b/SecurityPkg/Include/Library/HashLib.h
index 63f08398788b..6ad960ad70ee 100644
--- a/SecurityPkg/Include/Library/HashLib.h
+++ b/SecurityPkg/Include/Library/HashLib.h
@@ -137,6 +137,10 @@ 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 \
+  { \
+0x251C7818, 0x0DBF, 0xE619, { 0x7F, 0xC2, 0xD6, 0xAC, 0x43, 0x42, 0x7D, 
0xA3 } \
+  }
 
 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 

[edk2-devel] [PATCH v7 3/4] SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default

2019-07-18 Thread Imran Desai


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 (#43977): https://edk2.groups.io/g/devel/message/43977
Mute This Topic: https://groups.io/mt/32520443/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 0/4] Implement SM3 measured boot

2019-07-18 Thread Imran Desai
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v7

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.

Delta in v7:
1. Dropped 95a040cff from v6 to address https://edk2.groups.io/g/devel/topic/
32454898?p=,,,20,0,0,0::Created,,sm3,20,2,0,32454898,ct=1=1
2. Relocated SM3 GUID definition from MdePkg to SecurityPkg in 9728b54f4


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 (4):
  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

 OvmfPkg/OvmfPkgIa32.dsc   |   2 +
 OvmfPkg/OvmfPkgIa32X64.dsc|   2 +
 OvmfPkg/OvmfPkgX64.dsc|   2 +
 SecurityPkg/Include/Library/HashLib.h |   4 +
 .../HashInstanceLibSm3/HashInstanceLibSm3.c   | 150 ++
 .../HashInstanceLibSm3/HashInstanceLibSm3.inf |  41 +
 .../HashInstanceLibSm3/HashInstanceLibSm3.uni |  15 ++
 .../HashLibBaseCryptoRouterCommon.c   |   1 +
 SecurityPkg/SecurityPkg.dec   |   5 +-
 SecurityPkg/SecurityPkg.dsc   |   3 +
 10 files changed, 223 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 (#43974): https://edk2.groups.io/g/devel/message/43974
Mute This Topic: https://groups.io/mt/32520440/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 4/4] OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe

2019-07-18 Thread Imran Desai
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 
Reviewed-by: Laszlo Ersek 
---
 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 (#43978): https://edk2.groups.io/g/devel/message/43978
Mute This Topic: https://groups.io/mt/32520444/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

2019-07-18 Thread Leif Lindholm
On Thu, Jul 18, 2019 at 11:17:30PM +0200, Laszlo Ersek wrote:
> On 07/18/19 18:27, Leif Lindholm wrote:
> > Laszlo, Hao - I have prepared a set for pushing as below.
> > 
> > (Reviewed-by: Leif Lindholm  for all of your
> > patches.)
> > *But*, I need a review from  Bob and/or Liming before I push the final one:
> > "BaseTools: add GetMaintainer.py script" -
> > https://edk2.groups.io/g/devel/message/43666
> > 
> > I have verified reviews/acks by all affected reviewers, except for Stefan
> > Berger for Ovmf TCG/TPM2.
> 
> Stefan's R-b has arrived as well:
> 
> 7201b3fb-d84b-30e0-61c8-bf9bb9defa7a@linux.ibm.com">http://mid.mail-archive.com/7201b3fb-d84b-30e0-61c8-bf9bb9defa7a@linux.ibm.com
> 
> So, I agree, those four patches regarding OvmfPkg reviewership are now
> fully approved.
> 
> Please pick up Phil's feedback as well.

Have done.
Staging branch in place at
https://git.linaro.org/people/leif.lindholm/edk2.git/log/?h=upstreaming/git-maintainer-v2

I'll push 1-7 tomorrow morning my time even if I don't get the R-b
from BaseTools Maintainers for 8/8 by then, and the whole set if I do.

> > While I would prefer to have that too, this is a file format shift - not a
> > change in responsibility areas.
> > Laszlo, do you agree?
> > If so, I can push 1-7/8 as is.
> 
> See above -- then I'm OK.

Thanks!

Best Regards,

Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43973): https://edk2.groups.io/g/devel/message/43973
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 0/3] add GetMaintainer.py helper script

2019-07-18 Thread Laszlo Ersek
On 07/18/19 18:27, Leif Lindholm wrote:
> Laszlo, Hao - I have prepared a set for pushing as below.
> 
> (Reviewed-by: Leif Lindholm  for all of your
> patches.)
> *But*, I need a review from  Bob and/or Liming before I push the final one:
> "BaseTools: add GetMaintainer.py script" -
> https://edk2.groups.io/g/devel/message/43666
> 
> I have verified reviews/acks by all affected reviewers, except for Stefan
> Berger for Ovmf TCG/TPM2.

Stefan's R-b has arrived as well:

7201b3fb-d84b-30e0-61c8-bf9bb9defa7a@linux.ibm.com">http://mid.mail-archive.com/7201b3fb-d84b-30e0-61c8-bf9bb9defa7a@linux.ibm.com

So, I agree, those four patches regarding OvmfPkg reviewership are now
fully approved.

Please pick up Phil's feedback as well.

> While I would prefer to have that too, this is a file format shift - not a
> change in responsibility areas.
> Laszlo, do you agree?
> If so, I can push 1-7/8 as is.

See above -- then I'm OK.

Thank you!
Laszlo

> 
> /
> Leif
> 
> Hao A Wu (1):
>   Maintainers.txt: Fine-grained review ownership for MdeModulePkg
> 
> Laszlo Ersek (4):
>   Maintainers.txt: split out section "ArmVirtPkg: modules used on Xen"
>   Maintainers.txt: split out section "OvmfPkg: Xen-related modules"
>   Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related
> modules"
>   Maintainers.txt: split out section "OvmfPkg: CSM modules"
> 
> Leif Lindholm (3):
>   Maintainers.txt: update for filesystem area descriptions
>   Maintainers.txt: add wildcard path association for Arm/AArch64
>   BaseTools: add GetMaintainer.py script
> 
> 
> On Fri, 12 Jul 2019 at 18: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.
>>
>> 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 

Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

2019-07-18 Thread Laszlo Ersek
On 07/18/19 18:02, Ravi Kumar Siadri wrote:
> Hi Laszlo Ersek / Hao Wu,
>
> I have gone through the Guide, i can see some points which are not
> very clear..
>
> [...]

Perhaps some examples will help.

In advance, I should mention a few things:

- This is just my interpretation of the spec, and of the guide.

- In my last email, the VenMsg suggestion was wrong. The device paths
  for the physical channel(s) are built by appending Ctrl(n) --
  "controller" -- hardware device path nodes, and not VenMsg() nodes.

- "Logical" means "channel with abstract devices, suitable for data
  access & booting", "Physical" means "channel with physical devices,
  used for diagnostics". A channel may be *both*, if each device on it
  is both physical and logical simultaneously -- that is, it can be used
  for data access / booting, and for low-level diagnostics.

So, the examples:

(A) non-RAID HBA

* Summary:

Handle#1: PciRoot(0x0)/Pci(0x1,0x0)   -- channel where each device 
is (L + P)
Handle#2: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0) -- disk that is (L + P)

* Details:

Handle#1:

- device path: PciRoot(0x0)/Pci(0x1,0x0)
- handle created by PciBusDxe [= platform firmware]
- device path protocol installed by PciBusDxe
- PciIo protocol installed by PciBusDxe
- ExtScsiPassThru protocol installed by the SCSI HBA driver, through
  consuming PciIo
- Logical bit set in ExtScsiPassThru: meaning that devices enumerated on
  this channel can be used for data access & booting
- Physical bit set in ExtScsiPassThru: meaning that devices enumerated
  on this channel can be sent diagnostic commands

Handle#2:

- device path: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0)
- handle created by ScsiBusDxe [= platform firmware]
- device path protocol installed by ScsiBusDxe (here: Target=1, Lun=0)
- ScsiIo protocol installed by ScsiBusDxe [= platform firmware], through
  consuming ExtScsiPassThru on Handle#1
- BlockIo protocol installed by ScsiDiskDxe [= platform firmware],
  through consuming ScsiIo on the same handle (= Handle#2)


(B) RAID HBA

* Summary:

Handle#1: PciRoot(0x0)/Pci(0x1,0x0) -- logical channel
Handle#2: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0)   -- logical disk
Handle#3: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)   -- physical channel
Handle#4: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x0) -- physical disk #0
Handle#5  PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x1) -- physical disk #1

* Details:

Handle#1:

- The same as Handle#1 from (A), except the Physical bit is clear in the
  ExtScsiPassThru protocol instance.
- This handle stands for the logical channel.

Handle#2:
- The same as Handle#2 from (A).
- This handle stands for the logical disk.

Handle#3:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0).
- Handle created by the SCSI HBA driver.
- Device path installed by the SCSI HBA driver.
- ExtScsiPassThru protocol installed by the SCSI HBA driver, through
  consuming PciIo on Handle#1.
- Logical bit is clear in ExtScsiPassThru.
- Physical bit is set in ExtScsiPassThru.
- This handle stands for the physical channel.

Handle#4:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x0)
- Handle created by ScsiBusDxe [= platform firmware].
- Device path protocol installed by ScsiBusDxe (here: Target=4, Lun=0).
- ScsiIo protocol installed by ScsiBusDxe [= platform firmware], through
  consuming ExtScsiPassThru on Handle#3.
- BlockIo protocol is *NOT* installed by ScsiDiskDxe [= platform
  firmware], due to the Logical bit being clear in ExtScsiPassThru on
  Handle#3.
- This handle stands for the first physical disk in the array.

Handle#5:
- Same as Handle#4, with the following differences:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x1).
- This handle stands for the second physical disk in the array.

Hope this helps,
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43971): https://edk2.groups.io/g/devel/message/43971
Mute This Topic: https://groups.io/mt/32007447/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 3/4] Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related modules"

2019-07-18 Thread Stefan Berger

On 7/18/19 4:56 AM, Marc-André Lureau wrote:

Hi

On Mon, Jul 15, 2019 at 9:04 PM Laszlo Ersek  wrote:

We ask contributors to copy Marc-André and Stefan on patches that affect
"TPM2 modules" under OvmfPkg. With the "GetMaintainer.py" script being
introduced later, express this expectation in "Maintainers.txt" in
machine-readable format.

Cc: Andrew Fish 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Leif Lindholm 
Cc: Marc-André Lureau 
Cc: Michael D Kinney 
Cc: Philippe Mathieu-Daudé 
Cc: Stefan Berger 
Signed-off-by: Laszlo Ersek 

Reviewed-by: Marc-André Lureau 



Reviewed-by: Stefan Berger 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43970): https://edk2.groups.io/g/devel/message/43970
Mute This Topic: https://groups.io/mt/32480695/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/1] edksetup.sh: rework python executable scanning

2019-07-18 Thread Leif Lindholm
On Thu, Jul 18, 2019 at 04:48:18PM +, Gao, Liming wrote:
> > > Find the high version python. When we enable Python3, we find
> > > Python37 does great performance optimization.
> > > So, we think high version python can bring more benefit.
> > 
> > This is where I disagree.
> > As a user/admin, I am no more interested in my build tools deciding I
> > would prefer another python than the default one than I am in they
> > deciding I would prefer another toolchain.
> > 
> > If I build a specific commit of edk2 (including BaseTools) from a
> > specific command line, then I expect any subsequent builds to behave
> > identically unless I have reconfigured the system. Installing another
> > version of python without changing the system default shoulds not
> > change that.
> 
> I agree this is a good point to keep the same build behavior even if user 
> environment is changed. But, I think user installs new version python, he 
> may want to use it.

Yes.
But perhaps the user isn't the admin, and the admin installs a new
version of python without updating the default links, in order to let
a different user test the new version. Thinking this will not affect
users, because python, python2 and python3 all behave exactly like
before.

> Current edksetup.sh can easily apply the new version python. 
> Now, the difference is the default policy to choose python version. 
> Your suggestion is to use default version python interpreter or base
> on PATH to find the python interpreter.
> Current logic is to find the high version in the available python 
> interpreter. 
> It is added @d8238aaf862a55eec77040844c71a02c71294e86 commit. 

Yes, and ideally I would have noticed that and had this conversation
back then. But I didn't. Sorry.

> Do you meet with the real problem with the high version python interpreter? 

Not yet.
But I can easily see this causing issues with the various docker
images we have set up for various (not just TianoCore) CI jobs.

> > If I _want_ to use the newly installed python, I can change the
> > python/python2/python3 links. And if I don't want to do that, I can
> > set PYTHON_COMMAND.
> > "We have seen better performance with 3.7" is an excellent argment for
> > suggesting people install, and use, python 3.7. I do not see it as a
> > good argument for always preferring the highest version available.
> 
> User can set PYTHON_COMMAND to keep the same python interpreter.

Yes, but for me, that logic fails the "least amount of surprise"
litmus test. If the command invoked when I call 'python' (or 'python2'
or 'python3') is the same, then I would expect the same version to be
used by the build system. If I *wanted* applications to use the newer
version, I would change the 'python' (or 'python2' or 'python3')
symlink.

> > > > - Can we use simply 'python' as the default?
> > >
> > > Based on previous discussion, we recommend to use Python3 as default.
> > 
> > If python3 is to be the default, then I see no use for PYTHON3_£NABLE.
> 
> Now, BaseTools has not drop Python2 support. If user wants to use Python2, 
> he can simply set PYTHON3_ENABLE=FALSE, then he doesn't need to find python 
> path 
> to set PYTHON_COMMAND env. 

On Linux, the path is not required for PYTHON_COMMAND. And this is the
.sh, so I would hope the same holds true under cygwin. So
PYTHON_COMMAND=python2 provides the same functionality as
PYTHON3_ENABLE=FALSE.

*But* the latest version of my script does not behave in this way, so
that still needs to change.

> > If PYTHON_COMMAND is set, it should always be respected. If it's not
> > set, python3 is picked in preference anyway.
> 
> So, PYTHON_COMMAND is higher priority than PYTHON3_ENABLE.
> That means PYTHON3_ENABLE value will be ignored. Right?

Exactly. So I think it it not needed.

/
Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43969): https://edk2.groups.io/g/devel/message/43969
Mute This Topic: https://groups.io/mt/32495132/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

2019-07-18 Thread Philippe Mathieu-Daudé
On 7/18/19 7:40 PM, Leif Lindholm wrote:
> On Thu, Jul 18, 2019 at 07:01:40PM +0200, Philippe Mathieu-Daudé wrote:
>> Hi Leif,
>>
>> On 7/18/19 6:27 PM, Leif Lindholm wrote:
>>> Laszlo, Hao - I have prepared a set for pushing as below.
>>>
>>> (Reviewed-by: Leif Lindholm >> > for all of your patches.)
>>> *But*, I need a review from  Bob and/or Liming before I push the final one:
>>> "BaseTools: add GetMaintainer.py script" -
>>> https://edk2.groups.io/g/devel/message/43666
>>>
>>> I have verified reviews/acks by all affected reviewers, except for
>>> Stefan Berger for Ovmf TCG/TPM2.
>>> While I would prefer to have that too, this is a file format shift - not
>>> a change in responsibility areas.
>>
>> As Marc-André and Stefan have the same responsabilities, Marc-André's
>> review for their common section should be sufficient, right?
> 
> Pretty much.
> 
>> Now if you want to be kind and patient with Stefan, since this is not a
>> logical change blocking anyone, it might be wise to wait over the weekend.
>>
>> My 2 cents ;)
> 
> Yeah, only thing is it would be nice if we could get the script in
> (which is dependent on the Maintainers.txt changes in order to not
> give misleading results) with some time to spare (and for it to see
> real-world use) before we start the freeze for edk2-stable201908.

Then I insist, since Marc-André reviewed the patch, except for being
particularly kind, I don't see any reason to not merge your series ;)

Regards,

Phil.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43968): https://edk2.groups.io/g/devel/message/43968
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 0/3] add GetMaintainer.py helper script

2019-07-18 Thread Leif Lindholm
On Thu, Jul 18, 2019 at 07:01:40PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Leif,
> 
> On 7/18/19 6:27 PM, Leif Lindholm wrote:
> > Laszlo, Hao - I have prepared a set for pushing as below.
> > 
> > (Reviewed-by: Leif Lindholm  > > for all of your patches.)
> > *But*, I need a review from  Bob and/or Liming before I push the final one:
> > "BaseTools: add GetMaintainer.py script" -
> > https://edk2.groups.io/g/devel/message/43666
> > 
> > I have verified reviews/acks by all affected reviewers, except for
> > Stefan Berger for Ovmf TCG/TPM2.
> > While I would prefer to have that too, this is a file format shift - not
> > a change in responsibility areas.
> 
> As Marc-André and Stefan have the same responsabilities, Marc-André's
> review for their common section should be sufficient, right?

Pretty much.

> Now if you want to be kind and patient with Stefan, since this is not a
> logical change blocking anyone, it might be wise to wait over the weekend.
> 
> My 2 cents ;)

Yeah, only thing is it would be nice if we could get the script in
(which is dependent on the Maintainers.txt changes in order to not
give misleading results) with some time to spare (and for it to see
real-world use) before we start the freeze for edk2-stable201908.

/
Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43967): https://edk2.groups.io/g/devel/message/43967
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 0/3] add GetMaintainer.py helper script

2019-07-18 Thread Philippe Mathieu-Daudé
Hi Leif,

On 7/18/19 6:27 PM, Leif Lindholm wrote:
> Laszlo, Hao - I have prepared a set for pushing as below.
> 
> (Reviewed-by: Leif Lindholm  > for all of your patches.)
> *But*, I need a review from  Bob and/or Liming before I push the final one:
> "BaseTools: add GetMaintainer.py script" -
> https://edk2.groups.io/g/devel/message/43666
> 
> I have verified reviews/acks by all affected reviewers, except for
> Stefan Berger for Ovmf TCG/TPM2.
> While I would prefer to have that too, this is a file format shift - not
> a change in responsibility areas.

As Marc-André and Stefan have the same responsabilities, Marc-André's
review for their common section should be sufficient, right?

Now if you want to be kind and patient with Stefan, since this is not a
logical change blocking anyone, it might be wise to wait over the weekend.

My 2 cents ;)

Phil.

> Laszlo, do you agree?
> If so, I can push 1-7/8 as is.
> 
> /
>     Leif
> 
> Hao A Wu (1):
>   Maintainers.txt: Fine-grained review ownership for MdeModulePkg
> 
> Laszlo Ersek (4):
>   Maintainers.txt: split out section "ArmVirtPkg: modules used on Xen"
>   Maintainers.txt: split out section "OvmfPkg: Xen-related modules"
>   Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related
>     modules"
>   Maintainers.txt: split out section "OvmfPkg: CSM modules"
> 
> Leif Lindholm (3):
>   Maintainers.txt: update for filesystem area descriptions
>   Maintainers.txt: add wildcard path association for Arm/AArch64
>   BaseTools: add GetMaintainer.py script
> 
> 
> On Fri, 12 Jul 2019 at 18: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 mailto:af...@apple.com>>
>   Laszlo Ersek mailto:ler...@redhat.com>>
>   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 

Re: [edk2-devel] [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible out-of-bounds memory writes

2019-07-18 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty  

-Original Message-
From: Desimone, Nathaniel L 
Sent: Wednesday, July 17, 2019 11:49 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Kubacki, Michael A 
; Chaganty, Rangasai V 

Subject: [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible out-of-bounds 
memory writes

- Add check for the DSDT not existing.
- Fixed logic errors in loop boundary check.

Cc: Chasel Chiu 
Cc: Michael A Kubacki 
Cc: Sai Chaganty 

Co-authored-by: John Mathews 
Signed-off-by: Nate DeSimone 
---
 .../Library/DxeAslUpdateLib/DxeAslUpdateLib.c  | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c 
b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
index e6ab43db6d..87c6b15ed2 100644
--- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
+++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpd
+++ ateLib.c
@@ -6,7 +6,7 @@
 
   This library uses the ACPI Support protocol.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -59,6 +59,7 @@ InitializeAslUpdateLib (
   @param[in] Length- length of data to be overwritten
 
   @retval EFI_SUCCESS  - The function completed successfully.
+  @retval EFI_NOT_FOUND- Failed to locate AcpiTable.
 **/
 EFI_STATUS
 UpdateNameAslCode (
@@ -72,6 +73,7 @@ UpdateNameAslCode (
   UINT8   *CurrPtr;
   UINT32  *Signature;
   UINT8   *DsdtPointer;
+  UINT8   *EndPointer;
   UINTN   Handle;
   UINT8   DataSize;
 
@@ -99,11 +101,15 @@ UpdateNameAslCode (
   /// Point to the beginning of the DSDT table
   ///
   CurrPtr = (UINT8 *) Table;
+  if (CurrPtr == NULL) {
+return EFI_NOT_FOUND;
+  }
 
   ///
   /// Loop through the ASL looking for values that we must fix up.
   ///
-  for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + 
((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+  EndPointer = CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length; 
+ for (DsdtPointer = CurrPtr; DsdtPointer < EndPointer; DsdtPointer++) {
 ///
 /// Get a pointer to compare for signature
 ///
--
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43965): https://edk2.groups.io/g/devel/message/43965
Mute This Topic: https://groups.io/mt/32512569/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/1] edksetup.sh: rework python executable scanning

2019-07-18 Thread Liming Gao
Leif:

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Leif 
> Lindholm
> Sent: Thursday, July 18, 2019 6:37 AM
> To: Gao, Liming 
> Cc: Laszlo Ersek ; devel@edk2.groups.io; Rebecca Cran 
> ; Feng, Bob C ;
> Kinney, Michael D ; af...@apple.com
> Subject: Re: [edk2-devel] [PATCH 1/1] edksetup.sh: rework python executable 
> scanning
> 
> On Wed, Jul 17, 2019 at 03:23:26AM +, Gao, Liming wrote:
> > Leif:
> >   I agree to discuss the behavior first, then review the code logic in 
> > detail. I add my comments below.
> >
> > > -Original Message-
> > > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > > So, first of all - I am entirely happy with dropping the function.
> > > But I wanted to have it written anyway in case someone came up with a
> > > really good explanation for why we needed to completely cover the same
> > > pattern as the code currently in tree: and the situation does not
> > > relate to python4 or python5 - it relates to picking the latest of
> > > 2.7, 2.7.6, 3.5, 3.5.2, 3.5,4, 3.7 (which is my interpretation of the
> > > behaviour of current HEAD).
> > >
> > > So basically - I think we need to reach an agreement (with BaseTools
> > > maintainers, and existing users) about what the behaviour should be.
> > >
> > > - What does PYTHON3_ENABLE mean? Is it for probing only, or are we
> > >   setting it for later use by BaseTools?
> >
> > PYTHON3_EANBLE is to decide python3 enable or not. It has high priority.
> > Once it is set, PYTHON_COMMAND will be ignored.
> >   If it is set to TRUE, edksetup.sh will find Python3 in the system, set 
> > PYTHON_COMMAND env.
> >   If it is set to other value, edksetup.sh will find Python2 in the system, 
> > set PYTHON_COMMAND env.
> > If PYTHON3_EANBLE is not set, PYTHON_COMMAND will be used if PYTHON_COMMAND 
> > is set.
> > If PYTHON3_EANBLE is not set, and PYTHON_COMMAND is not set, the
> > default behavior will set PYTHON3_EANBLE to TRUE.
> 
> (typo as discussed in other email corrected above (python3->python2))
> 
> > So, the default behavior is to use highest version Python3. User can
> > set PYTHON_COMMAND for their python version.
> >
> > > - What should the priority order be when looking for python
> > >   executables?
> >
> > Find the high version python. When we enable Python3, we find
> > Python37 does great performance optimization.
> > So, we think high version python can bring more benefit.
> 
> This is where I disagree.
> As a user/admin, I am no more interested in my build tools deciding I
> would prefer another python than the default one than I am in they
> deciding I would prefer another toolchain.
> 
> If I build a specific commit of edk2 (including BaseTools) from a
> specific command line, then I expect any subsequent builds to behave
> identically unless I have reconfigured the system. Installing another
> version of python without changing the system default shoulds not
> change that.

I agree this is a good point to keep the same build behavior even if user 
environment is changed. But, I think user installs new version python, he 
may want to use it. Current edksetup.sh can easily apply the new version 
python. 
Now, the difference is the default policy to choose python version. 
Your suggestion is to use default version python interpreter or base on PATH to 
find the python interpreter. 
Current logic is to find the high version in the available python interpreter. 
It is added @d8238aaf862a55eec77040844c71a02c71294e86 commit. 

Do you meet with the real problem with the high version python interpreter? 

> 
> If I _want_ to use the newly installed python, I can change the
> python/python2/python3 links. And if I don't want to do that, I can
> set PYTHON_COMMAND.
> "We have seen better performance with 3.7" is an excellent argment for
> suggesting people install, and use, python 3.7. I do not see it as a
> good argument for always preferring the highest version available.
> 

User can set PYTHON_COMMAND to keep the same python interpreter.

> > > - Can we use simply 'python' as the default?
> >
> > Based on previous discussion, we recommend to use Python3 as default.
> 
> If python3 is to be the default, then I see no use for PYTHON3_£NABLE.

Now, BaseTools has not drop Python2 support. If user wants to use Python2, 
he can simply set PYTHON3_ENABLE=FALSE, then he doesn't need to find python 
path 
to set PYTHON_COMMAND env. 

> If PYTHON_COMMAND is set, it should always be respected. If it's not
> set, python3 is picked in preference anyway.

So, PYTHON_COMMAND is higher priority than PYTHON3_ENABLE.
That means PYTHON3_ENABLE value will be ignored. Right?

Thanks
Liming
> 
> > > - Do we need functionality for more than selecting between
> > >   python2/python3?
> >
> > Yes. Find the high version python installed in the system.
> 
> Best Regards,
> 
> Leif
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.


Re: [edk2-devel] [PATCH 0/3] add GetMaintainer.py helper script

2019-07-18 Thread Leif Lindholm
Laszlo, Hao - I have prepared a set for pushing as below.

(Reviewed-by: Leif Lindholm  for all of your
patches.)
*But*, I need a review from  Bob and/or Liming before I push the final one:
"BaseTools: add GetMaintainer.py script" -
https://edk2.groups.io/g/devel/message/43666

I have verified reviews/acks by all affected reviewers, except for Stefan
Berger for Ovmf TCG/TPM2.
While I would prefer to have that too, this is a file format shift - not a
change in responsibility areas.
Laszlo, do you agree?
If so, I can push 1-7/8 as is.

/
Leif

Hao A Wu (1):
  Maintainers.txt: Fine-grained review ownership for MdeModulePkg

Laszlo Ersek (4):
  Maintainers.txt: split out section "ArmVirtPkg: modules used on Xen"
  Maintainers.txt: split out section "OvmfPkg: Xen-related modules"
  Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related
modules"
  Maintainers.txt: split out section "OvmfPkg: CSM modules"

Leif Lindholm (3):
  Maintainers.txt: update for filesystem area descriptions
  Maintainers.txt: add wildcard path association for Arm/AArch64
  BaseTools: add GetMaintainer.py script


On Fri, 12 Jul 2019 at 18: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.
>
> 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 (#43963): https://edk2.groups.io/g/devel/message/43963
Mute This Topic: https://groups.io/mt/32444044/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 

Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

2019-07-18 Thread Ravi Kumar Siadri
Hi Laszlo Ersek / Hao Wu,

I have gone through the Guide, i can see some points which are not very
clear..

*1.  *
*Single-Channel SCSI Adapters*
*If the SCSI adapter supports one channel, then the SCSI host controller
driver*
*performs the following:*
*• Install Extended SCSI Pass Thru Protocol onto the controller handle for
the*
*SCSI host controller.*
*• Set the logical attribute for the SCSI channel in the mode structure.*
*• Set the physical attribute for the SCSI channel in the mode structure.*

*The platform firmware must only enumerate and boot from SCSI targets
present on the logical SCSI channel.*

Suppose a HBA controller (non RAID) has only Physical Devices connected to
it.(logical devices cannot be created on it).
What is the point in setting *logical attribute *in SCSI passthru handle,
when a controller cannot produce logical devices (as it is non RAID) ??

UEFI spec say logical SCSI passthru handle is to access the logical devices
attached to the RAID controller. Then what is the dependency here to
produce child handles (Block IO protocol) of Physical devices with the
logical SCSI passthru handle, when the controller cannot produce a logical
devices ??


*2. *
*EFI_EXT_SCSI_PASS_THRU_PROTOCOL.Mode is a structure that describes the
intrinsic*
*attributes of Extended SCSI Pass Thru Protocol instance. Note that a
non-RAID SCSI*
*channel sets both the physical and logical attributes. A physical channel
on the RAID*
*adapter only sets the physical attribute, and the logical channel on the
RAID adapter*
*only sets the logical attribute. If the channel supports non-blocking I/O,
the nonblocking attribute is also set*

*Of course, there are many possible designs for implementing SCSI RAID
functionality.*
*The point is that an SCSI host controller driver may be designed and
implemented for a*
*wide variety of SCSI adapters types, and those SCSI host controller
drivers can*
*produce the Extended SCSI Pass Thru Protocol for SCSI channels that
contain SCSI*
*targets that may be used as UEFI boot devices.*

All the implementations recommended are hacks/tricks to achieve the spec
defined way of SCSI pass Thru. To acheive this each Producers of scsi pass
thru protocol can follow a multiple ways. If this happens how a Consumer of
scsi pass thru (application or other drivers) can figure out the
implementation of producer if it is not defined in any standard
specification ?? how the producer and consumer of SCSI passthru are inline
??

I feel the current design is an over head and not cleary defined by UEFI
specification. Can't we update the way of implementation ??
I have a new design proposal which can make a scsi pass thru protocol more
clear and simple. Can you please check and comment on this.
https://edk2.groups.io/g/devel/files/Designs/2019/0710


I think the Driver Writer's Guide is designed by assuming the RAID
controllers will expose/produce only Logical Devices, but a there are some
RAID controllers which exposes a mix of Physical and Logical Devices (RAID
devices) as well.

Thanks,
Ravi Kumar

On Mon, Jul 15, 2019 at 10:55 AM Wu, Hao A  wrote:

> > -Original Message-
> > From: Laszlo Ersek [mailto:ler...@redhat.com]
> > Sent: Saturday, July 13, 2019 6:11 AM
> > To: siadriravikumaru...@gmail.com
> > Cc: devel@edk2.groups.io; Wu, Hao A; Cetola, Stephano
> > Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
> >
> > On 06/10/19 14:32, Ravi Kumar Siadri wrote:
> > > Hi all,
> > >
> > > I have couple of queries regarding the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in
> > > EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
> > >
> > > 1.
> > > The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> > > tells if the interface is for physical SCSI devices or logical SCSI
> > > devices. Drivers for non-RAID SCSI controllers will set both the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.
> > >
> > > If the Drivers is for non-RAID SCSI controllers why to set the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any
> > case
> > > that non-RAID SCSI controllers have Logical devices connected to it ??
> > >
> > > 2.
> > > Drivers for RAID controllers that allow access to the physical devices
> > > and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> > > interfaces: One with the just the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another
> > with
> > > just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One
> > > interface can be used to access the physical devices attached to the
> > > RAID controller, and the other can be used to access the logical
> > > devices attached to the RAID controller for its current configuration.
> > >
> > > Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2
> > instances
> > > ? why can't we install attributes
> > > 

Re: [edk2-devel] [PATCH v1 1/8] ShellPkg: acpiview: RSDP: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43961): https://edk2.groups.io/g/devel/message/43961
Mute This Topic: https://groups.io/mt/32513485/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 4/8] ShellPkg: acpiview: SRAT: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43960): https://edk2.groups.io/g/devel/message/43960
Mute This Topic: https://groups.io/mt/32513484/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 5/8] ShellPkg: acpiview: MADT: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43959): https://edk2.groups.io/g/devel/message/43959
Mute This Topic: https://groups.io/mt/32513483/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 7/8] ShellPkg: acpiview: GTDT: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43957): https://edk2.groups.io/g/devel/message/43957
Mute This Topic: https://groups.io/mt/32513486/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 3/8] ShellPkg: acpiview: SPCR: Remove redundant forward declaration

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43958): https://edk2.groups.io/g/devel/message/43958
Mute This Topic: https://groups.io/mt/32513489/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 8/8] ShellPkg: acpiview: DBG2: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43956): https://edk2.groups.io/g/devel/message/43956
Mute This Topic: https://groups.io/mt/32513492/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 2/8] ShellPkg: acpiview: FADT: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43955): https://edk2.groups.io/g/devel/message/43955
Mute This Topic: https://groups.io/mt/32513493/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 6/8] ShellPkg: acpiview: IORT: Remove redundant forward declarations

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43954): https://edk2.groups.io/g/devel/message/43954
Mute This Topic: https://groups.io/mt/32513494/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 1/6] ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43953): https://edk2.groups.io/g/devel/message/43953
Mute This Topic: https://groups.io/mt/32514379/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 4/6] ShellPkg: acpiview: SRAT: Minor code style enhancements

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43950): https://edk2.groups.io/g/devel/message/43950
Mute This Topic: https://groups.io/mt/32514385/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 3/6] ShellPkg: acpiview: RSDP: Make code consistent with other parsers

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43951): https://edk2.groups.io/g/devel/message/43951
Mute This Topic: https://groups.io/mt/32514381/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 2/6] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43952): https://edk2.groups.io/g/devel/message/43952
Mute This Topic: https://groups.io/mt/32514380/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 5/6] ShellPkg: acpiview: MADT: Split structure length validation

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43949): https://edk2.groups.io/g/devel/message/43949
Mute This Topic: https://groups.io/mt/32514386/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 6/6] ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation

2019-07-18 Thread Alexei Fedorov
Reviewed-by: Alexei Fedorov 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43948): https://edk2.groups.io/g/devel/message/43948
Mute This Topic: https://groups.io/mt/32514387/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/PiSmmCpu: Allow SMM access-out when static paging is OFF

2019-07-18 Thread Laszlo Ersek
On 07/18/19 08:58, Ni, Ray wrote:
> Commit c60d36b4d1ee1f69b7cca897d3621dfa951895c2
> * UefiCpuPkg/SmmCpu: Block access-out only when static paging is used
> 
> updated page fault handler to treat SMM access-out as allowed
> address when static paging is not used.
> 
> But that commit is not complete because the page table is still
> updated in SetUefiMemMapAttributes() for non-SMRAM memory. When SMM
> code accesses non-SMRAM memory, page fault is still generated.
> 
> This patch skips to update page table for non-SMRAM memory and
> page table itself.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 21 +++--
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> index 2f7d777ee7..f75e75f55c 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> @@ -1103,6 +1103,9 @@ FindSmramInfo (
>*SmrrBase = (UINT32)CurrentSmramRange->CpuStart;
>*SmrrSize = (UINT32)CurrentSmramRange->PhysicalSize;
>  
> +  //
> +  // Extend *SmrrBase/*SmrrSize to include adjacent SMRAM ranges
> +  //
>do {
>  Found = FALSE;
>  for (Index = 0; Index < mSmmCpuSmramRangeCount; Index++) {
> @@ -1414,14 +1417,20 @@ PerformRemainingTasks (
>  SetMemMapAttributes ();
>  
>  //
> -// For outside SMRAM, we only map SMM communication buffer or MMIO.
> +// Do not protect memory outside SMRAM when SMM static page table is not 
> enabled.
>  //
> -SetUefiMemMapAttributes ();
> +if (mCpuSmmStaticPageTable) {
>  
> -//
> -// Set page table itself to be read-only
> -//
> -SetPageTableAttributes ();
> +  //
> +  // For outside SMRAM, we only map SMM communication buffer or MMIO.
> +  //
> +  SetUefiMemMapAttributes ();
> +
> +  //
> +  // Set page table itself to be read-only
> +  //
> +  SetPageTableAttributes ();
> +}
>  
>  //
>  // Configure SMM Code Access Check feature if available.
> 

This patch is a no-op for platforms with PcdCpuSmmStaticPageTable=TRUE
(which is both the UefiCpuPkg default and what OVMF uses), so, from my side:

Acked-by: Laszlo Ersek 

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43947): https://edk2.groups.io/g/devel/message/43947
Mute This Topic: https://groups.io/mt/32512605/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 0/6] Acpiview table parsers code style enhancements and refactoring

2019-07-18 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

Thanks
-Jaben


> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Thursday, July 18, 2019 5:32 AM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> Gao, Zhichao ; sami.muja...@arm.com;
> matteo.carl...@arm.com; n...@arm.com
> Subject: [edk2-devel] [PATCH v1 0/6] Acpiview table parsers code style
> enhancements and refactoring
> 
> This set of patches consists of a number of changes which make the code
> structure consistent across the existing ACPI table parsers. These are
> all refactoring changes which do not modify the existing functionality
> of the acpiview UEFI shell tool.
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/612_acpiview_code_style_e
> nhance_v1
> 
> Krzysztof Koch (6):
>   ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()
>   ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
>   ShellPkg: acpiview: RSDP: Make code consistent with other parsers
>   ShellPkg: acpiview: SRAT: Minor code style enhancements
>   ShellPkg: acpiview: MADT: Split structure length validation
>   ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26
> +---
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8
> +++--
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
> |  2 +-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |
> 32 ++--
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 30 +-
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
> | 11 +--
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |
> 3 +-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
> | 18 +++
>  8 files changed, 82 insertions(+), 48 deletions(-)
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43946): https://edk2.groups.io/g/devel/message/43946
Mute This Topic: https://groups.io/mt/32514378/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 0/8] Remove redundant forward declarations in acpiview

2019-07-18 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

Thanks
-Jaben

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Thursday, July 18, 2019 3:05 AM
> 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 0/8] Remove redundant forward declarations in acpiview
> 
> This patch series removes forward static function declarations in the
> acpiview table parsers. After repositioning blocks of code, these forward
> declarations are no longer needed and they increase the code size.
> 
> What is more, some of the existing ACPI table parsers don't have these
> duplicate declarations, so this set of patches makes the code structure
> consistent across all acpiview parsers.
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/612_remove_forward_decl_
> v1
> 
> Krzysztof Koch (8):
>   ShellPkg: acpiview: RSDP: Remove redundant forward declarations
>   ShellPkg: acpiview: FADT: Remove redundant forward declarations
>   ShellPkg: acpiview: SPCR: Remove redundant forward declaration
>   ShellPkg: acpiview: SRAT: Remove redundant forward declarations
>   ShellPkg: acpiview: MADT: Remove redundant forward declarations
>   ShellPkg: acpiview: IORT: Remove redundant forward declarations
>   ShellPkg: acpiview: GTDT: Remove redundant forward declarations
>   ShellPkg: acpiview: DBG2: Remove redundant forward declarations
> 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
> |  62 +++---
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
> | 113 ++-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> |  91 ++-
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |
> 58 +++---
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 118 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
> | 116 +++
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
> |  98 ++--
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |
> 64 +++
>  8 files changed, 236 insertions(+), 484 deletions(-)
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43945): https://edk2.groups.io/g/devel/message/43945
Mute This Topic: https://groups.io/mt/32513487/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 v2] KabylakeSiliconPkg: Possible out-of-bounds memory writes

2019-07-18 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Nate
> DeSimone
> Sent: Thursday, July 18, 2019 2:49 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Kubacki, Michael A
> ; Chaganty, Rangasai V
> 
> Subject: [edk2-devel] [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible
> out-of-bounds memory writes
> 
> - Add check for the DSDT not existing.
> - Fixed logic errors in loop boundary check.
> 
> Cc: Chasel Chiu 
> Cc: Michael A Kubacki 
> Cc: Sai Chaganty 
> 
> Co-authored-by: John Mathews 
> Signed-off-by: Nate DeSimone 
> ---
>  .../Library/DxeAslUpdateLib/DxeAslUpdateLib.c  | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> index e6ab43db6d..87c6b15ed2 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpd
> +++ ateLib.c
> @@ -6,7 +6,7 @@
> 
>This library uses the ACPI Support protocol.
> 
> -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -59,6 +59,7 @@ InitializeAslUpdateLib (
>@param[in] Length- length of data to be overwritten
> 
>@retval EFI_SUCCESS  - The function completed successfully.
> +  @retval EFI_NOT_FOUND- Failed to locate AcpiTable.
>  **/
>  EFI_STATUS
>  UpdateNameAslCode (
> @@ -72,6 +73,7 @@ UpdateNameAslCode (
>UINT8   *CurrPtr;
>UINT32  *Signature;
>UINT8   *DsdtPointer;
> +  UINT8   *EndPointer;
>UINTN   Handle;
>UINT8   DataSize;
> 
> @@ -99,11 +101,15 @@ UpdateNameAslCode (
>/// Point to the beginning of the DSDT table
>///
>CurrPtr = (UINT8 *) Table;
> +  if (CurrPtr == NULL) {
> +return EFI_NOT_FOUND;
> +  }
> 
>///
>/// Loop through the ASL looking for values that we must fix up.
>///
> -  for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr +
> ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
> +  EndPointer = CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length;
> + for (DsdtPointer = CurrPtr; DsdtPointer < EndPointer; DsdtPointer++) {
>  ///
>  /// Get a pointer to compare for signature
>  ///
> --
> 2.17.1.windows.2
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43944): https://edk2.groups.io/g/devel/message/43944
Mute This Topic: https://groups.io/mt/32512569/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 0/6] Acpiview table parsers code style enhancements and refactoring

2019-07-18 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

-Original Message-
From: Krzysztof Koch  
Sent: 18 July 2019 01:32 PM
To: devel@edk2.groups.io
Cc: jaben.car...@intel.com; ray...@intel.com; zhichao@intel.com; Sami 
Mujawar ; Matteo Carlini ; nd 

Subject: [PATCH v1 0/6] Acpiview table parsers code style enhancements and 
refactoring

This set of patches consists of a number of changes which make the code 
structure consistent across the existing ACPI table parsers. These are all 
refactoring changes which do not modify the existing functionality of the 
acpiview UEFI shell tool.

Changes can be seen at: 
https://github.com/KrzysztofKoch1/edk2/tree/612_acpiview_code_style_enhance_v1

Krzysztof Koch (6):
  ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()
  ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
  ShellPkg: acpiview: RSDP: Make code consistent with other parsers
  ShellPkg: acpiview: SRAT: Minor code style enhancements
  ShellPkg: acpiview: MADT: Split structure length validation
  ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation

 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26 
+---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8 
+++--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |  2 +- 
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 32 
++--  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 30 
+-  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 11 
+--  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c 
|  3 +-  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c 
| 18 +++
 8 files changed, 82 insertions(+), 48 deletions(-)

--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43943): https://edk2.groups.io/g/devel/message/43943
Mute This Topic: https://groups.io/mt/32514378/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/4] Maintainers.txt: formalize ArmVirtPkg and OvmfPkg subsystem pathnames

2019-07-18 Thread Laszlo Ersek
On 07/18/19 06:54, Philippe Mathieu-Daudé wrote:
> On 7/15/19 7:04 PM, Laszlo Ersek wrote:
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: ovmfpkg_maintainers
>>
>> The patches in this series should be inserted between Leif's patches
>>
>> * [edk2-devel] [PATCH 2/3] Maintainers.txt: add wildcard path association 
>> for Arm/AArch64
>>   20190712170128.6495-3-leif.lindholm@linaro.org">http://mid.mail-archive.com/20190712170128.6495-3-leif.lindholm@linaro.org
>>   https://edk2.groups.io/g/devel/message/43665
>>
>> and
>>
>> * [edk2-devel] [PATCH 3/3] BaseTools: add GetMaintainer.py script
>>   20190712170128.6495-4-leif.lindholm@linaro.org">http://mid.mail-archive.com/20190712170128.6495-4-leif.lindholm@linaro.org
>>   https://edk2.groups.io/g/devel/message/43666
>>
>> That's also how you will find them in my topic branch, referenced above
>> (in particular, look for the "Message-Id" tags on Leif's patches,
>> appended by my invocation of "git-am -m").
>>
>> My understanding is that Leif would only like to pick up these patches
>> once they are ready for pushing. That is, if corrections are necessary,
>> I should post v2 (and I should post v2 of these four patches only) --
>> Leif's series and mine will only be unified for the pushing.
>>
>> (Technically, Leif could incorporate these patches at once in his topic
>> branch, and post a unified v2; assuming corrections were necessary for
>> the OvmfPkg-related patches. That's because I expect minimal changes if
>> any, which Leif could implement on top "mindlessly". Of course, that's
>> also the argument against Leif writing the updates -- we shouldn't shove
>> mindless work over to other people. :) Anyway, I'm fine either way.)
>>
>> Cc: Andrew Fish 
>> Cc: Anthony Perard 
>> Cc: Ard Biesheuvel 
>> Cc: David Woodhouse 
>> Cc: Jordan Justen 
>> Cc: Julien Grall 
>> Cc: Leif Lindholm 
>> Cc: Marc-André Lureau 
>> Cc: Michael D Kinney 
>> Cc: Philippe Mathieu-Daudé 
>> Cc: Stefan Berger 
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (4):
>>   Maintainers.txt: split out section "ArmVirtPkg: modules used on Xen"
>>   Maintainers.txt: split out section "OvmfPkg: Xen-related modules"
>>   Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related
>> modules"
>>   Maintainers.txt: split out section "OvmfPkg: CSM modules"
>>
>>  Maintainers.txt | 52 +---
>>  1 file changed, 44 insertions(+), 8 deletions(-)
> 
> FWIW, for this series:
> Tested-by: Philippe Mathieu-Daude 
> (with various paths from each new sections, and also from the previous
> section, then comparating).
> 

Thank you!
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43942): https://edk2.groups.io/g/devel/message/43942
Mute This Topic: https://groups.io/mt/32480691/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/1] Maintainers.txt: Review ownership for MdeModulePkg

2019-07-18 Thread Laszlo Ersek
On 07/18/19 03:19, Hao A Wu wrote:
> This patch is also available at:
> https://github.com/hwu25/edk2/tree/mdemodulepkg_reviewers_v2
> 
> Also, please note that on the above branch, the proposed patch
> (MdeModulePkg reviewers) is inserted between:
> 
> * [edk2-devel] [PATCH 4/4] Maintainers.txt: split out section "OvmfPkg: CSM 
> modules"
> (from Laszlo)
> https://edk2.groups.io/g/devel/message/43732
> 
> and
> 
> * [edk2-devel] [PATCH 3/3] BaseTools: add GetMaintainer.py script
> (from Leif)
> https://edk2.groups.io/g/devel/message/43666
> 
> 
> V2 changes:
> A. Sort "F:" patterns in alphabetical order for each section;
> B. Serveral module renaming:
>Console and Graphic -> Console and Graphics
>S3  -> ACPI S3
>SMM -> Management Mode (MM, SMM)
>Variable-> UEFI Variable
> 
> 
> Cc: Andrew Fish 
> Cc: Laszlo Ersek 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Dandan Bi 
> Cc: Eric Dong 
> Cc: Liming Gao 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Zhichao Gao 
> 
> Hao A Wu (1):
>   Maintainers.txt: Fine-grained review ownership for MdeModulePkg
> 
>  Maintainers.txt | 151 +++-
>  1 file changed, 149 insertions(+), 2 deletions(-)
> 

Acked-by: Laszlo Ersek 

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43941): https://edk2.groups.io/g/devel/message/43941
Mute This Topic: https://groups.io/mt/32510838/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 5/6] ShellPkg: acpiview: MADT: Split structure length validation

2019-07-18 Thread Krzysztof Koch
Split the Interrupt Controller Structure length validation in the
acpiview UEFI shell tool into two logical parts:
1. Ensuring MADT table parser forward progress.
2. Preventing MADT table buffer overruns.

Also, make the condition for infinite loop detection applicable to
all types of Interrupt Controller Structures (for all interrupt models
which can be represented in MADT). Check if the controller length
specified is shorter than the byte size of the first two fields
('Type' and 'Length') present in every valid Interrupt Controller
Structure.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- split MADT structure length validation [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 30 
++--
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index 
59c3df0cc8a080497b517baf36fc63f1e4ab866f..52b71f37a40733de2029373306658ca08c78c42d
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -290,16 +290,30 @@ ParseAcpiMadt (
   PARSER_PARAMS (MadtInterruptControllerHeaderParser)
   );
 
-if (((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength) ||
-(*MadtInterruptControllerLength < 4)) {
+// Make sure forward progress is made.
+if (*MadtInterruptControllerLength < 2) {
   IncrementErrorCount ();
   Print (
- L"ERROR: Invalid Interrupt Controller Length,"
-  L" Type = %d, Length = %d\n",
- *MadtInterruptControllerType,
- *MadtInterruptControllerLength
- );
-  break;
+L"ERROR: Structure length is too small: " \
+  L"MadtInterruptControllerLength = %d. " \
+  L"MadtInterruptControllerType = %d. MADT parsing aborted.\n",
+*MadtInterruptControllerLength,
+*MadtInterruptControllerType
+);
+  return;
+}
+
+// Make sure the MADT structure lies inside the table
+if ((Offset + *MadtInterruptControllerLength) > AcpiTableLength) {
+  IncrementErrorCount ();
+  Print (
+L"ERROR: Invalid MADT structure length. " \
+  L"MadtInterruptControllerLength = %d. " \
+  L"RemainingTableBufferLength = %d. MADT parsing aborted.\n",
+*MadtInterruptControllerLength,
+AcpiTableLength - Offset
+);
+  return;
 }
 
 switch (*MadtInterruptControllerType) {
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43939): https://edk2.groups.io/g/devel/message/43939
Mute This Topic: https://groups.io/mt/32514386/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 4/6] ShellPkg: acpiview: SRAT: Minor code style enhancements

2019-07-18 Thread Krzysztof Koch
Minor changes to the SRAT parser code to conform with the EDKII coding
style and to make it consistent with other ACPI table parsers.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- minor code style enhancements [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
index 
075ff2a141a82b522e8aaedb7ad79249aaf5eaac..d0011ca65c17788c5e2f2225380854e780fb
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
@@ -234,6 +234,7 @@ ParseAcpiSrat (
  AcpiTableLength,
  PARSER_PARAMS (SratParser)
  );
+
   ResourcePtr = Ptr + Offset;
 
   while (Offset < AcpiTableLength) {
@@ -278,7 +279,7 @@ ParseAcpiSrat (
   ResourcePtr,
   *SratRALength,
   PARSER_PARAMS (SratGicITSAffinityParser)
-);
+  );
 break;
 
   case EFI_ACPI_6_2_MEMORY_AFFINITY:
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43938): https://edk2.groups.io/g/devel/message/43938
Mute This Topic: https://groups.io/mt/32514385/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 6/6] ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation

2019-07-18 Thread Krzysztof Koch
Move Performance Monitoring Counter Group (PMCG) node ID mapping count
validation from the core IORT acpiview parser logic to a dedicated
function. Now, the pointer to the validation function is passed 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, therefore, it is better to keep it away
from the code responsible for traversing the table.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- refactor PMCG node mapping count validation [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 32 
++--
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
index 
93f78e1a9786ed53f6b5529f478b72a220b4f8df..4d29ca2818804fb472bec0f632a87cd3c8a7cd48
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -47,6 +47,28 @@ ValidateItsIdMappingCount (
   IN VOID*  Context
   );
 
+/**
+  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.
 
@@ -204,7 +226,7 @@ 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},
@@ -567,14 +589,6 @@ DumpIortNodePmcg (
   if (*IortIdMappingCount != 0) {
 DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset);
   }
-
-  if (*IortIdMappingCount > 1) {
-IncrementErrorCount ();
-Print (
-  L"ERROR: ID mapping must not be greater than 1. Id Mapping Count =%d\n",
-  *IortIdMappingCount
-  );
-  }
 }
 
 /**
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43940): https://edk2.groups.io/g/devel/message/43940
Mute This Topic: https://groups.io/mt/32514387/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 3/6] ShellPkg: acpiview: RSDP: Make code consistent with other parsers

2019-07-18 Thread Krzysztof Koch
List ParseAcpi() function arguments one per line in order to make this
function call consistent with ParseAcpi() calls in other ACPI table
parsers.

Also, notify the user that XsdtAddress value of 0 results in RSDP
parsing being terminated and that the XSDT table will not be processed.

This effectively means that no more ACPI tables will be parsed because
of this RSDP table content error.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- minor code style enhancements [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 11 
+--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
index 
586de7cbfb12f856c0c735b6e295c1cc32eb2ceb..bceda91386b5c070b81b2beac83e2a0102a9b64e
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -159,7 +159,14 @@ ParseAcpiRsdp (
 VerifyChecksum (TRUE, Ptr, AcpiTableLength);
   }
 
-  ParseAcpi (Trace, 0, "RSDP", Ptr, AcpiTableLength, PARSER_PARAMS 
(RsdpParser));
+  ParseAcpi (
+Trace,
+0,
+"RSDP",
+Ptr,
+AcpiTableLength,
+PARSER_PARAMS (RsdpParser)
+);
 
   // This code currently supports parsing of XSDT table only
   // and does not parse the RSDT table. Platforms provide the
@@ -167,7 +174,7 @@ ParseAcpiRsdp (
   // Therefore the RSDT should not be used on ARM platforms.
   if ((*XsdtAddress) == 0) {
 IncrementErrorCount ();
-Print (L"ERROR: XSDT Pointer is not set.\n");
+Print (L"ERROR: XSDT Pointer is not set. RSDP parsing aborted.\n");
 return;
   }
 
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43937): https://edk2.groups.io/g/devel/message/43937
Mute This Topic: https://groups.io/mt/32514381/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 2/6] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call

2019-07-18 Thread Krzysztof Koch
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.

Modify remaining code to use the AcpiTableLength argument of the
ParseAcpiXsdt() function instead of a global static variable.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant ParseAcpi() call [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 18 
--
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
index 
4196168bff47d70c67f79f3fc1f4cdee302d460e..e39061f8e2612f2cce4aebf51a511b63b703662b
 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):
@@ -60,22 +60,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 +74,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;
@@ -140,7 +130,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 (#43936): https://edk2.groups.io/g/devel/message/43936
Mute This Topic: https://groups.io/mt/32514380/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 1/6] ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()

2019-07-18 Thread Krzysztof Koch
Modify the signature of the DumpGasStruct() function to include the
buffer length parameter and to return the number of bytes parsed by
the function.

This way it becomes possible to prevent buffer overruns when dumping
Generic Address Structure's (GAS) fields in the acpiview table
parsers.

Update all existing DumpGasStruct() calls in acpiview to add the
length argument.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- Modify DumpGasStruct() signature [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26 
+++-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8 
--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |  2 +-
 3 files changed, 22 insertions(+), 14 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..2c47a3f848aa2dd512c53343ecf1c3c285173dd6
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
@@ -164,7 +164,7 @@ DumpDbgDeviceInfo (
   AddrSize = (UINT32*)(Ptr + (*AddrSizeOffset));
   while (Index < (*GasCount)) {
 PrintFieldName (4, L"BaseAddressRegister");
-DumpGasStruct (DataPtr, 4);
+DumpGasStruct (DataPtr, 4, *DbgDevInfoLen);
 PrintFieldName (4, L"Address Size");
 Print (L"0x%x\n", AddrSize[Index]);
 DataPtr += GAS_LENGTH;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43935): https://edk2.groups.io/g/devel/message/43935
Mute This Topic: https://groups.io/mt/32514379/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 0/6] Acpiview table parsers code style enhancements and refactoring

2019-07-18 Thread Krzysztof Koch
This set of patches consists of a number of changes which make the code
structure consistent across the existing ACPI table parsers. These are
all refactoring changes which do not modify the existing functionality
of the acpiview UEFI shell tool.

Changes can be seen at: 
https://github.com/KrzysztofKoch1/edk2/tree/612_acpiview_code_style_enhance_v1

Krzysztof Koch (6):
  ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()
  ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
  ShellPkg: acpiview: RSDP: Make code consistent with other parsers
  ShellPkg: acpiview: SRAT: Minor code style enhancements
  ShellPkg: acpiview: MADT: Split structure length validation
  ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation

 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 26 
+---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  8 
+++--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |  2 +-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 32 
++--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 30 
+-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 11 
+--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |  3 +-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 18 
+++
 8 files changed, 82 insertions(+), 48 deletions(-)

--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43934): https://edk2.groups.io/g/devel/message/43934
Mute This Topic: https://groups.io/mt/32514378/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 0/8] Remove redundant forward declarations in acpiview

2019-07-18 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 


-Original Message-
From: Krzysztof Koch  
Sent: 18 July 2019 11:05 AM
To: devel@edk2.groups.io
Cc: jaben.car...@intel.com; ray...@intel.com; zhichao@intel.com; Sami 
Mujawar ; Matteo Carlini ; nd 

Subject: [PATCH v1 0/8] Remove redundant forward declarations in acpiview

This patch series removes forward static function declarations in the acpiview 
table parsers. After repositioning blocks of code, these forward declarations 
are no longer needed and they increase the code size.

What is more, some of the existing ACPI table parsers don't have these 
duplicate declarations, so this set of patches makes the code structure 
consistent across all acpiview parsers.

Changes can be seen at: 
https://github.com/KrzysztofKoch1/edk2/tree/612_remove_forward_decl_v1

Krzysztof Koch (8):
  ShellPkg: acpiview: RSDP: Remove redundant forward declarations
  ShellPkg: acpiview: FADT: Remove redundant forward declarations
  ShellPkg: acpiview: SPCR: Remove redundant forward declaration
  ShellPkg: acpiview: SRAT: Remove redundant forward declarations
  ShellPkg: acpiview: MADT: Remove redundant forward declarations
  ShellPkg: acpiview: IORT: Remove redundant forward declarations
  ShellPkg: acpiview: GTDT: Remove redundant forward declarations
  ShellPkg: acpiview: DBG2: Remove redundant forward declarations

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |  62 
+++---  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 113 
++-  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c |  91 
++-  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |  58 
+++---  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 118 
  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 116 
+++  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c |  98 
++--  
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |  64 
+++
 8 files changed, 236 insertions(+), 484 deletions(-)

--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43933): https://edk2.groups.io/g/devel/message/43933
Mute This Topic: https://groups.io/mt/32513487/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 8/8] ShellPkg: acpiview: DBG2: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | 62 
+---
 1 file changed, 16 insertions(+), 46 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
index 
8de5ebf74775bab8e765849cba6ef4eb6f659a5a..1efcbd40f86efdabed2152540a415db8a950fb71
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
@@ -27,7 +27,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 +37,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: NamespaceString Length = %d. If no Namespace device exists, " 
\
+L"NamespaceString[] must contain a period '.'",
+  NameSpaceStrLen
+  );
+  }
+}
 
 /// An ACPI_PARSER array describing the ACPI DBG2 table.
 STATIC CONST ACPI_PARSER Dbg2Parser[] = {
@@ -91,35 +90,6 @@ STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {
(VOID**), NULL, NULL}
 };
 
-/**
-  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
-  could be a pointer to the ACPI table header.
-**/
-STATIC
-VOID
-EFIAPI
-ValidateNameSpaceStrLen (
-  IN UINT8* Ptr,
-  IN VOID*  Context
-  )
-{
-  UINT16 NameSpaceStrLen;
-
-  NameSpaceStrLen = *(UINT16*)Ptr;
-
-  if (NameSpaceStrLen < 2) {
-IncrementErrorCount ();
-Print (
-  L"\nERROR: NamespaceString Length = %d. If no Namespace device exists,\n"
-   L"then NamespaceString[] must contain a period '.'",
-  NameSpaceStrLen
-  );
-  }
-}
-
 /**
   This function parses the debug device information structure.
 
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43930): https://edk2.groups.io/g/devel/message/43930
Mute This Topic: https://groups.io/mt/32513492/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 2/8] ShellPkg: acpiview: FADT: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 113 
++--
 1 file changed, 34 insertions(+), 79 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
index 
cee7ee0770433da96d6042d2f5d687903f4b5495..e40c9ef8ee4b3285faf8c6edf3cb6236ee367397
 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):
@@ -46,7 +46,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 +71,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 +96,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 +172,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.
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43931): https://edk2.groups.io/g/devel/message/43931
Mute This Topic: https://groups.io/mt/32513493/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 6/8] ShellPkg: acpiview: IORT: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 58 
+---
 1 file changed, 14 insertions(+), 44 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
index 
93f78e1a9786ed53f6b5529f478b72a220b4f8df..0461205b4f8bc02aa11ab1db1d0deb73bce053b7
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -45,7 +45,13 @@ 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.
@@ -60,7 +66,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.
@@ -210,48 +222,6 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
   {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.
 
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43932): https://edk2.groups.io/g/devel/message/43932
Mute This Topic: https://groups.io/mt/32513494/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 0/8] Remove redundant forward declarations in acpiview

2019-07-18 Thread Krzysztof Koch
This patch series removes forward static function declarations in the
acpiview table parsers. After repositioning blocks of code, these forward
declarations are no longer needed and they increase the code size.

What is more, some of the existing ACPI table parsers don't have these
duplicate declarations, so this set of patches makes the code structure
consistent across all acpiview parsers.

Changes can be seen at: 
https://github.com/KrzysztofKoch1/edk2/tree/612_remove_forward_decl_v1

Krzysztof Koch (8):
  ShellPkg: acpiview: RSDP: Remove redundant forward declarations
  ShellPkg: acpiview: FADT: Remove redundant forward declarations
  ShellPkg: acpiview: SPCR: Remove redundant forward declaration
  ShellPkg: acpiview: SRAT: Remove redundant forward declarations
  ShellPkg: acpiview: MADT: Remove redundant forward declarations
  ShellPkg: acpiview: IORT: Remove redundant forward declarations
  ShellPkg: acpiview: GTDT: Remove redundant forward declarations
  ShellPkg: acpiview: DBG2: Remove redundant forward declarations

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |  62 
+++---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 113 
++-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c |  91 
++-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |  58 
+++---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 118 

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 116 
+++
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c |  98 
++--
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |  64 
+++
 8 files changed, 236 insertions(+), 484 deletions(-)

--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43928): https://edk2.groups.io/g/devel/message/43928
Mute This Topic: https://groups.io/mt/32513487/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 3/8] ShellPkg: acpiview: SPCR: Remove redundant forward declaration

2019-07-18 Thread Krzysztof Koch
Reposition blocks of code to remove redundant forward function
declarations in order to reduce the code size.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function 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 (#43929): https://edk2.groups.io/g/devel/message/43929
Mute This Topic: https://groups.io/mt/32513489/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 4/8] ShellPkg: acpiview: SRAT: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 64 
++--
 1 file changed, 18 insertions(+), 46 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
index 
075ff2a141a82b522e8aaedb7ad79249aaf5eaac..03d28d52842040e4872e204fc10ae3dba7861936
 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):
@@ -32,7 +32,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 +50,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 +152,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
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43925): https://edk2.groups.io/g/devel/message/43925
Mute This Topic: https://groups.io/mt/32513484/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v1 1/8] ShellPkg: acpiview: RSDP: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 116 

 1 file changed, 43 insertions(+), 73 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
index 
586de7cbfb12f856c0c735b6e295c1cc32eb2ceb..4bf928139a507d0b8f203ed0cbf0863cc2ec5de5
 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):
@@ -28,7 +28,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 +63,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 +101,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;
-
-  XsdtAddr = *(UINT64*)Ptr;
-
-  if (XsdtAddr == 0) {
-IncrementErrorCount ();
-Print (
-  L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
-  XsdtAddr
-  );
-  }
-#endif
-}
-
 /**
   This function parses the ACPI RSDP table.
 
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43926): https://edk2.groups.io/g/devel/message/43926
Mute This Topic: https://groups.io/mt/32513485/21656

[edk2-devel] [PATCH v1 5/8] ShellPkg: acpiview: MADT: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 118 

 1 file changed, 44 insertions(+), 74 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index 
59c3df0cc8a080497b517baf36fc63f1e4ab866f..338295d30e35c366a60505225cf57145a8e73d93
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -35,7 +35,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 +58,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 +200,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 %d is not compliant with SBSA "
-L"Level 3 PPI ID assignment: %d.",
-  SpeOverflowInterrupt,
-  ARM_PPI_ID_PMBIRQ
-);
-  }
-}
-
 /**
   This function parses the ACPI MADT table.
   When trace is enabled this function parses the MADT table and
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43924): https://edk2.groups.io/g/devel/message/43924
Mute This Topic: https://groups.io/mt/32513483/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]

[edk2-devel] [PATCH v1 7/8] ShellPkg: acpiview: GTDT: Remove redundant forward declarations

2019-07-18 Thread Krzysztof Koch
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Replace multple use of literal values for GT Block Timer Frame
count/number validation with a macro definition.

Signed-off-by: Krzysztof Koch 
---

Notes:
v1:
- remove redundant forward function declarations [Krzysztof]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 91 
+++-
 1 file changed, 33 insertions(+), 58 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index 
3b05ff3015d4a3af62dd9fab057c32369a456267..1e5b5764f50a2d29aa904c889bc89af5bdc3af5c
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -13,6 +13,9 @@
 #include "AcpiParser.h"
 #include "AcpiTableParser.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;
 STATIC CONST UINT32* GtdtPlatformTimerOffset;
@@ -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.
@@ -134,62 +165,6 @@ 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.
 
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43927): https://edk2.groups.io/g/devel/message/43927
Mute This Topic: https://groups.io/mt/32513486/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 3/4] Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related modules"

2019-07-18 Thread Marc-André Lureau
Hi

On Mon, Jul 15, 2019 at 9:04 PM Laszlo Ersek  wrote:
>
> We ask contributors to copy Marc-André and Stefan on patches that affect
> "TPM2 modules" under OvmfPkg. With the "GetMaintainer.py" script being
> introduced later, express this expectation in "Maintainers.txt" in
> machine-readable format.
>
> Cc: Andrew Fish 
> Cc: Ard Biesheuvel 
> Cc: Jordan Justen 
> Cc: Leif Lindholm 
> Cc: Marc-André Lureau 
> Cc: Michael D Kinney 
> Cc: Philippe Mathieu-Daudé 
> Cc: Stefan Berger 
> Signed-off-by: Laszlo Ersek 

Reviewed-by: Marc-André Lureau 

> ---
>  Maintainers.txt | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3a690b2ee200..31ec66b3cb0d 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -206,16 +206,12 @@ M: Jiaxin Wu 
>  OvmfPkg
>  F: OvmfPkg/
>  W: http://www.tianocore.org/ovmf/
>  M: Jordan Justen 
>  M: Laszlo Ersek 
>  M: Ard Biesheuvel 
> -R: Marc-André Lureau 
> -   (TPM2 modules)
> -R: Stefan Berger 
> -   (TPM2 modules)
>  R: David Woodhouse 
> (CSM modules)
>  S: Maintained
>
>  OvmfPkg: Xen-related modules
>  F: OvmfPkg/AcpiPlatformDxe/Xen.c
> @@ -238,12 +234,21 @@ F: OvmfPkg/SmbiosPlatformDxe/*Xen.c
>  F: OvmfPkg/XenBusDxe/
>  F: OvmfPkg/XenIoPciDxe/
>  F: OvmfPkg/XenPvBlkDxe/
>  R: Anthony Perard 
>  R: Julien Grall 
>
> +OvmfPkg: TCG- and TPM2-related modules
> +F: OvmfPkg/Include/IndustryStandard/QemuTpm.h
> +F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
> +F: OvmfPkg/Library/Tcg2PhysicalPresenceLib*/
> +F: OvmfPkg/PlatformPei/ClearCache.c
> +F: OvmfPkg/Tcg/
> +R: Marc-André Lureau 
> +R: Stefan Berger 
> +
>  PcAtChipsetPkg
>  F: PcAtChipsetPkg/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/PcAtChipsetPkg
>  M: Ray Ni 
>
>  SecurityPkg
> --
> 2.19.1.3.g30247aa5d201
>
>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43923): https://edk2.groups.io/g/devel/message/43923
Mute This Topic: https://groups.io/mt/32480695/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [Patch] BaseTools: Sort file list in Makefile

2019-07-18 Thread Bob Feng
This patch is going to sort the file list in generated
Makefile. This change make the autogen makefile easy to
compare.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 212ca0fa7f..031c0ae370 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1024,11 +1024,12 @@ cleanlib:
 self.FileListMacros[T.FileListMacro].append(NewFile)
 elif T.GenFileListMacro:
 self.FileListMacros[T.FileListMacro].append(NewFile)
 else:
 Deps.append(NewFile)
-
+for key in self.FileListMacros:
+self.FileListMacros[key].sort()
 # Use file list macro as dependency
 if T.GenFileListMacro:
 Deps.append("$(%s)" % T.FileListMacro)
 if Type in [TAB_OBJECT_FILE, TAB_STATIC_LIBRARY]:
 Deps.append("$(%s)" % T.ListFileMacro)
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43922): https://edk2.groups.io/g/devel/message/43922
Mute This Topic: https://groups.io/mt/32512789/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 4/4] Maintainers.txt: split out section "OvmfPkg: CSM modules"

2019-07-18 Thread David Woodhouse
On Wed, 2019-07-17 at 11:38 +0200, Laszlo Ersek wrote:
> Stephano,
> 
> On 07/17/19 00:05, David Woodhouse wrote:
> > On Tue, 2019-07-16 at 22:55 +0200, Laszlo Ersek wrote:
> > > something must have gone wrong -- I don't see your message in my list
> > > folder, and I haven't received a moderation request either. Do you have
> > > an idea why your message may not have reached the list, or been
> > > reflected by the list?
> > > 
> > > The  list archive is missing your message too:
> > > 
> > > http://mid.mail-archive.com/bd9d4d7cc0fcdcb7e909f9bdf76f9d8bb050327d.camel@infradead.org
> > 
> > It was rejected, with a message saying "Your account is bouncing.
> > Please visit the web site to unbounce your account."
> > 
> > I have just done so. I did wonder if it actually meant that its email
> > to me was bouncing — but apparently not, since if that was the case
> > then it'd have a bounce message or an SMTP rejection to show me. It
> > didn't; just a link to click to "unbounce" my account. So I've no idea
> > what that's all about... just groups.io weirdness?
> 
> if you have time for this, may we please ask the groups.io admins as to
> what happened to David's message (please see the msgid included in the
> above link: ).
> 
> Normally I wouldn't obsess about this too much, but David is a
> designated reviewer; it's not going to be a productive use of his time
> if his messages are repeatedly rejected.

I apparently stopped receiving messages on 2019-06-28. Looking at my
MTA logs, I was receiving messages just fine from addresses of the form
bounce+27952+43034+1459038+4027...@groups.io until at 20:55:37 GMT
there was a message from an invalid address which got rejected:

2019-06-28 20:55:37 + H=web01.groups.io [66.175.222.12] sender verify fail 
for : lb01.groups.io 
[45.79.81.153] : SMTP error from remote mail server after RCPT 
TO:: 510 The group 
'bounceprobe+1459038+8818881604274358745' does not exist.
2019-06-28 20:55:37 + H=web01.groups.io [66.175.222.12] 
X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=no 
F= rejected RCPT 
: Sender verify failed
2019-06-28 20:55:37 + unexpected disconnection while reading SMTP command 
from web01.groups.io [66.175.222.12] D=4s

After rejecting that invalid mail, nothing else from the list was received.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43921): https://edk2.groups.io/g/devel/message/43921
Mute This Topic: https://groups.io/mt/32480696/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



smime.p7s
Description: S/MIME cryptographic signature


[edk2-devel] [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible out-of-bounds memory writes

2019-07-18 Thread Nate DeSimone
- Add check for the DSDT not existing.
- Fixed logic errors in loop boundary check.

Cc: Chasel Chiu 
Cc: Michael A Kubacki 
Cc: Sai Chaganty 

Co-authored-by: John Mathews 
Signed-off-by: Nate DeSimone 
---
 .../Library/DxeAslUpdateLib/DxeAslUpdateLib.c  | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c 
b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
index e6ab43db6d..87c6b15ed2 100644
--- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
+++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
@@ -6,7 +6,7 @@
 
   This library uses the ACPI Support protocol.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -59,6 +59,7 @@ InitializeAslUpdateLib (
   @param[in] Length- length of data to be overwritten
 
   @retval EFI_SUCCESS  - The function completed successfully.
+  @retval EFI_NOT_FOUND- Failed to locate AcpiTable.
 **/
 EFI_STATUS
 UpdateNameAslCode (
@@ -72,6 +73,7 @@ UpdateNameAslCode (
   UINT8   *CurrPtr;
   UINT32  *Signature;
   UINT8   *DsdtPointer;
+  UINT8   *EndPointer;
   UINTN   Handle;
   UINT8   DataSize;
 
@@ -99,11 +101,15 @@ UpdateNameAslCode (
   /// Point to the beginning of the DSDT table
   ///
   CurrPtr = (UINT8 *) Table;
+  if (CurrPtr == NULL) {
+return EFI_NOT_FOUND;
+  }
 
   ///
   /// Loop through the ASL looking for values that we must fix up.
   ///
-  for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + 
((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+  EndPointer = CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length;
+  for (DsdtPointer = CurrPtr; DsdtPointer < EndPointer; DsdtPointer++) {
 ///
 /// Get a pointer to compare for signature
 ///
-- 
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43919): https://edk2.groups.io/g/devel/message/43919
Mute This Topic: https://groups.io/mt/32512569/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] ClevoOpenBoardPkg: Added NVMe boot support

2019-07-18 Thread Nate DeSimone
Committed: 
https://github.com/tianocore/edk2-platforms/commit/ff90342886b01de2faf606122c273eef99d446ba

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Nate DeSimone
Sent: Wednesday, July 17, 2019 11:32 PM
To: Agyeman, Prince ; devel@edk2.groups.io
Cc: Gao, Liming ; Sinha, Ankit ; 
Kubacki, Michael A ; Chiu, Chasel 

Subject: Re: [edk2-devel] [PATCH] ClevoOpenBoardPkg: Added NVMe boot support

Reviewed-by: Nate DeSimone 

-Original Message-
From: Agyeman, Prince 
Sent: Monday, July 15, 2019 3:24 PM
To: devel@edk2.groups.io
Cc: Gao, Liming ; Sinha, Ankit ; 
Kubacki, Michael A ; Desimone, Nathaniel L 
; Chiu, Chasel 
Subject: [PATCH] ClevoOpenBoardPkg: Added NVMe boot support

Added NVMe dxe driver to enable N1xxWU
platforms boot from NVMe

Cc: Liming Gao 
Cc: Ankit Sinha 
Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Chasel Chiu 

Signed-off-by: Agyeman 
---
 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc | 1 +  
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
index f9deece846..5ba1a82f1c 100644
--- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
@@ -274,6 +274,7 @@
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf
+  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 
   #
   # Shell
diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
index 7d76257671..da498ad379 100644
--- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
@@ -330,6 +330,7 @@ INF  
MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF  MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf
+INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 
 INF  ShellPkg/Application/Shell/Shell.inf
 
--
2.19.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43918): https://edk2.groups.io/g/devel/message/43918
Mute This Topic: https://groups.io/mt/32483810/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] ClevoOpenBoardPkg: Added NVMe boot support

2019-07-18 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Agyeman, Prince 
Sent: Monday, July 15, 2019 3:24 PM
To: devel@edk2.groups.io
Cc: Gao, Liming ; Sinha, Ankit ; 
Kubacki, Michael A ; Desimone, Nathaniel L 
; Chiu, Chasel 
Subject: [PATCH] ClevoOpenBoardPkg: Added NVMe boot support

Added NVMe dxe driver to enable N1xxWU
platforms boot from NVMe

Cc: Liming Gao 
Cc: Ankit Sinha 
Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Chasel Chiu 

Signed-off-by: Agyeman 
---
 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc | 1 +  
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
index f9deece846..5ba1a82f1c 100644
--- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
@@ -274,6 +274,7 @@
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf
+  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 
   #
   # Shell
diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
index 7d76257671..da498ad379 100644
--- a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
@@ -330,6 +330,7 @@ INF  
MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF  MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf
+INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 
 INF  ShellPkg/Application/Shell/Shell.inf
 
--
2.19.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43917): https://edk2.groups.io/g/devel/message/43917
Mute This Topic: https://groups.io/mt/32483810/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [Patch 7/9] BaseTools: Add LogAgent to support multiple process Autogen

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

AutoGen processes race the logfile. To resolve this issue,
this patch create a LogAgent thread in main process to write
the log content to console or file, Other process will send
the log content to the LogAgent.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 .../Source/Python/AutoGen/AutoGenWorker.py| 86 +++
 BaseTools/Source/Python/AutoGen/DataPipe.py   |  2 +-
 BaseTools/Source/Python/Common/EdkLogger.py   | 33 ++-
 BaseTools/Source/Python/build/build.py| 27 --
 4 files changed, 120 insertions(+), 28 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py 
b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
index 150de0891c6e..19d1cfac39fd 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
@@ -19,52 +19,111 @@ from Workspace.WorkspaceDatabase import BuildDB
 import time
 from queue import Empty
 import traceback
 import sys
 from AutoGen.DataPipe import MemoryDataPipe
+import logging
+
+class LogAgent(threading.Thread):
+def __init__(self,log_q,log_level,log_file=None):
+super(LogAgent,self).__init__()
+self.log_q = log_q
+self.log_level = log_level
+self.log_file = log_file
+def InitLogger(self):
+# For DEBUG level (All DEBUG_0~9 are applicable)
+self._DebugLogger_agent = logging.getLogger("tool_debug_agent")
+_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: 
%(message)s", datefmt="%H:%M:%S")
+self._DebugLogger_agent.setLevel(self.log_level)
+_DebugChannel = logging.StreamHandler(sys.stdout)
+_DebugChannel.setFormatter(_DebugFormatter)
+self._DebugLogger_agent.addHandler(_DebugChannel)
+
+# For VERBOSE, INFO, WARN level
+self._InfoLogger_agent = logging.getLogger("tool_info_agent")
+_InfoFormatter = logging.Formatter("%(message)s")
+self._InfoLogger_agent.setLevel(self.log_level)
+_InfoChannel = logging.StreamHandler(sys.stdout)
+_InfoChannel.setFormatter(_InfoFormatter)
+self._InfoLogger_agent.addHandler(_InfoChannel)
+
+# For ERROR level
+self._ErrorLogger_agent = logging.getLogger("tool_error_agent")
+_ErrorFormatter = logging.Formatter("%(message)s")
+self._ErrorLogger_agent.setLevel(self.log_level)
+_ErrorCh = logging.StreamHandler(sys.stderr)
+_ErrorCh.setFormatter(_ErrorFormatter)
+self._ErrorLogger_agent.addHandler(_ErrorCh)
+
+if self.log_file:
+if os.path.exists(self.log_file):
+os.remove(self.log_file)
+_Ch = logging.FileHandler(self.log_file)
+_Ch.setFormatter(_DebugFormatter)
+self._DebugLogger_agent.addHandler(_Ch)
+
+_Ch= logging.FileHandler(self.log_file)
+_Ch.setFormatter(_InfoFormatter)
+self._InfoLogger_agent.addHandler(_Ch)
+
+_Ch = logging.FileHandler(self.log_file)
+_Ch.setFormatter(_ErrorFormatter)
+self._ErrorLogger_agent.addHandler(_Ch)
+
+def run(self):
+self.InitLogger()
+while True:
+log_message = self.log_q.get()
+if log_message is None:
+break
+if log_message.name == "tool_error":
+
self._ErrorLogger_agent.log(log_message.levelno,log_message.getMessage())
+elif log_message.name == "tool_info":
+
self._InfoLogger_agent.log(log_message.levelno,log_message.getMessage())
+elif log_message.name == "tool_debug":
+
self._DebugLogger_agent.log(log_message.levelno,log_message.getMessage())
+else:
+
self._InfoLogger_agent.log(log_message.levelno,log_message.getMessage())
+
+def kill(self):
+self.log_q.put(None)
 class AutoGenManager(threading.Thread):
 def __init__(self,autogen_workers, feedback_q):
 super(AutoGenManager,self).__init__()
 self.autogen_workers = autogen_workers
 self.feedback_q = feedback_q
-self.terminate = False
 self.Status = True
 def run(self):
 try:
 while True:
-if self.terminate:
-break
-if self.feedback_q.empty():
-time.sleep(1)
-continue
-badnews = self.feedback_q.get(False)
-if badnews:
-print(badnews)
+badnews = self.feedback_q.get()
+if badnews is None:
 self.Status = False
 self.TerminateWorkers()
 break
 except Exception:
 return
 
 def kill(self):
-self.terminate = True
+self.feedback_q.put(None)
 
 def TerminateWorkers(self):
 for w in self.autogen_workers:
 if w.is_alive():
 

[edk2-devel] [Patch 8/9] BaseTools: Move BuildOption parser out of build.py

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

Build tool supports user to specify the conf folder.
To make the build options be evaluated at the beginning
of launching build, extract the buildoption function
from build.py to a new .py file.

Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 .../Python/Common/TargetTxtClassObject.py |  28 -
 BaseTools/Source/Python/build/build.py| 108 +-
 BaseTools/Source/Python/build/buildoptions.py |  92 +++
 3 files changed, 121 insertions(+), 107 deletions(-)
 create mode 100644 BaseTools/Source/Python/build/buildoptions.py

diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py 
b/BaseTools/Source/Python/Common/TargetTxtClassObject.py
index 79a5acc01074..16cc75ccb7c8 100644
--- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py
+++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py
@@ -8,16 +8,19 @@
 ##
 # Import Modules
 #
 from __future__ import print_function
 from __future__ import absolute_import
+from buildoptions import BuildOption,BuildTarget
+import Common.GlobalData as GlobalData
 import Common.LongFilePathOs as os
 from . import EdkLogger
 from . import DataType
 from .BuildToolError import *
-from . import GlobalData
+
 from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
 
 gDefaultTargetTxtFile = "target.txt"
 
 ## TargetTxtClassObject
 #
@@ -139,16 +142,33 @@ class TargetTxtClassObject(object):
 #
 # @param ConfDir:  Conf dir
 #
 # @retval Target An instance of TargetTxtClassObject() with loaded target.txt
 #
-def TargetTxtDict(ConfDir):
+def TargetTxtDict():
 Target = TargetTxtClassObject()
-Target.LoadTargetTxtFile(os.path.normpath(os.path.join(ConfDir, 
gDefaultTargetTxtFile)))
+if BuildOption.ConfDirectory:
+# Get alternate Conf location, if it is absolute, then just use the 
absolute directory name
+ConfDirectoryPath = os.path.normpath(BuildOption.ConfDirectory)
+
+if not os.path.isabs(ConfDirectoryPath):
+# Since alternate directory name is not absolute, the alternate 
directory is located within the WORKSPACE
+# This also handles someone specifying the Conf directory in the 
workspace. Using --conf=Conf
+ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], 
ConfDirectoryPath)
+else:
+if "CONF_PATH" in os.environ:
+ConfDirectoryPath = 
os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))
+else:
+# Get standard WORKSPACE/Conf use the absolute path to the 
WORKSPACE/Conf
+ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], 'Conf')
+GlobalData.gConfDirectory = ConfDirectoryPath
+targettxt = os.path.normpath(os.path.join(ConfDirectoryPath, 
gDefaultTargetTxtFile))
+if os.path.exists(targettxt):
+Target.LoadTargetTxtFile(targettxt)
 return Target
 
-TargetTxt = TargetTxtDict(os.path.join(os.getenv("WORKSPACE"),"Conf"))
+TargetTxt = TargetTxtDict()
 
 ##
 #
 # This acts like the main() function for the script, unless it is 'import'ed 
into another
 # script.
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 6ecb80e45ed2..33fe548de8f4 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -24,11 +24,11 @@ import traceback
 import multiprocessing
 from threading import Thread,Event,BoundedSemaphore
 import threading
 from subprocess import Popen,PIPE
 from collections import OrderedDict, defaultdict
-from optparse import OptionParser
+from buildoptions import BuildOption,BuildTarget
 from AutoGen.PlatformAutoGen import PlatformAutoGen
 from AutoGen.ModuleAutoGen import ModuleAutoGen
 from AutoGen.WorkspaceAutoGen import WorkspaceAutoGen
 from AutoGen.AutoGenWorker import AutoGenWorkerInProcess,AutoGenManager,\
 LogAgent
@@ -41,11 +41,11 @@ from Common.Misc import 
PathClass,SaveFileOnChange,RemoveDirectory
 from Common.StringUtils import NormPath
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from Common.BuildToolError import *
 from Common.DataType import *
 import Common.EdkLogger as EdkLogger
-from Common.BuildVersion import gBUILD_VERSION
+
 from Workspace.WorkspaceDatabase import BuildDB
 
 from BuildReport import BuildReport
 from GenPatchPcdTable.GenPatchPcdTable import 
PeImageClass,parsePcdInfoFromMapFile
 from PatchPcdValue.PatchPcdValue import PatchBinaryFile
@@ -53,14 +53,10 @@ from PatchPcdValue.PatchPcdValue import PatchBinaryFile
 import Common.GlobalData as GlobalData
 from GenFds.GenFds import GenFds, GenFdsApi
 import multiprocessing as mp
 from multiprocessing import Manager
 
-# Version and Copyright
-VersionNumber = "0.60" + ' ' + gBUILD_VERSION
-__version__ = "%prog Version " + VersionNumber
-__copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation  All rights 
reserved."
 
 ## standard targets of build 

[edk2-devel] [Patch 9/9] BaseTools: Add the support for python 2

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

python3 change the module name of Queue to queue.
python3 add a new log handler of QueueHandler.

This patch is to make Multiple process AutoGen
feature work for python2

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 .../Source/Python/AutoGen/AutoGenWorker.py|  5 +-
 BaseTools/Source/Python/Common/EdkLogger.py   | 92 ++-
 2 files changed, 92 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py 
b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
index 19d1cfac39fd..233a921e74fe 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
@@ -15,11 +15,14 @@ import Common.EdkLogger as EdkLogger
 import os
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from AutoGen.AutoGen import AutoGen
 from Workspace.WorkspaceDatabase import BuildDB
 import time
-from queue import Empty
+try:
+from queue import Empty
+except:
+from Queue import Empty
 import traceback
 import sys
 from AutoGen.DataPipe import MemoryDataPipe
 import logging
 
diff --git a/BaseTools/Source/Python/Common/EdkLogger.py 
b/BaseTools/Source/Python/Common/EdkLogger.py
index f6a5e3b4daf9..15fd1458a95a 100644
--- a/BaseTools/Source/Python/Common/EdkLogger.py
+++ b/BaseTools/Source/Python/Common/EdkLogger.py
@@ -3,16 +3,100 @@
 #
 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
+# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# This copyright is for QueueHandler.
+
 ## Import modules
 from __future__ import absolute_import
 import Common.LongFilePathOs as os, sys, logging
 import traceback
 from  .BuildToolError import *
-import logging.handlers
+try:
+from logging.handlers import QueueHandler
+except:
+class QueueHandler(logging.Handler):
+"""
+This handler sends events to a queue. Typically, it would be used 
together
+with a multiprocessing Queue to centralise logging to file in one 
process
+(in a multi-process application), so as to avoid file write contention
+between processes.
+
+This code is new in Python 3.2, but this class can be copy pasted into
+user code for use with earlier Python versions.
+"""
+
+def __init__(self, queue):
+"""
+Initialise an instance, using the passed queue.
+"""
+logging.Handler.__init__(self)
+self.queue = queue
+
+def enqueue(self, record):
+"""
+Enqueue a record.
+
+The base implementation uses put_nowait. You may want to override
+this method if you want to use blocking, timeouts or custom queue
+implementations.
+"""
+self.queue.put_nowait(record)
+
+def prepare(self, record):
+"""
+Prepares a record for queuing. The object returned by this method 
is
+enqueued.
+
+The base implementation formats the record to merge the message
+and arguments, and removes unpickleable items from the record
+in-place.
+
+You might want to override this method if you want to convert
+the record to a dict or JSON string, or send a modified copy
+of the record while leaving the original intact.
+"""
+# The format operation gets traceback text into record.exc_text
+# (if there's exception data), and also returns the formatted
+# message. We can then use this to replace the original
+# msg + args, as these might be unpickleable. We also zap the
+# exc_info and exc_text attributes, as they are no longer
+# needed and, if not None, will typically not be pickleable.
+msg = self.format(record)
+record.message = msg
+record.msg = msg
+record.args = None
+   

[edk2-devel] [Patch 0/9] Enable multiple process AutoGen

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

In order to improve the build performance, we implemented
multiple-processes AutoGen. This change will reduce 20% time
for AutoGen phase.

The design document can be got from:
https://edk2.groups.io/g/devel/files/Designs/2019/0627/Multiple-thread-AutoGen.pdf

This patch serial pass the build of Ovmf, MinKabylake, MinPurley, packages
under Edk2 repository and intel client and server platforms.

Feng, Bob C (9):
  BaseTools: Singleton the object to handle build conf file
  BaseTools: Split WorkspaceAutoGen._InitWorker into multiple functions
  BaseTools: Add functions to get platform scope build options
  BaseTools: Decouple AutoGen Objects
  BaseTools: Enable Multiple Process AutoGen
  BaseTools: Add shared data for processes
  BaseTools: Add LogAgent to support multiple process Autogen
  BaseTools: Move BuildOption parser out of build.py
  BaseTools: Add the support for python 2

 BaseTools/Source/Python/AutoGen/AutoGen.py| 4227 +
 .../Source/Python/AutoGen/AutoGenWorker.py|  220 +
 .../Source/Python/AutoGen/BuildEngine.py  |   22 +
 BaseTools/Source/Python/AutoGen/DataPipe.py   |  153 +
 BaseTools/Source/Python/AutoGen/GenC.py   |6 +-
 .../Source/Python/AutoGen/ModuleAutoGen.py| 1883 
 .../Python/AutoGen/ModuleAutoGenHelper.py |  616 +++
 .../Source/Python/AutoGen/PlatformAutoGen.py  | 1483 ++
 .../Source/Python/AutoGen/WorkspaceAutoGen.py |  902 
 BaseTools/Source/Python/Common/EdkLogger.py   |  117 +-
 BaseTools/Source/Python/Common/Misc.py|1 -
 .../Python/Common/TargetTxtClassObject.py |   28 +-
 .../Python/Common/ToolDefClassObject.py   |6 +-
 BaseTools/Source/Python/GenFds/GenFds.py  |4 +-
 .../Python/GenFds/GenFdsGlobalVariable.py |   54 +-
 .../Python/PatchPcdValue/PatchPcdValue.py |1 -
 .../Source/Python/Workspace/DscBuildData.py   |   38 +-
 .../Source/Python/Workspace/InfBuildData.py   |   39 +
 .../Python/Workspace/WorkspaceCommon.py   |4 +
 .../Python/Workspace/WorkspaceDatabase.py |3 +
 BaseTools/Source/Python/build/BuildReport.py  |4 +-
 BaseTools/Source/Python/build/build.py|  322 +-
 BaseTools/Source/Python/build/buildoptions.py |   92 +
 23 files changed, 5789 insertions(+), 4436 deletions(-)
 create mode 100644 BaseTools/Source/Python/AutoGen/AutoGenWorker.py
 create mode 100644 BaseTools/Source/Python/AutoGen/DataPipe.py
 create mode 100644 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
 create mode 100644 BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
 create mode 100644 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
 create mode 100644 BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
 create mode 100644 BaseTools/Source/Python/build/buildoptions.py

-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43907): https://edk2.groups.io/g/devel/message/43907
Mute This Topic: https://groups.io/mt/32512451/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [Patch 1/9] BaseTools: Singleton the object to handle build conf file

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

The build config files are target.txt, build rule, tooldef
During a build, the config is not changed, so the object to
handle them need to be singleton.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 33 ++--
 .../Source/Python/AutoGen/BuildEngine.py  | 22 
 .../Python/Common/TargetTxtClassObject.py |  2 +
 .../Python/Common/ToolDefClassObject.py   |  6 ++-
 BaseTools/Source/Python/GenFds/GenFds.py  |  4 +-
 .../Python/GenFds/GenFdsGlobalVariable.py | 54 ---
 .../Source/Python/Workspace/DscBuildData.py   |  8 +--
 BaseTools/Source/Python/build/build.py| 29 +++---
 8 files changed, 62 insertions(+), 96 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2df055a109f7..c5b3fbb0a87f 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -22,11 +22,12 @@ from . import GenC
 from . import GenMake
 from . import GenDepex
 from io import BytesIO
 
 from .StrGather import *
-from .BuildEngine import BuildRule
+from .BuildEngine import BuildRuleObj as BuildRule
+from .BuildEngine import gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
 import shutil
 from Common.LongFilePathSupport import CopyLongFilePath
 from Common.BuildToolError import *
 from Common.DataType import *
 from Common.Misc import *
@@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern = 
re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
 
 ## Mapping Makefile type
 gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
 
 
-## Build rule configuration file
-gDefaultBuildRuleFile = 'build_rule.txt'
-
-## Build rule default version
-AutoGenReqBuildRuleVerNum = "0.1"
-
 ## default file name for AutoGen
 gAutoGenCodeFileName = "AutoGen.c"
 gAutoGenHeaderFileName = "AutoGen.h"
 gAutoGenStringFileName = "%(module_name)sStrDefs.h"
 gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
@@ -1970,32 +1965,10 @@ class PlatformAutoGen(AutoGen):
 ## Return the build options specific for EDKII modules in this platform
 @cached_property
 def EdkIIBuildOption(self):
 return self._ExpandBuildOption(self.Platform.BuildOptions, EDKII_NAME)
 
-## Parse build_rule.txt in Conf Directory.
-#
-#   @retval BuildRule object
-#
-@cached_property
-def BuildRule(self):
-BuildRuleFile = None
-if TAB_TAT_DEFINES_BUILD_RULE_CONF in 
self.Workspace.TargetTxt.TargetTxtDictionary:
-BuildRuleFile = 
self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]
-if not BuildRuleFile:
-BuildRuleFile = gDefaultBuildRuleFile
-RetVal = BuildRule(BuildRuleFile)
-if RetVal._FileVersion == "":
-RetVal._FileVersion = AutoGenReqBuildRuleVerNum
-else:
-if RetVal._FileVersion < AutoGenReqBuildRuleVerNum :
-# If Build Rule's version is less than the version number 
required by the tools, halting the build.
-EdkLogger.error("build", AUTOGEN_ERROR,
-ExtraData="The version number [%s] of 
build_rule.txt is less than the version number required by the AutoGen.(the 
minimum required version number is [%s])"\
- % (RetVal._FileVersion, 
AutoGenReqBuildRuleVerNum))
-return RetVal
-
 ## Summarize the packages used by modules in this platform
 @cached_property
 def PackageList(self):
 RetVal = set()
 for La in self.LibraryAutoGenList:
@@ -3149,11 +3122,11 @@ class ModuleAutoGen(AutoGen):
 return RetVal
 
 @cached_property
 def BuildRules(self):
 RetVal = {}
-BuildRuleDatabase = self.PlatformInfo.BuildRule
+BuildRuleDatabase = BuildRule
 for Type in BuildRuleDatabase.FileTypeList:
 #first try getting build rule by BuildRuleFamily
 RuleObject = BuildRuleDatabase[Type, self.BuildType, self.Arch, 
self.BuildRuleFamily]
 if not RuleObject:
 # build type is always module type, but ...
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py 
b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 14e61140e7ba..bb9153447793 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -18,10 +18,13 @@ from Common.LongFilePathSupport import OpenLongFilePath as 
open
 from Common.GlobalData import *
 from Common.BuildToolError import *
 from Common.Misc import tdict, PathClass
 from Common.StringUtils import NormPath
 from Common.DataType import *
+from Common.TargetTxtClassObject import TargetTxt
+gDefaultBuildRuleFile = 'build_rule.txt'
+AutoGenReqBuildRuleVerNum = '0.1'
 
 import Common.EdkLogger as EdkLogger
 
 ## Convert file type to file list macro name
 #
@@ -581,10 +584,29 @@ class BuildRule:

[edk2-devel] [Patch 6/9] BaseTools: Add shared data for processes

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

Add shared data for autogen processes.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGenWorker.py |  3 ++-
 BaseTools/Source/Python/build/build.py   | 10 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py 
b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
index a0415f0d3420..150de0891c6e 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
@@ -52,18 +52,19 @@ class AutoGenManager(threading.Thread):
 for w in self.autogen_workers:
 if w.is_alive():
 w.terminate()
 
 class AutoGenWorkerInProcess(mp.Process):
-def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock):
+def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock, 
share_data):
 mp.Process.__init__(self)
 self.module_queue = module_queue
 self.data_pipe_file_path =data_pipe_file_path
 self.data_pipe = None
 self.feedback_q = feedback_q
 self.PlatformMetaFileSet = {}
 self.file_lock = file_lock
+self.share_data = share_data
 def GetPlatformMetaFile(self,filepath,root):
 try:
 return self.PlatformMetaFileSet[(filepath,root)]
 except:
 self.PlatformMetaFileSet[(filepath,root)]  = filepath
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index b4916a32171a..46aed15bd9d1 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -50,10 +50,11 @@ from GenPatchPcdTable.GenPatchPcdTable import 
PeImageClass,parsePcdInfoFromMapFi
 from PatchPcdValue.PatchPcdValue import PatchBinaryFile
 
 import Common.GlobalData as GlobalData
 from GenFds.GenFds import GenFds, GenFdsApi
 import multiprocessing as mp
+from multiprocessing import Manager
 
 # Version and Copyright
 VersionNumber = "0.60" + ' ' + gBUILD_VERSION
 __version__ = "%prog Version " + VersionNumber
 __copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation  All rights 
reserved."
@@ -825,16 +826,17 @@ class Build():
 self.InitBuild()
 
 self.AutoGenMgr = None
 EdkLogger.info("")
 os.chdir(self.WorkspaceDir)
-def StartAutoGen(self,mqueue, DataPipe,SkipAutoGen,PcdMaList):
+self.share_data = Manager().dict()
+def StartAutoGen(self,mqueue, DataPipe,SkipAutoGen,PcdMaList,share_data):
 if SkipAutoGen:
 return
 feedback_q = mp.Queue()
 file_lock = mp.Lock()
-auto_workers = 
[AutoGenWorkerInProcess(mqueue,DataPipe.dump_file,feedback_q,file_lock) for _ 
in range(mp.cpu_count()//2)]
+auto_workers = 
[AutoGenWorkerInProcess(mqueue,DataPipe.dump_file,feedback_q,file_lock,share_data)
 for _ in range(mp.cpu_count()//2)]
 self.AutoGenMgr = AutoGenManager(auto_workers,feedback_q)
 self.AutoGenMgr.start()
 for w in auto_workers:
 w.start()
 if PcdMaList is not None:
@@ -1227,11 +1229,11 @@ class Build():
 
 AutoGenObject.DataPipe.DataContainer = {"FfsCommand":FfsCommand}
 self.Progress.Start("Generating makefile and code")
 data_pipe_file = os.path.join(self.WorkspaceDir, 
"GlobalVar_%s_%s.bin" % (str(AutoGenObject.Guid),AutoGenObject.Arch))
 AutoGenObject.DataPipe.dump(data_pipe_file)
-autogen_rt = self.StartAutoGen(mqueue, AutoGenObject.DataPipe, 
self.SkipAutoGen, PcdMaList)
+autogen_rt = self.StartAutoGen(mqueue, AutoGenObject.DataPipe, 
self.SkipAutoGen, PcdMaList,self.share_data)
 self.Progress.Stop("done!")
 return autogen_rt
 else:
 # always recreate top/platform makefile when clean, just in case 
of inconsistency
 AutoGenObject.CreateCodeFile(False)
@@ -2059,11 +2061,11 @@ class Build():
 for m in Pa.GetAllModuleInfo:
 mqueue.put(m)
 Pa.DataPipe.DataContainer = {"FfsCommand":CmdListDict}
 data_pipe_file = os.path.join(self.WorkspaceDir, 
"GlobalVar_%s_%s.bin" % (str(Pa.Guid),Pa.Arch))
 Pa.DataPipe.dump(data_pipe_file)
-autogen_rt = self.StartAutoGen(mqueue, Pa.DataPipe, 
self.SkipAutoGen, PcdMaList)
+autogen_rt = self.StartAutoGen(mqueue, Pa.DataPipe, 
self.SkipAutoGen, PcdMaList,self.share_data)
 self.Progress.Stop("done!")
 self.AutoGenTime += int(round((time.time() - 
AutoGenStart)))
 if not autogen_rt:
 return
 for Arch in Wa.ArchList:
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43913): 

[edk2-devel] [Patch 2/9] BaseTools: Split WorkspaceAutoGen._InitWorker into multiple functions

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

The WorkspaceAutoGen.__InitWorker function is too long, it's hard
to read and understand.
This patch is to separate the __InitWorker into multiple small ones.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 247 +
 1 file changed, 152 insertions(+), 95 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index c5b3fbb0a87f..9e06bb942126 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -333,13 +333,58 @@ class WorkspaceAutoGen(AutoGen):
 self._GuidDict = {}
 
 # there's many relative directory operations, so ...
 os.chdir(self.WorkspaceDir)
 
+self.MergeArch()
+self.ValidateBuildTarget()
+
+EdkLogger.info("")
+if self.ArchList:
+EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' 
'.join(self.ArchList)))
+EdkLogger.info('%-16s = %s' % ("Build target", self.BuildTarget))
+EdkLogger.info('%-16s = %s' % ("Toolchain", self.ToolChain))
+
+EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.Platform))
+if BuildModule:
+EdkLogger.info('%-24s = %s' % ("Active Module", BuildModule))
+
+if self.FdfFile:
+EdkLogger.info('%-24s = %s' % ("Flash Image Definition", 
self.FdfFile))
+
+EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
+
+if Progress:
+Progress.Start("\nProcessing meta-data")
 #
-# Merge Arch
+# Mark now build in AutoGen Phase
 #
+GlobalData.gAutoGenPhase = True
+self.ProcessModuleFromPdf()
+self.ProcessPcdType()
+self.ProcessMixedPcd()
+self.GetPcdsFromFDF()
+self.CollectAllPcds()
+self.GeneratePkgLevelHash()
+#
+# Check PCDs token value conflict in each DEC file.
+#
+self._CheckAllPcdsTokenValueConflict()
+#
+# Check PCD type and definition between DSC and DEC
+#
+self._CheckPcdDefineAndType()
+
+self.CreateBuildOptionsFile()
+self.CreatePcdTokenNumberFile()
+self.CreateModuleHashInfo()
+GlobalData.gAutoGenPhase = False
+
+#
+# Merge Arch
+#
+def MergeArch(self):
 if not self.ArchList:
 ArchList = set(self.Platform.SupArchList)
 else:
 ArchList = set(self.ArchList) & set(self.Platform.SupArchList)
 if not ArchList:
@@ -349,57 +394,49 @@ class WorkspaceAutoGen(AutoGen):
 SkippedArchList = 
set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))
 EdkLogger.verbose("\nArch [%s] is ignored because the platform 
supports [%s] only!"
   % (" ".join(SkippedArchList), " 
".join(self.Platform.SupArchList)))
 self.ArchList = tuple(ArchList)
 
-# Validate build target
+# Validate build target
+def ValidateBuildTarget(self):
 if self.BuildTarget not in self.Platform.BuildTargets:
 EdkLogger.error("build", PARAMETER_INVALID,
 ExtraData="Build target [%s] is not supported by 
the platform. [Valid target: %s]"
   % (self.BuildTarget, " 
".join(self.Platform.BuildTargets)))
-
-
-# parse FDF file to get PCDs in it, if any
+@cached_property
+def FdfProfile(self):
 if not self.FdfFile:
 self.FdfFile = self.Platform.FlashDefinition
 
-EdkLogger.info("")
-if self.ArchList:
-EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' 
'.join(self.ArchList)))
-EdkLogger.info('%-16s = %s' % ("Build target", self.BuildTarget))
-EdkLogger.info('%-16s = %s' % ("Toolchain", self.ToolChain))
-
-EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.Platform))
-if BuildModule:
-EdkLogger.info('%-24s = %s' % ("Active Module", BuildModule))
-
+FdfProfile = None
 if self.FdfFile:
-EdkLogger.info('%-24s = %s' % ("Flash Image Definition", 
self.FdfFile))
-
-EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
-
-if Progress:
-Progress.Start("\nProcessing meta-data")
-
-if self.FdfFile:
-#
-# Mark now build in AutoGen Phase
-#
-GlobalData.gAutoGenPhase = True
 Fdf = FdfParser(self.FdfFile.Path)
 Fdf.ParseFile()
 GlobalData.gFdfParser = Fdf
-GlobalData.gAutoGenPhase = False
-PcdSet = Fdf.Profile.PcdDict
 if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:
 FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
 for FdRegion in FdDict.RegionList:
 if 

[edk2-devel] [Patch 5/9] BaseTools: Enable Multiple Process AutoGen

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

Assign the Module AutoGen tasks into multiple
sub process.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 .../Source/Python/AutoGen/AutoGenWorker.py| 160 ++
 BaseTools/Source/Python/AutoGen/DataPipe.py   |   6 +
 BaseTools/Source/Python/AutoGen/GenC.py   |   4 +-
 .../Source/Python/AutoGen/ModuleAutoGen.py|   8 +-
 .../Source/Python/AutoGen/PlatformAutoGen.py  |   4 +-
 BaseTools/Source/Python/build/build.py| 109 +++-
 6 files changed, 240 insertions(+), 51 deletions(-)
 create mode 100644 BaseTools/Source/Python/AutoGen/AutoGenWorker.py

diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py 
b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
new file mode 100644
index ..a0415f0d3420
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
@@ -0,0 +1,160 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+import multiprocessing as mp
+import threading
+from Common.Misc import PathClass
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo,AutoGenInfo
+import Common.GlobalData as GlobalData
+import Common.EdkLogger as EdkLogger
+import os
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from AutoGen.AutoGen import AutoGen
+from Workspace.WorkspaceDatabase import BuildDB
+import time
+from queue import Empty
+import traceback
+import sys
+from AutoGen.DataPipe import MemoryDataPipe
+class AutoGenManager(threading.Thread):
+def __init__(self,autogen_workers, feedback_q):
+super(AutoGenManager,self).__init__()
+self.autogen_workers = autogen_workers
+self.feedback_q = feedback_q
+self.terminate = False
+self.Status = True
+def run(self):
+try:
+while True:
+if self.terminate:
+break
+if self.feedback_q.empty():
+time.sleep(1)
+continue
+badnews = self.feedback_q.get(False)
+if badnews:
+print(badnews)
+self.Status = False
+self.TerminateWorkers()
+break
+except Exception:
+return
+
+def kill(self):
+self.terminate = True
+
+def TerminateWorkers(self):
+for w in self.autogen_workers:
+if w.is_alive():
+w.terminate()
+
+class AutoGenWorkerInProcess(mp.Process):
+def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock):
+mp.Process.__init__(self)
+self.module_queue = module_queue
+self.data_pipe_file_path =data_pipe_file_path
+self.data_pipe = None
+self.feedback_q = feedback_q
+self.PlatformMetaFileSet = {}
+self.file_lock = file_lock
+def GetPlatformMetaFile(self,filepath,root):
+try:
+return self.PlatformMetaFileSet[(filepath,root)]
+except:
+self.PlatformMetaFileSet[(filepath,root)]  = filepath
+return self.PlatformMetaFileSet[(filepath,root)]
+def run(self):
+try:
+taskname = "Init"
+with self.file_lock:
+if not os.path.exists(self.data_pipe_file_path):
+self.feedback_q.put(taskname + ":" + "load data pipe %s 
failed." % self.data_pipe_file_path)
+self.data_pipe = MemoryDataPipe()
+self.data_pipe.load(self.data_pipe_file_path)
+EdkLogger.Initialize()
+loglevel = self.data_pipe.Get("LogLevel")
+if not loglevel:
+loglevel = EdkLogger.INFO
+EdkLogger.SetLevel(loglevel)
+logfile = self.data_pipe.Get("LogFile")
+if logfile:
+EdkLogger.SetLogFile(logfile)
+target = self.data_pipe.Get("P_Info").get("Target")
+toolchain = self.data_pipe.Get("P_Info").get("ToolChain")
+archlist = self.data_pipe.Get("P_Info").get("ArchList")
+
+active_p = self.data_pipe.Get("P_Info").get("ActivePlatform")
+workspacedir = self.data_pipe.Get("P_Info").get("WorkspaceDir")
+PackagesPath = os.getenv("PACKAGES_PATH")
+mws.setWs(workspacedir, PackagesPath)
+self.Wa = WorkSpaceInfo(
+workspacedir,active_p,target,toolchain,archlist
+)
+GlobalData.gGlobalDefines = self.data_pipe.Get("G_defines")
+GlobalData.gCommandLineDefines = self.data_pipe.Get("CL_defines")
+os.environ._data = self.data_pipe.Get("Env_Var")
+GlobalData.gWorkspace = workspacedir
+GlobalData.gDisableIncludePathCheck = False
+GlobalData.gFdfParser = 

[edk2-devel] [Patch 3/9] BaseTools: Add functions to get platform scope build options

2019-07-18 Thread Bob Feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875

These functions are used for get platform scope
build options. They will be used in later patches.

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 10 +-
 .../Source/Python/Workspace/DscBuildData.py   | 20 +++
 .../Source/Python/Workspace/InfBuildData.py   | 10 ++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 9e06bb942126..792beed65e6b 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2485,11 +2485,19 @@ class PlatformAutoGen(AutoGen):
 if Attr != 'PATH':
 BuildOptions[Tool][Attr] += " " + Options[Key]
 else:
 BuildOptions[Tool][Attr] = Options[Key]
 return BuildOptions
-
+def GetGlobalBuildOptions(self,Module):
+ModuleTypeOptions = self.Platform.GetBuildOptionsByPkg(Module, 
Module.ModuleType)
+ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
+if Module in self.Platform.Modules:
+PlatformModule = self.Platform.Modules[str(Module)]
+PlatformModuleOptions = 
self._ExpandBuildOption(PlatformModule.BuildOptions)
+else:
+PlatformModuleOptions = {}
+return ModuleTypeOptions, PlatformModuleOptions
 ## Append build options in platform to a module
 #
 #   @param  Module  The module to which the build options will be appended
 #
 #   @retval options The options appended with build options in platform
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index e7ec2aba57d2..dd5c3c2bd1f2 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1222,11 +1222,31 @@ class DscBuildData(PlatformBuildClassObject):
 self._BuildOptions[CurKey] = Option
 else:
 if ' ' + Option not in self._BuildOptions[CurKey]:
 self._BuildOptions[CurKey] += ' ' + Option
 return self._BuildOptions
+def GetBuildOptionsByPkg(self, Module, ModuleType):
 
+local_pkg = os.path.split(Module.LocalPkg())[0]
+if self._ModuleTypeOptions is None:
+self._ModuleTypeOptions = OrderedDict()
+if ModuleType not in self._ModuleTypeOptions:
+options = OrderedDict()
+self._ModuleTypeOptions[ ModuleType] = options
+RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 
self._Arch]
+for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, 
Dummy4, Dummy5 in RecordList:
+if Dummy2 not in (TAB_COMMON,local_pkg.upper(),"EDKII"):
+continue
+Type = Dummy3
+if Type.upper() == ModuleType.upper():
+Key = (ToolChainFamily, ToolChain)
+if Key not in options or not ToolChain.endswith('_FLAGS') 
or Option.startswith('='):
+options[Key] = Option
+else:
+if ' ' + Option not in options[Key]:
+options[Key] += ' ' + Option
+return self._ModuleTypeOptions[ModuleType]
 def GetBuildOptionsByModuleType(self, Edk, ModuleType):
 if self._ModuleTypeOptions is None:
 self._ModuleTypeOptions = OrderedDict()
 if (Edk, ModuleType) not in self._ModuleTypeOptions:
 options = OrderedDict()
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 60970cd92836..da35391d3aff 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -817,11 +817,21 @@ class InfBuildData(ModuleBuildClassObject):
 for Token in TokenList:
 TemporaryDictionary[Arch, ModuleType] = 
TemporaryDictionary[Arch, ModuleType] + Token.strip() + ' '
 for Arch, ModuleType in TemporaryDictionary:
 RetVal[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType]
 return RetVal
+def LocalPkg(self):
+module_path = self.MetaFile.File
+subdir = os.path.split(module_path)[0]
+TopDir = ""
+while subdir:
+subdir,TopDir = os.path.split(subdir)
 
+for file_name in os.listdir(os.path.join(self.MetaFile.Root,TopDir)):
+if file_name.upper().endswith("DEC"):
+pkg = os.path.join(TopDir,file_name)
+return pkg
 @cached_class_function
 def GetGuidsUsedByPcd(self):
 self.Pcds
 return self._GuidsUsedByPcd
 
-- 
2.20.1.windows.1