]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
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>
4 years agoOvmfPkg/build.sh: remove $ADD_QEMU_HDA
Rebecca Cran [Wed, 24 Jul 2019 21:44:05 +0000 (15:44 -0600)]
OvmfPkg/build.sh: remove $ADD_QEMU_HDA

$ADD_QEMU_HDA was added because QEMU used to refuse to run without a
disk. Since newer versions run without any disks, remove it.

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>
4 years agoMdePkg/UefiDebugLibStdErr: Add destructor to CloseEvent
Xu, Wei6 [Fri, 26 Jul 2019 03:10:55 +0000 (11:10 +0800)]
MdePkg/UefiDebugLibStdErr: Add destructor to CloseEvent

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

When driver is unloaded, the ExitBootSerivesEvent must be closed at
the same time. Otherwise exception will occur when ExitBootServices.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg/UefiDebugLibDebugPortProtocol: Add destructor to CloseEvent
Xu, Wei6 [Fri, 26 Jul 2019 03:10:54 +0000 (11:10 +0800)]
MdePkg/UefiDebugLibDebugPortProtocol: Add destructor to CloseEvent

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

When driver is unloaded, the ExitBootSerivesEvent must be closed at
the same time. Otherwise exception will occur when ExitBootServices.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg/UefiDebugLibConOut: Add destructor to CloseEvent
Xu, Wei6 [Fri, 26 Jul 2019 03:10:53 +0000 (11:10 +0800)]
MdePkg/UefiDebugLibConOut: Add destructor to CloseEvent

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

