]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
5 years agoFmpDevicePkg FmpDxe: Need repopulate after SetImage is called
Star Zeng [Mon, 6 Aug 2018 07:44:59 +0000 (15:44 +0800)]
FmpDevicePkg FmpDxe: Need repopulate after SetImage is called

No need repopulate if SetImage is not called.
But need repopulate after SetImage is called to update
LastAttemptVersion and LastAttemptStatus

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoBaseTools: Use gGuidPattern for Guid regular expression
Yunhua Feng [Mon, 6 Aug 2018 01:02:25 +0000 (09:02 +0800)]
BaseTools: Use gGuidPattern for Guid regular expression

Use GlobalData.py gGuidPattern for Guid regular expression

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoPatchCheck - add error message for invalid parameter
Jaben Carsey [Thu, 2 Aug 2018 23:21:06 +0000 (07:21 +0800)]
PatchCheck - add error message for invalid parameter

Currently if an invalid parameter is passed, it gives a stack trace.
This changes it to an error message.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Debug message make confused
Yunhua Feng [Mon, 6 Aug 2018 01:08:55 +0000 (09:08 +0800)]
BaseTools: Debug message make confused

Debug message make confused

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=995

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Fix incorrect %EDK_TOOLS_PATH%
Yunhua Feng [Tue, 7 Aug 2018 01:35:33 +0000 (09:35 +0800)]
BaseTools: Fix incorrect %EDK_TOOLS_PATH%

For non-root folder, such as "X:\test", the EDK_TOOLS_PATH will
resolve to "X:\test\edk2\BaseTools". This is OK.

But if WORKSPACE is at a root folder, such as "X:\", the EDK_TOOLS_PATH
will look like "X:\\BaseTools". The *double backslash* can fail the command
like "del" and thus affect the %ERRORLEVEL% variable, which may break
subsequent build processing.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoShellPkg/acpi: Fix XCODE5 X64 build failure
Ruiyu Ni [Mon, 6 Aug 2018 06:29:00 +0000 (14:29 +0800)]
ShellPkg/acpi: Fix XCODE5 X64 build failure

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
5 years agoOvmfPkg/PlatformDebugLibIoPort: fix port detection for use in the DXE Core
Laszlo Ersek [Thu, 2 Aug 2018 23:29:13 +0000 (01:29 +0200)]
OvmfPkg/PlatformDebugLibIoPort: fix port detection for use in the DXE Core

The DXE Core is one of those modules that call
ProcessLibraryConstructorList() manually.

Before DxeMain() [MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c] calls
ProcessLibraryConstructorList(), and through it, our
PlatformDebugLibIoPortConstructor() function, DxeMain() invokes the
DEBUG() macro multiple times. That macro lands in our
PlatformDebugLibIoPortFound() function -- which currently relies on the
"mDebugIoPortFound" global variable that has (not yet) been set by the
constructor. As a result, early debug messages from the DXE Core are lost.

Move the device detection into PlatformDebugLibIoPortFound(), also caching
the fact (not just the result) of the device detection.

(We could introduce a separate DebugLib instance just for the DXE Core,
but the above approach works for all modules that currently consume the
PlatformDebugLibIoPort instance (which means "everything but SEC").)

This restores messages such as:

> CoreInitializeMemoryServices:
>   BaseAddress - 0x7AF21000 Length - 0x3CDE000 MinimalMemorySizeNeeded - 0x10F4000

Keep the empty constructor function -- OVMF's DebugLib instances have
always had constructors; we had better not upset constructor dependency
ordering by making our instance(s) constructor-less.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: c09d9571300a089c35f5df2773b70edc25050d0d
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
[lersek@redhat.com: sanitize blank lines around "mDebugIoPortChecked"]

5 years agoMdeModulePkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:14:04 +0000 (10:14 +0800)]
MdeModulePkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
Now the DxeSmmPerformanceLib is not used by
any module. So remove it from edk2 code base to
avoid being used by mistake.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoShellPkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:10:49 +0000 (10:10 +0800)]
ShellPkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoVlv2TbltDevicePkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:10:15 +0000 (10:10 +0800)]
Vlv2TbltDevicePkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
5 years agoQuarkPlatformPkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:06:34 +0000 (10:06 +0800)]
QuarkPlatformPkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools/BinToPcd: Open output file as text file
Kinney, Michael D [Fri, 3 Aug 2018 20:47:33 +0000 (04:47 +0800)]
BaseTools/BinToPcd: Open output file as text file

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

Undo changes from following commit:

https://github.com/tianocore/edk2/commit/83964ebc5e74549d6efc7134af19150a0b2079aa

Change the open mode for the output file from 'wb' to 'w' so the
output file is written as a text file and not a binary file.

This resolves the issue where the text file was not writable from
Python 3.x and also removes b'' from output file when the string
was encoded as a bytearray.

Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by:YanYan Sun <yanyan.sun@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoShellPkg/acpi: Code cleanup to pass static code checker
Ruiyu Ni [Fri, 3 Aug 2018 02:46:34 +0000 (10:46 +0800)]
ShellPkg/acpi: Code cleanup to pass static code checker

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
5 years agoMdePkg/BaseLib: Add an additional check within AsciiStriCmp
Ruiyu Ni [Fri, 3 Aug 2018 02:42:45 +0000 (10:42 +0800)]
MdePkg/BaseLib: Add an additional check within AsciiStriCmp

