]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoCryptoPkg/OpensslLib: remove clone commands
Jian J Wang [Mon, 8 Jul 2019 09:07:08 +0000 (17:07 +0800)]
CryptoPkg/OpensslLib: remove clone commands

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

edk2/Readme.md has added a section to explain the correct clone
commands for submodules. Detailed steps in the OpenSSL-HOWTO.txt
are removed to avoid any inconsistency.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoReadme.md: add submodule policy and clone commands
Jian J Wang [Mon, 8 Jul 2019 09:02:42 +0000 (17:02 +0800)]
Readme.md: add submodule policy and clone commands

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

A section 'Submodules' is added to clarify the submodule policy
in edk2 repo. Git commands are also added to show the correct
way to clone submodule repos, in which '--recursive' is removed
because it's not needed but recommended in other document.

Related commits:
Openssl-1.1.1b upgrade: acfb90911840c38a0beb9bcfe0065668244d2b4d
berkeley-softfloat-3:   3cc57695df5a6e8c65fb46b993836c315cabf49d

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/DxeCapsuleLibFmp: Improve comparisons in CapsuleOnDisk.c
Xu, Wei6 [Tue, 13 Aug 2019 10:53:49 +0000 (18:53 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Improve comparisons in CapsuleOnDisk.c

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

Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=).

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/CapsuleApp: Improve comparisons in CapsuleOnDisk.c
Xu, Wei6 [Tue, 13 Aug 2019 10:53:17 +0000 (18:53 +0800)]
MdeModulePkg/CapsuleApp: Improve comparisons in CapsuleOnDisk.c

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

Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=).

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools: Move buildoptions.py to Common folder
Bob Feng [Tue, 13 Aug 2019 09:39:39 +0000 (17:39 +0800)]
BaseTools: Move buildoptions.py to Common folder

buildoptions is used by build.py and TargetTxtClassObj.py
Move buildoptions.py to Common folder so that
build tool and ECC tool work fine.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDEvicePkg/FmpDeviceLibNull: Implement new APIs
Eric Jin [Sun, 11 Aug 2019 03:04:32 +0000 (11:04 +0800)]
FmpDEvicePkg/FmpDeviceLibNull: Implement new APIs

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg: Add APIs to FmpDeviceLib
Eric Jin [Sun, 11 Aug 2019 02:55:13 +0000 (10:55 +0800)]
FmpDevicePkg: Add APIs to FmpDeviceLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525
Add new APIs to FmpDevideLib to support multiple controllers
* RegisterFmpUninstaller()
* FmpDeviceSetContext()
* FmpDeviceGetHardwareInstance()

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg: Add UEFI_DRIVER support
Eric Jin [Fri, 26 Jul 2019 02:39:04 +0000 (10:39 +0800)]
FmpDevicePkg: Add UEFI_DRIVER support

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525
Allow libs to be used with modules of type UEFI_DRIVE.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix checking for Sources section in INF file
Rodriguez, Christian [Mon, 12 Aug 2019 15:32:11 +0000 (23:32 +0800)]
BaseTools: Fix checking for Sources section in INF file

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

The check to see if [Sources] section lists all the header type
files of a module is missing the exclusion of source files that
fall under the scope of Package includes. This change adds the
exclusions.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Add "-" in a re to parse line in .map file
Feng, Bob C [Tue, 13 Aug 2019 01:56:37 +0000 (09:56 +0800)]
BaseTools: Add "-" in a re to parse line in .map file

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

If there are multiple module instances with different
guid used in .dsc file, the temp path of the module will
contain 8-4-4-4-12 format guid string. So "-" need to be
added into the regular expression for parsing it correctly.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix incremental build bug
Feng, Bob C [Tue, 13 Aug 2019 04:09:17 +0000 (12:09 +0800)]
BaseTools: Fix incremental build bug

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

This is a build tool regression issue that
is introduced by multiple-process-autogen.

The workspace timestamp value is not pass
to module autogen object correctly, so build tool
does not detect the change of .dsc and ignore the autogen.

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoMdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++
Zhang, Shenglei [Mon, 12 Aug 2019 06:24:44 +0000 (14:24 +0800)]
MdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++

This commit will fix a GCC 4.8.5 build failure introduced by commit
b3527dedc3951f061c5a73cb4fb2b0f95f47e08b.

