]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoSecurityPkg: Fix spelling errors
Sean Brogan [Wed, 9 Oct 2019 07:20:15 +0000 (00:20 -0700)]
SecurityPkg: Fix spelling errors

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

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoSecurityPkg: Change EFI_D_INFO to DEBUG_INFO
Michael D Kinney [Tue, 22 Oct 2019 23:50:32 +0000 (16:50 -0700)]
SecurityPkg: Change EFI_D_INFO to DEBUG_INFO

Update DEBUG() macro to use DEBUG_INFO to address PatchCheck.py error.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoFmpDevicePkg: Fix spelling errors
Sean Brogan [Wed, 9 Oct 2019 04:38:02 +0000 (21:38 -0700)]
FmpDevicePkg: Fix spelling errors

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

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Do not call sys.setdefaultencoding with python 3
Vitaly Cheptsov via Groups.Io [Sun, 20 Oct 2019 10:26:18 +0000 (18:26 +0800)]
BaseTools: Do not call sys.setdefaultencoding with python 3

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

This interface was a originally a no-op in python 3, and now
is fully removed causing a build warning on macOS (Darwin).

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>>
Acked-by: Bob Feng <bob.c.feng@intel.com>
4 years agoPcAtChipsetPkg: Fix spelling errors
Sean Brogan [Wed, 9 Oct 2019 04:55:54 +0000 (21:55 -0700)]
PcAtChipsetPkg: Fix spelling errors

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

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 agoFatPkg: Fix spelling errors
Sean Brogan [Wed, 9 Oct 2019 05:38:15 +0000 (22:38 -0700)]
FatPkg: Fix spelling errors

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

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 agoMdePkg: Add UefiFileHandleLib to DSC file
Sean Brogan [Wed, 25 Sep 2019 06:09:24 +0000 (23:09 -0700)]
MdePkg: Add UefiFileHandleLib to DSC file

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

Add the UefiFileHandleLib to the [Components] section of the
MdePkg DSC file to support full build testing of the MdePkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoOvmfPkg: Make SOURCE_DEBUG_ENABLE actually need to be set to TRUE
Peter Jones [Fri, 20 Sep 2019 18:45:07 +0000 (14:45 -0400)]
OvmfPkg: Make SOURCE_DEBUG_ENABLE actually need to be set to TRUE

Currently some tests check the value of SOURCE_DEBUG_ENABLE, and some
tests check if it's defined or not.  Additionally, in UefiPayloadPkg as
well as some other trees, we define it as FALSE in the .dsc file.

This patch changes all of the Ovmf platforms to explicitly define it as
FALSE by default, and changes all of the checks to test if the value is
TRUE.