This commit adds an addtional check in AsciiStriCmp. It
explicitly checks the end of the sting pointed by 'SecondString' to make
the code logic easier for reading and to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
5 years agoBaseTools/Pkcs7Sign: Add PKCS7 test key include files
Kinney, Michael D [Mon, 16 Apr 2018 05:02:05 +0000 (22:02 -0700)]
BaseTools/Pkcs7Sign: Add PKCS7 test key include files

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

Add PCD statement include files for the PKCS7 test key.
* gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer
* gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr

These include files can be used in !include statements in PCD
sections of a platform DSC file to assign these PCDs to the
test key certificate values.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit
Marcin Wojtas [Thu, 2 Aug 2018 20:50:54 +0000 (22:50 +0200)]
ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit

According to the SBSA specification the Watchdog Compare
Register is split into two separate 32bit registers.
EDK2 code uses a single 64bit transaction to update
them, which can be problematic, depending on the SoC
implementation and could result in unpredictable behavior.

Fix this by modifying WatchdogWriteCompareRegister routine to
use two consecutive 32bit writes to the Watchdog Compare Register
Low and High, using new dedicated macros.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoBaseTools: Guid.xref doesn't specify the correct GUID value for Driver
Yunhua Feng [Tue, 31 Jul 2018 01:44:41 +0000 (09:44 +0800)]
BaseTools: Guid.xref doesn't specify the correct GUID value for Driver

In DSC, we can define the driver with the different FILE GUID. So this
driver name and its FILE GUID should also be listed in Build output
Guid.xref. But now, Guid.xref still lists the driver MODULE_GUID.

The case in Platform.dsc:
  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
    <Defines>
      FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2
    <LibraryClasses>
      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/BinToPcd: Encode string returned from ByteArray()
Kinney, Michael D [Thu, 2 Aug 2018 21:22:23 +0000 (14:22 -0700)]
BaseTools/BinToPcd: Encode string returned from ByteArray()

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

The ByteArray() method returns a string with the hex bytes of
a PCD value.  Make sure the string is always encoded as a string,
so it can be used to build a complete PCD statement string and be
written out to a file.  This change is required for Python 3.x
compatibility.

Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoNetworkPkg/HttpDxe: Strip square brackets in IPv6 expressed HostName.
Jiaxin Wu [Fri, 20 Jul 2018 02:30:13 +0000 (10:30 +0800)]
NetworkPkg/HttpDxe: Strip square brackets in IPv6 expressed HostName.

*v2: Optimize the patch by calculating AsciiStrSize() only once.