PageMapLevel5Entry may be uninitialized in original code, which means
uninitialized pointer will be modified at some circumstance.
So relocate the operation of PageMapLevel5Entry++ in order to make sure
the pointer could be modified only when it is initialized.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix coding style
Shenglei Zhang [Wed, 7 Aug 2019 02:06:10 +0000 (10:06 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix coding style

1. Update CPUStatus to CpuStatus in comments to align comments
   with code.
2. Add "OUT" attribute for "ProcedureArguments" parameter in function
   header.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoIntelFsp2Pkg/FspSecCore: Add missing header file in INF file
Shenglei Zhang [Tue, 6 Aug 2019 07:17:30 +0000 (15:17 +0800)]
IntelFsp2Pkg/FspSecCore: Add missing header file in INF file

SecFsp.h is used but missing inf file, which will cause generating
warning message.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
4 years agoShellPkg/UefiShellAcpiViewCommandLib: Add missing header files in INF
Shenglei Zhang [Tue, 6 Aug 2019 07:13:56 +0000 (15:13 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Add missing header files in INF

MadtParser.h and PpttParser.h are actually used but missing INF file,
which will generate warning message when building this package.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoMdePkg/BaseUefiDecompressLib: Add missing description for parameter
Shenglei Zhang [Tue, 6 Aug 2019 01:46:54 +0000 (09:46 +0800)]
MdePkg/BaseUefiDecompressLib: Add missing description for parameter

The description of parameter Version is missing in comments.
So add the description.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg: Add missing header files in INF files
Shenglei Zhang [Thu, 8 Aug 2019 03:12:04 +0000 (11:12 +0800)]
MdeModulePkg: Add missing header files in INF files

The header files are used but missing in INF,which causes
generating warning message when building them.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdePkg: Add MmAccess and MmControl definition.
Marc W Chen [Mon, 29 Jul 2019 04:25:56 +0000 (12:25 +0800)]
MdePkg: Add MmAccess and MmControl definition.

EFI MmAccess and MmControl PPIs are defined in the PI 1.5 specification.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2023
Signed-off-by: Marc W Chen <marc.w.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoReadme.md: Remove tag release from Readme
Liming Gao [Mon, 12 Aug 2019 02:09:15 +0000 (10:09 +0800)]
Readme.md: Remove tag release from Readme

The latest tag release can be found in Release Planning.
They are not required to be listed here.

Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMdeModulePkg/RegularExpressionDxe: Add two missing null pointer checks
Liming Gao [Mon, 12 Aug 2019 02:52:18 +0000 (10:52 +0800)]
MdeModulePkg/RegularExpressionDxe: Add two missing null pointer checks

After update Oniguruma from v6.9.0 to v6.9.3, two null pointer check
should be added.
This change bases on the patch https://edk2.groups.io/g/devel/message/45183.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg RegularExpressionDxe: Update Oniguruma from v6.9.0 to v6.9.3
Liming Gao [Thu, 8 Aug 2019 11:53:03 +0000 (19:53 +0800)]
MdeModulePkg RegularExpressionDxe: Update Oniguruma from v6.9.0 to v6.9.3

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2066
Update Oniguruma to the latest version v6.9.3.
Oniguruma https://github.com/kkos/oniguruma
This release is the security fix release. It includes the changes:
Fixed CVE-2019-13224
Fixed CVE-2019-13225
Fixed many problems (found by libfuzzer programs)

Verify VS2015, GCC5 build.
Verify RegularExpressionProtocol GetInfo() and Match() function.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL
Albecki, Mateusz [Fri, 9 Aug 2019 14:36:20 +0000 (22:36 +0800)]
MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL

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

This commit adds EDKII_UFS_HC_PLATFORM_PROTOCOL implementation
in UfsPassThruDxe driver in version 1. Driver assumes that at
most one instance of the protocol exists in the system. Presence
of the protocol is not mandatory.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Refactor private data to use UfsHcInfo
Albecki, Mateusz [Fri, 9 Aug 2019 14:36:19 +0000 (22:36 +0800)]
MdeModulePkg/UfsPassThruDxe: Refactor private data to use UfsHcInfo

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

Private data has been refactored to use EDKII_UFS_HC_INFO structure
to store host controller capabilities and version
information. Getting host controller data has been moved
into single place and is done before host controller enable.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function
Albecki, Mateusz [Fri, 9 Aug 2019 14:36:18 +0000 (22:36 +0800)]
MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function

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

UfsExecUicCommand function has been refactored to allow
the caller to check the command results which is important
for commands such as UIC read.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL
Albecki, Mateusz [Fri, 9 Aug 2019 14:36:17 +0000 (22:36 +0800)]
MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL

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

EDKII_UFS_HC_PLATFORM_PROTOCOL will allow the platform to inject
platform specific logic into standard UFS flows. Right now we
support callbacks pre and post host controller enable and pre
and post link startup. Provided callbacks allow the platform
driver to inject UIC programming after HCE is set which is
a standard initialization step covered by UFS specification as
well as cover some additional use cases during other callbacks.
For instance platform driver may switch to fast mode after link
startup.

We also allow the platform to override host controller capabilities
and version which might be useful to manage silicon bugs or
allow testing experimental features from new versions of the
specification.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checked
Gao, Zhichao [Mon, 12 Aug 2019 15:36:21 +0000 (08:36 -0700)]
ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checked

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

ShellPkg\Library\UefiShellLevel2CommandsLib\Cp.c line 104 and
ShellPkg\Library\UefiShellLevel2CommandsLib\Mv.c line 640, the
pointer variable Response may be a NULL pointer. So we should
make sure that it isn't NULL before dereference it.

If Response is NULL that indicates a EFI_OUT_OF_RESOURCES
error, directly return SHELL_ABORTED.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg: acpiview: SRAT: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:07 +0000 (16:44 -0700)]
ShellPkg: acpiview: SRAT: Prevent buffer overruns

Modify the SRAT parsing logic to prevent reading past the table buffer
length provided.

Check if the Static Resource Allocation Structure's buffer fits in the
SRAT table buffer before its contents are dumped.

Prevent buffer overruns when reading the Static Resource Allocation
Structure's header.

References:
- ACPI 6.3, January 2019, Section 5.2.16

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg: acpiview: PPTT: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:06 +0000 (16:44 -0700)]
ShellPkg: acpiview: PPTT: Prevent buffer overruns

Modify the PPTT table parsing logic to prevent reading past the ACPI
buffer lengths provided.

Check if the Number of Private Resources specified in the Processor
Hierarchy Node (Type 0) is possible given the Type 0 Structure's buffer
length.

Make sure that the processor topology structure's buffer fits in the
PPTT table buffer before its contents are dumped.

Prevent buffer overruns when reading the processor topology structure's
header.

References:
- ACPI 6.3, January 2019, Section 5.2.29

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg: acpiview: MADT: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:05 +0000 (16:44 -0700)]
ShellPkg: acpiview: MADT: Prevent buffer overruns

Modify the parsing logic to prevent reading past the MADT table buffer
length provided when parsing the Interrupt Controller Structure header.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg: acpiview: IORT: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:04 +0000 (16:44 -0700)]
ShellPkg: acpiview: IORT: Prevent buffer overruns

Modify the IORT table parsing logic to prevent reading past the buffer
lengths provided.

Change DumpIortNodeIdMappings() function's signature and implementation
to simplify buffer overrun prevention. Update all calls to this
function accordingly.

Modify the parser for each type of IORT node such that the offset from
the start of the node's buffer is tracked as the parsing function is
executed. Again, this change helps prevent buffer overruns.

Test that the IORT node buffer fits in the table buffer before the
node's buffer contents are dumped.

References:
- IO Remapping Table (Issue D), Platform Design Document, March 2018

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg: acpiview: GTDT: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:03 +0000 (16:44 -0700)]
ShellPkg: acpiview: GTDT: Prevent buffer overruns

Modify the GTDT table parsing logic to prevent reading past the ACPI
buffer lengths provided and to make it consistent with other table
parsers. This includes converting the do-while loop in ParseAcpiGtdt()
into a while loop.

Remove a check which ensures that the entire Platform GT Block
Structure buffer has been parsed. The ACPI specification does not ban
from defining buffers which are larger than the size indicated by the
count and sizes of substructures which constitute it.

Change the data type of the Length parameter to the DumpGTBlock()
function to reflect the width of the respective ACPI structure's
field.

References:
- ACPI 6.3, January 2019, Table 5-124

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg: acpiview: DBG2: Prevent buffer overruns
Krzysztof Koch [Thu, 1 Aug 2019 23:44:02 +0000 (16:44 -0700)]
ShellPkg: acpiview: DBG2: Prevent buffer overruns

Modify the DBG2 table parsing logic to prevent reading past the ACPI
buffer lengths provided.

Modify the signature of the DumpDbgDeviceInfo() function to make it
consistent with the ACPI structure processing functions in other
acpiview parsers. Now, the length of the Debug Device Information
Structure is read before the entire structure is dumped.

This refactoring change makes it easier to stop reading beyond the
DBG2 table buffer if the Debug Device Information Structure Buffer
does not fit in the DBG2 buffer.

For processing the first two fields of the Debug Device Information
Structure (to get the length) a new ACPI_PARSER array is defined.

References:
- Microsoft Debug Port Table 2 (DBG2), December 10, 2015

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoBaseTools: Fixed an issue that build raise exception
Feng, Bob C [Fri, 2 Aug 2019 06:40:31 +0000 (14:40 +0800)]
BaseTools: Fixed an issue that build raise exception

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

Build raise exception if there is libraryclass
missing in dsc file and --pcd build option is used.

Build should report the missing libraryclass but not
a call stack.

This patch is going to fix it.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoSourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case
Zeng, Star [Fri, 9 Aug 2019 01:53:45 +0000 (09:53 +0800)]
SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case

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

Original code GetConfigTable for AddrPtr first, if failed,
InstalConfigTable with allocated AddrPtr. So the AddrPtr
should not be NULL and the NULL pointer dereference case
should be false positive. This patch is just to address
the case raised from static analysis.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools: Enable block queue log agent.
Feng, Bob C [Wed, 31 Jul 2019 05:33:31 +0000 (13:33 +0800)]
BaseTools: Enable block queue log agent.

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

To support Ctrl+S and Ctrl+Q, we enable block queue
for log.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Add the support for python 2
Feng, Bob C [Tue, 30 Jul 2019 10:19:33 +0000 (18:19 +0800)]
BaseTools: Add the support for python 2

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

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

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

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Move BuildOption parser out of build.py
Feng, Bob C [Mon, 22 Jul 2019 06:23:40 +0000 (14:23 +0800)]
BaseTools: Move BuildOption parser out of build.py

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

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

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Add LogAgent to support multiple process Autogen
Feng, Bob C [Wed, 31 Jul 2019 05:31:15 +0000 (13:31 +0800)]
BaseTools: Add LogAgent to support multiple process Autogen

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

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

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Add shared data for processes
Feng, Bob C [Tue, 30 Jul 2019 10:04:14 +0000 (18:04 +0800)]
BaseTools: Add shared data for processes

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

Add shared data for autogen processes.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Enable Multiple Process AutoGen
Feng, Bob C [Tue, 30 Jul 2019 09:15:31 +0000 (17:15 +0800)]
BaseTools: Enable Multiple Process AutoGen

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

Assign the Module AutoGen tasks into multiple
sub process.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Decouple AutoGen Objects
Feng, Bob C [Mon, 22 Jul 2019 03:09:22 +0000 (11:09 +0800)]
BaseTools: Decouple AutoGen Objects

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

1. Separate the AutoGen.py into 3 small py files.
One is for AutoGen base class, one is for WorkspaceAutoGen class
and PlatformAutoGen class, and the one for ModuleAutoGen class.
2. Create a new class DataPipe to store the Platform scope settings.
Create a new class PlatformInfo to provide the same interface
as PlatformAutoGen. PlatformInfo class is initialized by
DataPipe instance.
Create a new class WorkspaceInfo to provide the same interface
as WorkspaceAutoGen. WorkspaceInfo class is initialized by
DataPipe instance.
3. Change ModuleAutoGen to depends on DataPipe, PlatformInfo and
WorkspaceInfo. Remove the dependency of ModuleAutoGen to PlatformAutoGen.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Add functions to get platform scope build options
Feng, Bob C [Mon, 27 May 2019 14:19:25 +0000 (22:19 +0800)]
BaseTools: Add functions to get platform scope build options

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

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

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Split WorkspaceAutoGen._InitWorker into multiple functions
Feng, Bob C [Mon, 27 May 2019 09:43:05 +0000 (17:43 +0800)]
BaseTools: Split WorkspaceAutoGen._InitWorker into multiple functions

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

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

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Singleton the object to handle build conf file
Feng, Bob C [Sat, 13 Apr 2019 08:02:02 +0000 (16:02 +0800)]
BaseTools: Singleton the object to handle build conf file

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

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

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
4 years agoCryptoPkg/BaseCryptLib: Wrap OpenSSL HKDF algorithm
Gary West [Wed, 31 Jul 2019 05:54:08 +0000 (05:54 +0000)]
CryptoPkg/BaseCryptLib: Wrap OpenSSL HKDF algorithm

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

1. Implement OpenSSL HKDF wrapped function in CryptHkdf.c file.
2. Implement stub implementation function in CryptHkdfNull.c file.
3. Add wrapped HKDF function declaration to BaseCryptLib.h file.
4. Add CryptHkdf.c to module information BaseCryptLib.inf file.
5. Add CryptHkdfNull.c to module information PeiCryptLib.inf,
   RuntimeCryptLib.inf and SmmCryptLib.inf

Signed-off-by: Gary West <Gary.West@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Reviewed-by: Jian Wang <jian.j.wang@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Clean up useless ConsoleLogLock spinlock.
Eric Dong [Thu, 8 Aug 2019 13:17:13 +0000 (21:17 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Clean up useless ConsoleLogLock spinlock.

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

Remove the useless ConsoleLogLock spinlock.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Clean up useless ConsoleLogLock spinlock.
Eric Dong [Thu, 8 Aug 2019 13:16:21 +0000 (21:16 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Clean up useless ConsoleLogLock spinlock.

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

Remove the useless ConsoleLogLock spinlock.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg: Update code to include register definitions from MdePkg
Ni, Ray [Thu, 1 Aug 2019 09:58:31 +0000 (17:58 +0800)]
UefiCpuPkg: Update code to include register definitions from MdePkg

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg|MdePkg: Move Register/ folder to MdePkg/Include/
Ni, Ray [Thu, 1 Aug 2019 09:58:30 +0000 (17:58 +0800)]
UefiCpuPkg|MdePkg: Move Register/ folder to MdePkg/Include/

The patch moves all files under UefiCpuPkg/Include/Register/ to
MdePkg/Include/Register using following detailed approaches:
1. Move UefiCpuPkg/Include/Register/Amd/ to
   MdePkg/Include/Register/Amd folder.
2. Move remaining in UefiCpuPkg/Include/Register/ to
   MdePkg/Include/Register/Intel folder.
3. Create wrapper header files under UefiCpuPkg/Include/Register/
   to include the accordingly files in MdePkg/Include/Register/Intel.
   This is to avoid build break because code in other repos like
   edk2-platform includes the file from UefiCpuPkg.

The wrapper header files will be removed after all consumers code
is updated.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoMdeModulePkg/DxeIpl: Create 5-level page table for long mode
Ni, Ray [Thu, 1 Aug 2019 09:58:29 +0000 (17:58 +0800)]
MdeModulePkg/DxeIpl: Create 5-level page table for long mode

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

DxeIpl is responsible to create page table for DXE phase running
either in long mode or in 32bit mode with certain protection
mechanism enabled (refer to ToBuildPageTable()).

The patch updates DxeIpl to create 5-level page table for DXE phase
running in long mode when PcdUse5LevelPageTable is TRUE and CPU
supports 5-level page table.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoMdePkg/Cpuid.h: Move Cpuid.h from UefiCpuPkg to MdePkg
Ni, Ray [Thu, 1 Aug 2019 09:58:28 +0000 (17:58 +0800)]
MdePkg/Cpuid.h: Move Cpuid.h from UefiCpuPkg to MdePkg

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

MdeModulePkg/DxeIpl needs to get CPUID output for CPU
5-level paging capability detection.

In order to use the macros/structures defined in
UefiCpuPkg/Include/Register/Cpuid.h, the patch adds Intel/Cpuid.h
to MdePkg/Include/Register/ directory and updates Cpuid.h
in UefiCpuPkg to include the new one in MdePkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoMdeModulePkg/DxeIpl: Introduce PCD PcdUse5LevelPageTable
Ni, Ray [Thu, 1 Aug 2019 09:58:27 +0000 (17:58 +0800)]
MdeModulePkg/DxeIpl: Introduce PCD PcdUse5LevelPageTable

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

The PCD indicates if 5-Level Paging will be enabled in long mode.
5-Level Paging will not be enabled when the PCD is TRUE but CPU
doesn't support 5-Level Paging.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/CpuDxe: Support parsing 5-level page table
Ni, Ray [Thu, 1 Aug 2019 09:58:26 +0000 (17:58 +0800)]
UefiCpuPkg/CpuDxe: Support parsing 5-level page table

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

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/CpuDxe: Remove unnecessary macros
Ni, Ray [Thu, 1 Aug 2019 09:58:25 +0000 (17:58 +0800)]
UefiCpuPkg/CpuDxe: Remove unnecessary macros

Today's code defines macros like CR0_PG, CR0_WP, CR4_PSE, CR4_PAE
when checking whether individual bits are set in CR0 or CR4 register.

The patch changes the code to use IA32_CR0 and IA32_CR4 structure
defined in MdePkg/Include/Library/BaseLib.h so that the module
local macros can be removed.

There is no functionality impact to this change.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Enable 5-level paging for AP when BSP's enabled
Ni, Ray [Thu, 1 Aug 2019 09:58:24 +0000 (17:58 +0800)]
UefiCpuPkg/MpInitLib: Enable 5-level paging for AP when BSP's enabled

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

MpInitLib is the library that's responsible to wake up APs to provide
MP PPI and Protocol services.

The patch synchronizes BSP's CR4.LA57 to each AP's CR4.LA57.
Without this change, AP may enter to GP fault when BSP's 5-level page
table is set to AP during AP wakes up.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoOvmfPkg/PlatformPei: Change referenced MSR name.
Eric Dong [Thu, 8 Aug 2019 05:17:47 +0000 (13:17 +0800)]
OvmfPkg/PlatformPei: Change referenced MSR name.

Change referenced MSR name to avoid later build failure.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools:Add the Judgment Method of "--exclude"
Fan, ZhijuX [Fri, 28 Jun 2019 07:01:11 +0000 (15:01 +0800)]
BaseTools:Add the Judgment Method of "--exclude"

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

--exclude cannot be used under certain circumstances
1.The value of the parameter USES an absolute path
2.The value of Exclude parameters is based on the value
  of the Path parameter
Neither of these approaches currently works

This patch is going to fix that issue.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools/PatchCheck: Disable text conversion in 'git show'
Michael D Kinney [Thu, 1 Aug 2019 23:03:46 +0000 (16:03 -0700)]
BaseTools/PatchCheck: Disable text conversion in 'git show'

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

'git show' is used to extract the patch contents for analysis.
Add the flag '--no-textconv' to the 'git show' command to
disable the conversion from some binary file types to text
content.

Without this change, binary files such as .pdf files are
converted to text in the show command and PatchCheck complains
that the wrong line endings are used in the patch.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools/PatchCheck: Add copy from/to keywords
Michael D Kinney [Thu, 1 Aug 2019 22:59:41 +0000 (15:59 -0700)]
BaseTools/PatchCheck: Add copy from/to keywords

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

When files are very similar, git will copy an existing
file to a new location and then apply differences.  This
is operation identified in the diff with 'copy from' and
'copy to' lines that need to be ignored.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoBaseTools/PatchCheck: Ignore blank lines in diff
Michael D Kinney [Thu, 1 Aug 2019 22:57:18 +0000 (15:57 -0700)]
BaseTools/PatchCheck: Ignore blank lines in diff

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

When fixes are made for incorrect line endings, there
are cases where the diff contains blank lines.  Ignore
these blank lines.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoMdeModulePkg/DxeCapsuleLibFmp: Add missing description for parameter
Zhang, Shenglei [Tue, 6 Aug 2019 02:17:37 +0000 (10:17 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Add missing description for parameter

The description of parameter CapFileName is missing in comments.
So add the description.

Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/EsrtFmpDxe: Enhance ESRT to support multiple controllers
Jin, Eric [Mon, 5 Aug 2019 08:02:48 +0000 (16:02 +0800)]
MdeModulePkg/EsrtFmpDxe: Enhance ESRT to support multiple controllers

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

The patch is to merge multiple FMP instances into single ESRT entry
when they have the same GUID.

The policy to LastAttemptStatus/LastAttemptVersion of ESRT entry is:
If all the LastAttemptStatus are LAST_ATTEMPT_STATUS_SUCCESS, then
LastAttemptVersion should be the smallest of LastAttemptVersion. If
any of the LastAttemptStatus is not LAST_ATTEMPT_STATUS_SUCCESS,
then the LastAttemptVersion/LastAttemptStatus should be the values
of the first FMP instance whose LastAttemptStatus is not
LAST_ATTEMPT_STATUS_SUCCESS.

To detect possible duplicated GUID/HardwareInstance, a table of
GUID/HardwareInstance pairs from all the EFI_FIRMWARE_IMAGE_DESCRIPTORs
from all FMP instances is built. If a duplicate is found, then generate
a DEBUG_ERROR message, generate an ASSERT(), and ignore the duplicate
EFI_FIRMWARE_IMAGE_DESCRIPTOR.

Add an internal worker function called FmpGetFirmwareImageDescriptor()
that retrieves the list of EFI_FIRMWARE_IMAGE_DESCRIPTORs from a single
FMP instance and returns the descriptors in an allocated buffer. This
function is used to get the descriptors used to build the table of
unique GUID/HardwareInstance pairs.  It is then used again to generate
the ESRT Table from all the EFI_FIRMWARE_IMAGE_DESCRIPTORs from all the
FMP instances. 2 passes are performed so the total number of
descriptors is known. This allows the correct sized buffers to always
be allocated.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdePkg/X64/ProcessorBind.h: Fix EmulatorPkg X64 XCODE5
Michael D Kinney [Thu, 1 Aug 2019 06:07:55 +0000 (23:07 -0700)]
MdePkg/X64/ProcessorBind.h: Fix EmulatorPkg X64 XCODE5

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

Make sure all libs that should be dynamically linked
are dynamically linked when XCODE5 compiler is used.
A previous change introduced the following pragma:

    #pragma GCC visibility push (hidden)

When the EmulatorPkg is built using XCODE5 toolchain
for X64, this pragma is included and it generates a
linker error when building the Unix Host module.  This
change uses !defined(__APPLE__) to prevent the use of
this pragma when building EmulatorPkg/Unix/Host.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg/Unix/Host: Fix XCODE5 IA32/X64 build failure
Michael D Kinney [Fri, 2 Aug 2019 00:55:26 +0000 (17:55 -0700)]
EmulatorPkg/Unix/Host: Fix XCODE5 IA32/X64 build failure

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

* Clean up XCODE5 IA32 [BuildOptions] and fix IA32
  X11 include path.
* Add -DEFIAPI=__attribute__((ms_abi)) to X64 XCODE5
  [BuildOptions]
* Use -target x86_64-apple-darwin for X64 XCODE5
  [BuildOptions]
* Add Wl,-no_pie to X64 XCODE5 [BuildOptions]
* Address function type mismatch reported by XCODE5
  in reverse gasket callback between UEFI ABI and
  MacOS ABI.  Use a UINTN to pass function address
  to assembly code.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg/Unix/Host: Fix NetworkPkg dependencies
Michael D Kinney [Fri, 2 Aug 2019 01:06:04 +0000 (18:06 -0700)]
EmulatorPkg/Unix/Host: Fix NetworkPkg dependencies

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

* Add NetworkPkg to UNIX Host.inf dependencies
* Fix MacOS redefinition of NTOHLL and HTONLL macros
  between EDK II and standard includes in UNIX Host.h.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg: Fix VS2015 build when VS2017 also installed
Michael Kinney [Thu, 16 May 2019 21:56:30 +0000 (14:56 -0700)]
EmulatorPkg: Fix VS2015 build when VS2017 also installed

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

* Remove INTEL family flags that are no longer used.
* Remove [BuildOptions] statements that apply to all
  MSFT family tool chains
* Update [BuildOptions] for VS2015 and VS2015x86 tool
  chain tags to use the correct path to tools when
  multiple VS20xx tool chains are installed.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove debug message.
Eric Dong [Mon, 5 Aug 2019 06:41:43 +0000 (14:41 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove debug message.

This debug message may be called by BSP and APs. It may
caused ASSERT when APs call this debug code.

In order to avoid system boot assert, Remove this debug
message.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Remove debug message.
Eric Dong [Mon, 5 Aug 2019 06:38:32 +0000 (14:38 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Remove debug message.

This debug message may be called by BSP and APs. It may
caused ASSERT when APs call this debug code.

In order to avoid system boot assert, Remove this debug
message.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Make code consistent with comments
shenglei [Wed, 31 Jul 2019 03:38:12 +0000 (11:38 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Make code consistent with comments

1.Remove "out" attribute for " Buffer" parameter in function header.
2.Add "out" attribute for " Token" parameter in function header.
3.Update ProcedureArgument to ProcedureArguments.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option
Jonathan Watt [Tue, 7 May 2019 04:02:57 +0000 (21:02 -0700)]
ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option

For all other bcfg commands the "#" (option number) argument(s) are
treated as hexedecimal values regardless of whether or not they are
prefixed by "0x".  This change fixes '-opt' to handle its "#"
(option number) argument consistently with the other commands.

Making this change removes a potential footgun whereby a user that
has been using a number without a "0x" prefix with other bcfg
commands finds that, on using that exact same number with '-opt', it
has this time unexpectedly been interpreted as a decimal number and
they have modified (corrupted) an unrelated load option.  For
example, a user may have been specifying "10" to other commands to
have them act on the 16th option (because simply "10", without any
prefix, is how 'bcfg boot dump' displayed the option number for the
16th option). Unfortunately for them, if they also use '-opt' with
"10" it would unexpectedly and inconsistently act on the 10th option.

CC: Jaben Carsey <jaben.carsey@intel.com>
CC: Ray Ni <ray.ni@intel.com>
Signed-off-by: Jonathan Watt <jwatt@jwatt.org>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
4 years agoShellPkg: Add shell with all commands integrated
Michael D Kinney [Thu, 1 Aug 2019 20:38:39 +0000 (13:38 -0700)]
ShellPkg: Add shell with all commands integrated

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

Update ShellPkg DSC file to build an extra version of
the Shell with all commands integrated.  This verifies
that the shell can build in this max configuration.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoShellPkg/AcpiView: Fix IA32 link error
Michael D Kinney [Thu, 1 Aug 2019 20:34:13 +0000 (13:34 -0700)]
ShellPkg/AcpiView: Fix IA32 link error

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

Update SLIT_ELEMENT() macro to use MultU64x64() to
perform multiplication on 64-bit operands.  This is
required to avoid use of an intrinsic on IA32 VS20xx
builds.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry
Shenglei Zhang [Wed, 31 Jul 2019 05:55:35 +0000 (13:55 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry

The pointer Pml5Entry, returned from call to function
AllocatePageTableMemory, may be null.
So add check for it.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull
Zhang, Shenglei [Fri, 2 Aug 2019 06:55:27 +0000 (14:55 +0800)]
MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull

RecoveryLib.h and PeiRecoveryLibNull have been deprecated from 2009,
so remove them.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: Remove S3Lib.h and PeiS3LibNull
Zhang, Shenglei [Fri, 2 Aug 2019 06:55:26 +0000 (14:55 +0800)]
MdeModulePkg: Remove S3Lib.h and PeiS3LibNull

S3Lib.h and PeiS3LibNull have been deprecated since 2009, so remove them.
https://bugzilla.tianocore.org/show_bug.cgi?id=1299

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UsbBusDxe: Return error when the device is not present
Marcin Wojtas [Wed, 31 Jul 2019 06:25:19 +0000 (14:25 +0800)]
MdeModulePkg/UsbBusDxe: Return error when the device is not present

Until now, during the USB device enumeration when its PortState
USB_PORT_STAT_CONNECTION bit was not set, the stack was not informed
that the device is not present. Fix that by returning appropriate
error code.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoSecurityPkg/SecurityPkg.dec: Remove trailing white space
Shenglei Zhang [Mon, 29 Jul 2019 03:39:16 +0000 (11:39 +0800)]
SecurityPkg/SecurityPkg.dec: Remove trailing white space

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg/PiSmmCore: Use unique structure signatures
Michael D Kinney [Fri, 28 Jun 2019 19:49:52 +0000 (12:49 -0700)]
MdeModulePkg/PiSmmCore: Use unique structure signatures

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

Update the data structure signatures in the PiSmmCore
to be unique. Some of the signatures are the same as those
used by the DxeCore. For example, the memory pool head and
tail structures use the same signature in the PiSmmCore
and DxeCore.  This means the use of the wrong FreePool API
will not be noticed at the time FreePool is called and a
failure can occur much later.  By making the signatures
unique, misuse of an API is caught at that time the API is
called.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: don't shadow the microcode patch twice.
Eric Dong [Wed, 31 Jul 2019 07:59:26 +0000 (15:59 +0800)]
UefiCpuPkg/MpInitLib: don't shadow the microcode patch twice.

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

MpInitLibInitialize in MpLib.c will be invoked on both PEI and DXE
CPU code, MicrocodeDetect would be performed twice and copy
Microcode from flash to memory twice as well, which consider as
duplicate work to lead longer boot time.
This patch just use microcode memory copied in PEI phase if exist.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoIntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
Ching JenX Cheng [Thu, 1 Aug 2019 04:16:46 +0000 (12:16 +0800)]
IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.

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

When running with Python 3.x and relying on GenCfgOpt.py to
automatically assign UPD offsets, the script crashed
because some float type variable not compatible with
the operations.
Converted those float variable to int to fix these issues.

Cc: Amy Chan <amy.chan@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Keep function comment and declaration adjacent
Shenglei Zhang [Tue, 30 Jul 2019 08:31:21 +0000 (16:31 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Keep function comment and declaration adjacent

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoSecurityPkg/FvReportPei: Change HashAlgoId to HashAlgId
Shenglei Zhang [Tue, 30 Jul 2019 08:28:46 +0000 (16:28 +0800)]
SecurityPkg/FvReportPei: Change HashAlgoId to HashAlgId

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg: Fix typos and add periods
Shenglei Zhang [Tue, 30 Jul 2019 08:14:54 +0000 (16:14 +0800)]
MdeModulePkg: Fix typos and add periods

1.Update @parm to @param in function comments in Presentation.c.
2.Add missing period (.) in some function comments.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoBaseTools: Fixed a typo in Trim.py
Feng, Bob C [Thu, 1 Aug 2019 13:23:43 +0000 (21:23 +0800)]
BaseTools: Fixed a typo in Trim.py

This is a regression issue introduced
by commit 307e1650be267b67db7be1089e0979ace460d83

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools:Added arch output to build report
Matthew Carlson [Tue, 16 Jul 2019 06:34:57 +0000 (14:34 +0800)]
BaseTools:Added arch output to build report

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

Added arch output to build report so it's easy to tell
which arch is being generated. Useful when multiple versions
of a single module is being emitted for multiple archs.

This patch is going to Added arch output

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools:Updata the output encoding of the Popen function
Bob Feng [Tue, 16 Jul 2019 09:14:08 +0000 (17:14 +0800)]
BaseTools:Updata the output encoding of the Popen function

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

Not all output works in utf-8, so change the encoding to
the default

This patch is going to fix that issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools:Add extra debugging message
Max Knutsen [Tue, 16 Jul 2019 09:26:55 +0000 (17:26 +0800)]
BaseTools:Add extra debugging message

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

Add extra debugging to improve error identification.
Error while processing file if the file is read incorrectly

This patch is going to fix that issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools:replace the chinese quotation mark with unicode "
Sean Brogan [Tue, 16 Jul 2019 05:58:33 +0000 (13:58 +0800)]
BaseTools:replace the chinese quotation mark with unicode "

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

chinese quotation mark are used in the file
This patch is going to fix that issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation
Krzysztof Koch [Mon, 22 Jul 2019 22:50:26 +0000 (15:50 -0700)]
ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation

Move Performance Monitoring Counter Group (PMCG) node ID mapping count
validation from the core IORT acpiview parser logic to a dedicated
function. Now, the pointer to the validation function is passed to the
IortNodePmcgParser[] ACPI_PARSER array.

This check does not affect the flow of IORT parsing and is limited to
a single table field in scope, therefore, it is better to keep it away
from the code responsible for traversing the table.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: MADT: Split structure length validation
Krzysztof Koch [Mon, 22 Jul 2019 22:50:25 +0000 (15:50 -0700)]
ShellPkg: acpiview: MADT: Split structure length validation

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

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

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: SRAT: Minor code style enhancements
Krzysztof Koch [Mon, 22 Jul 2019 22:50:24 +0000 (15:50 -0700)]
ShellPkg: acpiview: SRAT: Minor code style enhancements

Minor changes to the SRAT parser code to conform with the EDKII coding
style and to make it consistent with other ACPI table parsers.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: RSDP: Make code consistent with other parsers
Krzysztof Koch [Mon, 22 Jul 2019 22:50:23 +0000 (15:50 -0700)]
ShellPkg: acpiview: RSDP: Make code consistent with other parsers

List ParseAcpi() function arguments one per line in order to make this
function call consistent with ParseAcpi() calls in other ACPI table
parsers.

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

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

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call
Krzysztof Koch [Mon, 22 Jul 2019 22:50:22 +0000 (15:50 -0700)]
ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call

Remove a call to ParseAcpi() responsible for getting the XSDT table
length. This call is not needed because the ACPI table buffer length is
provided as an input argument to the ParseAcpiXsdt() function.

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

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()
Krzysztof Koch [Mon, 22 Jul 2019 22:50:21 +0000 (15:50 -0700)]
ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()

Modify the signature of the DumpGasStruct() function to include the
buffer length parameter and to return the number of bytes parsed by
the function.

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

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

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoMdePkg: Add PI 1.5 SmramMemoryReserve HOB file
Chen, Marc W [Mon, 29 Jul 2019 08:41:19 +0000 (16:41 +0800)]
MdePkg: Add PI 1.5 SmramMemoryReserve HOB file

This is a special GUID extension Hob to describe SMRAM memory regions

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2020
Signed-off-by: Marc W Chen <marc.w.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg/PciExpress21.h: Fix the PCI industry standard register defines
Javeed, Ashraf [Mon, 29 Jul 2019 03:51:23 +0000 (11:51 +0800)]
MdePkg/PciExpress21.h: Fix the PCI industry standard register defines

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2007
The following two PCI Capability Structure registers are updated as per
the PCI Base Specification Revision 4:-
(1) The PCI Device capability register 2(PCI_REG_PCIE_DEVICE_CAPABILITY2)
    needs to be upgraded for the PCI features like -
    LN system CLS (LnSystemCLS),
    10b Tag completer/requester register fields
    (TenBitTagCompleterSupported, TenBitTagRequesterSupported),
    Emergency power reduction support and initialization requirement
    (EmergencyPowerReductionSupported,
     EmergencyPowerReductionInitializationRequired),
    and FRS support (FrsSupported ).

(2) The PCI Device Control register 2(PCI_REG_PCIE_DEVICE_CONTROL2) needs
    to be upgraded for the -
    Emergency power reduction request enabling
    (EmergencyPowerReductionRequest), and also the 10b Extended Tag
    enabling (TenBitTagRequesterEnable).

The following two are defined as per the PCI Express Base Specification
Revision 2.1:-
(1) Defined macro definitions for all the ranges of Maximum Payload Sizes
    and Maximum Read Request Sizes register fields

(2) Defined macro definitions for all the ranges of Completion Timeout
    value.

Signed-off-by: Ashraf Javeed <ashraf.javeed@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoCryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons
Zhichao Gao [Tue, 30 Jul 2019 01:14:57 +0000 (09:14 +0800)]
CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons

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

Refer to CSS_2_1 5.7.2.1 "Non-Boolean comparisons must use a
compare operator (==, !=, >, < >=, <=).", use compare operator
for the non-boolean comparisons.

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoArmPkg: DebugPeCoffExtraActionLib: fix trivial comment typos
Philippe Mathieu-Daude [Mon, 29 Jul 2019 18:03:21 +0000 (20:03 +0200)]
ArmPkg: DebugPeCoffExtraActionLib: fix trivial comment typos

Fix a pair of trivial typos in comments by inserting a space.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoArmPkg: DebugPeCoffExtraActionLib: debugger commands are not errors
Philippe Mathieu-Daude [Mon, 29 Jul 2019 18:03:20 +0000 (20:03 +0200)]
ArmPkg: DebugPeCoffExtraActionLib: debugger commands are not errors

In commit 1fce963d89f3e we reduced the level of information printed
by PeCoffLoaderRelocateImageExtraAction() but we did not update the
similar PeCoffLoaderUnloadImageExtraAction() function.

PeCoffLoaderUnloadImageExtraAction() prints helpful debugger commands
for source level debugging. These messages should not be printed on the
EFI_D_ERROR level; they don't report errors. Change the debug level
(bitmask, actually) to DEBUG_LOAD | DEBUG_INFO, because the messages are
printed in relation to image loading, and they are informative.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reported-by: Andrew Jones <drjones@redhat.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoOvmfPkg/build.sh: use newer '-drive if=pflash' syntax when running qemu
Rebecca Cran [Wed, 24 Jul 2019 21:44:04 +0000 (15:44 -0600)]
OvmfPkg/build.sh: use newer '-drive if=pflash' syntax when running qemu

Specify the firmware to use via the newer '-drive if=pflash' syntax
which allows specifying the raw format parameter. This
avoids warnings with newer version of QEMU.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>