Signed-off-by: Peter Jones <pjones@redhat.com>
Message-Id: <20190920184507.909884-1-pjones@redhat.com>
[lersek@redhat.com: drop Contributed-under line, per TianoCore BZ#1373]
[lersek@redhat.com: replace "!= TRUE" with more idiomatic "== FALSE"]
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 Kinney <michael.d.kinney@intel.com>
Cc: Peter Jones <pjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: Arm SRAT Table Generator
Sami Mujawar [Fri, 18 Oct 2019 09:49:20 +0000 (10:49 +0100)]
DynamicTablesPkg: Arm SRAT Table Generator

The SRAT generator uses the configuration manager protocol
to obtain the affinity information for the GICC, GIC ITS,
Memory, Generic Initiator, etc. and generates the SRAT table.

The table generator supports ACPI 6.3, SRAT table revision 3.

The ACPI and PCI device handles of the Generic Initiator
Affinity structures are represented using tokens. The
generator invokes the configuration manager protocol
interfaces and requests for objects referenced by tokens
to get the device handle information.

The Configuration Manager object definition for the GICC has
been updated to include the Proximity Domain, Clock Domain
and associated flag information. Similarly the Configuration
Manager object for the GIC ITS has been updated to include
the Proximity Domain information. These changes should not
impact any existing implementations as the new fields have
been added towards the end of the Configuration Manager
Objects.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: include ARM intrinsics library to fix 32-bit build
Ard Biesheuvel [Tue, 15 Oct 2019 11:07:42 +0000 (13:07 +0200)]
DynamicTablesPkg: include ARM intrinsics library to fix 32-bit build

DynamicTablesPkg can be built for ARM as well as for AARCH64, but on
the former, doing so will result in a build failure due to the lack
of 64-bit division helpers provided by the ArmPkg intrinsics library.
So add the missing reference, for both ARM and AARCH64 (which may
start relying on intrinsics due to future changes)

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2269
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
4 years agoNetworkPkg/SnpDxe: Add PCD to remove ExitBootServices event from SNP driver.
Rabeda, Maciej [Mon, 14 Oct 2019 12:37:28 +0000 (20:37 +0800)]
NetworkPkg/SnpDxe: Add PCD to remove ExitBootServices event from SNP driver.

Patch addresses Bugzilla #1974.

During ExitBootServices stage, drivers should not call any
functions known to use Memory Allocation Services. One of such
functions (as per UEFI spec) is UNDI->Shutdown().

Since UNDI drivers during ExitBootServices phase are expected
to put the adapter to such a state that it will not perform any DMA
operations, there is no need to interface UNDI by SNP driver during
that phase.

Finally, since ExitBootServices event notification function in SNP
only calls UNDI->Shutdown() and Stop() functions, there is no need
to create this event at all. Adding PCD to control creation of event
reacting to ExitBootServices() call so that systems with UNDIs relying
on SNP to call their Shutdown() and Stop() can still work.

Change-Id: Idd76f26d2e8ff7cf88b2d75e2d524c74211f2e89
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Maciej Rabeda <maciej.rabeda@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
4 years agoWinHost: Add SimplePointer support
Marvin Haeuser [Tue, 24 Sep 2019 12:46:14 +0000 (20:46 +0800)]
WinHost: Add SimplePointer support

Catch WM mouse events and expose them via the SimplePointer protocol.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
4 years agoMdeModulePkg/XhciPei: Fix Aligned Page Allocation
Ashish Singhal [Tue, 15 Oct 2019 17:20:47 +0000 (01:20 +0800)]
MdeModulePkg/XhciPei: Fix Aligned Page Allocation

Add support for allocating aligned pages at an alignment higher
than 4K. The new function allocated memory taking into account
the padding required and then frees up unused pages before mapping
it.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/XhciDxe: Fix Aligned Page Allocation
Ashish Singhal [Tue, 15 Oct 2019 17:20:46 +0000 (01:20 +0800)]
MdeModulePkg/XhciDxe: Fix Aligned Page Allocation

While allocating pages aligned at an alignment higher than
4K, allocate memory taking into consideration the padding
required for that alignment. The calls to free pages takes
care of this already.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoSignedCapsulePkg: fix AARCH64 build
Leif Lindholm [Fri, 18 Oct 2019 09:36:01 +0000 (10:36 +0100)]
SignedCapsulePkg: fix AARCH64 build

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

Add NULL library resolution of CompilerIntrinsicsLib and
BaseStackCheckLib for AARCH64 as well as ARM in order to
fix "undefined reference to `memcpy'" build errors.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
4 years agoSecurityPkg Tcg2Dxe: Add Variable Arch protocol dependency
Liming Gao [Wed, 16 Oct 2019 23:46:17 +0000 (07:46 +0800)]
SecurityPkg Tcg2Dxe: Add Variable Arch protocol dependency

commit a7e2d20193e853020a1415c25b53280955055394 introduces the code to
get PcdTpm2AcpiTableRev in the driver entry point. This PCD is designed as
DynamicHii or DynamicHiiEx PCD. So, this PCD depends on Variable service.
To make sure PcdTpm2AcpiTableRev value be got, add Variable service as Depex.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: jiewen Yao <jiewen.yao@intel.com>
4 years agoBaseTools: Fix an incremental build issue caused by macro in #include
Lin, Derek (HPS SW) [Wed, 16 Oct 2019 06:17:26 +0000 (14:17 +0800)]
BaseTools: Fix an incremental build issue caused by macro in #include

When c/h file use macro after #include, for example,
In this case, GenMake is not able to create a healthy dependency for the c
file. GenMake used to add $(FORCE_REBUILD) dependency in the c file, this
guarantee the c file is always compiled in incremental build. But, this
function is broken since 05217d210e8da37b47d0be58ec363f7af2fa1c18 which
enable /MP for MSVC compiler, in order to compile multiple c files in one
command multi-processing. The fix here is adding '$(FORCE_REBUILD)' back to
retain the original function.

Line number 1728 and 978 are the code pieces which handle this logic.

Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoShellPkg/UefiShellDebug1CommandsLib: Update to support SmBios 3.3.0
Abner Chang [Tue, 15 Oct 2019 07:45:45 +0000 (15:45 +0800)]
ShellPkg/UefiShellDebug1CommandsLib: Update to support SmBios 3.3.0

Shell command smbiosview updates for SMBIOS 3.3.0 spec.

Bugzilla link,
https://bugzilla.tianocore.org/show_bug.cgi?id=2202

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoMdePkg/Include: Update to support SmBios 3.3.0
Abner Chang [Tue, 8 Oct 2019 08:04:07 +0000 (16:04 +0800)]
MdePkg/Include: Update to support SmBios 3.3.0

Update SmBios.h to support SMBIOS 3.3.0 spec.

Bugzilla link,
https://bugzilla.tianocore.org/show_bug.cgi?id=2202

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: Update to support SmBios 3.3.0
Abner Chang [Tue, 8 Oct 2019 08:04:06 +0000 (16:04 +0800)]
MdeModulePkg: Update to support SmBios 3.3.0

This commit update the revision of SMBIOS spec reported in PCDs.
Bugzilla link,
https://bugzilla.tianocore.org/show_bug.cgi?id=2202

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoNetworkPkg/Ip6Dxe: Fix typo in comment
Philippe Mathieu-Daude [Wed, 16 Oct 2019 13:25:33 +0000 (21:25 +0800)]
NetworkPkg/Ip6Dxe: Fix typo in comment

An extra 's' slipped into the 'processing' word.
Drop it to fix the typo.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoStandaloneMmPkg/Core: Fix typo in function name
Philippe Mathieu-Daude [Wed, 16 Oct 2019 13:25:32 +0000 (21:25 +0800)]
StandaloneMmPkg/Core: Fix typo in function name

An extra 's' slipped into the FvIsBeingProcessed function
name. Drop it to fix the typo.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/PiSmmCore: Fix typo in function name
Philippe Mathieu-Daude [Wed, 16 Oct 2019 13:25:31 +0000 (21:25 +0800)]
MdeModulePkg/PiSmmCore: Fix typo in function name

An extra 's' slipped into the FvIsBeingProcessed function
name. Drop it to fix the typo.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg DxeCore: Fix typo in function name
Philippe Mathieu-Daude [Wed, 16 Oct 2019 13:25:30 +0000 (21:25 +0800)]
MdeModulePkg DxeCore: Fix typo in function name

An extra 's' slipped into the FvIsBeingProcessed function
name. Drop it to fix the typo.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoArmVirtPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0
Pete Batard [Mon, 14 Oct 2019 15:03:11 +0000 (16:03 +0100)]
ArmVirtPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0

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

Similar to what we now do for OVMF, we need to consider the possibility
that PlatformBootManagerWaitCallback () may be called with a
PcdPlatformBootTimeOut that was set to zero, in which case the call should
simply return.

We also change the initial timeout variable name to make the code explicit.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20191014150311.16740-3-pete@akeo.ie>

4 years agoOvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0
Pete Batard [Mon, 14 Oct 2019 15:03:10 +0000 (16:03 +0100)]
OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0

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

Independently of how we decide to address other aspects of the regression
introduced with commit 2de1f611be06ded3a59726a4052a9039be7d459b, it doesn't
make much sense to call for a progress update if PcdPlatformBootTimeOut is
zero.

PcdPlatformBootTimeOut 0, which is the cause of the bug (division by zero)
should be considered to indicate that a platform is not interested in
displaying a progress report, so we alter PlatformBootManagerWaitCallback
to behave that way.

We also change one variable name to make the code more explicit.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20191014150311.16740-2-pete@akeo.ie>

4 years agoMdeModulePkg/Ufs: Fix UFS flag read from Query Resp UPIU
Agrawal, Sachin [Mon, 23 Sep 2019 11:48:17 +0000 (19:48 +0800)]
MdeModulePkg/Ufs: Fix UFS flag read from Query Resp UPIU

As per UFS spec, flag value is stored in the 'last byte' of value
field. Existing code is attempting to read first byte.

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

Test: Verified the Fix by sending command to set fPowerOnWPEn flag
and then reading it to verify the set value.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/BdsDxe: Fix calling PlatformBootManagerWaitCallback on 0
Laszlo Ersek [Fri, 11 Oct 2019 15:43:37 +0000 (23:43 +0800)]
MdeModulePkg/BdsDxe: Fix calling PlatformBootManagerWaitCallback on 0

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

Commit 2de1f611be06ded3a59726a4052a9039be7d459b introduced a regression
whereas platforms that did set PcdPlatformBootTimeOut to 0 are now getting
an unexpected call to PlatformBootManagerWaitCallback().

This patch also ensures that, if PcdPlatformBootTimeOut is 0xFFFF we don't
call PlatformBootManagerWaitCallback() with a zero argument as doing so
would produce an unwarranted jump to full progress completion which is
likely to throw off users.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix a bug of genffs command generation
Feng, Bob C [Fri, 27 Sep 2019 02:30:17 +0000 (10:30 +0800)]
BaseTools: Fix a bug of genffs command generation

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

The command used by multiple thread genffs feature in makefile
for testing if file exist is generated based on the toolchain family.
It should be based on the OS type.

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/MpInitLib: honor the platform's boot CPU count in AP detection
Laszlo Ersek [Mon, 7 Oct 2019 12:05:28 +0000 (14:05 +0200)]
UefiCpuPkg/MpInitLib: honor the platform's boot CPU count in AP detection

- If a platform boots such that the boot CPU count is smaller than
  PcdCpuMaxLogicalProcessorNumber, then the platform cannot use the "fast
  AP detection" logic added in commit 6e1987f19af7. (Which has been
  documented as a subset of use case (2) in the previous patch.)

  Said logic depends on the boot CPU count being equal to
  PcdCpuMaxLogicalProcessorNumber. If the equality does not hold, the
  platform either has to wait too long, or risk missing APs due to an
  early timeout.

- The platform may not be able to use the variant added in commit
  0594ec417c89 either. (Which has been documented as use case (1) in the
  previous patch.)

  See commit 861218740d6d. When OVMF runs on QEMU/KVM, APs may check in
  with the BSP in arbitrary order, plus the individual AP may take
  arbitrarily long to check-in. If "NumApsExecuting" falls to zero
  mid-enumeration, APs will be missed.

Allow platforms to specify the exact boot CPU count, independently of
PcdCpuMaxLogicalProcessorNumber. In this mode, the BSP waits for all APs
to check-in regardless of timeout. If at least one AP fails to check-in,
then the AP enumeration hangs forever. That is the desired behavior when
the exact boot CPU count is known in advance. (A hung boot is better than
an AP checking-in after timeout, and executing code from released
storage.)

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: expand comment on initial AP enumeration
Laszlo Ersek [Thu, 10 Oct 2019 09:07:39 +0000 (11:07 +0200)]
UefiCpuPkg/MpInitLib: expand comment on initial AP enumeration

Before adding another AP enumeration mode, clarify the documentation on
the current logic. No functional changes.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoSecurityPkg/Tcg2: Add Support Laml, Lasa for TPM2 ACPI.
Jiewen Yao [Sat, 28 Sep 2019 11:56:08 +0000 (19:56 +0800)]
SecurityPkg/Tcg2: Add Support Laml, Lasa for TPM2 ACPI.

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

Tcg2Dxe produces PcdTpm2AcpiTableLaml/Lasa for event log address.
Tcg2Smm consumes PcdTpm2AcpiTableLaml/Lasa to fill TPM2 ACPI table.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoSecurityPkg/dsc: Add PCD for Laml, Lasa for TPM2.
Jiewen Yao [Sat, 28 Sep 2019 11:54:43 +0000 (19:54 +0800)]
SecurityPkg/dsc: Add PCD for Laml, Lasa for TPM2.

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

Those PCDs will be used for TPM2 ACPI table.
Tcg2Dxe need produce those for event log address.
Tcg2Smm need consume those to fill TPM2 ACPI table.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdePkg/Include: correct Lasa in Tpm2Acpi.
Jiewen Yao [Sat, 28 Sep 2019 11:52:22 +0000 (19:52 +0800)]
MdePkg/Include: correct Lasa in Tpm2Acpi.

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

Correct Lasa according to TCG ACPI spec.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls
Laszlo Ersek [Fri, 13 Sep 2019 19:06:19 +0000 (21:06 +0200)]
UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls

The last parameter of ReserveResourceInGcd() is "ImageHandle", forwarded
in turn to gDS->AllocateMemorySpace() or gDS->AllocateIoSpace() as "owner"
image handle.

But BlDxeEntryPoint() passes "SystemTable" as "ImageHandle".

Compilers have not flagged it because EFI_HANDLE (the type of
"ImageHandle") is unfortunately specified as (VOID*), and
(EFI_SYSTEM_TABLE*) converts to (VOID*) silently.

Hand the entry point function's "ImageHandle" parameter to
ReserveResourceInGcd(). This fixes an actual bug.

Cc: Benjamin You <benjamin.you@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoUefiPayloadPkg/BlSupportPei: fix MMCONFIG assignment from XSDT
Laszlo Ersek [Tue, 17 Sep 2019 15:44:30 +0000 (17:44 +0200)]
UefiPayloadPkg/BlSupportPei: fix MMCONFIG assignment from XSDT

(This patch is unrelated to the rest of this series; its purpose is to
enable building the UefiPayloadPkg DSC files with GCC.)

When building "UefiPayloadPkg/UefiPayloadPkgIa32.dsc" with GCC48 for the
DEBUG target, the compiler reports that "Entry32" may be used
uninitialized in ParseAcpiInfo(), in the XSDT branch.

Code inspection proves the compiler right. In the XSDT branch, the code
from the RSDT branch must have been duplicated, and "Entry32" references
were replaced with "Entry64" -- except where "MmCfgHdr" is assigned.

Fix this bug by introducing a helper variable called "Signature", so that
we have to refer to "Entry32" or "Entry64" only once per loop body.

Cc: Benjamin You <benjamin.you@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoStandaloneMmPkg/Core: stop abusing EFI_HANDLE for FwVolHeader tracking
Laszlo Ersek [Tue, 17 Sep 2019 14:59:09 +0000 (16:59 +0200)]
StandaloneMmPkg/Core: stop abusing EFI_HANDLE for FwVolHeader tracking