In URI, the colon (:) is used to terminate the HostName path before
a port number. However, if HostName is expressed as IPv6 format, colon
characters in IPv6 addresses will conflict with the colon before port
number. To alleviate this conflict in URI, the IPv6 expressed HostName
are enclosed in square brackets ([]). To record the real IPv6 HostName,
square brackets should be stripped.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Add NULL check to the return buffers
Star Zeng [Thu, 2 Aug 2018 01:14:59 +0000 (09:14 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Add NULL check to the return buffers

Add NULL check to the return buffers from GetFmpHandleBufferByType().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Hao A Wu <Hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao A Wu <Hao.a.wu@intel.com>
5 years agoMdeModulePkg/BdsDxe: Move display of test key usage into BDS module
Kinney, Michael D [Wed, 21 Mar 2018 02:34:55 +0000 (19:34 -0700)]
MdeModulePkg/BdsDxe: Move display of test key usage into BDS module

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Remove useless lib mapping in dsc
Star Zeng [Wed, 1 Aug 2018 07:44:43 +0000 (00:44 -0700)]
FmpDevicePkg: Remove useless lib mapping in dsc

NOTE: This patch is based on thread
https://lists.01.org/pipermail/edk2-devel/2018-July/027810.html.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Fix XCODE build failure
Star Zeng [Wed, 1 Aug 2018 08:24:53 +0000 (16:24 +0800)]
FmpDevicePkg FmpDxe: Fix XCODE build failure

FmpDxe.c:517:18: error: equality comparison with extraneous
parentheses [-Werror,-Wparentheses-equality]

NOTE: This patch is based on thread
https://lists.01.org/pipermail/edk2-devel/2018-July/027810.html.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Use local variable to store test key digest size
Star Zeng [Tue, 31 Jul 2018 02:25:49 +0000 (10:25 +0800)]
FmpDevicePkg FmpDxe: Use local variable to store test key digest size

Some static tool reports "the condition in 'if' statement is constant".

This patch updates the code to use local variable to store test key
digest size. It can pass the static tool's check.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg: Fix code style issue
Star Zeng [Mon, 30 Jul 2018 09:47:57 +0000 (17:47 +0800)]
FmpDevicePkg: Fix code style issue

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Initialize DeviceLibLowestSupportedVersion
Star Zeng [Mon, 30 Jul 2018 02:35:09 +0000 (10:35 +0800)]
FmpDevicePkg FmpDxe: Initialize DeviceLibLowestSupportedVersion

Some static tool reports "DeviceLibLowestSupportedVersion" is used,
but is uninitialized. It is false positive reporting based because
DeviceLibLowestSupportedVersion will have assigned value after
FmpDeviceGetLowestSupportedVersion() returns SUCCESS.

This patch updates the code to initialize
DeviceLibLowestSupportedVersion
to DEFAULT_LOWESTSUPPORTEDVERSION before calling
FmpDeviceGetLowestSupportedVersion().
It can pass the static tool's check.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Return UNSUPPORTED if device has been locked
Star Zeng [Sat, 28 Jul 2018 13:56:47 +0000 (21:56 +0800)]
FmpDevicePkg FmpDxe: Return UNSUPPORTED if device has been locked

Instead of EFI_ACCESS_DENIED which is not defined in retval by
UEFI spec, return UNSUPPORTED if device has been locked in
SetTheImage().

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Add comment in mFmpDeviceLocked's declaration
Star Zeng [Sat, 28 Jul 2018 01:57:01 +0000 (09:57 +0800)]
FmpDevicePkg FmpDxe: Add comment in mFmpDeviceLocked's declaration

Add comment in mFmpDeviceLocked's declaration to make it more clear.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Use Attributes to know whether reset is required
Star Zeng [Wed, 18 Jul 2018 11:00:32 +0000 (19:00 +0800)]
FmpDevicePkg FmpDxe: Use Attributes to know whether reset is required

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

Use Attributes to know whether reset is required and remove
PcdFmpDeviceSystemResetRequired.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Check ImageIndex first before Image/ImageSize
Star Zeng [Sat, 28 Jul 2018 01:22:03 +0000 (09:22 +0800)]
FmpDevicePkg FmpDxe: Check ImageIndex first before Image/ImageSize

It does not make sense to check the Image/ImageSize if ImageIndex
has been invalid.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2
Star Zeng [Sat, 28 Jul 2018 01:16:54 +0000 (09:16 +0800)]
FmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg: Remove DisplayUpdateProgressLib mapping for FmpDxe
Star Zeng [Sat, 28 Jul 2018 01:11:19 +0000 (09:11 +0800)]
FmpDevicePkg: Remove DisplayUpdateProgressLib mapping for FmpDxe

FmpDxe does not consume DisplayUpdateProgressLib, so remove the
mapping in FmpDevicePkg.dsc.
Also rename the ESRT GUIDs.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Fix typo "EFI_SECURITY_VIOLATIO"
Star Zeng [Fri, 27 Jul 2018 11:11:10 +0000 (19:11 +0800)]
FmpDevicePkg FmpDxe: Fix typo "EFI_SECURITY_VIOLATIO"

Fix typo "EFI_SECURITY_VIOLATIO" to "EFI_SECURITY_VIOLATION".

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Add EFI_ABORTED in retval of CheckTheImage()
Star Zeng [Wed, 25 Jul 2018 10:26:43 +0000 (18:26 +0800)]
FmpDevicePkg FmpDxe: Add EFI_ABORTED in retval of CheckTheImage()

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Check Progress!= NULL before calling Progress(100)
Star Zeng [Wed, 25 Jul 2018 10:22:54 +0000 (18:22 +0800)]
FmpDevicePkg FmpDxe: Check Progress!= NULL before calling Progress(100)

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg: Add DISABLE_NEW_DEPRECATED_INTERFACES build options
Star Zeng [Wed, 25 Jul 2018 09:22:10 +0000 (17:22 +0800)]
FmpDevicePkg: Add DISABLE_NEW_DEPRECATED_INTERFACES build options

Add DISABLE_NEW_DEPRECATED_INTERFACES build options to make sure
no deprecated interface used in this package.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg: Remove IPF
Star Zeng [Fri, 20 Jul 2018 09:19:56 +0000 (17:19 +0800)]
FmpDevicePkg: Remove IPF

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Return 0 when LSV check is not required
Star Zeng [Thu, 19 Jul 2018 10:29:52 +0000 (18:29 +0800)]
FmpDevicePkg FmpDxe: Return 0 when LSV check is not required

Current code return 1 when LSV check is not required,
but 1 LSV will make 0 Version capsule image update failed.

0 LSV is valid, this patch updates the code to return 0 when
LSV check is not required
We can see even the DEFAULT_LOWESTSUPPORTEDVERSION is 0.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg FmpDxe: Update function comment for FmpDxeEntryPoint
Star Zeng [Thu, 19 Jul 2018 05:44:28 +0000 (13:44 +0800)]
FmpDevicePkg FmpDxe: Update function comment for FmpDxeEntryPoint

FmpDxeEntryPoint is used by both FmpDxe and FmpDxeLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoFmpDevicePkg: Add DSC file to build all package components
Kinney, Michael D [Wed, 4 Apr 2018 17:31:50 +0000 (10:31 -0700)]
FmpDevicePkg: Add DSC file to build all package components

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Adds a DSC file that is used to verify that all of the
FmpDevicePkg libraries and modules build without error.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add FmpDxe module
Kinney, Michael D [Wed, 4 Apr 2018 17:31:06 +0000 (10:31 -0700)]
FmpDevicePkg: Add FmpDxe module

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

The FmpDxe directory contains 2 INF files.  FmpDxe.inf
is a DXE driver that is used in a platform to add a
Firmware Management Protocol for firmware device that
supports firmware updates.

FmpDxeLib.inf is a NULL library instance with the exact
same functionality as FmpDxe.inf, but allows the the
Firmware Management Protocol feature to be added to
an existing device driver.

The FmpDxe component is intended to be used "as is"
with no need for any device specific or platform specific
changes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add library instances
Kinney, Michael D [Wed, 4 Apr 2018 17:27:21 +0000 (10:27 -0700)]
FmpDevicePkg: Add library instances

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Add library instances for FmpDeviceLib, CapsuleUpdatePolicyLib,
and FmpPayloadHeaderLib.

Library Classes
===============
* FmpDeviceLibNull - Non-functional template of the FmpDeviceLib
  that can be used as a starting point for an FmpDeviceLib for
  a specific firmware storage device.
* CapsuleUpdatePolicyLibNull - Functional template of the
  CapsuleUpdatePolicyLib that can be used as a starting point
  of a platform specific implementation.
* FmpPayloadHeaderLibV1 - Version 1 of the FmpPayloadHeaderLib.
  This library is indented to be used "as is" with no need for
  any device specific or platform specific changes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add package, library classes, and PCDs
Kinney, Michael D [Wed, 14 Mar 2018 22:05:29 +0000 (15:05 -0700)]
FmpDevicePkg: Add package, library classes, and PCDs

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Create FmpDevicePkg with library classes and PCDs used to
customize the behavior of a Firmware Management Protocol
instance.

Library Classes
===============
* FmpDeviceLib - Provides firmware device specific services
  to support updates of a firmware image stored in a firmware
  device.
* CapsuleUpdatePolicyLib - Provides platform policy services
  used during a capsule update.
* FmpPayloadHeaderLib - Provides services to retrieve values
  from a capsule's FMP Payload Header.  The structure is not
  included in the library class.  Instead, services are
  provided to retrieve information from the FMP Payload Header.
  If information is added to the FMP Payload Header, then new
  services may be added to this library class to retrieve the
  new information.

PCDs set per module
====================
* PcdFmpDeviceSystemResetRequired - Indicates if a full
  system reset is required before a firmware update to a
  firmware devices takes effect
* PcdFmpDeviceTestKeySha256Digest - The SHA-256 hash of a
  PKCS7 test key that is used to detect if a test key is
  being used to authenticate capsules.  Test key detection
  is disabled by setting the value to {0}.
* PcdFmpDeviceProgressColor - The color of the progress bar
  during a firmware update.
* PcdFmpDeviceImageIdName - The Null-terminated Unicode
  string used to fill in the ImageIdName field of the
  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned
  by the GetImageInfo() service of the Firmware Management
  Protocol for the firmware device.
* PcdFmpDeviceBuildTimeLowestSupportedVersion - The build
  time value used to fill in the LowestSupportedVersion field
  of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is
  returned by the GetImageInfo() service of the Firmware
  Management Protocol.
* PcdFmpDeviceProgressWatchdogTimeInSeconds - The time in
  seconds to arm a watchdog timer during the update of a
  firmware device.

PCDs set per module or for entire platform
==========================================
* PcdFmpDevicePkcs7CertBufferXdr - One or more PKCS7
  certificates used to verify a firmware device capsule
  update image.
* PcdFmpDeviceLockEventGuid - An event GUID that locks
  the firmware device when the event is signaled.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoBaseTools/Capsule: Support capsules without a payload header
Kinney, Michael D [Sun, 29 Jul 2018 17:57:12 +0000 (10:57 -0700)]
BaseTools/Capsule: Support capsules without a payload header

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

Update --dump-info and --decode to show auth header information
even if a payload header is not present.  The --decode operation
still fails if a payload header is not present.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Prevent traceback during signing operations
Kinney, Michael D [Sun, 29 Jul 2018 17:01:37 +0000 (10:01 -0700)]
BaseTools/Capsule: Prevent traceback during signing operations

https://bugzilla.tianocore.org/show_bug.cgi?id=1046
https://bugzilla.tianocore.org/show_bug.cgi?id=1048
https://bugzilla.tianocore.org/show_bug.cgi?id=1050

Remove raise statements that generate Tracebacks that were only
intended for development/debug.  With the raise statements removed
proper error messages are shown.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Update file header with tool limitations
Kinney, Michael D [Sat, 28 Jul 2018 07:32:34 +0000 (00:32 -0700)]
BaseTools/Capsule: Update file header with tool limitations

Update file header to state that the tool does not support:
* Multiple payloads
* Drivers
* Vendor code bytes

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Update help for --fw-version and --lsv
Kinney, Michael D [Sat, 28 Jul 2018 07:18:40 +0000 (00:18 -0700)]
BaseTools/Capsule: Update help for --fw-version and --lsv

Update help to state that --fw-version and -=-lsv are required
for encode operations that sign a payload.

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Do not support -o with --dump-info
Kinney, Michael D [Sat, 28 Jul 2018 07:10:51 +0000 (00:10 -0700)]
BaseTools/Capsule: Do not support -o with --dump-info

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Fix CertType GUID byte order
Kinney, Michael D [Sat, 28 Jul 2018 07:00:08 +0000 (00:00 -0700)]
BaseTools/Capsule: Fix CertType GUID byte order

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Remove support for PopulateSystemTable
Kinney, Michael D [Fri, 27 Jul 2018 19:31:22 +0000 (12:31 -0700)]
BaseTools/Capsule: Remove support for PopulateSystemTable

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Add max value checks to Capsule Generation tools
Kinney, Michael D [Fri, 27 Jul 2018 19:27:19 +0000 (12:27 -0700)]
BaseTools/Capsule: Add max value checks to Capsule Generation tools

https://bugzilla.tianocore.org/show_bug.cgi?id=1021
https://bugzilla.tianocore.org/show_bug.cgi?id=1022
https://bugzilla.tianocore.org/show_bug.cgi?id=1026

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools GenerateCapsule: Change property to executable for Linux
Star Zeng [Mon, 16 Jul 2018 10:22:47 +0000 (18:22 +0800)]
BaseTools GenerateCapsule: Change property to executable for Linux

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoBaseTools/Capsule: Add Capsule Generation Tools
Kinney, Michael D [Wed, 2 May 2018 03:54:46 +0000 (20:54 -0700)]
BaseTools/Capsule: Add Capsule Generation Tools

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

Based on content from the following branch

https://github.com/Microsoft/MS_UEFI/tree/share/beta/CapsuleTools

* Convert C tools to Python
* Add common python modules to:
    BaseTools/Source/Python/Common/Uefi/Capsule
    BaseTools/Source/Python/Common/Edk2/Capsule
* Add GenerateCapsule.py to BaseTools/Source/Python/Capsule
* Add Windows and Posix wrappers for GenerateCapsule.py

usage: GenerateCapsule [-h] [-o OUTPUTFILE] (-e | -d | --dump-info)
                       [--capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}]
                       [--capoemflag CAPSULEOEMFLAG] [--guid GUID]
                       [--hardware-instance HARDWAREINSTANCE]
                       [--monotonic-count MONOTONICCOUNT]
                       [--fw-version FWVERSION] [--lsv LOWESTSUPPORTEDVERSION]
                       [--pfx-file SIGNTOOLPFXFILE]
                       [--signer-private-cert OPENSSLSIGNERPRIVATECERTFILE]
                       [--other-public-cert OPENSSLOTHERPUBLICCERTFILE]
                       [--trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE]
                       [--signing-tool-path SIGNINGTOOLPATH] [--version] [-v]
                       [-q] [--debug [0-9]]
                       InputFile

Generate a capsule. Copyright (c) 2018, Intel Corporation. All rights
reserved.

positional arguments:
  InputFile             Input binary payload filename.

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUTFILE, --output OUTPUTFILE
                        Output filename.
  -e, --encode          Encode file
  -d, --decode          Decode file
  --dump-info           Display FMP Payload Header information
  --capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}
                        Capsule flag can be PersistAcrossReset, or
                        PopulateSystemTable or InitiateReset or not set
  --capoemflag CAPSULEOEMFLAG
                        Capsule OEM Flag is an integer between 0x0000 and
                        0xffff.
  --guid GUID           The FMP/ESRT GUID in registry format. Required for
                        encode operations.
  --hardware-instance HARDWAREINSTANCE
                        The 64-bit hardware instance. The default is
                        0x0000000000000000
  --monotonic-count MONOTONICCOUNT
                        64-bit monotonic count value in header. Default is
                        0x0000000000000000.
  --fw-version FWVERSION
                        The 32-bit version of the binary payload (e.g.
                        0x11223344 or 5678).
  --lsv LOWESTSUPPORTEDVERSION
                        The 32-bit lowest supported version of the binary
                        payload (e.g. 0x11223344 or 5678).
  --pfx-file SIGNTOOLPFXFILE
                        signtool PFX certificate filename.
  --signer-private-cert OPENSSLSIGNERPRIVATECERTFILE
                        OpenSSL signer private certificate filename.
  --other-public-cert OPENSSLOTHERPUBLICCERTFILE
                        OpenSSL other public certificate filename.
  --trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE
                        OpenSSL trusted public certificate filename.
  --signing-tool-path SIGNINGTOOLPATH
                        Path to signtool or OpenSSL tool. Optional if path to
                        tools are already in PATH.
  --version             show program's version number and exit
  -v, --verbose         Turn on verbose output with informational messages
                        printed, including capsule headers and warning
                        messages.
  -q, --quiet           Disable all messages except fatal errors.
  --debug [0-9]         Set debug level

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Use pickle to replace cPickle
Yunhua Feng [Tue, 31 Jul 2018 08:32:57 +0000 (16:32 +0800)]
BaseTools: Use pickle to replace cPickle