When driver is unloaded, the ExitBootSerivesEvent must be closed at
the same time. Otherwise exception will occur when ExitBootServices.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously.
Eric Dong [Thu, 20 Dec 2018 02:19:08 +0000 (10:19 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously.

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

For semaphore type register, it required all processors to do the
task at the same time.
Current logic begins BSP's task after all APs have finished their tasks.
This will caused set semaphore task hang if semaphore has package
level type.
This patch use new EDKII_PEI_MP_SERVICES2_PPI to start all processors at
the same time to fix the potential hang issue.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.
Eric Dong [Mon, 29 Jul 2019 00:53:20 +0000 (08:53 +0800)]
UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.

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

Produce new EDKII_PEI_MP_SERVICES2_PPI service.

It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI
and add new API EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI
Eric Dong [Mon, 29 Jul 2019 00:52:57 +0000 (08:52 +0800)]
UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI

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

Add definition for new EDKII_PEI_MP_SERVICES2_PPI.

It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI
and add new API EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/MpInitLibUp: Add MpInitLibStartupAllCPUs API.
Eric Dong [Mon, 22 Jul 2019 00:19:29 +0000 (08:19 +0800)]
UefiCpuPkg/MpInitLibUp: Add MpInitLibStartupAllCPUs API.

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

Add new MpInitLibStartupAllCPUs API uses to start all processors
at the same time.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API.
Eric Dong [Wed, 10 Apr 2019 03:00:43 +0000 (11:00 +0800)]
UefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API.

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

Add new MpInitLibStartupAllCPUs API uses to start all processors
at the same time.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API.
Eric Dong [Wed, 10 Apr 2019 03:00:04 +0000 (11:00 +0800)]
UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API.

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

Add new MpInitLibStartupAllCPUs API uses to start all processors
at the same time.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoRevert "UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF"
Laszlo Ersek [Fri, 26 Jul 2019 09:59:56 +0000 (11:59 +0200)]
Revert "UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF"

This reverts commit 30f6148546c7092650ab4886fc6d95d5065c3188.

Commit 30f6148546c7 causes a build failure, when building for IA32:

> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c: In function
> 'PerformRemainingTasks':
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c:1440:9: error:
> 'mCpuSmmStaticPageTable' undeclared (first use in this function)
>      if (mCpuSmmStaticPageTable) {

"mCpuSmmStaticPageTable" is an X64-only variable. It is defined in
"X64/PageTbl.c", which is not linked into the IA32 binary. We must not
reference the variable in such code that is linked into both IA32 and X64
builds, such as "PiSmmCpuDxeSmm.c".

We have encountered the same challenge at least once in the past:

- https://bugzilla.tianocore.org/show_bug.cgi?id=1593
- commit 37f9fea5b88d ("UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand
  paging in SMM", 2019-04-04)

The right approach is to declare a new function in "PiSmmCpuDxeSmm.h", and
to provide two definitions for the function, one in "Ia32/PageTbl.c", and
another in "X64/PageTbl.c". The IA32 implementation should return a
constant value. The X64 implementation should return
"mCpuSmmStaticPageTable". (In the example named above, the functions were
SaveCr2() and RestoreCr2().)

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: push revert immediately, due to build breakage that
 would have been easy to catch before submitting the patch]

4 years agoUefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF
Ni, Ray [Thu, 18 Jul 2019 06:58:07 +0000 (14:58 +0800)]
UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF

Commit c60d36b4d1ee1f69b7cca897d3621dfa951895c2
* UefiCpuPkg/SmmCpu: Block access-out only when static paging is used

updated page fault handler to treat SMM access-out as allowed
address when static paging is not used.

But that commit is not complete because the page table is still
updated in SetUefiMemMapAttributes() for non-SMRAM memory. When SMM
code accesses non-SMRAM memory, page fault is still generated.

This patch skips to update page table for non-SMRAM memory and
page table itself.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoIntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain
Chasel Chiu [Thu, 25 Jul 2019 14:22:29 +0000 (22:22 +0800)]
IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain

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

Current FSP SEC_IDT_TABLE structure is not natural aligned:
  typedef struct _SEC_IDT_TABLE {
    EFI_PEI_SERVICES  *PeiService;
    UINT64            IdtTable[];
  } SEC_IDT_TABLE;
Compiler will insert DWORD padding between 2 elements and
GetPeiServicesTablePointer() in early phase then always
returns padding data from stack, which was not reset to 0
in SecMain.

Solution is to align FSP SEC_IDT_TABLE structure to UefiCpuPkg
to have UINT64 as PeiService field and reset it to 0.

Test: Verified on internal platform and booting successfully
      with FSP API mode.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoOvmfPkg/build.sh: remove literal carriage return
rebecca@bsdio.com [Thu, 25 Jul 2019 01:35:40 +0000 (19:35 -0600)]
OvmfPkg/build.sh: remove literal carriage return

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoBaseTools: Sort file list in Makefile
Feng, Bob C [Mon, 15 Jul 2019 14:42:45 +0000 (22:42 +0800)]
BaseTools: Sort file list in Makefile

This patch is going to sort the file list in generated
Makefile. This change make the autogen makefile easy to
compare.

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>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: add GetMaintainer.py script
Leif Lindholm [Fri, 14 Jun 2019 17:37:06 +0000 (18:37 +0100)]
BaseTools: add GetMaintainer.py script

Add a new script GetMaintainer.py that uses the new Maintainer.txt format
to determine which addresses to cc on patch submission.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoOvmfPkg/build.sh: enable multitheaded build by default
Rebecca Cran [Tue, 23 Jul 2019 00:32:25 +0000 (18:32 -0600)]
OvmfPkg/build.sh: enable multitheaded build by default

Enable multithreaded builds by default when building OvmfPkg
using build.sh.
This can drastically reduce build times. For example, on a
modern ThreadRipper system the time required to build decreases
from 3 minutes to 1 minute.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoedksetup.sh: remove redundant -?, -h and --help in options parsing
rebecca@bsdio.com [Tue, 16 Jul 2019 16:55:36 +0000 (10:55 -0600)]
edksetup.sh: remove redundant -?, -h and --help in options parsing

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Message-Id: <20190716165538.57960-4-rebecca@bsdio.com>

4 years agoedksetup.sh: when executing arithmetic commands, $ isn't needed
rebecca@bsdio.com [Tue, 16 Jul 2019 16:55:35 +0000 (10:55 -0600)]
edksetup.sh: when executing arithmetic commands, $ isn't needed

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Message-Id: <20190716165538.57960-3-rebecca@bsdio.com>

4 years agoedksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh'
rebecca@bsdio.com [Tue, 16 Jul 2019 16:55:34 +0000 (10:55 -0600)]
edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh'

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Message-Id: <20190716165538.57960-2-rebecca@bsdio.com>

4 years agoedksetup.sh: Use bash variable $PWD instead of executing pwd command
rebecca@bsdio.com [Tue, 16 Jul 2019 16:55:33 +0000 (10:55 -0600)]
edksetup.sh: Use bash variable $PWD instead of executing pwd command

This is a (very minor) optimization: `pwd` runs the command (even as a
built-in), whereas $PWD simply evaluates the value of the variable.

ALso, modern scripts should generally use $(...) to run commands,
instead of `...`.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Message-Id: <20190716165538.57960-1-rebecca@bsdio.com>

4 years agoEmbeddedPkg: list module-internal header files in INF [Sources]
Laszlo Ersek [Fri, 19 Jul 2019 15:33:05 +0000 (17:33 +0200)]
EmbeddedPkg: list module-internal header files in INF [Sources]

The BaseTools build feature introduced for TianoCore#1804 / in commit
1fa6699e6cd4 ("BaseTools: Add a checking for Sources section in INF file",
2019-06-10) logs some (non-fatal) warnings about unlisted internal header
files. List those files explicitly.

Note: header files are added in lexicographical order only if the
underlying INF file already keeps the [Sources] and [LibraryClasses]
sections in lexicographical order. Otherwise, header files are added in
rough "logical" order.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoCryptoPkg/BaseCryptLib: list module-internal header files in INF [Sources]
Laszlo Ersek [Fri, 19 Jul 2019 15:31:01 +0000 (17:31 +0200)]
CryptoPkg/BaseCryptLib: list module-internal header files in INF [Sources]

The BaseTools build feature introduced for TianoCore#1804 / in commit
1fa6699e6cd4 ("BaseTools: Add a checking for Sources section in INF file",
2019-06-10) logs some (non-fatal) warnings about unlisted internal header
files. List those files explicitly.

Note: header files are added in lexicographical order only if the
underlying INF file already keeps the [Sources] and [LibraryClasses]
sections in lexicographical order. Otherwise, header files are added in
rough "logical" order.

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoArmPlatformPkg: list module-internal header files in INF [Sources]
Laszlo Ersek [Fri, 19 Jul 2019 15:18:01 +0000 (17:18 +0200)]
ArmPlatformPkg: list module-internal header files in INF [Sources]

The BaseTools build feature introduced for TianoCore#1804 / in commit
1fa6699e6cd4 ("BaseTools: Add a checking for Sources section in INF file",
2019-06-10) logs some (non-fatal) warnings about unlisted internal header
files. List those files explicitly.

Note: header files are added in lexicographical order only if the
underlying INF file already keeps the [Sources] and [LibraryClasses]
sections in lexicographical order. Otherwise, header files are added in
rough "logical" order.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoArmPkg: list module-internal header files in INF [Sources]
Laszlo Ersek [Fri, 19 Jul 2019 15:08:12 +0000 (17:08 +0200)]
ArmPkg: list module-internal header files in INF [Sources]

The BaseTools build feature introduced for TianoCore#1804 / in commit
1fa6699e6cd4 ("BaseTools: Add a checking for Sources section in INF file",
2019-06-10) logs some (non-fatal) warnings about unlisted internal header
files. List those files explicitly.

Note: header files are added in lexicographical order only if the
underlying INF file already keeps the [Sources] and [LibraryClasses]
sections in lexicographical order. Otherwise, header files are added in
rough "logical" order.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoBaseTools: Fixed the mis-using strip() function issue.
Feng, Bob C [Sun, 21 Jul 2019 03:31:11 +0000 (11:31 +0800)]
BaseTools: Fixed the mis-using strip() function issue.

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

lstrip(parameter) do the match based on the char
in parameter but not only the whole parameter string.

In GenMake line 1082,
CmdSign.lstrip('/Fo') will strip the '/' or
'F' or 'o' on the left of CmdSign. This is not expected.

This patch is going to fix such 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>
4 years agoBaseTools: Create ".cache" folder when initialize Build object
Feng, Bob C [Fri, 19 Jul 2019 01:10:28 +0000 (09:10 +0800)]
BaseTools: Create ".cache" folder when initialize Build object

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

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

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoShellPkg: acpiview: DBG2: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:05:02 +0000 (18:05 -0700)]
ShellPkg: acpiview: DBG2: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: GTDT: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:05:01 +0000 (18:05 -0700)]
ShellPkg: acpiview: GTDT: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

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

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: IORT: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:05:00 +0000 (18:05 -0700)]
ShellPkg: acpiview: IORT: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: MADT: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:04:59 +0000 (18:04 -0700)]
ShellPkg: acpiview: MADT: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: SRAT: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:04:58 +0000 (18:04 -0700)]
ShellPkg: acpiview: SRAT: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: SPCR: Remove redundant forward declaration
Krzysztof Koch [Fri, 19 Jul 2019 01:04:57 +0000 (18:04 -0700)]
ShellPkg: acpiview: SPCR: Remove redundant forward declaration