The FvHasBeenProcessed() and FvIsBeingProcesssed() functions make sure
that every firmware volume is processed only once (every driver in every
firmware volume should be discovered only once). For this, the functions
use a linked list.

In MdeModulePkg's DXE Core and SMM Core, the key used for identifying
those firmware volumes that have been processed is the EFI_HANDLE on which
the DXE or SMM firmware volume protocol is installed. In the
StandaloneMmPkg core however, the key is the address of the firmware
volume header; that is, it has type (EFI_FIRMWARE_VOLUME_HEADER*).

(EFI_FIRMWARE_VOLUME_HEADER*) has nothing to do with EFI_HANDLE.
EFI_HANDLE just happens to be specified as (VOID*), and therefore the
conversion between (EFI_FIRMWARE_VOLUME_HEADER*) and EFI_HANDLE is silent.

(The FvHasBeenProcessed() and FvIsBeingProcesssed() functions were likely
copied verbatim from MdeModulePkg's DXE Core and/or the SMM Core, and not
flagged by the compiler in StandaloneMmPkg due to UEFI regrettably
specifying EFI_HANDLE as (VOID*), thereby enabling the above implicit
conversion.)

We should not exploit this circumstance. Represent the key type faithfully
instead.

This is a semantic fix; there is no change in operation.

Cc: Achin Gupta <achin.gupta@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
4 years agoShellPkg/UefiShellLib: clarify workaround for unfixable EdkShell bug
Laszlo Ersek [Fri, 6 Sep 2019 22:19:29 +0000 (00:19 +0200)]
ShellPkg/UefiShellLib: clarify workaround for unfixable EdkShell bug

The EDK 1 Shell (available at <https://github.com/tianocore/edk-Shell>)
has a bug in its EFI_SHELL_ENVIRONMENT2.Execute() implementation that
edk2's UefiShellLib has no choice but to work around.

Improve the explanation in the code. Also, document the implicit
EFI_HANDLE -> (EFI_HANDLE*) conversion, which happens implicitly after
dereferencing ParentHandle, with an explicit cast.

In practice, this patch is a no-op.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/UefiShellDebug1CommandsLib: fix ShellCloseFile() call
Laszlo Ersek [Fri, 6 Sep 2019 21:29:03 +0000 (23:29 +0200)]
ShellPkg/UefiShellDebug1CommandsLib: fix ShellCloseFile() call

In the FileBufferSave() function, we invoke ShellCloseFile() if "Directory
Can Not Be Saved".

The ShellCloseFile() function takes a (SHELL_FILE_HANDLE*) parameter
called "FileHandle", and correctly passes the de-referenced (*FileHandle)
to EFI_SHELL_CLOSE_FILE, which takes a SHELL_FILE_HANDLE.

However, FileBufferSave() passes SHELL_FILE_HANDLE to ShellCloseFile(),
not the expected (SHELL_FILE_HANDLE*). Correct it.

This fixes an actual bug that has remained hidden for two reasons:

- pointer-to-VOID converts from/to any pointer-to-object type silently,
- the bug is on an error path which has likely never fired in practice.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 21:40:37 +0000 (23:40 +0200)]
ShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLE

The TouchFileByHandle() and IsDirectoryEmpty() functions are passed
SHELL_FILE_HANDLE parameters, and they use those parameters correctly.
However, their parameter lists say EFI_HANDLE.

Spell out the right type in the parameter lists.

In practice, this change is a no-op (because, quite regrettably, both
EFI_HANDLE and SHELL_FILE_HANDLE are specified to be typedefs of (VOID*)).

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 21:15:42 +0000 (23:15 +0200)]
ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE

The UefiShell*CommandsLib instances have constructor functions that do
something like:

  gHiiHandle = HiiAddPackages (...);
  ...
  ShellCommandRegisterCommandName (..., gHiiHandle, ...);

and destructor functions that implement the following pattern:

  HiiRemovePackages (gHiiHandle);

The -- semantic, not functional -- problem is that "gHiiHandle" is
declared with type EFI_HANDLE, and not EFI_HII_HANDLE, in all of these
library instances, even though HiiAddPackages() correctly returns
EFI_HII_HANDLE, and HiiRemovePackages() takes EFI_HII_HANDLE.

Once we fix the type of "gHiiHandle", it causes sort of a butterfly
effect, because it is passed around widely. Track down and update all of
those locations.

The DynamicCommand lib instances use a similar pattern, so they are
affected too.

NOTE: in practice, this patch is a no-op, as both EFI_HII_HANDLE and
EFI_HANDLE are typedefs to (VOID*). However, we shouldn't use EFI_HANDLE
where semantically EFI_HII_HANDLE is passed around.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg/UefiShellDriver1CommandsLib: fix parameter list typo
Laszlo Ersek [Fri, 6 Sep 2019 20:02:06 +0000 (22:02 +0200)]
ShellPkg/UefiShellDriver1CommandsLib: fix parameter list typo

The ShellCommandRunConnect() function passes EFI_HANDLE -- (VOID*) --
objects to ConvertAndConnectControllers(), and
ConvertAndConnectControllers() passes those to gBS->OpenProtocol().

Accordingly, ConvertAndConnectControllers() should specify EFI_HANDLE
parameter types, not (EFI_HANDLE*) -- (VOID**) -- types.

This typo is masked because (VOID*) converts to and from any
pointer-to-object type silently.

Note that functionally speaking there is no problem, so this patch does
not change beavior, only cleans up the code.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoSecurityPkg: stop abusing EFI_EVENT for protocol notify registration
Laszlo Ersek [Fri, 6 Sep 2019 22:58:19 +0000 (00:58 +0200)]
SecurityPkg: stop abusing EFI_EVENT for protocol notify registration

EfiCreateProtocolNotifyEvent() takes a (VOID**) for "Registration",
similarly to gBS->RegisterProtocolNotify(). We should pass the address of
an actual pointer-to-VOID, and not the address of an EFI_EVENT. EFI_EVENT
just happens to be specified as (VOID*), and has nothing to do with the
registration.

This change is a no-op in practice; it's a semantic improvement.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoSecurityPkg: fix UninstallMultipleProtocolInterfaces() calls
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
SecurityPkg: fix UninstallMultipleProtocolInterfaces() calls

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

These are actual bugs. They must have remained hidden until now because
they are all in Unload() functions, which are probably exercised
infrequently. Fix the UninstallMultipleProtocolInterfaces() calls.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoOvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions
Laszlo Ersek [Thu, 12 Sep 2019 21:53:16 +0000 (23:53 +0200)]
OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions

In the following call tree:

 PlatformInit ()
   mInstalledPackages = HiiAddPackages ()
 GopInstalled ()
    PopulateForm (PackageList = mInstalledPackages)
      CreateResolutionOptions (PackageList)
        HiiSetString (PackageList
      HiiUpdateForm (PackageList)

PlatformDxe passes around an EFI_HII_HANDLE that (a) originates from
HiiAddPackages() and (b) is ultimately passed to HiiSetString() and
HiiUpdateForm(). The intermediate functions PopulateForm() and
CreateResolutionOptions() however take that parameter as an
(EFI_HII_HANDLE*).

There is no bug in practice (because the affected functions never try to
de-reference the "PackageList" parameter, they just pass it on), but the
function prototypes are semantically wrong. Fix that.

This could remain hidden so long because pointer-to-VOID silently converts
to/from any pointer-to-object type, and the UEFI spec mandates that
EFI_HII_HANDLE be a typedef to (VOID*).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoOvmfPkg/VirtioNetDxe: fix SignalEvent() call
Laszlo Ersek [Thu, 12 Sep 2019 21:27:56 +0000 (23:27 +0200)]
OvmfPkg/VirtioNetDxe: fix SignalEvent() call

The SignalEvent() boot service takes an EFI_EVENT, not an (EFI_EVENT*).
Fix the call in the notification function of
"EFI_SIMPLE_NETWORK_PROTOCOL.WaitForPacket".

This is an actual bug. The reason it's never been triggered is likely that
the "SNP.WaitForPacket" event is rarely waited for by applications -- edk2
itself has zero instances of that, for example.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoOvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
OvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

This is an actual bug. It must have remained hidden until now because it's
on an error path. Fix the UninstallMultipleProtocolInterfaces() call.

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>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoNetworkPkg/TcpDxe: fix SockFreeFoo() parameter list
Laszlo Ersek [Sat, 7 Sep 2019 18:17:24 +0000 (20:17 +0200)]
NetworkPkg/TcpDxe: fix SockFreeFoo() parameter list

The SockFreeFoo() callback function for NetbufFromExt() has to match the
NET_VECTOR_EXT_FREE prototype, which takes a (VOID*) as callback argument
(Arg). EFI_EVENT has nothing to do with NET_VECTOR_EXT_FREE. Fix the
SockFreeFoo() parameter list.

This change is a no-op in practice.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg/Ip4Dxe: fix NetLibDestroyServiceChild() call
Laszlo Ersek [Sat, 7 Sep 2019 12:25:43 +0000 (14:25 +0200)]
NetworkPkg/Ip4Dxe: fix NetLibDestroyServiceChild() call

Both NetLibDestroyServiceChild() and EFI_SERVICE_BINDING_DESTROY_CHILD
take an EFI_HANDLE for the "ChildHandle" parameter, not an (EFI_HANDLE*).

This patch fixes a real bug.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg: fix CloseProtocol & UninstallMultipleProtocolInterfaces calls
Laszlo Ersek [Sat, 7 Sep 2019 12:11:31 +0000 (14:11 +0200)]
NetworkPkg: fix CloseProtocol & UninstallMultipleProtocolInterfaces calls

Both the "ControllerHandle" parameter of CloseProtocol() and the "Handle"
parameter of UninstallMultipleProtocolInterfaces() have type EFI_HANDLE,
not (EFI_HANDLE*).

This patch fixes actual bugs. The issues have been dormant likely because
they are on error paths. (Or, in case of TlsAuthConfigDxe, because the
driver is unloaded likely very infrequently.)

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoNetworkPkg/DxeNetLib: fix type typo in NetLibGetMacAddress()
Laszlo Ersek [Fri, 6 Sep 2019 22:37:31 +0000 (00:37 +0200)]
NetworkPkg/DxeNetLib: fix type typo in NetLibGetMacAddress()

NetLibGetSnpHandle() returns an EFI_HANDLE, not an (EFI_HANDLE*).
NetLibGetMacAddress() only uses the return value ("SnpHandle") for a
NULL-check. Fix the type of "SnpHandle".

This patch is a no-op.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdePkg/DxeServicesLib: remove bogus cast
Laszlo Ersek [Fri, 6 Sep 2019 22:40:56 +0000 (00:40 +0200)]
MdePkg/DxeServicesLib: remove bogus cast

The HandleProtocol() boot service takes an EFI_HANDLE, not an
(EFI_HANDLE*). Remove the bogus cast in the
InternalImageHandleToFvHandle() function.

This is a semantic cleanup; there is no change in behavior.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/S3SaveState: cast Position for S3BootScriptLib explicitly
Laszlo Ersek [Fri, 13 Sep 2019 17:33:38 +0000 (19:33 +0200)]
MdeModulePkg/S3SaveState: cast Position for S3BootScriptLib explicitly

The BootScriptInsert() and BootScriptLabel() functions take the in/out
parameter "Position" as (EFI_S3_BOOT_SCRIPT_POSITION*), and pass it to
S3BootScriptMoveLastOpcode() and S3BootScriptLabel(), respectively.

The callees take the in/out parameter "Position" as (VOID**). Add explicit
casts for clarity.

There is no change in functionality.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/PiSmmCore: make type punning consistent
Laszlo Ersek [Thu, 12 Sep 2019 22:29:43 +0000 (00:29 +0200)]
MdeModulePkg/PiSmmCore: make type punning consistent

The SmiHandlerRegister() function explicitly casts "SmiHandler" (of type
(SMI_HANDLER*)) to EFI_HANDLE, when outputting "DispatchHandle".

Apply the same cast in the counterpart function SmiHandlerUnRegister(),
which compares multiple "SmiHandler"s against the input "DispatchHandle".

This is a semantic cleanup; there is no functional change.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
MdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

These are actual bugs. They must have remained hidden until now because
they are on error paths. Fix the UninstallMultipleProtocolInterfaces()
calls.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: PEI Core: clean up "AprioriFile" handling in FindFileEx()
Laszlo Ersek [Sat, 7 Sep 2019 13:13:39 +0000 (15:13 +0200)]
MdeModulePkg: PEI Core: clean up "AprioriFile" handling in FindFileEx()

Clean up two issues around FindFileEx():

- The "AprioriFile" parameter's type differs between the function
  declaration and the function definition. The correct type is
  (EFI_PEI_FILE_HANDLE*).

- "FfsFileHeader" has type (EFI_FFS_FILE_HEADER*); for clarity, we should
  cast it explicitly to EFI_PEI_FILE_HANDLE when assigning it to
  (*AprioriFile).

This is a semantic cleanup, there is no functional change.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: stop abusing EFI_HANDLE for keystroke notify registration
Laszlo Ersek [Sat, 7 Sep 2019 11:34:09 +0000 (13:34 +0200)]
MdeModulePkg: stop abusing EFI_HANDLE for keystroke notify registration

EFI_REGISTER_KEYSTROKE_NOTIFY and EFI_UNREGISTER_KEYSTROKE_NOTIFY require
the notification handle to have type (VOID*). The notification handle has
nothing to do with the EFI_HANDLE type.

This change is a semantic fix; functionally, it's a no-op.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug
Laszlo Ersek [Sat, 7 Sep 2019 11:17:49 +0000 (13:17 +0200)]
MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug

The PI spec (v1.7) correctly specifies "EFI_RUNTIME_EVENT_ENTRY.Event" in
natural language, but the field type in the structure definition itself is
wrong -- it should be EFI_EVENT, not (EFI_EVENT*).

This spec bug is likely unfixable for compatibility reasons, and so edk2
works it around already. We should clearly document the workaround.

Functionally, this patch is a no-op.

(I've also requested a non-normative (informative) clarification for the
PI spec: <https://mantis.uefi.org/mantis/view.php?id=2017>.)

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call
Laszlo Ersek [Sat, 7 Sep 2019 09:48:58 +0000 (11:48 +0200)]
MdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call

The HiiConstructConfigHdr() function takes the "DriverHandle" parameter in
order to fetch the device path from it, and then turn the device path into
PATH routing information.

The HiiConstructConfigHdr() function is called from
VariableCleanupHiiExtractConfig(), which is only installed when "Type" is
"VarCleanupManually" in PlatformVarCleanup().

In that case, we create "Private->DriverHandle" as a new handle, and
install "mVarCleanupHiiVendorDevicePath" on it. Then we pass
"Private->DriverHandle" to HiiAddPackages(), which consumes the device
path for routing purposes.

It follows that the "DriverHandle" argument passed to
HiiConstructConfigHdr() should be the same driver handle, for matching
routing.

Currently we pass "Private->HiiHandle", which is clearly a typo, because
it is the return value of HiiAddPackages(), and stands for the published
HII package list.

Therefore this patch addresses an actual bug.

The typo has not been flagged by compilers because the UEFI spec
regrettably defines both EFI_HANDLE and EFI_HII_HANDLE as (VOID*).

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: stop abusing EFI_EVENT for protocol notify registration
Laszlo Ersek [Fri, 6 Sep 2019 22:58:19 +0000 (00:58 +0200)]
MdeModulePkg: stop abusing EFI_EVENT for protocol notify registration

EfiCreateProtocolNotifyEvent() takes a (VOID**) for "Registration",
similarly to gBS->RegisterProtocolNotify(). We should pass the address of
an actual pointer-to-VOID, and not the address of an EFI_EVENT. EFI_EVENT
just happens to be specified as (VOID*), and has nothing to do with the
registration.

The same applies to gMmst->MmRegisterProtocolNotify().

"mFtwRegistration", "mFvRegistration", and "mFvbRegistration" are used for
nothing else.

This change is a no-op in practice; it's a semantic improvement.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/UefiHiiLib: stop using EFI_HANDLE in place of EFI_HII_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 22:45:38 +0000 (00:45 +0200)]
MdeModulePkg/UefiHiiLib: stop using EFI_HANDLE in place of EFI_HII_HANDLE

HiiGetHiiHandles() returns an array of EFI_HII_HANDLEs, not EFI_HANDLEs.
HiiGetString() takes an EFI_HII_HANDLE, not an EFI_HANDLE.

This change is a no-op in practice; it's a semantic improvement.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: fix cast in GetModuleInfoFromHandle() calls
Laszlo Ersek [Fri, 6 Sep 2019 19:40:32 +0000 (21:40 +0200)]
MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls

GetModuleInfoFromHandle() takes an EFI_HANDLE -- (VOID*) -- as first
parameter, but InsertFpdtRecord() passes (EFI_HANDLE*) -- (VOID**).
(VOID**) converts silently to (VOID*), which is why the wrong cast is
masked.

Note that the *value* that is passed is alright -- therefore this patch
does not change behavior --, it's just semantically wrong to pass an
(EFI_HANDLE*) where an EFI_HANDLE is expected.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoEmulatorPkg: stop abusing EFI_HANDLE for keystroke notify registration
Laszlo Ersek [Sat, 7 Sep 2019 11:34:09 +0000 (13:34 +0200)]
EmulatorPkg: stop abusing EFI_HANDLE for keystroke notify registration

EFI_REGISTER_KEYSTROKE_NOTIFY and EFI_UNREGISTER_KEYSTROKE_NOTIFY require
the notification handle to have type (VOID*). The notification handle has
nothing to do with the EFI_HANDLE type.

This change is a semantic fix; functionally, it's a no-op.

Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmulatorPkg/DxeTimerLib: drop superfluous cast
Laszlo Ersek [Sat, 7 Sep 2019 00:07:55 +0000 (02:07 +0200)]
EmulatorPkg/DxeTimerLib: drop superfluous cast

"gTimerEvent" has type EFI_EVENT already, drop the superfluous cast.

Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop()
Laszlo Ersek [Fri, 6 Sep 2019 23:43:28 +0000 (01:43 +0200)]
EmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop()

The 3rd and 4th parameters of the CloseProtocol() call are wrong.

Given that we're not dissociating a child controller from a parent
controller (= closing a BY_CHILD_CONTROLLER open), but closing a BY_DRIVER
open, the 4th parameter (ControllerHandle) should equal the 1st parameter
(Handle).

It's unclear why this code hasn't crashed before.

Note that the patch doesn't fix the underlying driver model bug. I don't
understand what the loop in MmcDriverBindingStop() attempts to do. Is this
driver supposed to be a bus driver? It seems to create new handles, and to
append device path nodes. But it doesn't set up proper parent/child
protocol opens, and it doesn't close them.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoEmbeddedPkg/AndroidFastbootTransportTcpDxe: fix DestroyChild() call
Laszlo Ersek [Fri, 6 Sep 2019 23:25:10 +0000 (01:25 +0200)]
EmbeddedPkg/AndroidFastbootTransportTcpDxe: fix DestroyChild() call

- The 2nd parameter of EFI_SERVICE_BINDING_CREATE_CHILD is:

  IN OUT EFI_HANDLE *ChildHandle

- The 2nd parameter of EFI_SERVICE_BINDING_DESTROY_CHILD is:

  IN EFI_HANDLE ChildHandle

Fix the DestroyChild() call in TcpFastbootTransportStop().

This is an actual bugfix; I don't know why the current code doesn't crash.
Perhaps the function is never reached in practice? (It could be tied to an
error path.)

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>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoEmbeddedPkg: add missing EFIAPI calling convention specifiers
Laszlo Ersek [Tue, 17 Sep 2019 11:05:09 +0000 (13:05 +0200)]
EmbeddedPkg: add missing EFIAPI calling convention specifiers

This patch is unrelated to the rest of the series; it just makes sure that
"EmbeddedPkg/EmbeddedPkg.dsc" builds for all platforms advertised in
SUPPORTED_ARCHITECTURES (in particular, X64).

No functional changes.

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 agoMdeModulePkg/BdsDxe: Also call PlatformBootManagerWaitCallback on 0
Pete Batard [Wed, 25 Sep 2019 15:50:05 +0000 (23:50 +0800)]
MdeModulePkg/BdsDxe: Also call PlatformBootManagerWaitCallback on 0

The existing loop is set to call PlatformBootManagerWaitCallback every
second except the last one. We believe this is a mistake as it prevents
the called code from performing timeout expiration tasks such as, for
instance, ensuring that the last segment of a progress bar is displayed
before continuing (which is a current issue for the RPi3 platform).

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMaintainers.txt: Move ShellBin maintainers to EDK II Releases section
Liming Gao [Fri, 27 Sep 2019 00:23:30 +0000 (08:23 +0800)]
Maintainers.txt: Move ShellBin maintainers to EDK II Releases section

ShellBinPkg is generated for each edk2 stable tag release.

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>
4 years agoNetworkPkg: Remove unnecessary MdeModulePkg/MdeModulePkg.dec dependency in INF
Liming Gao [Tue, 17 Sep 2019 02:58:59 +0000 (10:58 +0800)]
NetworkPkg: Remove unnecessary MdeModulePkg/MdeModulePkg.dec dependency in INF

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdeModulePkg: Remove PCD gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize
Liming Gao [Tue, 17 Sep 2019 02:58:58 +0000 (10:58 +0800)]
MdeModulePkg: Remove PCD gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2195
This PCD has been moved to NetworkPkg.dec file.

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: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoNetworkPkg UefiPxeBcDxe: Consume PcdTftpBlockSize defined in NetworkPkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:57 +0000 (10:58 +0800)]
NetworkPkg UefiPxeBcDxe: Consume PcdTftpBlockSize defined in NetworkPkg.dec

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

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg: Add PcdTftpBlockSize in NetworkPkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:56 +0000 (10:58 +0800)]
NetworkPkg: Add PcdTftpBlockSize in NetworkPkg.dec

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2195
PcdTftpBlockSize is network related PCD. It should be defined in NetworkPkg.dec.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdeModulePkg: Remove network related guid definitions from MdeModulePkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:55 +0000 (10:58 +0800)]
MdeModulePkg: Remove network related guid definitions from MdeModulePkg.dec

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2196
Network related guid definitions have been moved into NetworkPkg.dec.
So, they can be removed from MdeModulePkg.dec.

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: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoNetworkPkg: Move network related header files from MdeModulePkg to NetworkPkg
Liming Gao [Tue, 17 Sep 2019 02:58:54 +0000 (10:58 +0800)]
NetworkPkg: Move network related header files from MdeModulePkg to NetworkPkg

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

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoUefiCpuPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:05:06 +0000 (13:05 +0100)]
UefiCpuPkg: strip trailing whitespace

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoOvmfPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:05:00 +0000 (13:05 +0100)]
OvmfPkg: strip trailing whitespace

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:53 +0000 (13:04 +0100)]
MdeModulePkg: strip trailing whitespace

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoEmulatorPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:40 +0000 (13:04 +0100)]
EmulatorPkg: strip trailing whitespace

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: strip trailing whitespace
Leif Lindholm [Tue, 1 Oct 2019 12:42:32 +0000 (13:42 +0100)]
BaseTools: strip trailing whitespace

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoArmPlatformPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:27 +0000 (13:04 +0100)]
ArmPlatformPkg: strip trailing whitespace

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoArmPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:22 +0000 (13:04 +0100)]
ArmPkg: strip trailing whitespace

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: convert Lauterbach README.txt to 7-bit safe Readme.md
Leif Lindholm [Wed, 18 Sep 2019 21:44:56 +0000 (22:44 +0100)]
EmbeddedPkg: convert Lauterbach README.txt to 7-bit safe Readme.md

This file contained what looked like windows 1250 encoded single
quotation marks. Convert them to regular 's. Rework the file to
markdown format and and rename it Readme.md while we're at it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: correct line endings for ConvertFce Python script
Leif Lindholm [Wed, 18 Sep 2019 21:41:08 +0000 (22:41 +0100)]
BaseTools: correct line endings for ConvertFce Python script

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoArmPkg: ArmScmiDxe - convert .h to from 8859-x to 7-bit
Leif Lindholm [Wed, 18 Sep 2019 21:38:46 +0000 (22:38 +0100)]
ArmPkg: ArmScmiDxe - convert .h to from 8859-x to 7-bit

A paragraph sign in a comment came from some ISO8859 encoding,
convert it to the word "section" to remain 7-bit safe, since we're
not actually doing anything special.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: fix .dsc line ending
Leif Lindholm [Wed, 18 Sep 2019 20:40:42 +0000 (21:40 +0100)]
DynamicTablesPkg: fix .dsc line ending

Correct line ending in package .dsc.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Sami Mujawar <Sami.Mujawar@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: fix line endings in SetupGit.py Conf files
Leif Lindholm [Wed, 18 Sep 2019 20:35:08 +0000 (21:35 +0100)]
BaseTools: fix line endings in SetupGit.py Conf files

A file header license/copyright header copied around in commit
5b3e695d8ac5 ("BaseTools: add centralized location for git config files")
was missing a CR - add it in both faulty locations.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: delete outdated FdtLib README.txt
Leif Lindholm [Wed, 18 Sep 2019 20:26:44 +0000 (21:26 +0100)]
EmbeddedPkg: delete outdated FdtLib README.txt

While looking at encoding and line ending errors, I found this file
in fact simply points to a sourceforge page which no longer exists.
Since there is nothing more to say than "this is an import of
libfdt", let's just delete it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoNetworkPkg: add missing newline at end of file
Leif Lindholm [Wed, 18 Sep 2019 08:23:05 +0000 (09:23 +0100)]
NetworkPkg: add missing newline at end of file

Add missing newline at end of WifiConnectionManagerDxe .uni.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf
Leif Lindholm [Wed, 18 Sep 2019 08:22:52 +0000 (09:22 +0100)]
EmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: add missing newlines at end of files
Leif Lindholm [Wed, 18 Sep 2019 08:22:15 +0000 (09:22 +0100)]
BaseTools: add missing newlines at end of files

Some scripts in Source/Python were missing newlines at end of files,
so add them.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-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: Fix GenMake multi-workspace failure
Kubacki, Michael A [Tue, 1 Oct 2019 22:57:56 +0000 (06:57 +0800)]
BaseTools: Fix GenMake multi-workspace failure

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

