[edk2] BlockIo2 Protocol test tool

2019-01-25 Thread Sajeesh Kk
Hello all,

I have a prototype BlockIO2 protocol implementation. Are there any
independent tools available to test this out ?. Please let me know.

Thanks,
Sajeesh.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [edk2-platforms/devel-MinPlatform][PATCH v3 1/6] ClevoOpenBoardPkg: Add package and headers

2019-01-25 Thread Michael Kubacki
Based on KabylakeOpenBoardPkg from the following branch:
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform

Create the ClevoOpenBoardPkg to provide an initial board package
for Clevo boards. The ClevoOpenBoardPkg is intended to contain a
series of specific Clevo board instances such as the N1XXWU and
N1XXZU series. A given board instance serves as a board
implementation for use with the MinPlatformPkg.

* Common resources are shared at the top-level of ClevoOpenBoardPkg.
* Features are organized into the Features directory.
  * Features not mandatory to load the OS in the standard hardware
configuration are considered advanced and only enabled when
gMinPlatformPkgTokenSpaceGuid.PcdBootStage is greater than 5.

Cc: Hao Wu 
Cc: Liming Gao 
Cc: Jiewen Yao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kubacki 
---
 Platform/Intel/ClevoOpenBoardPkg/OpenBoardPkg.dec  | 306 +
 .../Features/PciHotPlug/PciHotPlug.h   | 136 +
 .../Features/Tbt/Include/Acpi/TbtNvsAreaDef.h  |  68 +
 .../Features/Tbt/Include/Library/DxeTbtPolicyLib.h |  52 
 .../Features/Tbt/Include/Library/PeiTbtPolicyLib.h |  47 
 .../Features/Tbt/Include/Library/TbtCommonLib.h| 247 +
 .../Features/Tbt/Include/Ppi/PeiTbtPolicy.h|  35 +++
 .../Tbt/Include/Private/Library/PeiDTbtInitLib.h   | 114 
 .../Include/Private/Library/PeiTbtCommonInitLib.h  |  47 
 .../Features/Tbt/Include/Protocol/DxeTbtPolicy.h   | 116 
 .../Features/Tbt/Include/Protocol/TbtNvsArea.h |  48 
 .../Features/Tbt/Include/TbtBoardInfo.h|  28 ++
 .../Tbt/Include/TbtPolicyCommonDefinition.h|  83 ++
 .../Library/DxeTbtPolicyLib/DxeTbtPolicyLibrary.h  |  28 ++
 .../Library/PeiTbtPolicyLib/PeiTbtPolicyLibrary.h  |  23 ++
 .../Features/Tbt/TbtInit/Smm/TbtSmiHandler.h   | 185 +
 .../Include/Acpi/GlobalNvsAreaDef.h| 122 
 .../Intel/ClevoOpenBoardPkg/Include/IoExpander.h   |  73 +
 .../Include/Library/GpioExpanderLib.h  | 128 +
 .../Include/Library/I2cAccessLib.h |  39 +++
 .../ClevoOpenBoardPkg/Include/PchHsioPtssTables.h  |  57 
 .../Include/Protocol/GlobalNvsArea.h   |  53 
 Platform/Intel/ClevoOpenBoardPkg/Include/SioRegs.h | 163 +++
 Platform/Intel/ClevoOpenBoardPkg/Contributions.txt | 218 +++
 Platform/Intel/ClevoOpenBoardPkg/License.txt   |  25 ++
 25 files changed, 2441 insertions(+)
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/OpenBoardPkg.dec
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/PciHotPlug/PciHotPlug.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Acpi/TbtNvsAreaDef.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Library/DxeTbtPolicyLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Library/PeiTbtPolicyLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Library/TbtCommonLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Ppi/PeiTbtPolicy.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Private/Library/PeiDTbtInitLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Private/Library/PeiTbtCommonInitLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Protocol/DxeTbtPolicy.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/Protocol/TbtNvsArea.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/TbtBoardInfo.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Include/TbtPolicyCommonDefinition.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLibrary.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/PeiTbtPolicyLib/PeiTbtPolicyLibrary.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/TbtInit/Smm/TbtSmiHandler.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Include/Acpi/GlobalNvsAreaDef.h
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/Include/IoExpander.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Include/Library/GpioExpanderLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Include/Library/I2cAccessLib.h
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/Include/PchHsioPtssTables.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Include/Protocol/GlobalNvsArea.h
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/Include/SioRegs.h
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/Contributions.txt
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/License.txt

diff --git a/Platform/Intel/ClevoOpenBoardPkg/OpenBoardPkg.dec 
b/Platform/Intel/ClevoOpenBoardPkg/OpenBoardPkg.dec
new 

[edk2] [edk2-platforms/devel-MinPlatform][PATCH v3 6/6] ClevoOpenBoardPkg/N1xxWU: Add DSC and build files

2019-01-25 Thread Michael Kubacki
Based on KabylakeOpenBoardPkg from the following branch:
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform

Adds the DSC and build files necessary to build the N1xxWU Clevo
board instance.

The board follows the same build procedure as other OpenBoardPkg
instances in Platform/Intel in devel-MinPlatform.

Key files
=
* GitEdk2Clevo.bat - Sets up the local environment for build.
* OpenBoardPkg.dsc - The N1xxWU board description file.
* OpenBoardPkgConfig.dsc - Used for feature-related PCD
  customization.
* OpenBoardPkgPcd.dsc - Used for other PCD customization.
* OpenBoardPkg.fdf - The N1xxWU board flash file.
* FlashMapInclude.fdf - The N1xxWU board flash map.
* cln.bat - Cleans temporary files from the workspace.
* prep.bat - Performs pre-build steps.
* bld.bat - Performs build steps.
* postbuild.bat - Performs post-build steps.
* OpenBoardPkgBuildOption.dsc - Sets build options Based
  on PCD values.

Cc: Hao Wu 
Cc: Liming Gao 
Cc: Jiewen Yao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kubacki 
---
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc  | 351 ++
 .../N1xxWU/OpenBoardPkgBuildOption.dsc | 155 +
 .../N1xxWU/OpenBoardPkgConfig.dsc  | 139 
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc   | 268 
 .../N1xxWU/Include/Fdf/FlashMapInclude.fdf |  52 ++
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf  | 716 +
 .../ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat  |  85 +++
 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat| 165 +
 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat|  54 ++
 .../Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat   |  45 ++
 .../Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat| 220 +++
 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat   |  85 +++
 12 files changed, 2335 insertions(+)
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgBuildOption.dsc
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgConfig.dsc
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Include/Fdf/FlashMapInclude.fdf
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/GitEdk2Clevo.bat
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/bld.bat
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/cln.bat
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/postbuild.bat
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prebuild.bat
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/prep.bat

diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
new file mode 100644
index 00..81487ed58d
--- /dev/null
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc
@@ -0,0 +1,351 @@
+## @file
+#  Clevo N1xxWU board description file.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.
+#
+# This program and the accompanying materials are licensed and made available 
under
+# the terms and conditions of the BSD License which accompanies this 
distribution.
+# The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+[Defines]
+  #
+  # Set platform specific package/folder name, same as passed from PREBUILD 
script.
+  # PLATFORM_PACKAGE would be the same as PLATFORM_NAME as well as package 
build folder
+  # DEFINE only takes effect at R9 DSC and FDF.
+  #
+  DEFINE  PLATFORM_PACKAGE= MinPlatformPkg
+  DEFINE  PLATFORM_SI_PACKAGE = KabylakeSiliconPkg
+  DEFINE  PLATFORM_SI_BIN_PACKAGE = KabylakeSiliconBinPkg
+  DEFINE  PLATFORM_FSP_BIN_PACKAGE= KabylakeFspBinPkg
+  DEFINE  PLATFORM_BOARD_PACKAGE  = ClevoOpenBoardPkg
+  DEFINE  BOARD   = N1xxWU
+  DEFINE  PROJECT = 
$(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+
+  #
+  # Platform On/Off features are defined here
+  #
+  !include OpenBoardPkgConfig.dsc
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME   = $(PLATFORM_PACKAGE)
+  PLATFORM_GUID   = 465B0A0B-7AC1-443b-8F67-7B8DEC145F90
+  PLATFORM_VERSION= 0.1
+  DSC_SPECIFICATION   = 0x00010005
+  

[edk2] [edk2-platforms/devel-MinPlatform][PATCH v3 2/6] ClevoOpenBoardPkg/N1xxWU: Add headers

2019-01-25 Thread Michael Kubacki
Based on KabylakeOpenBoardPkg from the following branch:
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform

Header files for the N1XXWU Clevo board instance.

* PeiPchPolicyUpdate.h - Shared interfaces and includes used for
  Platform Controller Hub (PCH) initialization in
  PeiSiliconPolicyUpdateLibFsp.
* PeiSaPolicyUpdate.h - Shared interfaces and includes used for
  System Agent (SA) initialization in PeiSiliconPolicyUpdateLibFsp.
* N1xxWUId.h - The board IDs for N1xxWU boards. Exposed for use
  in libraries/modules in the N1xxWU directory.
* PeiN1xxWUInitLib.h - Shared interfaces and includes for the
  N1xxWU PEI board initialization library.
* DxeGopPolicyInit.h - Shared interfaces and includes used for GOP
  policy initialization in DxeSiliconPolicyUpdateLib.
* DxeSaPolicyInit.h - Shared interfaces and includes used for
  System Agent (SA) initialization in DxeSiliconPolicyUpdateLib.

Cc: Hao Wu 
Cc: Liming Gao 
Cc: Jiewen Yao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kubacki 
---
 .../PeiPchPolicyUpdate.h   | 34 +++
 .../PeiSaPolicyUpdate.h| 36 +++
 .../ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h| 19 ++
 .../N1xxWU/Library/BoardInitLib/PeiN1xxWUInitLib.h | 48 +++
 .../DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h   | 45 ++
 .../DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h| 70 ++
 6 files changed, 252 insertions(+)
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Library/BoardInitLib/PeiN1xxWUInitLib.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Policy/Library/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h

diff --git 
a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h
 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h
new file mode 100644
index 00..b736111344
--- /dev/null
+++ 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h
@@ -0,0 +1,34 @@
+/** @file
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _PEI_PCH_POLICY_UPDATE_H_
+#define _PEI_PCH_POLICY_UPDATE_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#endif
diff --git 
a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h
 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h
new file mode 100644
index 00..10122af262
--- /dev/null
+++ 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.h
@@ -0,0 +1,36 @@
+/** @file
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _PEI_SA_POLICY_UPDATE_H_
+#define _PEI_SA_POLICY_UPDATE_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#include 
+#include 
+#include 
+#include 
+#include "PeiPchPolicyUpdate.h"
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+extern EFI_GUID gTianoLogoGuid;
+
+#endif
+
diff --git a/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h 
b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h
new file mode 100644
index 00..c5cf2e3143
--- /dev/null
+++ b/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h
@@ 

[edk2] [edk2-platforms/devel-MinPlatform][PATCH v3 3/6] ClevoOpenBoardPkg: Add library instances

2019-01-25 Thread Michael Kubacki
Based on KabylakeOpenBoardPkg from the following branch:
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform

Library instances shared across Clevo board instances.

* BaseGpioExpanderLib - Support for the TCA6424 IO expander.
* PeiI2cAccessLib - Provides I2C read and write services.
* PeiDTbtInitLib - PEI discrete Thunderbolt initialization services.
* PeiTbtPolicyLib - PEI Thunderbolt policy initialization.
* DxeTbtPolicyLib - DXE Thunderbolt policy initialization.
* TbtCommonLib - Common Thunderbolt services.

Cc: Hao Wu 
Cc: Liming Gao 
Cc: Jiewen Yao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kubacki 
---
 .../Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf|  73 +++
 .../Library/PeiDxeSmmTbtCommonLib/TbtCommonLib.inf |  68 +++
 .../Library/PeiTbtPolicyLib/PeiTbtPolicyLib.inf|  62 +++
 .../Private/PeiDTbtInitLib/PeiDTbtInitLib.inf  |  47 ++
 .../BaseGpioExpanderLib/BaseGpioExpanderLib.inf|  39 ++
 .../Library/PeiI2cAccessLib/PeiI2cAccessLib.inf|  42 ++
 .../Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.c  | 166 ++
 .../Library/PeiDxeSmmTbtCommonLib/TbtCommonLib.c   | 321 
 .../Tbt/Library/PeiTbtPolicyLib/PeiTbtPolicyLib.c  | 210 
 .../Private/PeiDTbtInitLib/PeiDTbtInitLib.c| 572 +
 .../BaseGpioExpanderLib/BaseGpioExpanderLib.c  | 315 
 .../Library/PeiI2cAccessLib/PeiI2cAccessLib.c  | 121 +
 12 files changed, 2036 insertions(+)
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/PeiDxeSmmTbtCommonLib/TbtCommonLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/PeiTbtPolicyLib/PeiTbtPolicyLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/Private/PeiDTbtInitLib/PeiDTbtInitLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Library/PeiI2cAccessLib/PeiI2cAccessLib.inf
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.c
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/PeiDxeSmmTbtCommonLib/TbtCommonLib.c
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/PeiTbtPolicyLib/PeiTbtPolicyLib.c
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/Private/PeiDTbtInitLib/PeiDTbtInitLib.c
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.c
 create mode 100644 
Platform/Intel/ClevoOpenBoardPkg/Library/PeiI2cAccessLib/PeiI2cAccessLib.c

diff --git 
a/Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf
 
b/Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf
new file mode 100644
index 00..75a7473060
--- /dev/null
+++ 
b/Platform/Intel/ClevoOpenBoardPkg/Features/Tbt/Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf
@@ -0,0 +1,73 @@
+## @file
+# Component description file for Tbt functionality
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.
+#
+# This program and the accompanying materials are licensed and made available 
under
+# the terms and conditions of the BSD License which accompanies this 
distribution.
+# The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+
+[Defines]
+INF_VERSION = 0x00010017
+BASE_NAME = DxeTbtPolicyLib
+FILE_GUID = 28ABF346-4E52-4BD3-b1FF-63BA7563C9D4
+VERSION_STRING = 1.0
+MODULE_TYPE = BASE
+LIBRARY_CLASS = DxeTbtPolicyLib
+
+
+[LibraryClasses]
+BaseMemoryLib
+UefiRuntimeServicesTableLib
+UefiBootServicesTableLib
+DebugLib
+PostCodeLib
+HobLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+  ClevoOpenBoardPkg/OpenBoardPkg.dec
+  KabylakeSiliconPkg/SiPkg.dec
+
+[Pcd]
+gBoardModuleTokenSpaceGuid.PcdDTbtSecurityMode   ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtGpio5Filter## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtWakeupSupport  ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtHotSMI ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtHotNotify  ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtSetClkReq  ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtAspm   ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtAcDcSwitch ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdRtd3Tbt## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdRtd3TbtClkReq  ## CONSUMES
+gBoardModuleTokenSpaceGuid.PcdDTbtWin10Support   ## CONSUMES

[edk2] [edk2-platforms/devel-MinPlatform][PATCH v3 0/6] Add initial ClevoOpenBoardPkg

2019-01-25 Thread Michael Kubacki
This series adds a new board package in Platform/Intel for Clevo
boards. This provides a board implementation for use with the
MinPlatformPkg. Currently, this is largely a copy of
KabylakeOpenBoardPkg with the name refactored. It is intended to
serve as a base for future community development.

A board directory for the N1xxWU series of Clevo boards based on
Kaby Lake-R is provided as this is the first board planned to be
enabled. The next board instance expected to be supported is the
N1xxZU series based on Whiskey Lake. This directory will be a
peer to N1xxWU in ClevoOpenBoardPkg. Both boards share common
resources in the ClevoOpenBoardPkg root directory.

To minimize intial delta from the source KabylakeOpenBoardPkg,
changes required for boot have not yet been made. Therefore,
in this current state boot functionality should not be expected.

The build instructions are similar to the other boards already
present in Platform/Intel and can be found in ReadMe.md on
devel-MinPlatform.
https://github.com/tianocore/edk2-platforms/tree/devel-MinPlatform

Michael Kubacki (6):
  ClevoOpenBoardPkg: Add package and headers
  ClevoOpenBoardPkg/N1xxWU: Add headers
  ClevoOpenBoardPkg: Add library instances
  ClevoOpenBoardPkg/N1xxWU: Add library instances
  ClevoOpenBoardPkg: Add modules
  ClevoOpenBoardPkg/N1xxWU: Add DSC and build files

 Platform/Intel/ClevoOpenBoardPkg/OpenBoardPkg.dec  |  306 
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.dsc  |  351 
 .../N1xxWU/OpenBoardPkgBuildOption.dsc |  155 ++
 .../N1xxWU/OpenBoardPkgConfig.dsc  |  139 ++
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkgPcd.dsc   |  268 +++
 .../N1xxWU/Include/Fdf/FlashMapInclude.fdf |   52 +
 .../ClevoOpenBoardPkg/N1xxWU/OpenBoardPkg.fdf  |  716 
 .../Acpi/BoardAcpiDxe/BoardAcpiDxe.inf |   75 +
 .../Features/PciHotPlug/PciHotPlug.inf |   65 +
 .../Library/DxeTbtPolicyLib/DxeTbtPolicyLib.inf|   73 +
 .../Library/PeiDxeSmmTbtCommonLib/TbtCommonLib.inf |   68 +
 .../Library/PeiTbtPolicyLib/PeiTbtPolicyLib.inf|   62 +
 .../Private/PeiDTbtInitLib/PeiDTbtInitLib.inf  |   47 +
 .../Features/Tbt/TbtInit/Dxe/TbtDxe.inf|   55 +
 .../Features/Tbt/TbtInit/Pei/PeiTbtInit.inf|   50 +
 .../Features/Tbt/TbtInit/Smm/TbtSmm.inf|   83 +
 .../BaseGpioExpanderLib/BaseGpioExpanderLib.inf|   39 +
 .../Library/PeiI2cAccessLib/PeiI2cAccessLib.inf|   42 +
 .../PeiSiliconPolicyUpdateLibFsp.inf   |  149 ++
 .../BasePlatformHookLib/BasePlatformHookLib.inf|   57 +
 .../Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf  |   53 +
 .../BoardAcpiLib/DxeMultiBoardAcpiSupportLib.inf   |   54 +
 .../Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf |   53 +
 .../BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf   |   54 +
 .../BoardInitLib/PeiBoardInitPostMemLib.inf|   59 +
 .../Library/BoardInitLib/PeiBoardInitPreMemLib.inf |  138 ++
 .../BoardInitLib/PeiMultiBoardInitPostMemLib.inf   |   61 +
 .../BoardInitLib/PeiMultiBoardInitPreMemLib.inf|  140 ++
 .../DxeSiliconPolicyUpdateLib.inf  |   55 +
 .../Features/PciHotPlug/PciHotPlug.h   |  136 ++
 .../Features/Tbt/Include/Acpi/TbtNvsAreaDef.h  |   68 +
 .../Features/Tbt/Include/Library/DxeTbtPolicyLib.h |   52 +
 .../Features/Tbt/Include/Library/PeiTbtPolicyLib.h |   47 +
 .../Features/Tbt/Include/Library/TbtCommonLib.h|  247 +++
 .../Features/Tbt/Include/Ppi/PeiTbtPolicy.h|   35 +
 .../Tbt/Include/Private/Library/PeiDTbtInitLib.h   |  114 ++
 .../Include/Private/Library/PeiTbtCommonInitLib.h  |   47 +
 .../Features/Tbt/Include/Protocol/DxeTbtPolicy.h   |  116 ++
 .../Features/Tbt/Include/Protocol/TbtNvsArea.h |   48 +
 .../Features/Tbt/Include/TbtBoardInfo.h|   28 +
 .../Tbt/Include/TbtPolicyCommonDefinition.h|   83 +
 .../Library/DxeTbtPolicyLib/DxeTbtPolicyLibrary.h  |   28 +
 .../Library/PeiTbtPolicyLib/PeiTbtPolicyLibrary.h  |   23 +
 .../Features/Tbt/TbtInit/Smm/TbtSmiHandler.h   |  185 ++
 .../Include/Acpi/GlobalNvsAreaDef.h|  122 ++
 .../Intel/ClevoOpenBoardPkg/Include/IoExpander.h   |   73 +
 .../Include/Library/GpioExpanderLib.h  |  128 ++
 .../Include/Library/I2cAccessLib.h |   39 +
 .../ClevoOpenBoardPkg/Include/PchHsioPtssTables.h  |   57 +
 .../Include/Protocol/GlobalNvsArea.h   |   53 +
 Platform/Intel/ClevoOpenBoardPkg/Include/SioRegs.h |  163 ++
 .../PeiPchPolicyUpdate.h   |   34 +
 .../PeiSaPolicyUpdate.h|   36 +
 .../ClevoOpenBoardPkg/N1xxWU/Include/N1xxWUId.h|   19 +
 .../N1xxWU/Library/BoardInitLib/PeiN1xxWUInitLib.h |   48 +
 .../DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h   |   45 +
 .../DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h|   70 +
 .../Acpi/BoardAcpiDxe/AcpiGnvsInit.c   |  101 ++
 .../Acpi/BoardAcpiDxe/BoardAcpiDxe.c   |  313 
 

Re: [edk2] [PATCH] IntelFsp2Pkg: FSP can utilize bootloader stack

2019-01-25 Thread Desimone, Nathaniel L
Hi Chasel,

I agree with Star that we should just take "Bootloader stack" out of the 
diagram for scenario 1. It doesn't matter where in the memory map the 
bootloader stack is really.

My only extra comment is the definition for AsmReadEsp() should be placed in 
SecMain.h instead of SecMain.c.

With those changes: Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel 
Sent: Wednesday, January 23, 2019 1:33 AM
To: edk2-devel@lists.01.org
Cc: Desimone, Nathaniel L ; Zeng, Star 
; Chiu, Chasel 
Subject: [PATCH] IntelFsp2Pkg: FSP can utilize bootloader stack

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1485

Current FSP utilizes pre-allocated temporary memory from boot loader for both 
heap and stack. To reduce overall temporary memory usage FSP may share the same 
stack with boot loader and only needs a smaller memory for heap, no separate 
memory required for stack.
Setting PcdFspHeapSizePercentage to 0 to enable FSP sharing stack with boot 
loader, in this case boot loader stack has to be large enough for FSP to use. 
Default is 50 (half memory heap and half memory stack) for backward compatible 
with original model.

Test: Verified on internal platform and booting successfully
  with both modes.

Cc: Nate DeSimone 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/SecMain.c  | 86 
++
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf|  3 ++-
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm | 52 
++--
 IntelFsp2Pkg/FspSecCore/Ia32/ReadEsp.nasm  | 28 

 IntelFsp2Pkg/IntelFsp2Pkg.dec  |  4 
 5 files changed, 154 insertions(+), 19 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c 
b/IntelFsp2Pkg/FspSecCore/SecMain.c
index 70460a3c8b..b0b5dda711 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.c
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights 
+ reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at @@ -38,6 +38,19 @@ UINT64  mIdtEntryTemplate = 0x8e08ffe4ULL;
 
 /**
 
+  Return value of esp
+
+  @return  value of esp
+
+**/
+UINT32
+EFIAPI
+AsmReadEsp (
+  VOID
+  );
+
+/**
+
   Entry point to the C language phase of SEC. After the SEC assembly
   code has initialized some temporary memory and set up the stack,
   the control is transferred to this function.
@@ -83,7 +96,26 @@ SecStartup (
   //
   InitializeFloatingPointUnits ();
 
+  //
+  // Scenario 1 memory map when running on bootloader stack  //  // 
+ |---|>
+  // |Idt Table  |
+  // |---|
+  // |PeiService Pointer |
+  // |---|
+  // |   |
+  // |   |
+  // |  Heap |
+  // |   |
+  // |   |
+  // |---|>  TempRamBase
+  // |Bootloader stack   |
+  // |---|
 
+  //
+  // Scenario 2 memory map when running FSP on a separate stack  //
   // |---|>
   // |Idt Table  |
   // |---|
@@ -135,11 +167,19 @@ SecStartup (
   SecCoreData.BootFirmwareVolumeSize = (UINT32)((EFI_FIRMWARE_VOLUME_HEADER 
*)BootFirmwareVolume)->FvLength;
 
   SecCoreData.TemporaryRamBase   = (VOID*)(UINTN) TempRamBase;
-  SecCoreData.TemporaryRamSize   = SizeOfRam;
-  SecCoreData.PeiTemporaryRamBase= SecCoreData.TemporaryRamBase;
-  SecCoreData.PeiTemporaryRamSize= SecCoreData.TemporaryRamSize * PcdGet8 
(PcdFspHeapSizePercentage) / 100;
-  SecCoreData.StackBase  = 
(VOID*)(UINTN)((UINTN)SecCoreData.TemporaryRamBase + 
SecCoreData.PeiTemporaryRamSize);
-  SecCoreData.StackSize  = SecCoreData.TemporaryRamSize - 
SecCoreData.PeiTemporaryRamSize;
+  if (PcdGet8 (PcdFspHeapSizePercentage) == 0) {
+SecCoreData.TemporaryRamSize   = SizeOfRam; // stack size that is 
going to be copied to the permanent memory
+SecCoreData.PeiTemporaryRamBase= SecCoreData.TemporaryRamBase;
+SecCoreData.PeiTemporaryRamSize= SecCoreData.TemporaryRamSize;
+SecCoreData.StackBase  = (VOID *)GetFspEntryStack(); // Share 
the same boot loader stack
+SecCoreData.StackSize  = 0;
+  } else {
+SecCoreData.TemporaryRamSize   = SizeOfRam;
+SecCoreData.PeiTemporaryRamBase= SecCoreData.TemporaryRamBase;
+SecCoreData.PeiTemporaryRamSize= SecCoreData.TemporaryRamSize * 
PcdGet8 (PcdFspHeapSizePercentage) / 100;
+SecCoreData.StackBase  = 

Re: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of parsing parameter.

2019-01-25 Thread Yao, Jiewen
Exactly. Currently APP is using that to parse parameter.
Would you please clarify why we cannot use the same way?

Thank you
Yao Jiewen


From: Gao, Liming
Sent: Friday, January 25, 2019 5:25 PM
To: Zhang, Chao B ; Yao, Jiewen ; 
edk2-devel@lists.01.org
Cc: Wu, Hao A ; Chen, Chen A ; Gao, 
Liming 
Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of 
parsing parameter.

Chao:
  CapsuleApp can base on gEfiShellProtocolGuid and 
gEfiShellParametersProtocolGuid to do it. Current CapsuleApp bases on these two 
protocols to parse the parameters.

Thanks
Liming
From: Zhang, Chao B
Sent: Friday, January 25, 2019 3:24 PM
To: Yao, Jiewen mailto:jiewen@intel.com>>; 
edk2-devel@lists.01.org; Gao, Liming 
mailto:liming@intel.com>>
Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Chen, Chen A 
mailto:chen.a.c...@intel.com>>
Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of 
parsing parameter.

Jiewen & Liming:
   It is a problem. Unlike UiApp. CapsuleApp is supposed to run in Shell.  
ShellLib provides standard parameter parsing support.
Any suggestion on this?

From: Yao, Jiewen
Sent: Friday, January 25, 2019 2:25 PM
To: Chen, Chen A mailto:chen.a.c...@intel.com>>; 
edk2-devel@lists.01.org
Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Zhang, Chao B 
mailto:chao.b.zh...@intel.com>>
Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of 
parsing parameter.

Hey
I don't think MdeModulePkg can depend on ShellPkg.

That is why we do not use ShellLib in the first version.

Do we change the package dependency rule?

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Chen A Chen
> Sent: Friday, January 25, 2019 2:14 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Zhang, Chao B
> mailto:chao.b.zh...@intel.com>>
> Subject: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic
> of parsing parameter.
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1482
>
> No change functionality, use ShellLib to parsing command line.
>
> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
> Cc: Hao Wu mailto:hao.a...@intel.com>>
> Cc: Zhang Chao B mailto:chao.b.zh...@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chen A Chen 
> mailto:chen.a.c...@intel.com>>
> ---
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c   | 433
> +++--
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf |   2 +
>  2 files changed, 236 insertions(+), 199 deletions(-)
>
> diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> index 4d907242f3..acae0fe261 100644
> --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> @@ -27,6 +27,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #define CAPSULE_HEADER_SIZE  0x20
>
> @@ -39,15 +40,27 @@
>
>  #define MAX_CAPSULE_NUM 10
>
> -extern UINTN  Argc;
> -extern CHAR16 **Argv;
> -
>  //
>  // Define how many block descriptors we want to test with.
>  //
>  UINTN  NumberOfDescriptors = 1;
> -UINTN  CapsuleFirstIndex;
> -UINTN  CapsuleLastIndex;
> +
> +STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
> +  {L"-C", TypeFlag},
> +  {L"-E", TypeFlag},
> +  {L"-S", TypeFlag},
> +
> +  {L"-NR", TypeFlag},
> +
> +  {L"-G", TypeValue},
> +  {L"-O", TypeValue},
> +  {L"-N", TypeValue},
> +  {L"-D", TypeValue},
> +  {L"-P", TypeValue},
> +  {L"-I", TypeValue},
> +
> +  {NULL, TypeMax}
> +  };
>
>  /**
>Dump capsule information
> @@ -161,13 +174,12 @@ GetArg (
>  **/
>  EFI_STATUS
>  CreateBmpFmp (
> -  VOID
> +  IN CHAR16 *BmpName,
> +  IN CHAR16
> *OutputCapsuleName
>)
>  {
> -  CHAR16
> *OutputCapsuleName;
>VOID  *BmpBuffer;
>UINTN FileSize;
> -  CHAR16*BmpName;
>UINT8
> *FullCapsuleBuffer;
>UINTN
> FullCapsuleBufferSize;
>EFI_DISPLAY_CAPSULE   *DisplayCapsule;
> @@ -191,22 +203,10 @@ CreateBmpFmp (
>// HorizontalResolution >= BMP_IMAGE_HEADER.PixelWidth
>// VerticalResolution   >= BMP_IMAGE_HEADER.PixelHeight
>
> -  if (Argc != 5) {
> -Print(L"CapsuleApp: Incorrect parameter count.\n");
> -return EFI_UNSUPPORTED;
> -  }
> -
> -  if (StrCmp(Argv[3], L"-O") != 0) {
> -Print(L"CapsuleApp: NO output capsule name.\n");
> -return EFI_UNSUPPORTED;
> -  }
> -  OutputCapsuleName = Argv[4];
> -
>BmpBuffer = NULL;
>FileSize = 0;
>FullCapsuleBuffer = NULL;
>
> -  BmpName = Argv[2];
>Status = ReadFileToBuffer(BmpName, , );
>if (EFI_ERROR(Status)) {
>  Print(L"CapsuleApp: BMP image (%s) is not found.\n", BmpName);
> @@ -425,13 +425,12 

Re: [edk2] [Patch 2/2] MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting TCG spec info

2019-01-25 Thread Yao, Jiewen
Hi Chao
Do you think we need provide a way to let a platform fill " 
PlatformSpecificParameters ", then the core driver can fill laml and lasl ?

Thank you
Yao Jiewen


> -Original Message-
> From: Zhang, Chao B
> Sent: Friday, January 25, 2019 11:31 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen 
> Subject: [Patch 2/2] MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting
> TCG spec info
> 
> Update "TCG ACPI Specification Level 00 Revision 00.37" to "TCG ACPI
> Specification 1.2 Revision 8"
> https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralS
> pecification_v1.20_r8.pdf
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Cc: Yao Jiewen 
> Signed-off-by: Zhang, Chao B 
> ---
>  MdePkg/Include/IndustryStandard/Tpm2Acpi.h | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
> b/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
> index 6b8161e6a6..6bae0a0aa5 100644
> --- a/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
> +++ b/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
> @@ -1,9 +1,9 @@
>  /** @file
>TPM2 ACPI table definition.
> 
> -Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved. 
> +Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved. 
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
>  which accompanies this distribution.  The full text of the license may be
> found at
>  http://opensource.org/licenses/bsd-license.php
> 
> @@ -29,17 +29,20 @@ typedef struct {
>//BIT0~15:  PlatformClass  This field is only valid for version
> 4 and above
>//BIT16~31: Reserved
>UINT32  Flags;
>UINT64  AddressOfControlArea;
>UINT32  StartMethod;
> -//UINT8   PlatformSpecificParameters[];
> +//UINT8   PlatformSpecificParameters[];  // size
> up to 12
> +//UINT32  Laml;
> // Optional
> +//UINT32  Lasa;
> // Optional
>  } EFI_TPM2_ACPI_TABLE;
> 
>  #define EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI
> 2
>  #define EFI_TPM2_ACPI_TABLE_START_METHOD_TIS
> 6
>  #define
> EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_
> INTERFACE 7
>  #define
> EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_
> INTERFACE_WITH_ACPI   8
> +#define
> EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_
> INTERFACE_WITH_SMC11
> 
>  typedef struct {
>UINT32   Reserved;
>UINT32   Error;
>UINT32   Cancel;
> --
> 2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v2] OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

2019-01-25 Thread Stefan Berger
This patch adds the TCG2 Configuration menu to the Device Manager
menu. We can apparently reuse the sample Tcg2ConfigDxe from
SecurityPkg/Tcg/Tcg2Config without obvious adverse effects. The
added TCG2 Configuration menu now shows details about the attached
TPM 2.0 and lets one for example configure the active PCR banks
or issue commands, among other things.

The code is added to Ovmf by building with -DTPM2_ENABLE and
-DTPM2_CONFIG_ENABLE.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Stefan Berger 
---
 OvmfPkg/OvmfPkgIa32.dsc| 4 
 OvmfPkg/OvmfPkgIa32.fdf| 3 +++
 OvmfPkg/OvmfPkgIa32X64.dsc | 4 
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 +++
 OvmfPkg/OvmfPkgX64.dsc | 4 
 OvmfPkg/OvmfPkgX64.fdf | 3 +++
 6 files changed, 21 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index aee19b75d7..2b642ab5dc 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -40,6 +40,7 @@
   DEFINE SMM_REQUIRE = FALSE
   DEFINE TLS_ENABLE  = FALSE
   DEFINE TPM2_ENABLE = FALSE
+  DEFINE TPM2_CONFIG_ENABLE  = FALSE
 
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
@@ -632,6 +633,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index e013099136..4999403ad7 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -381,6 +381,9 @@ INF  
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 
 !if $(TPM2_ENABLE) == TRUE
 INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
 

diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90cbd8e341..14a5c1bb29 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -40,6 +40,7 @@
   DEFINE SMM_REQUIRE = FALSE
   DEFINE TLS_ENABLE  = FALSE
   DEFINE TPM2_ENABLE = FALSE
+  DEFINE TPM2_CONFIG_ENABLE  = FALSE
 
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
@@ -640,6 +641,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
 [Components.X64]
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index afaa334384..d0cc107928 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -388,6 +388,9 @@ INF  
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 
 !if $(TPM2_ENABLE) == TRUE
 INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
 

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 83d16eb00b..aa7197f533 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -40,6 +40,7 @@
   DEFINE SMM_REQUIRE = FALSE
   DEFINE TLS_ENABLE  = FALSE
   DEFINE TPM2_ENABLE = FALSE
+  DEFINE TPM2_CONFIG_ENABLE  = FALSE
 
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
@@ -639,6 +640,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
   #
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index afaa334384..d0cc107928 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -388,6 +388,9 @@ INF  
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 
 !if $(TPM2_ENABLE) == TRUE
 INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
 

-- 
2.20.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

2019-01-25 Thread Stefan Berger

On 1/25/19 2:30 PM, Laszlo Ersek wrote:

  Hi,

(1) when posting a patch, please CC all people marked with "M" for the
subject package in Maintainers.txt. And, if in doubt, please CC the "R"
people too.

Adding the others now.

(2) In [a] [b], you mentioned a need to repost, due to your email
address having changed. However, that posting, and this posting, seem to
come from the same email address, and to use the same S-o-b: "Stefan
Berger ".


I re-subscribed to the ml. Old address was stef...@linux.vnet.ibm.com.




[a] 
d0222c94-4578-74bd-94ad-90d10911b534@linux.ibm.com">http://mid.mail-archive.com/d0222c94-4578-74bd-94ad-90d10911b534@linux.ibm.com
[b] https://lists.01.org/pipermail/edk2-devel/2019-January/035701.html

On 01/25/19 18:12, Stefan Berger wrote:

This patch adds the TCG2 Configuration menu to the Device Manager
menu.

OK.


We can reuse all the code in the SecurityPkg and need to
only add it to the build and flash config files.

(3) I disagree with this formulation.

Instead, we can apparently include the *sample* Tcg2ConfigDxe from
SecurityPkg as-is, without obvious adverse effects. I consider this an



I will reuse some of this formulation.



experimental feature that's being enabled (not by default) in order to
support further R The Tcg2ConfigDxe has not been trimmed / modified
for OVMF / QEMU specifics (unlike Tcg2ConfigPei in commit 6cf1880fb5b6).
That's why we are gating Tcg2ConfigDxe with TPM2_CONFIG_ENABLE, and not
enabling it simply as part of TPM2_ENABLE.


The code is added to Ovfm by building with -DTPM2_ENABLE and
-DTPM2_CONFIG_ENABLE.

(4) Typo, s/Ovfm/OVMF/. "OVMF" stands for Open Virtual Machine Firmware.



:-)





Signed-off-by: Stefan Berger 

(5) Before your S-o-b, please add:

"""
Contributed-under: TianoCore Contribution Agreement 1.1
"""

after reviewing "Contributions.txt" in the project root dir.



Done.





---
  OvmfPkg/OvmfPkgIa32.dsc| 3 +++
  OvmfPkg/OvmfPkgIa32.fdf| 4 
  OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++
  OvmfPkg/OvmfPkgIa32X64.fdf | 4 
  OvmfPkg/OvmfPkgX64.dsc | 3 +++
  OvmfPkg/OvmfPkgX64.fdf | 4 
  6 files changed, 21 insertions(+)

(6) In all three DSC files, please DEFINE TPM2_CONFIG_ENABLE = FALSE as
well, just below TPM2_ENABLE.



Done.





diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index aee19b75d7..68e707e7e5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -632,6 +632,9 @@
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
}
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
  !endif

#

This looks good.


diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index e013099136..a46598f2c3 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -295,6 +295,10 @@ INF  ShellPkg/Application/Shell/Shell.inf

  INF MdeModulePkg/Logo/LogoDxe.inf

+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+

(7) In this file, we already have

"""
!if $(TPM2_ENABLE) == TRUE
INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
!endif
"""

elsewhere. Can you please nest the addition in that scope?


Done.




Thanks,
Laszlo



___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Drop CSM support in OvmfPkg?

2019-01-25 Thread Brian J. Johnson

On 1/24/19 5:30 AM, Laszlo Ersek wrote:

On 01/24/19 10:31, David Woodhouse wrote:

On Thu, 2019-01-24 at 01:48 +, Ni, Ray wrote:

David,
I think we got an agreement here to move CSM components in OvmfPkg.
I prefer we firstly clone the required CSM components in OvmfPkg right no.
Finally I can remove the IntelFrameworkModulePkg/IntelFrameworkPkg in one patch.
(I say "finally" because OVMF CSM dependency is not the only case that prevent 
removing
the two framework packages.)

Would you like to do the clone? Or if you are busy, I can do that.


I keep asking this question, I don't believe I've seen an
answer. Apologies if I've missed it.


I think you haven't. And, I'm curious too. :)

Thanks
Laszlo


Is this code genuinely not going to continue to exist anywhere else in
the Intel ecosystem, any more?

No TianoCore-based images from this point forth are ever going to even
have the option of supporting CSM?

Unless some third party also chooses to fork the CSM support code and
keep it on for themselves?



In fall of 2017, Intel declared their intention to end legacy BIOS 
support on their platforms by 2020.


http://www.uefi.org/sites/default/files/resources/Brian_Richardson_Intel_Final.pdf

I believe they have stuck to this story at subsequent UEFI plugfests.

--

Brian



   "Occasionally get out of the office, the lab, the computer room,
smell the flowers and take a look at the physical world around you."
   -- Rob Cook
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

2019-01-25 Thread Laszlo Ersek
 Hi,

(1) when posting a patch, please CC all people marked with "M" for the
subject package in Maintainers.txt. And, if in doubt, please CC the "R"
people too.

Adding the others now.

(2) In [a] [b], you mentioned a need to repost, due to your email
address having changed. However, that posting, and this posting, seem to
come from the same email address, and to use the same S-o-b: "Stefan
Berger ".

[a] 
d0222c94-4578-74bd-94ad-90d10911b534@linux.ibm.com">http://mid.mail-archive.com/d0222c94-4578-74bd-94ad-90d10911b534@linux.ibm.com
[b] https://lists.01.org/pipermail/edk2-devel/2019-January/035701.html

On 01/25/19 18:12, Stefan Berger wrote:
> This patch adds the TCG2 Configuration menu to the Device Manager
> menu.

OK.

> We can reuse all the code in the SecurityPkg and need to
> only add it to the build and flash config files.

(3) I disagree with this formulation.

Instead, we can apparently include the *sample* Tcg2ConfigDxe from
SecurityPkg as-is, without obvious adverse effects. I consider this an
experimental feature that's being enabled (not by default) in order to
support further R The Tcg2ConfigDxe has not been trimmed / modified
for OVMF / QEMU specifics (unlike Tcg2ConfigPei in commit 6cf1880fb5b6).
That's why we are gating Tcg2ConfigDxe with TPM2_CONFIG_ENABLE, and not
enabling it simply as part of TPM2_ENABLE.

> The code is added to Ovfm by building with -DTPM2_ENABLE and
> -DTPM2_CONFIG_ENABLE.

(4) Typo, s/Ovfm/OVMF/. "OVMF" stands for Open Virtual Machine Firmware.

>
> Signed-off-by: Stefan Berger 

(5) Before your S-o-b, please add:

"""
Contributed-under: TianoCore Contribution Agreement 1.1
"""

after reviewing "Contributions.txt" in the project root dir.

> ---
>  OvmfPkg/OvmfPkgIa32.dsc| 3 +++
>  OvmfPkg/OvmfPkgIa32.fdf| 4 
>  OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++
>  OvmfPkg/OvmfPkgIa32X64.fdf | 4 
>  OvmfPkg/OvmfPkgX64.dsc | 3 +++
>  OvmfPkg/OvmfPkgX64.fdf | 4 
>  6 files changed, 21 insertions(+)

(6) In all three DSC files, please DEFINE TPM2_CONFIG_ENABLE = FALSE as
well, just below TPM2_ENABLE.

>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index aee19b75d7..68e707e7e5 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -632,6 +632,9 @@
>
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
>
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
>}
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
>  !endif
>
>#

This looks good.

> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index e013099136..a46598f2c3 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf
> @@ -295,6 +295,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
>
>  INF MdeModulePkg/Logo/LogoDxe.inf
>
> +!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)
> +INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +

(7) In this file, we already have

"""
!if $(TPM2_ENABLE) == TRUE
INF  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
!endif
"""

elsewhere. Can you please nest the addition in that scope?

Thanks,
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 00/33] BaseTools python3 migration patch set

2019-01-25 Thread Laszlo Ersek
On 01/25/19 10:42, Feng, Bob C wrote:
> [...]
>
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, January 25, 2019 4:57 PM
> To: Feng, Bob C 
> Cc: edk2-devel@lists.01.org; Gao, Liming 
> Subject: Re: [edk2] [Patch 00/33] BaseTools python3 migration patch
> set
>
> [...]
>
> On 01/25/19 05:55, Feng, Bob C wrote:
>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
>>
>> This patch set is to enable python3 on BaseTools. Basetools code will
>> be compatible with both python3 and python2.
>>
>> We will have two envs PYTHON3_ENABLE and PYTHON_COMMAND. The behavior
>> can be combined as the below to support this usage.
>> If user wants the specific python interpreter, he only needs to set
>> PYTHON_COMMAND env.
>> If PYTHON3_ENABLE is set, PYTHON_COMMAND will be set to the found one
>> by edk2 scripts based on PYTHON3_ENABLE value.
>> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is set, then
>> PYTHON_COMMAND will be used to run python script. No version check
>> here.
>> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is not set,
>> PYTHON_COMMAND will be set to the high version python installed in
>> OS.

I ran the following tests, at commit 41c0616fc081 ("BaseTools: Eot tool
Python3 adaption", 2019-01-25). Each test was performed in a clean tree
(after running "git clean -ffdx") and clean environment (I re-sourced
"edksetup.sh" for each test in separation). In addition, the base tools
were rebuilt (again from a clean tree) for each test, with the following
command [1]:

  nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)

(a) On my RHEL7.5 Workstation laptop, I have both the system-level
python packages installed (python-2.7.5-69.el7_5.x86_64), and the extra
python-3.4 stuff from EPEL-7 (python34-3.4.9-1.el7.x86_64).

(a1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build
utility picked

  PYTHON_COMMAND   = /usr/bin/python3.4

and I successfully built OvmfPkg for IA32, IA32X64, and X64; also
ArmVirtQemu for AARCH64. The built firmware images passed a smoke test
too.

(a2) I removed all the python34 packages (and the dependent packages)
from my laptop. Didn't set either of PYTHON3_ENABLE and PYTHON_COMMAND.
(This is the configuration what a "normal" RHEL7 environment would
provide.)

In this case, rebuilding the base tools [1] failed, in the testing
phase:

> ==
> FAIL: test_Ecc_CParser4_CLexer (CheckPythonSyntax.Tests)
> --
> Traceback (most recent call last):
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 55, in 
> newmethod = lambda self: self.SingleFileTest(filename)
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 33, in SingleFileTest
> self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
> AssertionError: syntax error: 
> .../BaseTools/Source/Python/Ecc/CParser4/CLexer.py, Error is   File 
> ".../BaseTools/Source/Python/Ecc/CParser4/CLexer.py", line 590
> def __init__(self, input=None, output:TextIO = sys.stdout):
>  ^
> SyntaxError: invalid syntax
>
>
> ==
> FAIL: test_Ecc_CParser4_CListener (CheckPythonSyntax.Tests)
> --
> Traceback (most recent call last):
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 55, in 
> newmethod = lambda self: self.SingleFileTest(filename)
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 33, in SingleFileTest
> self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
> AssertionError: syntax error: 
> .../BaseTools/Source/Python/Ecc/CParser4/CListener.py, Error is   File 
> ".../BaseTools/Source/Python/Ecc/CParser4/CListener.py", line 35
> def enterTranslation_unit(self, ctx:CParser.Translation_unitContext):
>^
> SyntaxError: invalid syntax
>
>
> ==
> FAIL: test_Ecc_CParser4_CParser (CheckPythonSyntax.Tests)
> --
> Traceback (most recent call last):
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 55, in 
> newmethod = lambda self: self.SingleFileTest(filename)
>   File ".../BaseTools/Tests/CheckPythonSyntax.py", line 33, in SingleFileTest
> self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
> AssertionError: syntax error: 
> .../BaseTools/Source/Python/Ecc/CParser4/CParser.py, Error is   File 
> ".../BaseTools/Source/Python/Ecc/CParser4/CParser.py", line 744
> def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
> ^
> SyntaxError: invalid syntax
>
>
> ==
> FAIL: test_Eot_CParser4_CLexer 

[edk2] [PATCH] OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

2019-01-25 Thread Stefan Berger
This patch adds the TCG2 Configuration menu to the Device Manager
menu. We can reuse all the code in the SecurityPkg and need to
only add it to the build and flash config files.

The code is added to Ovfm by building with -DTPM2_ENABLE and
-DTPM2_CONFIG_ENABLE.

Signed-off-by: Stefan Berger 
---
 OvmfPkg/OvmfPkgIa32.dsc| 3 +++
 OvmfPkg/OvmfPkgIa32.fdf| 4 
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++
 OvmfPkg/OvmfPkgIa32X64.fdf | 4 
 OvmfPkg/OvmfPkgX64.dsc | 3 +++
 OvmfPkg/OvmfPkgX64.fdf | 4 
 6 files changed, 21 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index aee19b75d7..68e707e7e5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -632,6 +632,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index e013099136..a46598f2c3 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -295,6 +295,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
 
 INF MdeModulePkg/Logo/LogoDxe.inf
 
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
 #
 # Network modules
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90cbd8e341..dd6c700774 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -640,6 +640,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
 [Components.X64]
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index afaa334384..8a02b3cc79 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -296,6 +296,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
 
 INF MdeModulePkg/Logo/LogoDxe.inf
 
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
 #
 # Network modules
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 83d16eb00b..828a1d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -639,6 +639,9 @@
   NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
   NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
   }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
 !endif
 
   #
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index afaa334384..8a02b3cc79 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -296,6 +296,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
 
 INF MdeModulePkg/Logo/LogoDxe.inf
 
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)
+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
 #
 # Network modules
 #
-- 
2.20.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

2019-01-25 Thread Stefan Berger

I have to repost this since my email has changed.

On 1/25/19 11:55 AM, Stefan Berger wrote:

This patch adds the TCG2 Configuration menu to the Device Manager
menu. We can reuse all the code in the SecurityPkg and need to
only add it to the build and flash config files.

The code is added to Ovfm by building with -DTPM2_ENABLE and
-DTPM2_CONFIG_ENABLE.

Signed-off-by: Stefan Berger 
---
  OvmfPkg/OvmfPkgIa32.dsc| 3 +++
  OvmfPkg/OvmfPkgIa32.fdf| 4 
  OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++
  OvmfPkg/OvmfPkgIa32X64.fdf | 4 
  OvmfPkg/OvmfPkgX64.dsc | 3 +++
  OvmfPkg/OvmfPkgX64.fdf | 4 
  6 files changed, 21 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index aee19b75d7..68e707e7e5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -632,6 +632,9 @@
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
}
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
  !endif
  
#

diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index e013099136..a46598f2c3 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -295,6 +295,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
  
  INF MdeModulePkg/Logo/LogoDxe.inf
  
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)

+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
  #
  # Network modules
  #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90cbd8e341..dd6c700774 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -640,6 +640,9 @@
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
}
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
  !endif
  
  [Components.X64]

diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index afaa334384..8a02b3cc79 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -296,6 +296,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
  
  INF MdeModulePkg/Logo/LogoDxe.inf
  
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)

+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
  #
  # Network modules
  #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 83d16eb00b..828a1d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -639,6 +639,9 @@
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
}
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
  !endif
  
#

diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index afaa334384..8a02b3cc79 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -296,6 +296,10 @@ INF  ShellPkg/Application/Shell/Shell.inf
  
  INF MdeModulePkg/Logo/LogoDxe.inf
  
+!if ($(TPM2_ENABLE) == TRUE) && ($(TPM2_CONFIG_ENABLE) == TRUE)

+INF  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+
  #
  # Network modules
  #



___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Do python3 supported in edk2 shell now?

2019-01-25 Thread Richardson, Brian
There is a MicroPython interpreter in edk2-staging which is being developed to 
address Python 3.x support. Please evaluate and report any issues you see as 
this code transitions out of the staging branch.

https://github.com/tianocore/edk2-staging/tree/MicroPythonTestFramework

https://github.com/tianocore/tianocore.github.io/wiki/MicroPython 

Thanks ... br
---
Brian Richardson -- Director, Firmware Ecosystem Development
brian.richard...@intel.com -- @intel_brian (Twitter & WeChat)
https://software.intel.com/en-us/meet-the-developers/evangelists/team/brian-richardson
 

-Original Message-
From: edk2-devel  On Behalf Of wang xiaofeng
Sent: Thursday, January 24, 2019 10:27 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Do python3 supported in edk2 shell now?

HI All,
   I only see AppPkg/Applications/Python/2.7.10 in latest edk2 tree. Do edk2 
plan to support python3 in shell ?
  Thanks!
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] ShellPkg/TftpDynamicCommand: Return proper status

2019-01-25 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

And pushed with the BZ added to commit REF.



> -Original Message-
> From: Li, Songpeng
> Sent: Thursday, January 24, 2019 9:08 PM
> To: Vladimir Olovyannikov ; edk2-
> de...@lists.01.org
> Cc: Carsey, Jaben ; Ni, Ray 
> Subject: RE: [edk2] [PATCH] ShellPkg/TftpDynamicCommand: Return proper
> status
> Importance: High
> 
> Reviewed-by: Songpeng Li 
> 
> Sorry, the previous email did not include edk2 mailing list.
> 
> Best,
> Songpeng
> 
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Vladimir Olovyannikov via edk2-devel
> > Sent: Thursday, January 24, 2019 2:26 AM
> > To: Carsey, Jaben ; Ni, Ray ;
> > edk2-devel@lists.01.org
> > Cc: Vladimir Olovyannikov 
> > Subject: [edk2] [PATCH] ShellPkg/TftpDynamicCommand: Return proper
> > status
> >
> > Tftp command always returned "SHELL_NOT_FOUND" which is treated as
> an
> > error by callers. Add missing line to clean the ShellStatus on
> > successful operation. If operation has failed, return the error status
> > if available.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Vladimir Olovyannikov
> > 
> > ---
> >  ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
> > b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
> > index ba753a279b00..88e3988a554e 100644
> > --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
> > +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
> > @@ -548,6 +548,8 @@ RunTftp (
> >goto NextHandle;
> >  }
> >
> > +ShellStatus = SHELL_SUCCESS;
> > +
> >  NextHandle:
> >
> >  CloseProtocolAndDestroyServiceChild (
> > @@ -575,6 +577,10 @@ RunTftp (
> >  FreePool (Handles);
> >}
> >
> > +  if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR(Status))) {
> > +ShellStatus = Status & ~MAX_BIT;
> > +  }
> > +
> >return ShellStatus;
> >  }
> >
> > --
> > 2.20.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Text attachments

2019-01-25 Thread stephano

On 1/24/2019 3:38 AM, Tomas Pilar (tpilar) wrote:

Hi,

Does the mailing list support plaintext attachments?


As Laszlo mentioned, sadly, no.

Please know that we are working to address this issue. We are currently 
evaluating Groups.io which, so far, has proven a feature-rich 
replacement for the 01.org mailing list.


I'll be sending out an invite soon to our February community meeting 
where we will discuss this further.


Cheers,
Stephano

Stephano Cetola
TianoCore Community Manager
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of parsing parameter.

2019-01-25 Thread Carsey, Jaben
I think that if the application wants to depend on the libs, then we should 
discuss moving the application to the ShellPkg.

-Jaben

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Gao, Liming
> Sent: Friday, January 25, 2019 1:25 AM
> To: Zhang, Chao B ; Yao, Jiewen
> ; edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Gao, Liming 
> Subject: Re: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code
> logic of parsing parameter.
> Importance: High
> 
> Chao:
>   CapsuleApp can base on gEfiShellProtocolGuid and
> gEfiShellParametersProtocolGuid to do it. Current CapsuleApp bases on
> these two protocols to parse the parameters.
> 
> Thanks
> Liming
> From: Zhang, Chao B
> Sent: Friday, January 25, 2019 3:24 PM
> To: Yao, Jiewen ; edk2-devel@lists.01.org; Gao,
> Liming 
> Cc: Wu, Hao A ; Chen, Chen A
> 
> Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code
> logic of parsing parameter.
> 
> Jiewen & Liming:
>It is a problem. Unlike UiApp. CapsuleApp is supposed to run in Shell.
> ShellLib provides standard parameter parsing support.
> Any suggestion on this?
> 
> From: Yao, Jiewen
> Sent: Friday, January 25, 2019 2:25 PM
> To: Chen, Chen A
> mailto:chen.a.c...@intel.com>>; edk2-
> de...@lists.01.org
> Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Zhang,
> Chao B mailto:chao.b.zh...@intel.com>>
> Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code
> logic of parsing parameter.
> 
> Hey
> I don't think MdeModulePkg can depend on ShellPkg.
> 
> That is why we do not use ShellLib in the first version.
> 
> Do we change the package dependency rule?
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Chen A Chen
> > Sent: Friday, January 25, 2019 2:14 PM
> > To: edk2-devel@lists.01.org
> > Cc: Wu, Hao A mailto:hao.a...@intel.com>>;
> Zhang, Chao B
> > mailto:chao.b.zh...@intel.com>>
> > Subject: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code
> logic
> > of parsing parameter.
> >
> > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1482
> >
> > No change functionality, use ShellLib to parsing command line.
> >
> > Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
> > Cc: Hao Wu mailto:hao.a...@intel.com>>
> > Cc: Zhang Chao B
> mailto:chao.b.zh...@intel.com>>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Chen A Chen
> mailto:chen.a.c...@intel.com>>
> > ---
> >  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c   | 433
> > +++--
> >  MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf |   2 +
> >  2 files changed, 236 insertions(+), 199 deletions(-)
> >
> > diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> > b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> > index 4d907242f3..acae0fe261 100644
> > --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> > +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> > @@ -27,6 +27,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #define CAPSULE_HEADER_SIZE  0x20
> >
> > @@ -39,15 +40,27 @@
> >
> >  #define MAX_CAPSULE_NUM 10
> >
> > -extern UINTN  Argc;
> > -extern CHAR16 **Argv;
> > -
> >  //
> >  // Define how many block descriptors we want to test with.
> >  //
> >  UINTN  NumberOfDescriptors = 1;
> > -UINTN  CapsuleFirstIndex;
> > -UINTN  CapsuleLastIndex;
> > +
> > +STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
> > +  {L"-C", TypeFlag},
> > +  {L"-E", TypeFlag},
> > +  {L"-S", TypeFlag},
> > +
> > +  {L"-NR", TypeFlag},
> > +
> > +  {L"-G", TypeValue},
> > +  {L"-O", TypeValue},
> > +  {L"-N", TypeValue},
> > +  {L"-D", TypeValue},
> > +  {L"-P", TypeValue},
> > +  {L"-I", TypeValue},
> > +
> > +  {NULL, TypeMax}
> > +  };
> >
> >  /**
> >Dump capsule information
> > @@ -161,13 +174,12 @@ GetArg (
> >  **/
> >  EFI_STATUS
> >  CreateBmpFmp (
> > -  VOID
> > +  IN CHAR16 *BmpName,
> > +  IN CHAR16
> > *OutputCapsuleName
> >)
> >  {
> > -  CHAR16
> > *OutputCapsuleName;
> >VOID  *BmpBuffer;
> >UINTN FileSize;
> > -  CHAR16*BmpName;
> >UINT8
> > *FullCapsuleBuffer;
> >UINTN
> > FullCapsuleBufferSize;
> >EFI_DISPLAY_CAPSULE   *DisplayCapsule;
> > @@ -191,22 +203,10 @@ CreateBmpFmp (
> >// HorizontalResolution >= BMP_IMAGE_HEADER.PixelWidth
> >// VerticalResolution   >= BMP_IMAGE_HEADER.PixelHeight
> >
> > -  if (Argc != 5) {
> > -Print(L"CapsuleApp: Incorrect parameter count.\n");
> > -return EFI_UNSUPPORTED;
> > -  }
> > -
> > -  if (StrCmp(Argv[3], L"-O") != 0) {
> > -Print(L"CapsuleApp: NO output capsule name.\n");
> > -return EFI_UNSUPPORTED;
> > -  }
> > -  OutputCapsuleName = Argv[4];
> > -
> >

[edk2] [Patch 2/2] MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting TCG spec info

2019-01-25 Thread Zhang, Chao B
Update "TCG ACPI Specification Level 00 Revision 00.37" to "TCG ACPI 
Specification 1.2 Revision 8"
https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yao Jiewen 
Signed-off-by: Zhang, Chao B 
---
 MdePkg/Include/IndustryStandard/Tpm2Acpi.h | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Tpm2Acpi.h 
b/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
index 6b8161e6a6..6bae0a0aa5 100644
--- a/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
+++ b/MdePkg/Include/IndustryStandard/Tpm2Acpi.h
@@ -1,9 +1,9 @@
 /** @file
   TPM2 ACPI table definition.
 
-Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved. 
+Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved. 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -29,17 +29,20 @@ typedef struct {
   //BIT0~15:  PlatformClass  This field is only valid for version 4 
and above
   //BIT16~31: Reserved
   UINT32  Flags;
   UINT64  AddressOfControlArea;
   UINT32  StartMethod;
-//UINT8   PlatformSpecificParameters[];
+//UINT8   PlatformSpecificParameters[];  // size up to 12
+//UINT32  Laml;  // Optional
+//UINT32  Lasa;  // Optional
 } EFI_TPM2_ACPI_TABLE;
 
 #define EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI  
2
 #define EFI_TPM2_ACPI_TABLE_START_METHOD_TIS   
6
 #define EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE 
7
 #define 
EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_ACPI   8
+#define 
EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_SMC
11
 
 typedef struct {
   UINT32   Reserved;
   UINT32   Error;
   UINT32   Cancel;
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] Update UEFI supporting TCG spec info

2019-01-25 Thread Zhang, Chao B
Update UEFI supporting TCG spec info

Zhang, Chao B (2):
  SecurityPkg/TCG: Upgrade UEFI supporting TCG spec info
  MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting TCG spec info

 MdePkg/Include/IndustryStandard/Tpm2Acpi.h | 7 +--
 SecurityPkg/SecurityPkg.dec| 2 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf| 4 +++-
 SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf| 6 --
 4 files changed, 13 insertions(+), 6 deletions(-)

-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] SecurityPkg/TCG: Upgrade UEFI supporting TCG spec info

2019-01-25 Thread Zhang, Chao B
Update "TCG ACPI Specification Level 00 Revision 00.37" to "TCG ACPI 
Specification 1.2 Revision 8"
https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf

Upgrade TCG PC Client Platform Physical Presence Interface Specification 
Version 1.3 Revision 0.52" to Errata Version 0.4
https://trustedcomputinggroup.org/wp-content/uploads/Errata-Version-0.4-for-TCG-PC-Client-Platform-Physical-Presence-Interface-Version-1.30-Revision-0.52.pdf

Upgrade "TCG EFI Protocol Specification for Family 2.0 Level 00" to Errata 0.5
https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-Errata-v.5.pdf

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yao Jiewen 
Signed-off-by: Zhang, Chao B 
---
 SecurityPkg/SecurityPkg.dec | 2 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf | 4 +++-
 SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf | 6 --
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
index 2708e7953c..7ae42ea150 100644
--- a/SecurityPkg/SecurityPkg.dec
+++ b/SecurityPkg/SecurityPkg.dec
@@ -403,11 +403,11 @@
   # When it is configured to Dynamic or DynamicEx, it can be set through 
detection using
   # a platform-specific method (e.g. Button pressed) in a actual platform in 
early boot phase.
   # @Prompt A physical presence user status
   
gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|FALSE|BOOLEAN|0x00010019
 
-  ## Indicate the TPM2 ACPI table revision. Rev 4 is defined in TCG ACPI 
Specification Rev 00.37.
+  ## Indicate the TPM2 ACPI table revision. Rev 4 has been defined since TCG 
ACPI Specification Rev 00.37.
   # To support configuring from setup page, this PCD can be DynamicHii type 
and map to a setup option.
   # For example, map to TCG2_VERSION.Tpm2AcpiTableRev to be configured by 
Tcg2ConfigDxe driver.
   # 
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
   # @Prompt Revision of TPM2 ACPI table.
   gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|3|UINT8|0x0001001A
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
index 87f0492750..49402d902c 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
@@ -4,19 +4,21 @@
 #  Spec Compliance Info:
 #"TCG PC Client Platform Firmware Profile Specification for TPM Family 2.0 
Level 00 Revision 1.03 v51"
 #  along with
 #"Errata for PC Client Specific Platform Firmware Profile Specification 
Version 1.0 Revision 1.03"
 #"TCG EFI Protocol Specification" "Family 2.0" "Level 00 Revision 00.13"
+#  along with
+#"Errata Version 0.5 for TCG EFI Protocol Specification"
 #
 #  This module will produce Tcg2 protocol and measure boot environment.
 #
 #  Caution: This module requires additional review when modified.
 #  This driver will have external input - PE/COFF image.
 #  This external input must be validated carefully to avoid security issue like
 #  buffer overflow, integer overflow.
 #
-# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution. The full text of the license may be 
found at
 # http://opensource.org/licenses/bsd-license.php
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf 
b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
index 97cec443e4..cc5768294d 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf
@@ -1,11 +1,13 @@
 ## @file
 #  Provides ACPI methods for TPM 2.0 support
 #
 #  Spec Compliance Info:
-# "TCG ACPI Specification Level 00 Revision 00.37"
+# "TCG ACPI Specification Version 1.2 Revision 8"
 # "Physical Presence Interface Specification Version 1.30 Revision 00.52"
+#   along with
+# "Errata Version 0.4 for TCG PC Client Platform Physical Presence 
Interface Specification"
 # "Platform Reset Attack Mitigation Specification Version 1.00"
 #TPM2.0 ACPI device object
 # "TCG PC Client Platform Firmware Profile Specification for TPM Family 
2.0 Level 00 Revision 1.03 v51"
 #   along with
 # "Errata for PC Client Specific Platform Firmware Profile Specification 
Version 1.0 Revision 1.03"
@@ -16,11 +18,11 @@
 #
 #  Caution: This module requires additional review when modified.
 #  This driver will have external input - variable and ACPINvs data in SMM 
mode.
 #  This external input must be validated carefully to avoid security issue.
 #
-# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms 

Re: [edk2] Network Stack Budgeting

2019-01-25 Thread Tomas Pilar (tpilar)
Yeah, that makes sense I suppose. The end result is however that the network 
device is 'opened' as soon as ConnectController() is called rather than when 
someone wants to do networking. This seems wrong and directly leads to a DoS of 
a platform in case of heavy network load (unless we implement budgeting in the 
network driver, which is a really not what it should be doing).

How do you suggest we solve this problem?

Cheers,
Tom

On 25/01/2019 08:44, Wu, Jiaxin wrote:
> Hi Tom,
>
> One thing I want to highlight is that our design of network stack is not only 
> for the PXE/HTTP boot trigged in BootManager, but also to make sure it's 
> workable once there is any MNP instance configured by upper drivers 
> (ARP/IPv4/IPv6). 
>
> Take ARP/IP as an example, once ARP/IP are started, we need a heartbeat to 
> process any ARP requests, which is required by ARP functionality. In such a 
> case, SNP must be started to make ARP/IP drivers works well. 
>
> Thanks,
> Jiaxin
>
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>> Tomas Pilar (tpilar)
>> Sent: Friday, January 25, 2019 1:43 AM
>> To: Laszlo Ersek ; edk2-devel@lists.01.org
>> Subject: Re: [edk2] Network Stack Budgeting
>>
>>
>>
>> On 24/01/2019 16:49, Laszlo Ersek wrote:
>>> On 01/24/19 14:25, Tomas Pilar (tpilar) wrote:
 Hmm,

 Mnp->Configure() will eventually call MnpStartSnp().

 A grep for Mnp->Configure shows that:
 * ArpDxe performs this on DriverBinding.Start()
 * Ip6Dxe performs this on DriverBinding.Start()

 Ipv4 and DnsDhcp do this as a part of their Configure() they expose in the
>> API.
>>> Yes, that makes sense. All of the above drivers are UEFI drivers that
>>> follow the UEFI driver model, AIUI. As long as the controller is not
>>> connected from BDS, no BindingStart() function should be called in these.
>> Ah, but I would expect the BDS to call ConnectController() on the NIC, but I
>> would not expect the network stack to be started unless the device is
>> actually chosen for PXE booting. In other words, the above protocols should
>> follow the example of EFI_DNS4_PROTOCOL that binds against the device
>> during BDS but .Configure() is not automatically called by
>> DriverBinding.Start().
>>
>> .Configure() should be called by the BootManager if networking is actually to
>> be done. That in turn will configure Mnp and start Snp.
>>
>> Cheers,
>> Tom
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/ARM/SgiPkg: Include HobLib, MmServicesTableLib and MemoryAllocationLib

2019-01-25 Thread Ard Biesheuvel
On Fri, 25 Jan 2019 at 11:46, Ard Biesheuvel  wrote:
>
> On Fri, 25 Jan 2019 at 11:29, Jagadeesh Ujja  wrote:
> >
> > hi Ard
> >
> > On Fri, Jan 25, 2019 at 3:32 PM Ard Biesheuvel
> >  wrote:
> > >
> > > On Fri, 25 Jan 2019 at 07:42, Jagadeesh Ujja  
> > > wrote:
> > > >
> > > > Include the HobLib, MmServicesTableLib and MemoryAllocationLib 
> > > > libraries on
> > > > Sgi platforms. These will be consumed by MM_STANDALONE drivers.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Jagadeesh Ujja 
> > > > ---
> > > >  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 5 +
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc 
> > > > b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > > index 2a17e9f..65dd6ac 100644
> > > > --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > > +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > > @@ -71,6 +71,11 @@
> > > >
> > > >
> > > > StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
> > > >
> > > > +[LibraryClasses.common.MM_STANDALONE]
> > > > +  
> > > > HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
> > > > +  
> > > > MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
> > > > +  
> > > > MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
> > > > +
> > >
> > > Should you add the entrypoint library as well?
> >
> > in 
> > https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > we already have
> > StandaloneMmDriverEntryPoint|StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
> > StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
> >
> > Are you looking for this?
> >
>
> Ah yes, I missed that.
>
> But in fact, we should replace that reference with the MdePkg version,
> and drop the one from StandaloneMmPkg entirely
>

For this patch

Reviewed-by: Ard Biesheuvel 

Pushed as b4069053a8a6..b0bb325f2033

Thanks!
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/ARM/SgiPkg: Include HobLib, MmServicesTableLib and MemoryAllocationLib

2019-01-25 Thread Ard Biesheuvel
On Fri, 25 Jan 2019 at 11:29, Jagadeesh Ujja  wrote:
>
> hi Ard
>
> On Fri, Jan 25, 2019 at 3:32 PM Ard Biesheuvel
>  wrote:
> >
> > On Fri, 25 Jan 2019 at 07:42, Jagadeesh Ujja  wrote:
> > >
> > > Include the HobLib, MmServicesTableLib and MemoryAllocationLib libraries 
> > > on
> > > Sgi platforms. These will be consumed by MM_STANDALONE drivers.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Jagadeesh Ujja 
> > > ---
> > >  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 5 +
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc 
> > > b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > index 2a17e9f..65dd6ac 100644
> > > --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > > @@ -71,6 +71,11 @@
> > >
> > >
> > > StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
> > >
> > > +[LibraryClasses.common.MM_STANDALONE]
> > > +  
> > > HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
> > > +  
> > > MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
> > > +  
> > > MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
> > > +
> >
> > Should you add the entrypoint library as well?
>
> in 
> https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> we already have
> StandaloneMmDriverEntryPoint|StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
> StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
>
> Are you looking for this?
>

Ah yes, I missed that.

But in fact, we should replace that reference with the MdePkg version,
and drop the one from StandaloneMmPkg entirely


> > >  
> > > 
> > >  #
> > >  # Pcd Section - list of all EDK II PCD Entries defined by this Platform
> > > --
> > > 2.7.4
> > >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/ARM/SgiPkg: Include HobLib, MmServicesTableLib and MemoryAllocationLib

2019-01-25 Thread Jagadeesh Ujja
hi Ard

On Fri, Jan 25, 2019 at 3:32 PM Ard Biesheuvel
 wrote:
>
> On Fri, 25 Jan 2019 at 07:42, Jagadeesh Ujja  wrote:
> >
> > Include the HobLib, MmServicesTableLib and MemoryAllocationLib libraries on
> > Sgi platforms. These will be consumed by MM_STANDALONE drivers.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jagadeesh Ujja 
> > ---
> >  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc 
> > b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > index 2a17e9f..65dd6ac 100644
> > --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> > @@ -71,6 +71,11 @@
> >
> >
> > StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
> >
> > +[LibraryClasses.common.MM_STANDALONE]
> > +  HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
> > +  
> > MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
> > +  
> > MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
> > +
>
> Should you add the entrypoint library as well?

in 
https://github.com/tianocore/edk2-platforms/blob/master/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
we already have
StandaloneMmDriverEntryPoint|StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf

Are you looking for this?

> >  
> > 
> >  #
> >  # Pcd Section - list of all EDK II PCD Entries defined by this Platform
> > --
> > 2.7.4
> >
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/ARM/SgiPkg: Include HobLib, MmServicesTableLib and MemoryAllocationLib

2019-01-25 Thread Ard Biesheuvel
On Fri, 25 Jan 2019 at 07:42, Jagadeesh Ujja  wrote:
>
> Include the HobLib, MmServicesTableLib and MemoryAllocationLib libraries on
> Sgi platforms. These will be consumed by MM_STANDALONE drivers.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jagadeesh Ujja 
> ---
>  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc 
> b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> index 2a17e9f..65dd6ac 100644
> --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> @@ -71,6 +71,11 @@
>
>
> StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
>
> +[LibraryClasses.common.MM_STANDALONE]
> +  HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
> +  
> MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
> +  
> MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
> +

Should you add the entrypoint library as well?

>  
> 
>  #
>  # Pcd Section - list of all EDK II PCD Entries defined by this Platform
> --
> 2.7.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2] BaseTools: Enable CODE format in DEC file

2019-01-25 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1292.
Enable CODE format in DEC File.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 .../Source/Python/Workspace/DscBuildData.py   | 38 +++
 .../Source/Python/Workspace/MetaFileParser.py | 99 ---
 BaseTools/Source/Python/build/BuildReport.py  |  2 +-
 3 files changed, 86 insertions(+), 53 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 0dad04212e..4c3c9b8d34 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1786,20 +1786,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, "Invalid 
value format for %s. From %s Line %d " %
 (".".join((Pcd.TokenSpaceGuidCName, 
Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d / 
__ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); 
 // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+if not Pcd.IsArray:
+CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d / 
__ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); 
 // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = FieldName.strip('.')
 while '[' in  FieldName:
 NewFieldName = NewFieldName + FieldName.split('[', 
1)[0] + '[0]'
 ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 
1)[0])
 FieldName = FieldName.split(']', 1)[1]
 FieldName = NewFieldName + FieldName
-while '[' in FieldName:
+while '[' in FieldName and not Pcd.IsArray:
 FieldName = FieldName.rsplit('[', 1)[0]
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); 
// From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), 
ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], 
FieldList[FieldName_ori][0])
 for skuname in Pcd.SkuOverrideValues:
 if skuname == TAB_COMMON:
 continue
@@ -1817,20 +1818,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, 
"Invalid value format for %s. From %s Line %d " %
 
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, 
%s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 
1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+if not Pcd.IsArray:
+CApp = CApp + '  __FLEXIBLE_SIZE(*Size, 
%s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, 
%s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, 
FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], 
FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = 

Re: [edk2] [Patch 00/33] BaseTools python3 migration patch set

2019-01-25 Thread Feng, Bob C
Hi Laszlo,

(1) Yes. There are some fixes. I think you performed the testing on Liming's 
repository https://github.com/lgao4/edk2/tree/Python3. I am not sure which 
specific version were you using but we did some fixes in recent days.
The repository link(https://github.com/BobCF/edk2.git branch py3basetools) 
mentioned in this mail have all the patches in Liming's repository, but they 
are not 1:1 mapping. I merged some patches for they are in same category. 
(2) Thank you in advance for your more testing.

Thanks,
Bob


-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, January 25, 2019 4:57 PM
To: Feng, Bob C 
Cc: edk2-devel@lists.01.org; Gao, Liming 
Subject: Re: [edk2] [Patch 00/33] BaseTools python3 migration patch set

Hi Bob,

On 01/25/19 05:55, Feng, Bob C wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
> 
> This patch set is to enable python3 on BaseTools. Basetools code will 
> be compatible with both python3 and python2.
> 
> We will have two envs PYTHON3_ENABLE and PYTHON_COMMAND. The behavior 
> can be combined as the below to support this usage.
> If user wants the specific python interpreter, he only needs to set 
> PYTHON_COMMAND env.
> If PYTHON3_ENABLE is set, PYTHON_COMMAND will be set to the found one by edk2 
> scripts based on PYTHON3_ENABLE value. 
> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is set, then PYTHON_COMMAND 
> will be used to run python script. No version check here. 
> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is not set, PYTHON_COMMAND 
> will be set to the high version python installed in OS. 
> 
> This patch set is verified by basic testing on Ovmf, MinKabylake and 
> MinPurley platform with Python3.7.1 and minimal testing on Ovmf, MinKabylake 
> and MinPurley with Python2.7.15.
> 
> After this change, we will focus on the Python3 validation.
> 
> You can also review and try the patch set at 
> https://github.com/BobCF/edk2.git branch py3basetools

(1) Have there been any fixes since my last testing at

dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com">http://mid.mail-archive.com/dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com

?


(2) My other question would have been about PYTHON3_ENABLE / PYTHON_COMMAND, 
since we discussed those in the same thread as well.
But, your blurb explains them.

So the test cases I plan to do are:

- Test on RHEL7 (python2 only) without setting any variables. This would be 
used both for interactive builds and for package builds.

- Test on RHEL8 without setting any variables. Expect python3 to be picked 
automatically. Used for interactive builds.

- Test on RHEL8 with just  PYTHON_COMMAND set, namely to 
"/usr/libexec/platform-python". Expect the python3 logic to be active.
Would be used for package builds.

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/MdeModulePkg.dsc: ignore standalone MM modules for EBC or XCODE5

2019-01-25 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>Sent: Friday, January 25, 2019 4:12 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming ; Bi, Dandan ;
>Wang, Jian J ; Ard Biesheuvel
>
>Subject: [PATCH] MdeModulePkg/MdeModulePkg.dsc: ignore standalone
>MM modules for EBC or XCODE5
>
>The newly added standalone MM versions of the FTW and variable runtime
>drivers were included in MdeModulePkg.dsc to get test coverage when
>building the package from its own .dsc, but the resulting modules are
>non-functional since they incorporate some dummy libraries.
>
>Dandan reports that these modules don't build cleanly when using the
>EBC or XCODE5 compilers, so given the above, let's just ignore them
>in this case.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Ard Biesheuvel 
>---
> MdeModulePkg/MdeModulePkg.dsc | 8 +---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/MdeModulePkg/MdeModulePkg.dsc
>b/MdeModulePkg/MdeModulePkg.dsc
>index 93eaf4b404a1..55eca4d74c04 100644
>--- a/MdeModulePkg/MdeModulePkg.dsc
>+++ b/MdeModulePkg/MdeModulePkg.dsc
>@@ -426,9 +426,6 @@ [Components]
>   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
>   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
>
>-
>MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandal
>oneMm.inf
>-
>MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
>-
> [Components.IA32, Components.X64, Components.AARCH64]
>   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>   MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
>@@ -442,6 +439,11 @@ [Components.IA32, Components.X64,
>Components.ARM, Components.AARCH64]
>
>NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
>uidedSectionExtractLib.inf
>   }
>
>+!if $(TOOL_CHAIN_TAG) != "XCODE5"
>+
>MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandal
>oneMm.inf
>+
>MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
>+!endif
>+
> [Components.IA32, Components.X64, Components.Ebc]
>
>MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeD
>xe.inf
>
>--
>2.17.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of parsing parameter.

2019-01-25 Thread Gao, Liming
Chao:
  CapsuleApp can base on gEfiShellProtocolGuid and 
gEfiShellParametersProtocolGuid to do it. Current CapsuleApp bases on these two 
protocols to parse the parameters.

Thanks
Liming
From: Zhang, Chao B
Sent: Friday, January 25, 2019 3:24 PM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Gao, Liming 

Cc: Wu, Hao A ; Chen, Chen A 
Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of 
parsing parameter.

Jiewen & Liming:
   It is a problem. Unlike UiApp. CapsuleApp is supposed to run in Shell.  
ShellLib provides standard parameter parsing support.
Any suggestion on this?

From: Yao, Jiewen
Sent: Friday, January 25, 2019 2:25 PM
To: Chen, Chen A mailto:chen.a.c...@intel.com>>; 
edk2-devel@lists.01.org
Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Zhang, Chao B 
mailto:chao.b.zh...@intel.com>>
Subject: RE: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic of 
parsing parameter.

Hey
I don't think MdeModulePkg can depend on ShellPkg.

That is why we do not use ShellLib in the first version.

Do we change the package dependency rule?

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Chen A Chen
> Sent: Friday, January 25, 2019 2:14 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A mailto:hao.a...@intel.com>>; Zhang, Chao B
> mailto:chao.b.zh...@intel.com>>
> Subject: [edk2] [PATCH 1/3] MdeModulePkg/CapsuleApp: Refine code logic
> of parsing parameter.
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1482
>
> No change functionality, use ShellLib to parsing command line.
>
> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
> Cc: Hao Wu mailto:hao.a...@intel.com>>
> Cc: Zhang Chao B mailto:chao.b.zh...@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chen A Chen 
> mailto:chen.a.c...@intel.com>>
> ---
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c   | 433
> +++--
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf |   2 +
>  2 files changed, 236 insertions(+), 199 deletions(-)
>
> diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> index 4d907242f3..acae0fe261 100644
> --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> @@ -27,6 +27,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #define CAPSULE_HEADER_SIZE  0x20
>
> @@ -39,15 +40,27 @@
>
>  #define MAX_CAPSULE_NUM 10
>
> -extern UINTN  Argc;
> -extern CHAR16 **Argv;
> -
>  //
>  // Define how many block descriptors we want to test with.
>  //
>  UINTN  NumberOfDescriptors = 1;
> -UINTN  CapsuleFirstIndex;
> -UINTN  CapsuleLastIndex;
> +
> +STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
> +  {L"-C", TypeFlag},
> +  {L"-E", TypeFlag},
> +  {L"-S", TypeFlag},
> +
> +  {L"-NR", TypeFlag},
> +
> +  {L"-G", TypeValue},
> +  {L"-O", TypeValue},
> +  {L"-N", TypeValue},
> +  {L"-D", TypeValue},
> +  {L"-P", TypeValue},
> +  {L"-I", TypeValue},
> +
> +  {NULL, TypeMax}
> +  };
>
>  /**
>Dump capsule information
> @@ -161,13 +174,12 @@ GetArg (
>  **/
>  EFI_STATUS
>  CreateBmpFmp (
> -  VOID
> +  IN CHAR16 *BmpName,
> +  IN CHAR16
> *OutputCapsuleName
>)
>  {
> -  CHAR16
> *OutputCapsuleName;
>VOID  *BmpBuffer;
>UINTN FileSize;
> -  CHAR16*BmpName;
>UINT8
> *FullCapsuleBuffer;
>UINTN
> FullCapsuleBufferSize;
>EFI_DISPLAY_CAPSULE   *DisplayCapsule;
> @@ -191,22 +203,10 @@ CreateBmpFmp (
>// HorizontalResolution >= BMP_IMAGE_HEADER.PixelWidth
>// VerticalResolution   >= BMP_IMAGE_HEADER.PixelHeight
>
> -  if (Argc != 5) {
> -Print(L"CapsuleApp: Incorrect parameter count.\n");
> -return EFI_UNSUPPORTED;
> -  }
> -
> -  if (StrCmp(Argv[3], L"-O") != 0) {
> -Print(L"CapsuleApp: NO output capsule name.\n");
> -return EFI_UNSUPPORTED;
> -  }
> -  OutputCapsuleName = Argv[4];
> -
>BmpBuffer = NULL;
>FileSize = 0;
>FullCapsuleBuffer = NULL;
>
> -  BmpName = Argv[2];
>Status = ReadFileToBuffer(BmpName, , );
>if (EFI_ERROR(Status)) {
>  Print(L"CapsuleApp: BMP image (%s) is not found.\n", BmpName);
> @@ -425,13 +425,12 @@ IsFmpCapsuleGuid (
>  **/
>  EFI_STATUS
>  CreateNestedFmp (
> -  VOID
> +  IN CHAR16 *CapsuleName,
> +  IN CHAR16
> *OutputCapsuleName
>)
>  {
> -  CHAR16
> *OutputCapsuleName;
>VOID  *CapsuleBuffer;
>UINTN FileSize;
> -  CHAR16*CapsuleName;
>UINT8
> *FullCapsuleBuffer;
>UINTN
> FullCapsuleBufferSize;
>EFI_CAPSULE_HEADER
> *NestedCapsuleHeader;
> @@ -439,22 

Re: [edk2] [Patch] BaseTools: Enable CODE format in DEC file

2019-01-25 Thread Feng, Bob C
Hi Laszlo,

There is a BZ https://bugzilla.tianocore.org/show_bug.cgi?id=1292.

This patch is to implement the CODE format support in DEC file. I'll re-sent 
this patch with this link.

Thanks,
Bob

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, January 25, 2019 5:08 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: Re: [edk2] [Patch] BaseTools: Enable CODE format in DEC file

Hi Bob,

On 01/25/19 09:58, Feng, Bob C wrote:
> Enable CODE format in DEC File.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  .../Source/Python/Workspace/DscBuildData.py   | 38 +++
>  .../Source/Python/Workspace/MetaFileParser.py | 99 
> ---  BaseTools/Source/Python/build/BuildReport.py  |  
> 2 +-
>  3 files changed, 86 insertions(+), 53 deletions(-)

Do you have a BZ and/or Wiki article for this?

Thanks,
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for enable GPT support

2019-01-25 Thread Gao, Liming
Chen:
  I agree with Hao. For UEFI definition, please add EFI_ prefix. And, reuse the 
existing definition, not introduce new one. 

Thanks
Liming
>-Original Message-
>From: Wu, Hao A
>Sent: Friday, January 25, 2019 3:47 PM
>To: Chen, Chen A ; Gao, Liming
>; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Zhang, Chao B
>
>Subject: RE: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for
>enable GPT support
>
>> -Original Message-
>> From: Chen, Chen A
>> Sent: Friday, January 25, 2019 3:45 PM
>> To: Wu, Hao A; Gao, Liming; edk2-devel@lists.01.org
>> Cc: Kinney, Michael D; Zhang, Chao B
>> Subject: RE: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for
>> enable GPT support
>>
>>
>>
>> -Original Message-
>> From: Wu, Hao A
>> Sent: Friday, January 25, 2019 3:27 PM
>> To: Chen, Chen A ; Gao, Liming
>> ; edk2-devel@lists.01.org
>> Cc: Kinney, Michael D ; Zhang, Chao B
>> 
>> Subject: RE: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for
>> enable GPT support
>>
>> > -Original Message-
>> > From: Chen, Chen A
>> > Sent: Friday, January 25, 2019 3:16 PM
>> > To: Wu, Hao A; edk2-devel@lists.01.org
>> > Cc: Kinney, Michael D; Zhang, Chao B; Gao, Liming
>> > Subject: RE: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition
>> > for enable GPT support
>> >
>> >
>> >
>> > -Original Message-
>> > From: Wu, Hao A
>> > Sent: Friday, January 25, 2019 11:04 AM
>> > To: Chen, Chen A ; edk2-devel@lists.01.org
>> > Cc: Kinney, Michael D ; Zhang, Chao B
>> > ; Gao, Liming 
>> > Subject: RE: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition
>> > for enable GPT support
>> >
>> > > -Original Message-
>> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
>> > > Of Chen A Chen
>> > > Sent: Thursday, January 17, 2019 10:03 AM
>> > > To: edk2-devel@lists.01.org
>> > > Cc: Kinney, Michael D; Zhang, Chao B; Gao, Liming
>> > > Subject: [edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for
>> > > enable GPT support
>> > >
>> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470
>> > > This two new definitions are defined for GPT in FatPei diver.
>> > >
>> > > Cc: Liming Gao 
>> > > Cc: Michael D Kinney 
>> > > Cc: Zhang Chao B 
>> > > Contributed-under: TianoCore Contribution Agreement 1.1
>> > > Signed-off-by: Chen A Chen 
>> > > ---
>> > >  MdePkg/Include/Uefi/UefiGpt.h | 16 
>> > >  1 file changed, 16 insertions(+)
>> > >
>> > > diff --git a/MdePkg/Include/Uefi/UefiGpt.h
>> > > b/MdePkg/Include/Uefi/UefiGpt.h index f635b05390..8665c8cbc9
>100644
>> > > --- a/MdePkg/Include/Uefi/UefiGpt.h
>> > > +++ b/MdePkg/Include/Uefi/UefiGpt.h
>> > > @@ -24,9 +24,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF
>> > ANY KIND,
>> > > EITHER EXPRESS OR IMPLIED.
>> > >  /// EFI Partition Table Signature: "EFI PART".
>> > >  ///
>> > >  #define EFI_PTAB_HEADER_ID  SIGNATURE_64 ('E','F','I',' 
>> > > ','P','A','R','T')
>> > > +///
>> > > +/// Minimum bytes reserve for EFI entry array buffer.
>> > > +///
>> > > +#define GPT_PART_ENTRY_MIN_SIZE 16384
>> >
>> > May I know where this definition comes from?
>> > Does it come from the UEFI spec?
>> >
>> > Chen: The MACRO is not explicitly defined in UEFI Spec, But UEFI Spec
>> > specifies a minimum value for GPT entry araray.
>>
>> Does it comes from the below content within the UEFI spec?
>>
>> > A minimum of 16,384 bytes of space must be reserved for the GPT
>> > Partition Entry Array.
>>
>> If so, I am not sure whether 'EFI_' prefix should be added before
>> 'GPT_PART_ENTRY_MIN_SIZE'.
>>
>> Liming, could you help to confirm?
>>
>> Chen: I have no strong opinion on ' GPT_PART_ENTRY_MIN_SIZE' and
>> 'EFI_GPT_PART_ENTRY_MIN_SIZE'.
>>
>> >
>> > >
>> > >  #pragma pack(1)
>> > >
>> > > +///
>> > > +/// MBR Partition Entry
>> > > +///
>> > > +typedef struct {
>> > > +  UINT8   BootIndicator;
>> > > +  UINT8   StartingCHS[3];
>> > > +  UINT8   OSType;
>> > > +  UINT8   EndingCHS[3];
>> > > +  UINT32  StartingLBA;
>> > > +  UINT32  SizeInLBA;
>> > > +} MBR_PARTITION_ENTRY;
>> > > +
>> >
>> > What about using the 'MBR_PARTITION_RECORD' definition within
>> > edk2/MdePkg/Include/IndustryStandard/Mbr.h
>> >
>> > and thus get rid of adding this one?
>> >
>> > Chen: This structure defined as the following format in Mbr.h
>> >
>> > typedef struct {
>> >   ..
>> >   UINT8 StartingLBA[4];
>> >   UINT8 SizeInLBA[4];
>> > } MBR_PARTITION_RECORD;
>> >
>> > For StartingLBA, this field is represented the LBA, so I think it
>> > should be
>> > UINT32 type not an array type.
>>
>> I do not get your point, what prevents you from getting the LBA information
>> for the byte array?
>>
>> Chen: Yes, GPT DXE driver use UNPACK_UINT32 macro to extract UINT32
>>  from array. But I thought use UINT32 type get the value more directly.
>
>I would suggest to use the existing definition and avoid adding a
>'duplicated' definition.
>
>Best Regards,
>Hao Wu
>
>>
>> Best Regards,
>> Hao Wu
>>
>> >
>> > The 

Re: [edk2] [Patch] BaseTools: Enable CODE format in DEC file

2019-01-25 Thread Laszlo Ersek
Hi Bob,

On 01/25/19 09:58, Feng, Bob C wrote:
> Enable CODE format in DEC File.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  .../Source/Python/Workspace/DscBuildData.py   | 38 +++
>  .../Source/Python/Workspace/MetaFileParser.py | 99 ---
>  BaseTools/Source/Python/build/BuildReport.py  |  2 +-
>  3 files changed, 86 insertions(+), 53 deletions(-)

Do you have a BZ and/or Wiki article for this?

Thanks,
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdePkg/BasePeCoffLib: skip runtime relocation if relocation info is invalid.

2019-01-25 Thread Laszlo Ersek
On 01/25/19 00:18, Neo Hsueh wrote:
> 1.Skip runtime relocation for PE images that provide invalid relocation
>   infomation (ex: RelocDir->Size = 0) to fix a hang observed while booting
>   Windows.
> 2.Add a magic number check for PE32+ image.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Neo Hsueh 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Dandan Bi 
> ---
>  MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 19 ---
>  1 file changed, 16 insertions(+), 3 deletions(-)

I can't comment on the technical details of the patch, but I have some
comments on the organization of the patch.

First, the two changes that it implements should be separate patches.

> diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c 
> b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> index 1bd079ad6a..6477ef0759 100644
> --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> @@ -1725,11 +1725,18 @@ PeCoffLoaderRelocateImageForRuntime (
>  NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
>  DataDirectory = (EFI_IMAGE_DATA_DIRECTORY 
> *)&(Hdr.Pe32->OptionalHeader.DataDirectory[0]);
>} else {
> +if (Hdr.Pe32Plus->OptionalHeader.Magic == 
> EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
> +  //
> +  // Use PE32+ offset
> +  //
> +  NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
> +  DataDirectory = (EFI_IMAGE_DATA_DIRECTORY 
> *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[0]);
> +} else {
>  //
> -// Use PE32+ offset
> +// Not a valid PE image so Exit
>  //
> -NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
> -DataDirectory = (EFI_IMAGE_DATA_DIRECTORY 
> *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[0]);
> +return;
> +}
>}
>  
>//

Second, my understanding is that in edk2, we don't do

  if (Condition1) {
  } else {
if (Condition2) {
} else {
}
  }

Instead, we prefer

  if (Condition1) {
  } else if (Condition2) {
  } else {
  }

As far as I know, this is the only construct where we don't require
braces after an "else". See:

https://edk2-docs.gitbooks.io/edk-ii-c-coding-standards-specification/content/5_source_files/57_c_programming.html#57342-when-an-else-is-used-it-may-start-on-the-same-line-as-the-close-brace-of-the-if-or-be-on-the-following-line-and-aligned-with-the-closing-brace


Third, the return statement and the comment are not properly indented in
the last branch.

Thanks
Laszlo

> @@ -1746,6 +1753,12 @@ PeCoffLoaderRelocateImageForRuntime (
>  
> RelocDir->VirtualAddress + RelocDir->Size - 1,
>  0
>  
> );
> +if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < 
> RelocBase) {
> +  //
> +  // relocation block is not valid, just return
> +  //
> +  return;
> +}
>} else {
>  //
>  // Cannot find relocations, cannot continue to relocate the image, 
> ASSERT for this invalid image.
> 

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Enable CODE format in DEC file

2019-01-25 Thread Feng, Bob C
Enable CODE format in DEC File.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 .../Source/Python/Workspace/DscBuildData.py   | 38 +++
 .../Source/Python/Workspace/MetaFileParser.py | 99 ---
 BaseTools/Source/Python/build/BuildReport.py  |  2 +-
 3 files changed, 86 insertions(+), 53 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 0dad04212e..4c3c9b8d34 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1786,20 +1786,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, "Invalid 
value format for %s. From %s Line %d " %
 (".".join((Pcd.TokenSpaceGuidCName, 
Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d / 
__ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); 
 // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+if not Pcd.IsArray:
+CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d / 
__ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); 
 // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = FieldName.strip('.')
 while '[' in  FieldName:
 NewFieldName = NewFieldName + FieldName.split('[', 
1)[0] + '[0]'
 ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 
1)[0])
 FieldName = FieldName.split(']', 1)[1]
 FieldName = NewFieldName + FieldName
-while '[' in FieldName:
+while '[' in FieldName and not Pcd.IsArray:
 FieldName = FieldName.rsplit('[', 1)[0]
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); 
// From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), 
ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], 
FieldList[FieldName_ori][0])
 for skuname in Pcd.SkuOverrideValues:
 if skuname == TAB_COMMON:
 continue
@@ -1817,20 +1818,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, 
"Invalid value format for %s. From %s Line %d " %
 
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, 
%s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 
1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+if not Pcd.IsArray:
+CApp = CApp + '  __FLEXIBLE_SIZE(*Size, 
%s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, 
%s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, 
FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], 
FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = FieldName.strip('.')
 while '[' in  

Re: [edk2] [Patch 00/33] BaseTools python3 migration patch set

2019-01-25 Thread Laszlo Ersek
Hi Bob,

On 01/25/19 05:55, Feng, Bob C wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
> 
> This patch set is to enable python3 on BaseTools. Basetools code will be
> compatible with both python3 and python2.
> 
> We will have two envs PYTHON3_ENABLE and PYTHON_COMMAND. The behavior can be 
> combined as the below to support this usage.
> If user wants the specific python interpreter, he only needs to set 
> PYTHON_COMMAND env.
> If PYTHON3_ENABLE is set, PYTHON_COMMAND will be set to the found one by edk2 
> scripts based on PYTHON3_ENABLE value. 
> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is set, then PYTHON_COMMAND 
> will be used to run python script. No version check here. 
> If PYTHON3_ENABLE is not set, but PYTHON_COMMAND is not set, PYTHON_COMMAND 
> will be set to the high version python installed in OS. 
> 
> This patch set is verified by basic testing on Ovmf, MinKabylake and 
> MinPurley platform with Python3.7.1 and 
> minimal testing on Ovmf, MinKabylake and MinPurley with Python2.7.15. 
> 
> After this change, we will focus on the Python3 validation.
> 
> You can also review and try the patch set at 
> https://github.com/BobCF/edk2.git branch py3basetools

(1) Have there been any fixes since my last testing at

dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com">http://mid.mail-archive.com/dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com

?


(2) My other question would have been about PYTHON3_ENABLE /
PYTHON_COMMAND, since we discussed those in the same thread as well.
But, your blurb explains them.

So the test cases I plan to do are:

- Test on RHEL7 (python2 only) without setting any variables. This would
be used both for interactive builds and for package builds.

- Test on RHEL8 without setting any variables. Expect python3 to be
picked automatically. Used for interactive builds.

- Test on RHEL8 with just  PYTHON_COMMAND set, namely to
"/usr/libexec/platform-python". Expect the python3 logic to be active.
Would be used for package builds.

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert

2019-01-25 Thread Fan, ZhijuX
Define Macro in Inf file, the pcdvalue Can't convert

in dec:
gUefiOvmfPkgGuid.test1|"ddd"|VOID*|0x3c
in inf:
DEFINE ABC=PATH
gUefiOvmfPkgTokenSpaceGuid.test1|$(ABC)

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 6df0d3cdf8..f31dbc2649 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -757,9 +757,13 @@ class InfParser(MetaFileParser):
 if self._ValueList[2] != '':
 InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 
1)
 if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
-self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], 
'1', 1);
+self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], 
'1', 1)
 elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
-self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], 
'0', 1);
+self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], 
'0', 1)
+elif isinstance(InfPcdValueList[0], str) and 
InfPcdValueList[0].find('$(') >= 0:
+Value = ReplaceExprMacro(InfPcdValueList[0],self._Macros)
+if Value != '0':
+self._ValueList[2] = Value
 if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict:
 self.PcdsDict[self._ValueList[0], self._ValueList[1]] = 