Use pickle to replace cPickle because of python3 removed cPickle

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: remove unused import thread
Yunhua Feng [Tue, 31 Jul 2018 07:19:28 +0000 (15:19 +0800)]
BaseTools: remove unused import thread

remove unused import thread

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix VS2017 compilation errors
AlexeiFedorov [Fri, 13 Jul 2018 15:17:01 +0000 (23:17 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2017 compilation errors

This patch fixes VS2017 compilation errors for
UefiShellAcpiViewCommandLib\Parsers\Gtdt\GtdtParser.c
and
UefiShellAcpiViewCommandLib\Parsers\Xsdt\XsdtParser.c
reported in
https://bugzilla.tianocore.org/show_bug.cgi?id=985
https://bugzilla.tianocore.org/show_bug.cgi?id=986

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
Kinney, Michael D [Tue, 31 Jul 2018 16:24:20 +0000 (09:24 -0700)]
BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue

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

Convert Buffer to type bytearray before converting to a
string of hex byte values so the type of items in Buffer is
consistent for both Python 2.7.x and Python 3.x.

Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoArmPkg: Add initial OpteeLib implementation
Sumit Garg [Wed, 1 Aug 2018 06:07:41 +0000 (11:37 +0530)]
ArmPkg: Add initial OpteeLib implementation

This is initial version of OP-TEE library that provides api's to
communicate with OP-TEE OS (Trusted OS based on ARM TrustZone) via
secure monitor calls. Currently it provides basic api to detect OP-TEE
presence via UID matching.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoMdePkg FirmwareManagement.h: Fix code style issue
Star Zeng [Mon, 30 Jul 2018 09:43:13 +0000 (17:43 +0800)]
MdePkg FirmwareManagement.h: Fix code style issue

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hess Chen <hesheng.chen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Free HandleBuffer after it is used
Star Zeng [Mon, 30 Jul 2018 06:47:28 +0000 (14:47 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Free HandleBuffer after it is used

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg DxeCapsuleLib: Use Attr to know whether reset is required
Star Zeng [Thu, 26 Jul 2018 05:38:34 +0000 (13:38 +0800)]
MdeModulePkg DxeCapsuleLib: Use Attr to know whether reset is required

Current DxeCapsuleLibFmp always do reset for FMP capsule.
Actually, the code should use Attributes from FMP descriptor to know
whether reset is required or not.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoSignedCapsulePkg SystemFirmwareReportDxe: Try LocateProtocol
Star Zeng [Mon, 30 Jul 2018 05:42:41 +0000 (13:42 +0800)]
SignedCapsulePkg SystemFirmwareReportDxe: Try LocateProtocol

Try LocateProtocol after HandleProtocol fails to be compatible
with old SystemFirmwareUpdateDxe.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix GCC build failure
Dandan Bi [Mon, 30 Jul 2018 01:59:47 +0000 (09:59 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix GCC build failure

Fix following GCC build issues:
1.
xxx/SratParser.c:127:47: error:
initialization from incompatible pointer type
[-Werror=incompatible-pointer-types]
{L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
                                            ^
xxx/SratParser.c:127:47: note:
(near initialization for 'SratApciSapicAffinityParser[6].PrintFormatter')

2.
xxx\UefiShellAcpiViewCommandLib.c:66:14:
error: 'Status' may be used uninitialized in this fu
nction [-Werror=maybe-uninitialized]
   EFI_STATUS Status;
              ^

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure
Dandan Bi [Mon, 30 Jul 2018 01:31:36 +0000 (09:31 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure

Fix following build error:
UefiShellAcpiViewCommandLib\AcpiParser.c(519) :
error C2308: concatenating mismatched strings
Concatenating wide "ERROR: %a: Offset Mismatch for %s"
with narrow "CurrentOffset = %d FieldOffset = %d"

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure
Dandan Bi [Mon, 30 Jul 2018 01:25:11 +0000 (09:25 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure

Fix following build error:
xxx\AcpiParser.c(487) : error C2275: 'UINTN' :
illegal use of this type as an expression
xxx\ProcessorBind.h(224) : see declaration of 'UINTN'
xxx\AcpiParser.c(487) : error C2146: syntax error :
missing ';' before identifier 'OriginalAttribute'
xxx\AcpiParser.c(487) : error C2065: 'OriginalAttribute' :
undeclared identifier
......

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference
Hao Wu [Mon, 30 Jul 2018 05:20:13 +0000 (13:20 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference

Within function GetUefiMemoryAttributesTable(), add a check to avoid
possible null pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdePkg/SmmMemLib: Avoid possible NULL ptr dereference
Hao Wu [Mon, 30 Jul 2018 05:17:31 +0000 (13:17 +0800)]
MdePkg/SmmMemLib: Avoid possible NULL ptr dereference

Within function SmmMemLibInternalGetUefiMemoryAttributesTable(), add a
check to avoid possible null pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoBaseTools: Update build report for StructurePcd value
Yunhua Feng [Wed, 25 Jul 2018 04:26:09 +0000 (12:26 +0800)]
BaseTools: Update build report for StructurePcd value

Update build report to display the structure Pcd value that from
FDF file.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Fix build crash when fdf is empty file
Yunhua Feng [Wed, 25 Jul 2018 04:21:54 +0000 (12:21 +0800)]
BaseTools: Fix build crash when fdf is empty file

Fix build crash when fdf is empty file

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=912

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Fix typo "EsrtSyncFmp" to "SyncEsrtFmp"
Star Zeng [Fri, 27 Jul 2018 11:05:54 +0000 (19:05 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Fix typo "EsrtSyncFmp" to "SyncEsrtFmp"

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
5 years agoSecurityPkg:DSC: Fix 2 DSC build error
Zhang, Chao B [Sat, 28 Jul 2018 05:33:33 +0000 (13:33 +0800)]
SecurityPkg:DSC: Fix 2 DSC build error

Error is caused by SHA384/SHA512 hash lib change in.

Cc: Bi Dandan <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
5 years agoSecurityPkg: HashLib: Add SHA384, SHA512 HashLib
Zhang, Chao B [Wed, 6 Jun 2018 03:24:54 +0000 (11:24 +0800)]
SecurityPkg: HashLib: Add SHA384, SHA512 HashLib

Add SHA384, 512 Hash lib support. Now only CryptoPkg support PEI/DXE
version.

Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang Chao B <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
5 years agoMdeModulePkg CapsuleApp: Check capsule header for -D and -N options
Star Zeng [Thu, 26 Jul 2018 08:59:43 +0000 (16:59 +0800)]
MdeModulePkg CapsuleApp: Check capsule header for -D and -N options

Then meaningful error message can be shown when the input image is
unexpected.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Prompt info for -C option
Star Zeng [Thu, 26 Jul 2018 02:14:00 +0000 (10:14 +0800)]
MdeModulePkg CapsuleApp: Prompt info for -C option

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Index need be decimal for -P GET option
Star Zeng [Thu, 26 Jul 2018 01:58:00 +0000 (09:58 +0800)]
MdeModulePkg CapsuleApp: Index need be decimal for -P GET option

Also adjust the help information to be not too long to be suitable
for different display resolutions.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Refine -N option help information
Star Zeng [Wed, 25 Jul 2018 11:26:40 +0000 (19:26 +0800)]
MdeModulePkg CapsuleApp: Refine -N option help information

-N option is used to append a Capsule Header to an existing
FMP capsule image with its ImageTypeId supported by the system.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Fix -D failed to dump Nest FMP capsule
Star Zeng [Thu, 19 Jul 2018 03:03:25 +0000 (11:03 +0800)]
MdeModulePkg CapsuleApp: Fix -D failed to dump Nest FMP capsule

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Fix VS2012 build failure caused by 5410502
Star Zeng [Tue, 24 Jul 2018 09:02:47 +0000 (17:02 +0800)]
MdeModulePkg CapsuleApp: Fix VS2012 build failure caused by 5410502

The build failure is like below.
xxx\CapsuleApp.c(868) : error C2275: 'EFI_GUID' :
  illegal use of this type as an expression
        xxx/UefiBaseType.h(29) : see declaration of 'EFI_GUID'
xxx\CapsuleApp.c(868) : error C2146: syntax error :
  missing ';' before identifier 'ImageTypeId'
xxx\CapsuleApp.c(868) : error C2065: 'ImageTypeId' : undeclared identifier
xxx\CapsuleApp.c(869) : error C2275: 'UINTN' :
  illegal use of this type as an expression
        xxx\ProcessorBind.h(224) : see declaration of 'UINTN'
xxx\CapsuleApp.c(869) : error C2146: syntax error :
  missing ';' before identifier 'ImageIndex'
xxx\CapsuleApp.c(869) : error C2065: 'ImageIndex' : undeclared identifier

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Refine the code to check FmpImageSize
Star Zeng [Thu, 26 Jul 2018 05:57:11 +0000 (13:57 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Refine the code to check FmpImageSize

The code to check FmpImageSize again OFFSET_OF
(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance)
can be refined to check against FmpImageHeaderSize.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg/BdsDxe: Call PlatformBootManagerUnableToBoot()
Ruiyu Ni [Tue, 3 Jul 2018 06:28:50 +0000 (14:28 +0800)]
MdeModulePkg/BdsDxe: Call PlatformBootManagerUnableToBoot()

When no boot option can be launched, BDS core calls
PlatformBootManagerUnableToBoot() to let platform BdsDxe handle it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
5 years agoMdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"
Ruiyu Ni [Tue, 3 Jul 2018 06:16:45 +0000 (14:16 +0800)]
MdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"

Commit d1de487dd2e77f4741abcbd71d19a8c93971fda0
"MdeModulePkg/BdsDxe: fall back to a Boot Manager Menu loop before
 hanging"
changed BDS core to fall back to UI loop when no bootable option
can be launched.
Now since PlatformBootManagerUnableToBoot() is added, the commit
can be reverted.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoArmVirtPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Wed, 4 Jul 2018 01:43:02 +0000 (09:43 +0800)]
ArmVirtPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
5 years agoArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Wed, 4 Jul 2018 01:32:47 +0000 (09:32 +0800)]
ArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoQuarkPlatform/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:08:07 +0000 (14:08 +0800)]
QuarkPlatform/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
5 years agoNt32Pkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:06:34 +0000 (14:06 +0800)]
Nt32Pkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <Hao.a.wu@intel.com>
5 years agoOvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:04:55 +0000 (14:04 +0800)]
OvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@linaro.org>
5 years agoCorebootPayload/PlatformBDS: Impl PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 05:22:16 +0000 (13:22 +0800)]
CorebootPayload/PlatformBDS: Impl PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
5 years agoMdeModulePkg/PlatformBootManager: Add PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 05:19:28 +0000 (13:19 +0800)]
MdeModulePkg/PlatformBootManager: Add PlatformBootManagerUnableToBoot

The patch adds a new API PlatformBootManagerUnableToBoot()
to PlatformBootManagerLib.
The new API is provided by platform bds library and is called when
no boot option could be launched.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
5 years agoBaseTools: Fix bug about *M value not display decimal and hexadecimal
Yunhua Feng [Tue, 24 Jul 2018 11:30:11 +0000 (19:30 +0800)]
BaseTools: Fix bug about *M value not display decimal and hexadecimal

V2: Add the check for Pcd DatumType

report format like as below:
 *M     Shell.inf         = 0xFF (255)

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Parse decimal format INF_VERSION incorrect
Yunhua Feng [Wed, 25 Jul 2018 03:21:07 +0000 (11:21 +0800)]
BaseTools: Parse decimal format INF_VERSION incorrect

hex number 0x00010019, the major number is 0001, the
minor number is 0019.
the decimal number 1.25, the major number is 1, and the
minor number is 25

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=921

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice
Thomas Palmer [Tue, 3 Jul 2018 15:32:53 +0000 (23:32 +0800)]
MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg FvSimpleFileSystemDxe: Fix memory leak in Read function
Vladimir Olovyannikov [Wed, 25 Jul 2018 19:47:49 +0000 (03:47 +0800)]
MdeModulePkg FvSimpleFileSystemDxe: Fix memory leak in Read function

FvSimpleFileSystem on read always allocates a FileBuffer, and never frees
it. This causes memory leaks. It is especially bad for reading scripts
line-by-line. In some cases memory leak can exceed 1GB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vladimir Olovyannikiov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/DxeCore: Not update RtCode in MemAttrTable after EndOfDxe
Jiewen Yao [Fri, 24 Nov 2017 01:21:54 +0000 (09:21 +0800)]
MdeModulePkg/DxeCore: Not update RtCode in MemAttrTable after EndOfDxe

We want to provide precise info in MemAttribTable
to both OS and SMM, and SMM only gets the info at EndOfDxe.
So we do not update RtCode entry in EndOfDxe.

The impact is that if 3rd part OPROM is runtime, it cannot be executed
at UEFI runtime phase.
Currently, we do not see compatibility issue, because the only runtime
OPROM we found before in UNDI, and UEFI OS will not use UNDI interface
in OS.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/PiSmmCpu: Check EFI_RUNTIME_RO in UEFI mem attrib table.
Jiewen Yao [Wed, 22 Nov 2017 15:11:54 +0000 (23:11 +0800)]
UefiCpuPkg/PiSmmCpu: Check EFI_RUNTIME_RO in UEFI mem attrib table.

It treats the UEFI runtime page with EFI_MEMORY_RO attribute as
invalid SMM communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdePkg/SmmMemLib: Check EFI_MEMORY_RO in UEFI mem attrib table.
Jiewen Yao [Wed, 22 Nov 2017 15:11:22 +0000 (23:11 +0800)]
MdePkg/SmmMemLib: Check EFI_MEMORY_RO in UEFI mem attrib table.

It treats the UEFI runtime page with EFI_MEMORY_RO attribute as
invalid SMM communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/DxeCore: Install UEFI mem attrib table at EndOfDxe.
Jiewen Yao [Wed, 22 Nov 2017 14:05:07 +0000 (22:05 +0800)]
MdeModulePkg/DxeCore: Install UEFI mem attrib table at EndOfDxe.

So that the SMM can consume it to set page protection for
the UEFI runtime page with EFI_MEMORY_RO attribute.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/PiSmmCpu: Check for untested memory in GCD
Jiewen Yao [Thu, 2 Nov 2017 11:00:02 +0000 (19:00 +0800)]
UefiCpuPkg/PiSmmCpu: Check for untested memory in GCD

It treats GCD untested memory as invalid SMM
communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdePkg/SmmMemLib: Check for untested memory in GCD
Jiewen Yao [Thu, 2 Nov 2017 10:21:13 +0000 (18:21 +0800)]
MdePkg/SmmMemLib: Check for untested memory in GCD

It treats GCD untested memory as invalid SMM
communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Not use disabled AP when call StartAllAPs.
Eric Dong [Thu, 26 Jul 2018 08:44:22 +0000 (16:44 +0800)]
UefiCpuPkg/MpInitLib: Not use disabled AP when call StartAllAPs.

Base on UEFI spec requirement, StartAllAPs function should not use the APs which has been disabled before. This patch just change current code to follow this rule.

V3 changes:
Only called by StartUpAllAps, WakeUpAp will not wake up the disabled APs, in other cases also need to include the disabled APs, such as CpuDxe driver start up and ChangeApLoopCallback function.

WakeUpAP() is called with (Broadcast && WakeUpDisabledAps) from MpInitLibInitialize(), CollectProcessorCount() and MpInitChangeApLoopCallback() only. The first two run before the PPI or Protocol user has a chance to disable any APs. The last one runs in response to the ExitBootServices and LegacyBoot events, after which the MP protocol is unusable. For this reason, it doesn't matter that an originally disabled AP's state is not restored to Disabled, when
WakeUpAP() is called with (Broadcast && WakeUpDisabledAps).

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/MpInitLib: Remove StartCount and volatile definition.
Eric Dong [Tue, 24 Jul 2018 14:29:53 +0000 (22:29 +0800)]
UefiCpuPkg/MpInitLib: Remove StartCount and volatile definition.

The patch includes below changes:
(1) It removes "volatile" from RunningCount, because only the BSP modifies it.
(2) When we detect a timeout in CheckAllAPs(), and collect the list of failed CPUs, the size of the list is derived from the following difference, before the patch:
  StartCount - FinishedCount
where "StartCount" is set by the BSP at startup, and FinishedCount is incremented by the APs themselves.
Here the patch replaces this difference with
  StartCount - RunningCount
that is, the difference is no more calculated from the BSP's startup counter and the AP's shared finish counter, but from the RunningCount measurement that the BSP does itself, in CheckAllAPs().
(3) Finally, the patch changes the meaning of RunningCount. Before the patch, we have:
- StartCount: the number of APs the BSP stars up,
- RunningCount: the number of finished APs that the BSP collected
After the patch, StartCount is removed, and RunningCount is *redefined* as the following difference:
  OLD_StartCount - OLD_RunningCount
Giving the number of APs that the BSP started up but hasn't collected yet.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>