Commit 0075ab2cec introduced an issue that causes an exception
when multiple workspace packages paths are specified. For example,
if edk2-platforms is used, the root directory will contain an edk
and edk2-platforms directory representing the respective
repositories.

In GenMake, the path to the package DEC file for a module is
discovered by getting the relative path of the INF to the
workspace root directory. Each directory in the relative path
is incrementally joined to the WORKSPACE directory. The file
list in the joined path is searched for a DEC file.

As an example, if the build command is used on a package outside
the edk2 repository, the INF file path is relative to the
edk2-platforms directory not edk2. This causes directory paths
to be built that do not exist. Commit 0075ab2cec replaced the
os.path.exists() call with a try except block that always fails
when os.listdir() is invoked to enumerate the list of files in
the built directory path on packages outside edk2.

This commit restores the original conditional statement which
avoids calling os.listdir() with an invalid directory path.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: use stdint.h for GCC ProcessorBind.h typedefs
Leif Lindholm [Thu, 26 Sep 2019 19:28:18 +0000 (20:28 +0100)]
BaseTools: use stdint.h for GCC ProcessorBind.h typedefs

The AArch64 definitions of UINT64/INT64 differ from the X64 ones.
Since this is on the tool side, doing like X64 and picking the
definitions from stdint.h feels like a better idea than hardcoding
them. So copy the pattern from X64/ProcessorBind.h.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg: Enable/Disable S3BootScript dynamically.
Chasel Chiu [Wed, 4 Sep 2019 00:43:22 +0000 (08:43 +0800)]
MdeModulePkg: Enable/Disable S3BootScript dynamically.

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

In binary model the same binary may have to support both
S3 enabled and disabled scenarios, however not all DXE
drivers linking PiDxeS3BootScriptLib can return error to
invoke library DESTRUCTOR for releasing resource.

To support this usage model below PCD is used to skip
S3BootScript functions when PCD set to FALSE:
  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable

Test: Verified on internal platform and S3BootScript
      functions can be skipped by PCD during boot time.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools/LzmaCompress: Fix the option "d" dictionary size
Zhang, Shenglei [Mon, 30 Sep 2019 03:52:28 +0000 (11:52 +0800)]
BaseTools/LzmaCompress: Fix the option "d" dictionary size

The range of dictionary size is set from [0,30] to [0,27].
And update the help information for this.
The previous logic for processing the parameter dict size is incorrect.
Now fix the logic.
The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

Cc: Bob Feng <bob.c.feng@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/ScsiDiskDxe: Support Storage Security Command Protocol
Zurcher, Christopher J [Fri, 27 Sep 2019 02:20:00 +0000 (10:20 +0800)]
MdeModulePkg/ScsiDiskDxe: Support Storage Security Command Protocol

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

This patch implements the EFI_STORAGE_SECURITY_COMMAND_PROTOCOL in the
ScsiDiskDxe driver.

Support is currently limited to the RPMB Well-known LUN for UFS devices.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/ScsiBusDxe: Clean up Peripheral Type check
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:59 +0000 (10:19 +0800)]
MdeModulePkg/ScsiBusDxe: Clean up Peripheral Type check

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

Replacing "magic numbers" in the Peripheral Type check with defines for
the reserved range from IndustryStandard/Scsi.h

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun)
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:58 +0000 (10:19 +0800)]
MdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun)

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

Currently UfsPassThru only checks for 8 common LUNs. This adds a check
for the RPMB Well-known LUN and sets the corresponding bit-mask. Further
handling of the WLUN is already present in the driver.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdePkg: Implement SCSI commands for Security Protocol In/Out
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:57 +0000 (10:19 +0800)]
MdePkg: Implement SCSI commands for Security Protocol In/Out

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

This patch implements the Security Protocol In and Security Protocol Out
commands in UefiScsiLib to prepare support for the Storage Security
Command Protocol.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix the lib order in static_library_files.lst
Feng, Bob C [Fri, 27 Sep 2019 11:35:23 +0000 (19:35 +0800)]
BaseTools: Fix the lib order in static_library_files.lst

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

This patch is going to fix the lib order in static_library_files.lst.
This issue is introduced by commit 673d09a2dd.
Before 673d09a2dd, build tool apply build rule for the module's library
firstly and then apply build rule for module itself. Now, build tool
apply build rule for module self and then for its library. That behavior
impact the lib order in static_library_files.lst.

This patch is to call module's LibraryAutoGenList function
explicitly, where the applying build rule action for
library is triggered.

Cc: Liming Gao <liming.gao@intel.com>
Cc: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>