Reposition blocks of code to remove redundant forward function
declarations in order to reduce the code size.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: FADT: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:04:56 +0000 (18:04 -0700)]
ShellPkg: acpiview: FADT: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: acpiview: RSDP: Remove redundant forward declarations
Krzysztof Koch [Fri, 19 Jul 2019 01:04:55 +0000 (18:04 -0700)]
ShellPkg: acpiview: RSDP: Remove redundant forward declarations

Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg/Type.c: Add value check before (LoopVar - 1)
Zhichao Gao [Mon, 15 Jul 2019 06:11:49 +0000 (14:11 +0800)]
ShellPkg/Type.c: Add value check before (LoopVar - 1)

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

If the file begin with single line Feed ('\n'), then
"AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r'"
would cause a underflow. Add this condition
"(AsciiChar == '\n' && LoopVar == 0)" before it to make sure
(LoopVar - 1) would never encounter a underflow.

Same change in Unicode section.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
4 years agoOvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe
Imran Desai [Thu, 18 Jul 2019 22:53:26 +0000 (15:53 -0700)]
OvmfPkg: link SM3 support into Tcg2Pei and Tcg2Dxe

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6

EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR
banks. This digest algorithm is part of the China Crypto algorithm suite.
This integration has dependency on the openssl_1_1_1b integration into
edk2.

This patch links SM3 support into Tcg2Pei and Tcg2Dxe.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Imran Desai <imran.desai@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190718225326.40839-5-imran.desai@intel.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg: set SM3 bit in TPM 2.0 hash mask by default
Imran Desai [Thu, 18 Jul 2019 22:53:25 +0000 (15:53 -0700)]
SecurityPkg: set SM3 bit in TPM 2.0 hash mask by default

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6

EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR
banks. This digest algorithm is part of the China Crypto algorithm suite.
This integration has dependency on the openssl_1_1_1b integration into
edk2.

This patch sets SM3 bit in TPM2.0 hash mask by default.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Signed-off-by: Imran Desai <imran.desai@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Message-Id: <20190718225326.40839-4-imran.desai@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm
Imran Desai [Thu, 18 Jul 2019 22:53:24 +0000 (15:53 -0700)]
SecurityPkg/HashLibBaseCryptoRouter: recognize the SM3 digest algorithm

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6

EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR
banks. This digest algorithm is part of the China Crypto algorithm suite.
This integration has dependency on the openssl_1_1_1b integration into
edk2.

This patch adds SM3 as an available digest algorithm to crypto router.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Signed-off-by: Imran Desai <imran.desai@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Message-Id: <20190718225326.40839-3-imran.desai@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg: introduce the SM3 digest algorithm
Imran Desai [Thu, 18 Jul 2019 22:53:23 +0000 (15:53 -0700)]
SecurityPkg: introduce the SM3 digest algorithm

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
GITHUB: https://github.com/idesai/edk2/tree/enable_sm3_measured_boot_v6

EDK2 Support for SM3 digest algorithm is needed to enable TPM with SM3 PCR
banks. This digest algorithm is part of the China Crypto algorithm suite.
This integration has dependency on the openssl_1_1_1b integration into
edk2.

This patch add SM3 algorithm in the hashinstance library.

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

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Signed-off-by: Imran Desai <imran.desai@intel.com>
Message-Id: <20190718225326.40839-2-imran.desai@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMaintainers.txt: Fine-grained review ownership for MdeModulePkg
Hao A Wu [Wed, 17 Jul 2019 01:23:10 +0000 (09:23 +0800)]
Maintainers.txt: Fine-grained review ownership for MdeModulePkg

This commit add the reviewers information for modules within MdeModulePkg.

For now the modules list includes:
ACPI
ACPI S3
BDS
Console and Graphics
Core services (PEI, DXE and Runtime)
Device and Peripheral
Firmware Update
HII and UI
Management Mode (MM, SMM)
Reset
SMBIOS
UEFI Variable

Please note that, for MdeModulePkg components not included in the above
list, the reviewers will fall back to the package maintainers.

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>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMaintainers.txt: split out section "OvmfPkg: CSM modules"
Laszlo Ersek [Mon, 15 Jul 2019 16:26:21 +0000 (18:26 +0200)]
Maintainers.txt: split out section "OvmfPkg: CSM modules"

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

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMaintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related modules"
Laszlo Ersek [Mon, 15 Jul 2019 16:11:25 +0000 (18:11 +0200)]
Maintainers.txt: split out section "OvmfPkg: TCG- and TPM2-related modules"

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

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMaintainers.txt: split out section "OvmfPkg: Xen-related modules"
Laszlo Ersek [Mon, 15 Jul 2019 15:39:04 +0000 (17:39 +0200)]
Maintainers.txt: split out section "OvmfPkg: Xen-related modules"

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

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMaintainers.txt: split out section "ArmVirtPkg: modules used on Xen"
Laszlo Ersek [Mon, 15 Jul 2019 15:12:14 +0000 (17:12 +0200)]
Maintainers.txt: split out section "ArmVirtPkg: modules used on Xen"

We ask contributors to copy Julien on patches that affect "Xen modules"
under ArmVirtPkg. With the "GetMaintainer.py" script being introduced
later, express this expectation in "Maintainers.txt" in machine-readable
format.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMaintainers.txt: add wildcard path association for Arm/AArch64
Leif Lindholm [Fri, 14 Jun 2019 19:29:03 +0000 (20:29 +0100)]
Maintainers.txt: add wildcard path association for Arm/AArch64

Add Ard and Leif as responsible for any path matching
F: */Arm/
F: */AArch64/

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMaintainers.txt: update for filesystem area descriptions
Leif Lindholm [Fri, 14 Jun 2019 19:27:39 +0000 (20:27 +0100)]
Maintainers.txt: update for filesystem area descriptions

Add comment describing new F: and X: tags for associating maintainership
sections with specific filesystem paths, including wildcards.

Add global section associating *all* code with devel@edk2.groups.io,
with a default '*' F: tag directing all modifications that do not hit a
rule to the stewards.

Also tag all files in top directory as maintained by the stewards.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: avoid use dynamic PCD.
Dong, Eric [Mon, 15 Jul 2019 07:00:56 +0000 (15:00 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: avoid use dynamic PCD.

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

Function in this library may be used by APs. Assert will be trig if AP
uses dynamic pcd.
This patch enhance the current code, remove the unnecessary usage of
dynamic PCD. This change try to avoid report this issue again later.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiServices table.
Eric Dong [Thu, 11 Jul 2019 11:56:25 +0000 (19:56 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiServices table.

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

AP calls CollectProcessorData() to collect processor info.
CollectProcessorData function finally calls PcdGetSize function to
get DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use
PeiServices table which caused below assert info:
Processor Info: Package: 1, MaxCore : 4, MaxThread: 1
Package: 0, Valid Core : 4
ASSERT [CpuFeaturesPei] c:\projects\jsl\jsl_v1193\Edk2\MdePkg\Library
\PeiServicesTablePointerLibIdt\PeiServicesTablePointer.c(48):
PeiServices != ((void *) 0)

This change uses saved global pcd size instead of calls PcdGetSize to
fix this issue.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure
Star Zeng [Wed, 17 Jul 2019 03:19:48 +0000 (11:19 +0800)]
UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure

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

The new VS2012 build failure is caused by 7a0df26.

xxx\registercpufeatureslib\dxeregistercpufeatureslib.c(258) :
 warning C4701: potentially uninitialized local variable 'MpEvent' used

It is a false positive alarm.
MpEvent is assigned at line 238 and will be used at line 258, both
lines are controlled by "if (CpuFeaturesData->NumberOfCpus > 1)".

This patch initializes MpEvent to suppress incorrect compiler/analyzer
warnings.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdePkg/BaseLib: Base64Decode(): don't declare variables in nested blocks
Laszlo Ersek [Tue, 16 Jul 2019 22:18:51 +0000 (00:18 +0200)]
MdePkg/BaseLib: Base64Decode(): don't declare variables in nested blocks

The EDK II C Coding Standards Specification (v2.20) strongly discourages
variable declarations in nested block scope:

5       Source Files
5.4     Code File Structure
5.4.1   Scoping Rules
5.4.1.1 Scope

> Block (local) Scope
>
> [...]
>
> Data declarations may follow the opening brace of a compound statement,
> regardless of nesting depth, and before any code generating statements
> have been entered. Other than at the outermost block of a function body,
> this type of declaration is strongly discouraged.

Hoist such variable declarations in Base64Decode() to the outermost
function scope.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Fixes: 35e242b698cdc6205e99a6d6a188bf27fecf9fb4
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1980
Reported-by: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdePkg/BaseLib: rewrite Base64Decode()
Laszlo Ersek [Mon, 1 Jul 2019 22:35:18 +0000 (00:35 +0200)]
MdePkg/BaseLib: rewrite Base64Decode()

Rewrite Base64Decode() from scratch, due to reasons listed in the second
reference below.

Implement Base64Decode() according to the specification added in the
previous patch. The decoder scans the input buffer once, it has no inner
loop(s), and it spills each output byte as soon as the output byte is
complete.

The intent is to only strengthen the checks (sanity and input) relative to
the previous implementation, hence the MAX_ADDRESS checks are reinstated.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Marvin Häuser <mhaeuser@outlook.de>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1891
Ref: http://mid.mail-archive.com/c495bd0b-ea4d-7206-8a4f-a7149760d19a@redhat.com
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Tested-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
[lersek@redhat.com: add last para to commit msg per talks w/ Marvin & Phil]

4 years agoMdePkg/BaseLib: re-specify Base64Decode(), and add temporary stub impl
Laszlo Ersek [Mon, 1 Jul 2019 17:46:01 +0000 (19:46 +0200)]
MdePkg/BaseLib: re-specify Base64Decode(), and add temporary stub impl

Rewrite Base64Decode() from scratch, due to reasons listed in the second
reference below.

As first step, redo the interface contract, and replace the current
implementation with a stub that asserts FALSE, then fails.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Marvin Häuser <mhaeuser@outlook.de>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1891
Ref: http://mid.mail-archive.com/c495bd0b-ea4d-7206-8a4f-a7149760d19a@redhat.com
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg CpuCommonFeaturesLib: Enhance Ppin code
Star Zeng [Fri, 5 Jul 2019 05:14:33 +0000 (13:14 +0800)]
UefiCpuPkg CpuCommonFeaturesLib: Enhance Ppin code

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1961
Enhance Ppin code to enable and unlock for TRUE State,
and disable and lock for FALSE State.
Note: enable and lock could not be set both.
According to SDM, once Enable_PPIN is set, attempt to write
1 to LockOut will cause #GP, and writing 1 to LockOut is
permitted only if Enable_PPIN is clear.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Kevin Li <kevin.y.li@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Enable MM MP Protocol
Eric Dong [Wed, 10 Jul 2019 07:49:11 +0000 (15:49 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Enable MM MP Protocol

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

Add MM Mp Protocol in PiSmmCpuDxeSmm driver.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdePkg: Add new MM MP Protocol definition.
Eric Dong [Mon, 1 Jul 2019 04:37:24 +0000 (12:37 +0800)]
MdePkg: Add new MM MP Protocol definition.

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

EFI MM MP Protocol is defined in the PI 1.5 specification.

The MM MP protocol provides a set of functions to allow execution of
procedures on processors that have entered MM. This protocol has the
following properties:
1. The caller can invoke execution of a procedure on a processor, other
than the caller, that has also entered MM. Supports blocking and
non-blocking modes of operation.
2. The caller can invoke a procedure on multiple processors. Supports
blocking and non-blocking modes of operation.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools: Fix python3.8 SyntaxWarning
Cole Robinson [Fri, 12 Jul 2019 17:29:28 +0000 (01:29 +0800)]
BaseTools: Fix python3.8 SyntaxWarning

Building with python3.8 shows a warning like:

SyntaxWarning: invalid escape sequence \(
  GuidName = re.compile("\(GUID=[-a-fA-F0-9]+")

It seems harmless, but it's easy enough to fix: mark the string as
raw with the 'r' prefix like is used elsewhere in the file

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoEmulatorPkg/Unix: Convert timezone from seconds to minutes
Jordan Justen [Sat, 13 Jul 2019 00:34:55 +0000 (17:34 -0700)]
EmulatorPkg/Unix: Convert timezone from seconds to minutes

Fixes and assert seen when running ls under the shell. It appears the
assert was added in:

commit 99849a906e15ea3a9a0330d69bbae0d21ff49808

    ShellPkg/ls: Display the file time in local time.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg/build.sh: Fix missing usage of -b BUILDTARGET parameter
Jordan Justen [Sun, 18 Nov 2018 08:06:04 +0000 (00:06 -0800)]
EmulatorPkg/build.sh: Fix missing usage of -b BUILDTARGET parameter

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg: update HOST_TOOLS to xcode5
Stephano Cetola [Wed, 19 Jun 2019 16:57:20 +0000 (09:57 -0700)]
EmulatorPkg: update HOST_TOOLS to xcode5

The last compiler flag change was for Xcode 5.0, not Xcode 3.2. As such
the HOST_TOOLS should be set to XCODE5.

Also, fix a small typo.

This fixes bug 447:

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

Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoFmpDevicePkg: Fix various typos
Antoine Cœur [Thu, 11 Jul 2019 07:42:30 +0000 (15:42 +0800)]
FmpDevicePkg: Fix various typos

Fix one typo in FmpDevicePkg.

Signed-off-by: Cœur <coeur@gmx.fr>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Add HOST_APPLICATION module type.
Jiewen Yao [Mon, 1 Jul 2019 06:19:13 +0000 (06:19 +0000)]
BaseTools: Add HOST_APPLICATION module type.

It can be used to indicate a module can be build to run
as OS application and run in OS environment.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fixed the issue when ToolDefinitionFile is not generated
Bob Feng [Thu, 11 Jul 2019 00:57:58 +0000 (08:57 +0800)]
BaseTools: Fixed the issue when ToolDefinitionFile is not generated

ToolDefinitionFile is generated by PlatformAutoGen.ToolDefinition()
Code assume ToolDefinition is always called before using
ToolDefinitionFile, but in some cases, it's not true.

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg/PiSmmCpu: ReclaimPages: fix incorrect operator binding
Ray Ni [Thu, 11 Jul 2019 01:16:03 +0000 (09:16 +0800)]
UefiCpuPkg/PiSmmCpu: ReclaimPages: fix incorrect operator binding

Fixes: 4eee0cc7c
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpu: Enable 5 level paging when CPU supports
Ray Ni [Wed, 12 Jun 2019 09:26:45 +0000 (17:26 +0800)]
UefiCpuPkg/PiSmmCpu: Enable 5 level paging when CPU supports

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

The patch changes SMM environment to use 5 level paging when CPU
supports it.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 7365eb2c8cf1d7112330d09918c0c67e8d0b827a)

4 years agoMdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging
Ray Ni [Wed, 12 Jun 2019 03:04:52 +0000 (11:04 +0800)]
MdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging

5-level paging is documented in white paper:
https://software.intel.com/sites/default/files/managed/2b/80/5-level_paging_white_paper.pdf

Commit f8113e25001e715390127f23e2197252cbd6d1a2
changed Cpuid.h already.

This patch updates IA32_CR4 structure to include LA57 field.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
(cherry picked from commit 7c5010c7f88b790f4524c4a5311819e3af5e2752)

4 years agoRevert "MdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging"
Ray Ni [Fri, 12 Jul 2019 07:11:02 +0000 (15:11 +0800)]
Revert "MdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging"

This reverts commit 7c5010c7f88b790f4524c4a5311819e3af5e2752.
Commit
7c5010c7f8 MdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging
technically breaks the EDKII development process documented in
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process
and Maintainers.txt in EDKII repo root directory.

The voilation is commit 7c5010c7f8 doesn't have a Reviewed-by or
Acked-by from MdePkg maintainers.

Signed-off-by: Ray Ni <ray.ni@intel.com>
4 years agoRevert "UefiCpuPkg/PiSmmCpu: Enable 5 level paging when CPU supports"
Ray Ni [Fri, 12 Jul 2019 06:59:32 +0000 (14:59 +0800)]
Revert "UefiCpuPkg/PiSmmCpu: Enable 5 level paging when CPU supports"

This reverts commit 7365eb2c8cf1d7112330d09918c0c67e8d0b827a.
Commit
7c5010c7f8 MdePkg/BaseLib.h: Update IA32_CR4 structure for 5-level paging
technically breaks the EDKII development process documented in
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process
and Maintainers.txt in EDKII repo root directory.

The voilation is commit 7c5010c7f8 doesn't have a Reviewed-by or
Acked-by from MdePkg maintainers.

In order to revert 7c5010c7f87365eb2c8 needs to revert first otherwise
simply reverting 7c5010c7f8 will cause build break.

Signed-off-by: Ray Ni <ray.ni@intel.com>
4 years agoMaintainers.txt: Remove maintainer info for IntelFsp[Wrapper]Pkg
Ray Ni [Wed, 10 Jul 2019 08:04:40 +0000 (16:04 +0800)]
Maintainers.txt: Remove maintainer info for IntelFsp[Wrapper]Pkg

We removed IntelFspPkg and IntelFspWrapperPkg for
<https://bugzilla.tianocore.org/show_bug.cgi?id=1819>; now remove
the dangling maintainer/reviewer assignments too.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
4 years agoIntelFsp2Pkg: Fix various typos
Antoine Cœur [Thu, 11 Jul 2019 08:54:31 +0000 (16:54 +0800)]
IntelFsp2Pkg: Fix various typos

Fix various typos in IntelFsp2Pkg.

Signed-off-by: Cœur <coeur@gmx.fr>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>