self._SectionType
 elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != 
self._SectionType:
-- 
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Network Stack Budgeting

2019-01-25 Thread Wu, Jiaxin
Hi Tom,

One thing I want to highlight is that our design of network stack is not only 
for the PXE/HTTP boot trigged in BootManager, but also to make sure it's 
workable once there is any MNP instance configured by upper drivers 
(ARP/IPv4/IPv6). 

Take ARP/IP as an example, once ARP/IP are started, we need a heartbeat to 
process any ARP requests, which is required by ARP functionality. In such a 
case, SNP must be started to make ARP/IP drivers works well. 

Thanks,
Jiaxin

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Tomas Pilar (tpilar)
> Sent: Friday, January 25, 2019 1:43 AM
> To: Laszlo Ersek ; edk2-devel@lists.01.org
> Subject: Re: [edk2] Network Stack Budgeting
> 
> 
> 
> On 24/01/2019 16:49, Laszlo Ersek wrote:
> > On 01/24/19 14:25, Tomas Pilar (tpilar) wrote:
> >> Hmm,
> >>
> >> Mnp->Configure() will eventually call MnpStartSnp().
> >>
> >> A grep for Mnp->Configure shows that:
> >> * ArpDxe performs this on DriverBinding.Start()
> >> * Ip6Dxe performs this on DriverBinding.Start()
> >>
> >> Ipv4 and DnsDhcp do this as a part of their Configure() they expose in the
> API.
> > Yes, that makes sense. All of the above drivers are UEFI drivers that
> > follow the UEFI driver model, AIUI. As long as the controller is not
> > connected from BDS, no BindingStart() function should be called in these.
> Ah, but I would expect the BDS to call ConnectController() on the NIC, but I
> would not expect the network stack to be started unless the device is
> actually chosen for PXE booting. In other words, the above protocols should
> follow the example of EFI_DNS4_PROTOCOL that binds against the device
> during BDS but .Configure() is not automatically called by
> DriverBinding.Start().
> 
> .Configure() should be called by the BootManager if networking is actually to
> be done. That in turn will configure Mnp and start Snp.
> 
> Cheers,
> Tom
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg/MdeModulePkg.dsc: ignore standalone MM modules for EBC or XCODE5

2019-01-25 Thread Ard Biesheuvel
The newly added standalone MM versions of the FTW and variable runtime
drivers were included in MdeModulePkg.dsc to get test coverage when
building the package from its own .dsc, but the resulting modules are
non-functional since they incorporate some dummy libraries.

Dandan reports that these modules don't build cleanly when using the
EBC or XCODE5 compilers, so given the above, let's just ignore them
in this case.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/MdeModulePkg.dsc | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 93eaf4b404a1..55eca4d74c04 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -426,9 +426,6 @@ [Components]
   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
 
-  
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
-  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
-
 [Components.IA32, Components.X64, Components.AARCH64]
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
@@ -442,6 +439,11 @@ [Components.IA32, Components.X64, Components.ARM, 
Components.AARCH64]
   
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
   }
 
+!if $(TOOL_CHAIN_TAG) != "XCODE5"
+  
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
+!endif
+
 [Components.IA32, Components.X64, Components.Ebc]
   MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
 
-- 
2.17.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel