]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
6 years agoBaseTools: Clean up tools_def.template for XCODE5
Michael Kinney [Tue, 16 May 2017 18:59:52 +0000 (11:59 -0700)]
BaseTools: Clean up tools_def.template for XCODE5

Reorganize the statements for XCODE5 to match other tool
chains and remove dependency on XCLANG and XCODE32

Cc: Andrew Fish <afish@apple.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
6 years agoBaseTools: Add -D NO_MSABI_VARGS to X64 XCODE5 CC_FLAGS
Michael Kinney [Tue, 16 May 2017 18:41:08 +0000 (11:41 -0700)]
BaseTools: Add -D NO_MSABI_VARGS to X64 XCODE5 CC_FLAGS

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

Update BaseTools/Conf/tools_def.template to add the define

-D NO_MSABI_VAARGS

To CC_FLAGS for X64 XCODE5 builds.

The llvm/clang compiler used in XCODE5 builds supports the
_ms_ versions of the vararg builtins, but the compiler
generates build errors.

The recommendation from the XCODE5 experts is to never use
the _ms_ version of the vararg builtins.  The define
NO_MSABI_VARARGS is already supported in MdePkg/Include/Base.h
and forces the use the standard vararg builtins.

Cc: Andrew Fish <afish@apple.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
6 years agoOvmfPkg: Add XCODE5 statements to fix build break
Michael Kinney [Wed, 3 May 2017 00:25:10 +0000 (17:25 -0700)]
OvmfPkg: Add XCODE5 statements to fix build break

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

The XCODE5 tool chain has a FAMILY of GCC.  The
GCC statements in the [BuildOptions] section add
flags that are not compatible with XCODE5.  Add
empty XCODE5 statements in [BuildOptions] sections
to prevent the use of the GCC flags in XCODE5
builds.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoUefiCpuPkg: Use FINIT instead of hex values
Michael Kinney [Thu, 4 May 2017 22:33:06 +0000 (15:33 -0700)]
UefiCpuPkg: Use FINIT instead of hex values

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

Update X64 NASM file to match IA32 NASM file
and use FINIT instruction instead of hand
assembled hex values for the FINIT instruction.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoUefiCpuPkg/BaseUefiCpuLib: Use NASM read-only data section name
Michael Kinney [Tue, 16 May 2017 20:35:17 +0000 (13:35 -0700)]
UefiCpuPkg/BaseUefiCpuLib: Use NASM read-only data section name

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

NASM requires read-only data sections to use the section
name .rodata.  This fix changes .rdata to .rodata.

The build failure from use of .rdata is seen when using
the XCODE5 tool chain.

Section "7.8.1 macho extensions to the SECTION Directive"
of the NASM documentation at http://www.nasm.us/doc/
describes the section name requirements.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add missing JMP instruction
Michael Kinney [Thu, 11 May 2017 22:35:21 +0000 (15:35 -0700)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add missing JMP instruction

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

Add JMP instruction in SmiEntry.S file that is missing.  This
updates SmiEntry.S to match the logic in SmiEntry.asm and
SmiEntry.nasm.

The default BUILDRULEORDER has .nasm higher priority than
.asm or .S, so this issue was not seen with MSFT or GCC
tool chain families.  The XCODE5 tool chain overrides the
BUILDRULEORDER with .S higher than .nasm, so this issue
was only seen when using XCODE5 tool chain when IA32 SMM
is enabled.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoPcAtChipsetPkg/SerialIoLib: Remove negative value shift
Michael Kinney [Wed, 3 May 2017 00:23:22 +0000 (17:23 -0700)]
PcAtChipsetPkg/SerialIoLib: Remove negative value shift

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

Remove left shift of negative values that always evaluate
to 0 to address build errors from the llvm/clang compiler
used in the XCODE5 tool chain.

Clang rightfully complains about left-shifting ~DLAB. DLAB is #defined
as 0x01 (an "int"), hence ~DLAB has value (-2) on all edk2 platforms.
Left-shifting a negative int is undefined behavior.

Rather than replacing ~DLAB with ~(UINT32)DLAB, realize that the nonzero
bits of (~(UINT32)DLAB << 7) would all be truncated away in the final
conversion to UINT8 anyway. So just remove (~DLAB << 7).

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoMdeModulePkg PCD: Fix TmpTokenSpaceBufferCount not assigned correctly
Star Zeng [Thu, 18 May 2017 08:34:37 +0000 (16:34 +0800)]
MdeModulePkg PCD: Fix TmpTokenSpaceBufferCount not assigned correctly

When DynamicEx PCD is only used in PEI code, but not DXE code,
current implementation of DxePcdGetNextTokenSpace does not assign
TmpTokenSpaceBufferCount correctly, but leaves it as initial value,
then DxePcdGetNextTokenSpace may return incorrect token space guid
and status.

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoOvmfPkg/README: document 4MB flash layout
Laszlo Ersek [Sat, 6 May 2017 16:09:28 +0000 (18:09 +0200)]
OvmfPkg/README: document 4MB flash layout

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=527
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/PlatformPei: align EmuVariableNvStore at any page boundary
Laszlo Ersek [Sat, 6 May 2017 14:02:47 +0000 (16:02 +0200)]
OvmfPkg/PlatformPei: align EmuVariableNvStore at any page boundary

EmuVariableFvbRuntimeDxe now uses a 4KB (EFI_PAGE_SIZE) block size.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB
Laszlo Ersek [Sat, 6 May 2017 11:17:58 +0000 (13:17 +0200)]
OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB

EmuVariableFvbRuntimeDxe currently produces a Firmware Volume Block
protocol that is based on a block map of two blocks, each block having
PcdFlashNvStorageFtwSpareSize for size.

(The total size is 2 * PcdFlashNvStorageFtwSpareSize.)

FaultTolerantWriteDxe in turn expects the block size to be a power of two.

In the 4MB build of OVMF, PcdFlashNvStorageFtwSpareSize is 264KB, which is
not a power of two. In order to equip EmuVariableFvbRuntimeDxe for this
build, shrink the block size to 4KB (EFI_PAGE_SIZE), and grow the block
count from 2 to EFI_SIZE_TO_PAGES(2 * PcdFlashNvStorageFtwSpareSize). The
total size remains

  2 * PcdFlashNvStorageFtwSpareSize
  --------------------------------- * EFI_PAGE_SIZE
            EFI_PAGE_SIZE

Right now EmuVariableFvbRuntimeDxe open-codes the block count of 2 in
various limit checks, so introduce a few new macros:
- EMU_FVB_NUM_TOTAL_BLOCKS, for the LHS of the above product,
- EMU_FVB_NUM_SPARE_BLOCKS for the half of that.

Also rework the FVB protocol members to support an arbitrary count of
blocks.

Keep the invariant intact that the first half of the firmware volume hosts
the variable store and the FTW working block, and that the second half
maps the FTW spare area.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=527
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/EmuVariableFvbRuntimeDxe: strip trailing whitespace
Laszlo Ersek [Sat, 6 May 2017 11:52:08 +0000 (13:52 +0200)]
OvmfPkg/EmuVariableFvbRuntimeDxe: strip trailing whitespace

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/QemuFlashFvbServicesRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()
Laszlo Ersek [Thu, 18 May 2017 12:48:13 +0000 (14:48 +0200)]
OvmfPkg/QemuFlashFvbServicesRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()

According to the PI spec, Volume 3,
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.EraseBlocks():

> The variable argument list is a list of tuples. Each tuple describes a
> range of LBAs to erase and consists of the following:
> * An EFI_LBA that indicates the starting LBA
> * A UINTN that indicates the number of blocks to erase

(NB, in edk2, EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is a typedef to
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.)

In this driver, the NumOfLba local variable is defined with type UINTN,
but the TYPE argument passed to VA_ARG() is UINT32. Fix the mismatch.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/EmuVariableFvbRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()
Laszlo Ersek [Thu, 18 May 2017 12:48:13 +0000 (14:48 +0200)]
OvmfPkg/EmuVariableFvbRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()

According to the PI spec, Volume 3,
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.EraseBlocks():

> The variable argument list is a list of tuples. Each tuple describes a
> range of LBAs to erase and consists of the following:
> * An EFI_LBA that indicates the starting LBA
> * A UINTN that indicates the number of blocks to erase

(NB, in edk2, EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is a typedef to
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.)

In this driver, the NumOfLba local variable is defined with type UINTN,
but the TYPE argument passed to VA_ARG() is UINT32. Fix the mismatch.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoEmulatorPkg/FvbServicesRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()
Laszlo Ersek [Thu, 18 May 2017 12:48:13 +0000 (14:48 +0200)]
EmulatorPkg/FvbServicesRuntimeDxe: correct NumOfLba vararg type in EraseBlocks()

According to the PI spec, Volume 3,
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.EraseBlocks():

> The variable argument list is a list of tuples. Each tuple describes a
> range of LBAs to erase and consists of the following:
> * An EFI_LBA that indicates the starting LBA
> * A UINTN that indicates the number of blocks to erase

(NB, in edk2, EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is a typedef to
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.)

In this driver, the NumOfLba local variable is defined with type UINTN,
but the TYPE argument passed to VA_ARG() is UINT32. Fix the mismatch.

Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoArmPlatformPkg/NorFlashDxe: correct NumOfLba vararg type in EraseBlocks()
Laszlo Ersek [Thu, 18 May 2017 12:48:13 +0000 (14:48 +0200)]
ArmPlatformPkg/NorFlashDxe: correct NumOfLba vararg type in EraseBlocks()

According to the PI spec, Volume 3,
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.EraseBlocks():

> The variable argument list is a list of tuples. Each tuple describes a
> range of LBAs to erase and consists of the following:
> * An EFI_LBA that indicates the starting LBA
> * A UINTN that indicates the number of blocks to erase

(NB, in edk2, EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is a typedef to
EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.)

In this driver, the NumOfLba local variable is defined with type UINTN,
but the TYPE argument passed to VA_ARG() is UINT32. Fix the mismatch.

In addition, update the DEBUG macro invocation where NumOfLba is formatted
with the %d conversion specifier: UINTN values should be converted to
UINT64 and printed with %Lu or %Lx for portability between 32-bit and
64-bit.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoMdeModulePkg/PciHostBridgeDxe: Fix EBC build failure
Dandan Bi [Thu, 18 May 2017 01:51:42 +0000 (09:51 +0800)]
MdeModulePkg/PciHostBridgeDxe: Fix EBC build failure

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoOvmfPkg: resolve PcdLib for PEIMs to PeiPcdLib by default
Laszlo Ersek [Sun, 12 Mar 2017 22:59:04 +0000 (23:59 +0100)]
OvmfPkg: resolve PcdLib for PEIMs to PeiPcdLib by default

In the previous patch we had to add two explicit Null resolutions, but
here we can remove five PeiPcdLib ones, after setting the default to it.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: resolve PcdLib for all PEIMs individually
Laszlo Ersek [Sun, 12 Mar 2017 22:52:28 +0000 (23:52 +0100)]
OvmfPkg: resolve PcdLib for all PEIMs individually

Currently the default (module type independent) PcdLib resolution is to
BasePcdLibNull.inf, which is inherited by all PEIMs. In the next patch,
we'll flip the PEIM default resolution to PeiPcdLib.inf, but in order to
keep that patch both correct and simple to review, we should spell out the
Null resolution for those two PEIMs (ReportStatusCodeRouterPei and
StatusCodeHandlerPei) that are now the only ones that don't specify an
explicit resolution.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/PlatformPei: don't allocate reserved mem varstore if SMM_REQUIRE
Laszlo Ersek [Sun, 12 Mar 2017 21:01:40 +0000 (22:01 +0100)]
OvmfPkg/PlatformPei: don't allocate reserved mem varstore if SMM_REQUIRE

For the emulated variable store, PlatformPei allocates reserved memory (as
early as possible, so that the address remains the same during reboot),
and PcdEmuVariableNvStoreReserved carries the address to
EmuVariableFvbRuntimeDxe.

However, EmuVariableFvbRuntimeDxe is excluded from the SMM_REQUIRE build,
and then noone consumes PcdEmuVariableNvStoreReserved. Don't waste
reserved memory whenever that's the case.

(Even a dynamic default for PcdEmuVariableNvStoreReserved would be
unnecessary; but that way the PcdSet64S() call in the
ReserveEmuVariableNvStore() function doesn't compile.)

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: sync PcdVariableStoreSize with PcdFlashNvStorageVariableSize
Laszlo Ersek [Fri, 5 May 2017 01:31:32 +0000 (03:31 +0200)]
OvmfPkg: sync PcdVariableStoreSize with PcdFlashNvStorageVariableSize

"MdeModulePkg/MdeModulePkg.dec" declares PcdVariableStoreSize like this:

> The size of volatile buffer. This buffer is used to store VOLATILE
> attribute variables.

There is no inherent reason why the size of the volatile variable store
should match the same of the non-volatile variable store. Indeed flash
variables in the 4MB build work fine without this equality.

However, OvmfPkg/EmuVariableFvbRuntimeDxe uses PcdVariableStoreSize to
initialize the non-volatile VARIABLE_STORE_HEADER too. (Presumably based
on the fact that ultimately that storage will not be permanent.) When
using EmuVariableFvbRuntimeDxe in the 4MB build, the mismatch between the
two mentioned PCDs (which is apparent through EmuVariableFvbRuntimeDxe's
VARIABLE_STORE_HEADER) triggers an assertion in the variable driver:

> ASSERT MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c(3772):
> mNvVariableCache->Size == VariableStoreLength

Bringing PcdVariableStoreSize in sync with PcdFlashNvStorageVariableSize
fixes this. It also happens to ensure a volatile store size in the 4MB
build that equals the non-volatile store size, which likely doesn't hurt
for symmetry.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: b24fca05751f8222acf264853709012e0ab7bf49
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/PlatformPei: remove unused PcdVariableStoreSize dependency
Laszlo Ersek [Sun, 12 Mar 2017 20:01:25 +0000 (21:01 +0100)]
OvmfPkg/PlatformPei: remove unused PcdVariableStoreSize dependency

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: remove gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable
Laszlo Ersek [Sun, 12 Mar 2017 19:54:16 +0000 (20:54 +0100)]
OvmfPkg: remove gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable

This PCD is no longer used.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/EmuVariableFvbRuntimeDxe: always format an auth varstore header
Laszlo Ersek [Sun, 12 Mar 2017 19:51:08 +0000 (20:51 +0100)]
OvmfPkg/EmuVariableFvbRuntimeDxe: always format an auth varstore header

In this patch, we extend commit d92eaabefbe0 ("OvmfPkg: simplify
VARIABLE_STORE_HEADER generation", 2016-02-05) to
EmuVariableFvbRuntimeDxe.

This is the difference between FvAndVarTemplate and
FvAndAuthenticatedVarTemplate:

> --- non-auth    2017-05-05 22:32:06.001512283 +0200
> +++ auth        2017-05-05 22:32:18.841364882 +0200
> @@ -1,7 +1,7 @@
>    //
> -  // Templates for standard (non-authenticated) variable FV header
> +  // Templates for authenticated variable FV header
>    //
> -  STATIC FVB_FV_HDR_AND_VARS_TEMPLATE FvAndVarTemplate = {
> +  STATIC FVB_FV_HDR_AND_VARS_TEMPLATE FvAndAuthenticatedVarTemplate = {
>      { // EFI_FIRMWARE_VOLUME_HEADER FvHdr;
>        // UINT8                     ZeroVector[16];
>        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
> @@ -34,7 +34,7 @@
>        EFI_FVH_REVISION,
>
>        // EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
> -      {
> +      {
>          {
>            2, // UINT32 NumBlocks;
>            EMU_FVB_BLOCK_SIZE  // UINT32 Length;
> @@ -44,8 +44,8 @@
>      // EFI_FV_BLOCK_MAP_ENTRY     EndBlockMap;
>      { 0, 0 }, // End of block map
>      { // VARIABLE_STORE_HEADER      VarHdr;
> -      // EFI_GUID  Signature;
> -      EFI_VARIABLE_GUID,
> +        // EFI_GUID  Signature;     // need authenticated variables for secure boot
> +        EFI_AUTHENTICATED_VARIABLE_GUID,
>
>        // UINT32  Size;
>        (

After this change, using "-bios", the variable driver logs:

- with the SB feature enabled:
> Variable driver will work with auth variable format!
> Variable driver will work with auth variable support!

- with the SB feature disabled:
> Variable driver will work with auth variable format!
> Variable driver will continue to work without auth variable support!

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoMdeModulePkg/PciBus: Add IOMMU support.
Jiewen Yao [Sat, 29 Apr 2017 08:57:54 +0000 (16:57 +0800)]
MdeModulePkg/PciBus: Add IOMMU support.

If IOMMU protocol is installed, PciBus need call IOMMU
to set access attribute for the PCI device in Map/Ummap.

Only after the access attribute is set, the PCI device can
access the DMA memory.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leo Duran <leo.duran@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Previous patch Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Previous patch Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Leo Duran <leo.duran@amd.com>
6 years agoMdeModulePkg/PciHostBridge: Add IOMMU support.
Jiewen Yao [Sat, 29 Apr 2017 08:23:58 +0000 (16:23 +0800)]
MdeModulePkg/PciHostBridge: Add IOMMU support.

If IOMMU protocol is installed, PciHostBridge just calls
IOMMU AllocateBuffer/FreeBuffer/Map/Unmap.

PciHostBridge does not set IOMMU access attribute,
because it does not know which device request the DMA.
This work is done by PciBus driver.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leo Duran <leo.duran@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Previous patch Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Previous patch Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Leo Duran <leo.duran@amd.com>
6 years agoMdeModulePkg/Include: Add IOMMU protocol definition.
Jiewen Yao [Sat, 25 Mar 2017 02:53:28 +0000 (10:53 +0800)]
MdeModulePkg/Include: Add IOMMU protocol definition.

This protocol is to abstract DMA access from IOMMU.
1) Intel "DMAR" ACPI table.
2) AMD "IVRS" ACPI table
3) ARM "IORT" ACPI table.

There might be multiple IOMMU engines on one platform.
For example, one for graphic and one for rest PCI devices
(such as ATA/USB).
All IOMMU engines are reported by one ACPI table.

All IOMMU protocol provider should be based upon ACPI table.
This single IOMMU protocol can handle multiple IOMMU engines on one system.

This IOMMU protocol provider can use UEFI device path to distinguish
if the device is graphic or ATA/USB, and find out corresponding
IOMMU engine.

The IOMMU protocol provides 2 capabilities:
A) Set DMA access attribute - such as write/read control.
B) Remap DMA memory - such as remap above 4GiB system memory address
to below 4GiB device address.
It provides AllocateBuffer/FreeBuffer/Map/Unmap for DMA memory.
The remapping can be static (fixed at build time) or dynamic (allocate
at runtime).

4) AMD "SEV" feature.
We can have an AMD SEV specific IOMMU driver to produce IOMMU protocol,
and manage SEV bit.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leo Duran <leo.duran@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Previous patch Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Previous patch Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Leo Duran <leo.duran@amd.com>
6 years agoMdeModulePkg/UfsPassThruDxe: Fix typo in UfsPassThruGetTargetLun()
Hao Wu [Tue, 16 May 2017 05:24:29 +0000 (13:24 +0800)]
MdeModulePkg/UfsPassThruDxe: Fix typo in UfsPassThruGetTargetLun()

For function UfsPassThruGetTargetLun(), the length of the input device
node specified by 'DevicePath' should be compared with the size of
'UFS_DEVICE_PATH' rather than the size of 'SCSI_DEVICE_PATH'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoShellBinPkg: Ia32/X64 Shell binary update.
Ruiyu Ni [Fri, 12 May 2017 06:51:10 +0000 (14:51 +0800)]
ShellBinPkg: Ia32/X64 Shell binary update.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoBaseTools: Fix the bug for CArray PCD override in command line
Yonghong Zhu [Fri, 12 May 2017 04:12:23 +0000 (12:12 +0800)]
BaseTools: Fix the bug for CArray PCD override in command line

This patch updated the CArray PCD override format from B"{}" to H"{}"
which align to build spec. Besides, it also do the clean up for the
function BuildOptionPcdValueFormat.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd
Yonghong Zhu [Thu, 11 May 2017 13:23:29 +0000 (21:23 +0800)]
BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd

This patch for the bug FixedPcdGetPtr report failure for the CArray type
Pcd. 1) correct the Fixed Pcd list; 2) correct the Fixed Pcd in Library
AutoGen file to same with Driver AutoGen file format.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg SmiHandlerProfile: Fix memory leak in DumpSmiChildContext
Star Zeng [Thu, 11 May 2017 09:34:34 +0000 (17:34 +0800)]
MdeModulePkg SmiHandlerProfile: Fix memory leak in DumpSmiChildContext

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

In DumpSmiChildContext() of SmiHandlerProfile.c and
SmiHandlerProfileInfo.c, the return buffer from
ConvertDevicePathToText() should be freed after used.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoShellPkg/memmap: Dump memory map information for all memory types
Ruiyu Ni [Thu, 11 May 2017 10:20:09 +0000 (18:20 +0800)]
ShellPkg/memmap: Dump memory map information for all memory types

The patch dumps memory map information for all memory types.
But to follow the SFO format of "memmap" defined in Shell 2.2 spec,
the patch doesn't dump the memory map information for OEM/OS
memory types. But it does include the OEM/OS memory in the total
size in SFO format.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/memmap: Refine code
Ruiyu Ni [Thu, 11 May 2017 08:12:10 +0000 (16:12 +0800)]
ShellPkg/memmap: Refine code

The patch changes Buffer to Descriptors, changes
(UINT8 *Walker) to (EFI_MEMORY_DESCRIPTOR *Walker).
The change makes lots of type conversion unnecessary.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/HandleParsingLib: Show LoadedImageProtocol file name
Jeff Westfahl [Thu, 4 May 2017 21:53:04 +0000 (05:53 +0800)]
ShellPkg/HandleParsingLib: Show LoadedImageProtocol file name

This patch adds support for showing the file name associated with a
LoadedImageProtocol file path. This is a behavior that was present in
the old shell but has been lost in the new shell.

For example, using 'dh -v' in the old shell:

    Handle D3 (3A552218)
    Image (3A54C918)   File:MicrocodeUpdate
        ParentHandle..: 3A666398

vs. the new shell:

    D3: 3A552218
    LoadedImage
        Revision......: 0x00001000
        ParentHandle..: 3A666398

Here's what the output of 'dh -v' looks like after this patch:

    D3: 3A552218
    LoadedImage
        Name..........: MicrocodeUpdate
        Revision......: 0x00001000
        ParentHandle..: 3A666398

This seems like useful information for the shell to display.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/HandleParsingLib: Open LoadedImageProtocol first
Jeff Westfahl [Thu, 4 May 2017 21:53:03 +0000 (05:53 +0800)]
ShellPkg/HandleParsingLib: Open LoadedImageProtocol first

This patch changes the order of operations to make sure we can open the
LoadedImageProtocol before getting the format string. This should not
affect functionality, and makes the next patch easier to review.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/HandleParsingLib: Show LoadedImageProtocol file path as text
Jeff Westfahl [Thu, 4 May 2017 21:53:02 +0000 (05:53 +0800)]
ShellPkg/HandleParsingLib: Show LoadedImageProtocol file path as text

This patch adds support for displaying a text representation of the file
path associated with a LoadedImageProtocol. This is a behavior that was
present in the old shell but has been lost in the new shell.

For example, using 'dh -v' in the old shell:

    FilePath......: FvFile(F3331DE6-4A55-44E4-B767-7453F7A1A021)
    FilePath......: \EFI\BOOT\BOOTX64.EFI

vs. the new shell:

    FilePath......: 3A539018
    FilePath......: 3A728718

This seems like useful information for the shell to display.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix logic check error
Jeff Fan [Thu, 11 May 2017 07:01:39 +0000 (15:01 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix logic check error

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Check ProcessorId == INVALID_APIC_ID
Jeff Fan [Wed, 10 May 2017 08:32:25 +0000 (16:32 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Check ProcessorId == INVALID_APIC_ID

If PcdCpuHotPlugSupport is TRUE, gSmst->NumberOfCpus will be the
PcdCpuMaxLogicalProcessorNumber. If gSmst->SmmStartupThisAp() is invoked for
those un-existed processors, ASSERT() happened in ConfigSmmCodeAccessCheck().

This fix is to check if ProcessorId is valid before invoke
gSmst->SmmStartupThisAp() in ConfigSmmCodeAccessCheck() and to check if
ProcessorId is valid in InternalSmmStartupThisAp() to avoid unexpected DEBUG
error message displayed.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoUefiCpuPkg/SmmCpuFeaturesLib: Correct print level
Jeff Fan [Wed, 10 May 2017 06:47:03 +0000 (14:47 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Correct print level

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoUefiCpuPkg/SmmCpuFeaturesLib: Fix Ia32/SmiEntry.asm build issue
Jeff Fan [Wed, 10 May 2017 06:42:41 +0000 (14:42 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Fix Ia32/SmiEntry.asm build issue

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoSecurityPkg: Add TCG Spec info to TCG related modules
Zhang, Chao B [Thu, 11 May 2017 05:08:30 +0000 (13:08 +0800)]
SecurityPkg: Add TCG Spec info to TCG related modules

Add TCG Spec compliance info to TCG related module INFs.

Cc: Qin Long <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoBaseTools: Correct VOID* PatchPcd Size in Library Autogen
Yonghong Zhu [Wed, 10 May 2017 08:35:30 +0000 (16:35 +0800)]
BaseTools: Correct VOID* PatchPcd Size in Library Autogen

This patch correct the VOID* PatchPcd Size info generated in the
Library's autogen file. Update it to use the MaxDatumSize.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg CapsuleApp: Fix mixed EOL format issue
Star Zeng [Thu, 11 May 2017 04:57:47 +0000 (12:57 +0800)]
MdeModulePkg CapsuleApp: Fix mixed EOL format issue

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
6 years agoNetworkPkg/IScsiDxe: Switch IP4 configuration policy to Static before DHCP
Jiaxin Wu [Wed, 10 May 2017 15:30:57 +0000 (23:30 +0800)]
NetworkPkg/IScsiDxe: Switch IP4 configuration policy to Static before DHCP

DHCP4 service allows only one of its children to be configured in the active
state. If the DHCP4 D.O.R.A started by IP4 auto configuration and has not
been completed, the Dhcp4 state machine will not be in the right state for
the iSCSI to start a new round D.O.R.A. So, we need to switch it's policy to
static.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoMdeModulePkg/FormDisplay: Make the LineWidth of option consistent
Dandan Bi [Wed, 10 May 2017 01:47:06 +0000 (09:47 +0800)]
MdeModulePkg/FormDisplay: Make the LineWidth of option consistent

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

LineWidth of option in funcrion UpdateSkipInfoForMenu and DisplayOneMenu
are inconsistent. Now fix this issue to avoid incorrect UI display.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoBaseTools/Ecc: Add line break support for exception list
Hess Chen [Wed, 10 May 2017 01:29:50 +0000 (09:29 +0800)]
BaseTools/Ecc: Add line break support for exception list

Add line break support for exception list.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoArmPlatformPkg,ArmVirtPkg: delete redundant PL031 functions
Leif Lindholm [Wed, 3 May 2017 17:29:34 +0000 (18:29 +0100)]
ArmPlatformPkg,ArmVirtPkg: delete redundant PL031 functions

Remove the functions now provided by TimeBaseLib from
PL031RealTimeClockLib. Add TimeBaseLib resolution to ArmVirtPkg
in same commit to prevent breakage.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoEmbeddedPkg: import EfiTimeBaseLib (as TimeBaseLib)
Leif Lindholm [Wed, 3 May 2017 15:54:56 +0000 (16:54 +0100)]
EmbeddedPkg: import EfiTimeBaseLib (as TimeBaseLib)

Some generic RTC helper functions were broken out from the PL031
library for use with other RTCs in OpenPlatformPkg. Import the code back
here, realigning it with the current state of PL031RealTimeClockLib to
simplify comparisons.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoEmbeddedPkg: import DesignWare EMMC driver
Leif Lindholm [Wed, 3 May 2017 16:05:47 +0000 (17:05 +0100)]
EmbeddedPkg: import DesignWare EMMC driver

Imported from OpenPlatformPkg 0434ff62e3eb896e6c561dea84cfb8b80391603e.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoNt32Pkg/SnpNt32Dxe: Fix hang issue when multiple network interfaces existed
Jiaxin Wu [Fri, 5 May 2017 01:01:08 +0000 (09:01 +0800)]
Nt32Pkg/SnpNt32Dxe: Fix hang issue when multiple network interfaces existed

Currently all the network interfaces share the one recycled transmit buffer
array, which is used to store the recycled buffer address. However, those
recycled buffers are allocated by the different MNP interface if the multiple
network interfaces existed. Then, SNP GetStatus may return one recycled transmit
buffer address to the another MNP interface, which may result in the MNP driver
hang after 'reconnect -r' operation.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoNetworkPkg: Fix issue in dns driver when building DHCP packet.
Zhang Lubo [Thu, 4 May 2017 09:35:36 +0000 (17:35 +0800)]
NetworkPkg: Fix issue in dns driver when building DHCP packet.

Currently, DNS driver configure the dhcp message type to inform
when building dhcp packet to get dns info from, but it not works
with dhcp server deployed on linux system. However it works well
when changed to request type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: Addressing TCP Window Retraction when window scale factor is used.
Fu Siyuan [Wed, 3 May 2017 07:22:08 +0000 (15:22 +0800)]
MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used.

The RFC1323 which defines the TCP window scale option has been obsoleted by RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction problem
when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and
iSCSI file read/write.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoNetworkPkg: Addressing TCP Window Retraction when window scale factor is used.
Fu Siyuan [Wed, 3 May 2017 06:30:36 +0000 (14:30 +0800)]
NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.

The RFC1323 which defines the TCP window scale option has been obsoleted by RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction problem
when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and
iSCSI file read/write.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoMdeModulePkg: Add wnd scale check before shrinking window.
Fu Siyuan [Wed, 3 May 2017 07:21:23 +0000 (15:21 +0800)]
MdeModulePkg: Add wnd scale check before shrinking window.

Moving Right window edge to the left on sender side without additional check
can lead to the TCP deadlock, when receiver ACKs proper segment, while sender
discards it for future ACK. To prevent this add check if usable window (or
shrink amount in this case) is bigger then receiver's window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoNetworkPkg: Add wnd scale check before shrinking window.
Fu Siyuan [Wed, 3 May 2017 06:20:56 +0000 (14:20 +0800)]
NetworkPkg: Add wnd scale check before shrinking window.

Moving Right window edge to the left on sender side without additional check
can lead to the TCP deadlock, when receiver ACKs proper segment, while sender
discards it for future ACK. To prevent this add check if usable window (or
shrink amount in this case) is bigger then receiver's window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoUefiCpuPkg/MtrrLib: Don't report OutOfResource when MTRR is enough
Ruiyu Ni [Fri, 5 May 2017 02:10:00 +0000 (10:10 +0800)]
UefiCpuPkg/MtrrLib: Don't report OutOfResource when MTRR is enough

The MTRR calculation algorithm contains a bug that when left
subtraction cannot produce better MTRR solution, it forgets
to restore the BaseAddress/Length so that MtrrLibGetMtrrNumber()
returns bigger value of actual required MTRR numbers.
As a result, the MtrrLib reports OutOfResource but actually the
MTRR is enough.

MEMORY_RANGE mC[] = {
  0, 0x100000, CacheUncacheable,
  0x100000, 0x89F00000, CacheWriteBack,
  0x8A000000, 0x75000000, CacheUncacheable,
  0xFF000000, 0x01000000, CacheWriteProtected,
  0x100000000, 0x7F00000000, CacheUncacheable,
  0xFC240000, 0x2000, CacheWriteCombining // <-- trigger the error
};

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoUefiCpuPkg: Update package version to 0.80
Jeff Fan [Mon, 8 May 2017 05:31:00 +0000 (13:31 +0800)]
UefiCpuPkg: Update package version to 0.80

Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoUefiCpuPkg: Update package version to 0.80
Jeff Fan [Mon, 8 May 2017 03:31:50 +0000 (11:31 +0800)]
UefiCpuPkg: Update package version to 0.80

Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoMdePkg DxeServicesLib: Handle potential NULL FvHandle
Star Zeng [Fri, 5 May 2017 08:11:57 +0000 (16:11 +0800)]
MdePkg DxeServicesLib: Handle potential NULL FvHandle

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

The FvHandle input to InternalGetSectionFromFv() may be NULL,
then ASSERT will appear. It is because the LoadedImage->DeviceHandle
returned from InternalImageHandleToFvHandle() may be NULL.
For example for DxeCore, there is LoadedImage protocol installed
for it, but the LoadedImage->DeviceHandle could not be initialized
before the FV2 (contain DxeCore) protocol is installed.

This patch is to update InternalGetSectionFromFv() to return
EFI_NOT_FOUND directly for NULL FvHandle.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: PCD can only use single access method by source build
Yonghong Zhu [Wed, 3 May 2017 07:19:21 +0000 (15:19 +0800)]
BaseTools: PCD can only use single access method by source build

Add the error check that A PCD can only use one type for all source
modules.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoOvmfPkg/PlatformPei: handle non-power-of-two spare size for emu variables
Laszlo Ersek [Fri, 5 May 2017 00:35:21 +0000 (02:35 +0200)]
OvmfPkg/PlatformPei: handle non-power-of-two spare size for emu variables

In commit b24fca05751f ("OvmfPkg: introduce 4MB flash image (mainly) for
Windows HCK", 2017-04-29), I changed PcdFlashNvStorageFtwSpareSize to
264KB, in the then-new default 4MB build.

While PcdFlashNvStorageFtwSpareSize remains exactly half of the entire
non-volatile store (which is 528KB), 264KB isn't itself a power of two.
This triggers an assertion failure in AllocateAlignedRuntimePages() when
PlatformPei calls it from the ReserveEmuVariableNvStore() function,
passing PcdFlashNvStorageFtwSpareSize as the Alignment parameter:

> ASSERT MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c(196):
> (Alignment & (Alignment - 1)) == 0

Round up the alignment to the next power of two if necessary.

Fixes: b24fca05751f8222acf264853709012e0ab7bf49
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoRevert "OvmfPkg: make the 4MB flash size the default"
Laszlo Ersek [Fri, 5 May 2017 15:23:23 +0000 (17:23 +0200)]
Revert "OvmfPkg: make the 4MB flash size the default"

This reverts commit bba8dfbec3bbc4fba7fa6398ba3cf76593e0725e.

The 264KB size introduced for the NV spare area in commit b24fca05751f
("OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK",
2017-04-29) breaks the "-bios" (emulated varstore) use case. Until we sort
that out, revert the default build to the 2MB image.

Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoBaseTools: remove the hardcoded /bin/bash for PreBuild/PostBuild
Yonghong Zhu [Wed, 3 May 2017 07:31:58 +0000 (15:31 +0800)]
BaseTools: remove the hardcoded /bin/bash for PreBuild/PostBuild

This patch remove the hardcoded /bin/bash for PreBuild/PostBuild
scripts.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg: Update DEC/DSC version from 0.96 to 0.97
Tian, Feng [Fri, 5 May 2017 03:45:33 +0000 (11:45 +0800)]
MdeModulePkg: Update DEC/DSC version from 0.96 to 0.97

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoSecurityPkg/Pkcs7VerifyDxe: Add format check in DB list contents
Long Qin [Wed, 3 May 2017 09:25:48 +0000 (17:25 +0800)]
SecurityPkg/Pkcs7VerifyDxe: Add format check in DB list contents

Add the size check for invalid format detection in AllowedDb,
RevokedDb and TimeStampDb list contents.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
6 years agoSecurityPkg: Update package version to 0.97
Zhang, Chao B [Fri, 5 May 2017 05:09:13 +0000 (13:09 +0800)]
SecurityPkg: Update package version to 0.97

Update package version of SecurityPkg to 0.97.

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
6 years agoCryptoPkg: Update package version to 0.97
Long Qin [Thu, 4 May 2017 06:36:56 +0000 (14:36 +0800)]
CryptoPkg: Update package version to 0.97

Update package version of CryptoPkg to 0.97.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
6 years agoMdePkg: Update DEC and DSC version from 1.06 to 1.07
Liming Gao [Tue, 2 May 2017 08:44:19 +0000 (16:44 +0800)]
MdePkg: Update DEC and DSC version from 1.06 to 1.07

UEFI2.6 have been added in MdePkg. Update DEC and DSC version to
reflect those changes in MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Sync BrotliCompress script the same style
Song, BinX [Thu, 13 Apr 2017 06:40:30 +0000 (14:40 +0800)]
BaseTools: Sync BrotliCompress script the same style

- Sync BrotliCompress script the same style with BrotliCompress.bat

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Add --version option in Brotli and BrotliCompress
Song, BinX [Thu, 13 Apr 2017 01:19:48 +0000 (09:19 +0800)]
BaseTools: Add --version option in Brotli and BrotliCompress

https://bugzilla.tianocore.org/show_bug.cgi?id=464
V2:
- Add build version

V1:
- Add --version option in Brotli and BrotliCompress

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoNetworkPkg: Update package version to 0.97.
Fu Siyuan [Wed, 3 May 2017 07:52:48 +0000 (15:52 +0800)]
NetworkPkg: Update package version to 0.97.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoOvmfPkg: make the 4MB flash size the default
Laszlo Ersek [Wed, 3 May 2017 17:37:06 +0000 (19:37 +0200)]
OvmfPkg: make the 4MB flash size the default

The previously default 2MB can be explicitly selected with

  -D FD_SIZE_2MB

or

  -D FD_SIZE_IN_KB=2048

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: raise max variable size (auth & non-auth) to 33KB for FD_SIZE_4MB
Laszlo Ersek [Sat, 29 Apr 2017 02:41:08 +0000 (04:41 +0200)]
OvmfPkg: raise max variable size (auth & non-auth) to 33KB for FD_SIZE_4MB

The "ConfirmSetOfLargeVariable" test case of the Secure Boot Logo Test
("Microsoft.UefiSecureBootLogo.Tests") suite in the Microsoft Hardware
Certification Kit sets a 32 KB large non-authenticated variable.

In the FD_SIZE_4MB build, our live varstore is now 256 KB big, so we can
accommodate this. Set both PcdMaxVariableSize and PcdMaxAuthVariableSize
to 0x8400 -- beyond DataSize=0x8000 from the HCK test, we need some room
for the variable name and attributes as well.

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: introduce 4MB flash image (mainly) for Windows HCK
Laszlo Ersek [Sat, 29 Apr 2017 01:37:41 +0000 (03:37 +0200)]
OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK

The "Confirm64KilobytesOfUnauthenticatedVariableStorage" test case of the
Secure Boot Logo Test ("Microsoft.UefiSecureBootLogo.Tests") suite in the
Microsoft Hardware Certification Kit expects to be able to populate the
variable store up to roughly 64 KB, with a series of 1 KB sized,
unauthenticated variables. OVMF's current live varstore area is too small
for this: 56 KB.

Introduce the FD_SIZE_4MB build macro (equivalently, FD_SIZE_IN_KB=4096),
which

- enlarges the full flash image to 4MB -- QEMU supports up to 8MB, see
  FLASH_MAP_BASE_MIN in "hw/i386/pc_sysfw.c" --,

- inside that, grows the varstore area / pflash chip to 528 KB, and within
  it, the live area from 56 KB to 256 KB.

Importantly, a firmware binary built with -D FD_SIZE_4MB will *not* be
compatible with a variable store that originates from a variable store
template built *without* -D FD_SIZE_4MB. This is the reason for the large
increase, as every such change breaks compatibility between a new firmware
binary and old varstore files.

Enlarging the varstore does not impact the performance of normal
operations, as we keep the varstore block size 4KB. The performance of
reclaim is affected, but that is expected (since reclaim has to rework the
full live area). And, reclaim occurs proportionally less frequently.

While at it, the FVMAIN_COMPACT volume (with the compressed FFS file in
it) is also enlarged significantly, so that we have plenty of room for
future DXEFV (and perhaps PEIFV) increments -- DXEFV has been growing
steadily, and that increase shows through compression too. Right now the
PEIFV and DXEFV volumes need no resizing.

Here's a summary:

  Description                Compression type                Size [KB]
  -------------------------  -----------------  ----------------------
  Non-volatile data storage  open-coded binary    128 ->   528 ( +400)
                               data
    Variable store                                 56 ->   256 ( +200)
    Event log                                       4 ->     4 (   +0)
    Working block                                   4 ->     4 (   +0)
    Spare area                                     64 ->   264 ( +200)

  FVMAIN_COMPACT             uncompressed        1712 ->  3360 (+1648)
    FV FFS file              LZMA compressed
      PEIFV                  uncompressed         896 ->   896 (   +0)
        individual PEI       uncompressed
          modules
      DXEFV                  uncompressed       10240 -> 10240 (   +0)
        individual DXE       uncompressed
          modules

  SECFV                      uncompressed         208 ->   208 (   +0)
    SEC driver
    reset vector code

For now, the 2MB flash image remains the default.

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg/OvmfPkg.fdf.inc: extract VARS_LIVE_SIZE and VARS_SPARE_SIZE macros
Laszlo Ersek [Sat, 29 Apr 2017 01:35:23 +0000 (03:35 +0200)]
OvmfPkg/OvmfPkg.fdf.inc: extract VARS_LIVE_SIZE and VARS_SPARE_SIZE macros

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: introduce the FD_SIZE_IN_KB macro / build flag
Laszlo Ersek [Wed, 3 May 2017 15:54:49 +0000 (17:54 +0200)]
OvmfPkg: introduce the FD_SIZE_IN_KB macro / build flag

FD_SIZE_xMB defines have existed for flash size selection. They can be
passed as "-D FD_SIZE_xMB" on the command line. Passing multiple of them
at the same time has never been supported; earlier settings on the command
line cannot be overridden.

Introduce the integer valued FD_SIZE_IN_KB macro, which provides the
following improvements:

- several instances of it are permitted on the command line, with the last
  one taking effect,

- conditional statements in the DSC and FDF files need only check a single
  macro, and multiple values can be checked in a single !if with the ||
  operator,

- nested !ifdef / !else ladders can be replaced with flat equality tests,

- in the future, flash sizes can be expressed with a finer than MB
  granularity, if necessary.

For now, we're going to preserve the FD_SIZE_xMB defines as convenience
wrappers for FD_SIZE_IN_KB.

FD_SIZE_IN_KB is being added to the DSC files because this way we can
depend on it in both the DSC and FDF files.

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoShellPkg/ShellCommandLib: Update DumpHex to print {|}~
Jeff Westfahl [Wed, 26 Apr 2017 19:59:29 +0000 (03:59 +0800)]
ShellPkg/ShellCommandLib: Update DumpHex to print {|}~

ASCII characters {|}~ should be printed by DumpHex. The problem is that
if you have a string like

    {xizzy}~{foo|bar}~{quux}

in the dumped data, it will not appear as such in the *-delimited ASCII
column to the right, but as

    .xizzy...foo.bar...quux.

which is less than ideal.

Most of the commit message was inspired by/shamelessly stolen from
Laszlo's example:

    https://lists.01.org/pipermail/edk2-devel/2017-April/010266.html

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoSecurityPkg: Consume SmmIoLib.
Eric Dong [Wed, 3 May 2017 01:22:55 +0000 (09:22 +0800)]
SecurityPkg: Consume SmmIoLib.

Update code to consume SmmIoLib to pass build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoSecurityPkg OpalPasswordSmm: Consume SmmIoLib.
Eric Dong [Wed, 3 May 2017 01:22:26 +0000 (09:22 +0800)]
SecurityPkg OpalPasswordSmm: Consume SmmIoLib.

Update code to consume SmmIoLib to check Mmio validation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMaintainers.txt: Update maintainers for MdeModulePkg
Eric Dong [Wed, 3 May 2017 02:13:13 +0000 (10:13 +0800)]
Maintainers.txt: Update maintainers for MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Zeng Star <star.zeng@intel.com>
6 years agoArmVirtPkg: install EdkiiPlatformHasDeviceTree proto in the 32-bit builds
Nerijus Baliūnas [Tue, 2 May 2017 22:38:15 +0000 (01:38 +0300)]
ArmVirtPkg: install EdkiiPlatformHasDeviceTree proto in the 32-bit builds

Include XenPlatformHasAcpiDtDxe and PlatformHasAcpiDtDxe in the 32-bit
builds too.

Please see https://bugzilla.tianocore.org/show_bug.cgi?id=524
why it is needed. With this patch my arm uefi VM boots.

Fixes: 3a2c1548fe2df4b0b067671e2025da6372063218
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nerijus Baliūnas <nerijus@users.sourceforge.net>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: move long subj to commit msg body, add short subj]
[lersek@redhat.com: add Fixes reference]
[lersek@redhat.com: keep ACPI DXE modules grouped in QEMU DSCs]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
6 years agoNetworkPkg: Fix PXEv6 boot failure when DhcpBinl offer received.
Jiaxin Wu [Tue, 25 Apr 2017 01:21:34 +0000 (09:21 +0800)]
NetworkPkg: Fix PXEv6 boot failure when DhcpBinl offer received.

In case of the DHCP and PXE services on different servers,PXEv6 boot will
failure when DhcpBinl offer received. The issue is caused by the following
reasons:
* PXE Client doesn't append VENDOR_CLASS request parameter, so the
offer replied from DHCP service will not contain VENDOR_CLASS option
(16).
* Once the DhcpBinl offer is selected, the boot discover message should
be sent out to request the bootfile by this offer. Current implementation
always use servers multi-cast address instead of BootFileUrl address in
dhcp6 offer. we should check it first, then decide whether use multi-cast
address or not.
* If DhcpBinl offer is selected, the boot discover message shouldn't
find server ID Option from DhcpBinl offer. That's incorrect because DHCP
service and PXE service on different servers. In such a case, we can ignore
the Server ID Option.

With the above fix in the patch, PXEv6 can boot successfully when DhcpBinl
offer received.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoShellPkg: Update package version to 1.01
Ruiyu Ni [Wed, 3 May 2017 02:44:55 +0000 (10:44 +0800)]
ShellPkg: Update package version to 1.01

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/UefiHandleParsingLib: Fix memory leak
Ruiyu Ni [Tue, 2 May 2017 07:55:04 +0000 (15:55 +0800)]
ShellPkg/UefiHandleParsingLib: Fix memory leak

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoNetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
Zhang, Lubo [Fri, 28 Apr 2017 06:40:22 +0000 (14:40 +0800)]
NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.

if the server name expressed as a site local address begain with FEC0
when retrieving from dhcpv6 option 59 boot file url, it incorrectly process it
as a dns name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoNetworkPkg: Fix issue the iSCSI client can not send reset packet.
Zhang Lubo [Fri, 28 Apr 2017 06:41:33 +0000 (14:41 +0800)]
NetworkPkg: Fix issue the iSCSI client can not send reset packet.

if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.
Zhang, Lubo [Fri, 28 Apr 2017 06:40:49 +0000 (14:40 +0800)]
MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.

if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoCryptoPkg/SmmCryptLib: Enable HMAC-SHA256 support for SMM.
Long Qin [Wed, 26 Apr 2017 07:50:23 +0000 (15:50 +0800)]
CryptoPkg/SmmCryptLib: Enable HMAC-SHA256 support for SMM.

Enable HMAC-SHA256 cipher support in SmmCryptLib instance.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
6 years agoStdLib: GCC 6 build fixes
Leif Lindholm [Wed, 26 Apr 2017 21:49:16 +0000 (22:49 +0100)]
StdLib: GCC 6 build fixes

Resolve mainly 'misleading indentation', but also one 'defined but not used'
warning when building with GCC 6 (using GCC5 profile).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoBaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:53:50 +0000 (17:53 +0800)]
BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space

Update Rsa2048Sha256GenerateKeys Tool to support the case that
OPENSSL_PATH has space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:52:58 +0000 (17:52 +0800)]
BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space

Update Rsa2048Sha256Sign Tool to support the case that OPENSSL_PATH has
space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:51:45 +0000 (17:51 +0800)]
BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space

Update Pkcs7Sign Tool to support the case that OPENSSL_PATH has space
characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools/VolInfo: Update OPENSSL_PATH to support space characters
Yonghong Zhu [Wed, 19 Apr 2017 09:50:00 +0000 (17:50 +0800)]
BaseTools/VolInfo: Update OPENSSL_PATH to support space characters

Update OPENSSL_PATH handling to support space characters in the Path.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: fix the typo in function name LanuchPostbuild
Nikolai SAOUKH [Wed, 26 Apr 2017 08:53:58 +0000 (16:53 +0800)]
BaseTools: fix the typo in function name LanuchPostbuild

The patch fix function name typo LanuchPostbuild ==> LaunchPostbuild.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Fix a bug for BOOLEAN type value in Asbuilt inf
Yonghong Zhu [Wed, 26 Apr 2017 10:19:20 +0000 (18:19 +0800)]
BaseTools: Fix a bug for BOOLEAN type value in Asbuilt inf

When the PCD value is set to TRUE or FALSE, while it is not exchanged to
its int value, it cause error in the function int(Pcd.DefaultValue, 0).

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoShellPkg/Shell: eliminate double-free in RunSplitCommand()
Laszlo Ersek [Tue, 25 Apr 2017 12:44:36 +0000 (14:44 +0200)]
ShellPkg/Shell: eliminate double-free in RunSplitCommand()

Commit bd3fc8133b2b ("ShellPkg/App: Fix memory leak and save resources.",
2016-05-20) added a FreePool() call for Split->SplitStdIn, near end of the
RunSplitCommand(), right after the same shell file was closed with
CloseFile(). The argument was:

> 1) RunSplitCommand() allocates the initial SplitStdOut via
>    CreateFileInterfaceMem(). Free SplitStdIn after the swap to fix
>    the memory leak.

There is no memory leak actually, and the FreePool() call in question
constitutes a double-free:

(a) This is how the handle is established:

    ConvertEfiFileProtocolToShellHandle (
      CreateFileInterfaceMem (Unicode),
      NULL
      );

    CreateFileInterfaceMem() allocates an EFI_FILE_PROTOCOL_MEM object and
    populates it fully. ConvertEfiFileProtocolToShellHandle() allocates
    some administrative structures and links the EFI_FILE_PROTOCOL_MEM
    object into "mFileHandleList".

(b) EFI_SHELL_PROTOCOL.CloseFile() is required to close the
    SHELL_FILE_HANDLE and to release all associated data. Accordingly,
    near the end of RunSplitCommand(), we have:

    EfiShellClose()
      ShellFileHandleRemove()
        //
        // undoes the effects of ConvertEfiFileProtocolToShellHandle()
        //
      ConvertShellHandleToEfiFileProtocol()
        //
        // note that this does not adjust the pointer value; it's a pure
        // type cast
        //
      FileHandleClose()
        FileInterfaceMemClose()
          //
          // tears down EFI_FILE_PROTOCOL_MEM completely, undoing the
          // effects of CreateFileInterfaceMem ()
          //

The FreePool() call added by bd3fc8133b2b conflicts with

  SHELL_FREE_NON_NULL(This);

in FileInterfaceMemClose(), so remove it.

This error can be reproduced for example with:

> Shell> map | more
> 'more' is not recognized as an internal or external command, operable
> program, or script file.

which triggers:

> ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(624): CR has Bad Signature

with the following stack dump:

> #0  0x000000007f6dc094 in CpuDeadLoop () at
>     MdePkg/Library/BaseLib/CpuDeadLoop.c:37
> #1  0x000000007f6dd1b4 in DebugAssert (FileName=0x7f6ed9f0
>     "MdeModulePkg/Core/Dxe/Mem/Pool.c", LineNumber=624,
>     Description=0x7f6ed9d8 "CR has Bad Signature") at
>     OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c:153
> #2  0x000000007f6d075d in CoreFreePoolI (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:624
> #3  0x000000007f6d060e in CoreInternalFreePool (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:529
> #4  0x000000007f6d0648 in CoreFreePool (Buffer=0x7e232c98) at
>     MdeModulePkg/Core/Dxe/Mem/Pool.c:552
> #5  0x000000007d49fbf8 in FreePool (Buffer=0x7e232c98) at
>     MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c:818
> #6  0x000000007d4875c3 in RunSplitCommand (CmdLine=0x7d898398,
>     StdIn=0x0, StdOut=0x0) at ShellPkg/Application/Shell/Shell.c:1813
> #7  0x000000007d487d59 in ProcessNewSplitCommandLine
>     (CmdLine=0x7d898398) at ShellPkg/Application/Shell/Shell.c:2121
> #8  0x000000007d488937 in RunShellCommand (CmdLine=0x7e233018,
>     CommandStatus=0x0) at ShellPkg/Application/Shell/Shell.c:2670
> #9  0x000000007d488b0b in RunCommand (CmdLine=0x7e233018) at
>     ShellPkg/Application/Shell/Shell.c:2732
> #10 0x000000007d4867c8 in DoShellPrompt () at
>     ShellPkg/Application/Shell/Shell.c:1349
> #11 0x000000007d48524d in UefiMain (ImageHandle=0x7e24c898,
>     SystemTable=0x7f5b6018) at ShellPkg/Application/Shell/Shell.c:631

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Fixes: bd3fc8133b2b17ad2e0427d1bf6b44b08cf2f3b2
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Marvin Häuser <Marvin.Haeuser@outlook.com>
6 years agoShellPkg/Shell: clean up bogus member types in SPLIT_LIST
Laszlo Ersek [Tue, 25 Apr 2017 12:03:32 +0000 (14:03 +0200)]
ShellPkg/Shell: clean up bogus member types in SPLIT_LIST

The "SPLIT_LIST.SplitStdOut" and "SPLIT_LIST.SplitStdIn" members currently
have type (SHELL_FILE_HANDLE *). This is wrong; SHELL_FILE_HANDLE is
already a pointer, there's no need to store a pointer to a pointer.

The error is obvious if we check where and how these members are used:

- In the RunSplitCommand() function, these members are used (populated)
  extensively; this function has to be updated in sync.

  ConvertEfiFileProtocolToShellHandle() already returns the temporary
  memory file created with CreateFileInterfaceMem() as SHELL_FILE_HANDLE,
  not as (SHELL_FILE_HANDLE *).

- In particular, the ConvertShellHandleToEfiFileProtocol() calls need to
  be dropped as well in RunSplitCommand(), since
  EFI_SHELL_PROTOCOL.SetFilePosition() and EFI_SHELL_PROTOCOL.CloseFile()
  take SHELL_FILE_HANDLE parameters, not (EFI_FILE_PROTOCOL *).

  Given that ConvertShellHandleToEfiFileProtocol() only performs a
  type-cast (it does not adjust any pointer values), *and*
  SHELL_FILE_HANDLE -- taken by EFI_SHELL_PROTOCOL member functions -- is
  actually a typedef to (VOID *) -- see more on this later --, this
  conversion error hasn't been caught by compilers.

- In the ProcessNewSplitCommandLine() function, RunSplitCommand() is
  called either initially (passing in NULL / NULL; no update needed), or
  recursively (passing in Split->SplitStdIn / Split->SplitStdOut; again no
  update is necessary beyond the RunSplitCommand() modification above).

- In the UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  functions, said structure members are compared and assigned to
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdIn" and
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdOut", both of which have type
  SHELL_FILE_HANDLE, *not* (SHELL_FILE_HANDLE *).

  The compiler hasn't caught this error because of the fatally flawed type
  definition of SHELL_FILE_HANDLE, namely

    typedef VOID *SHELL_FILE_HANDLE;

  Pointer-to-void silently converts to and from most other pointer types;
  among them, pointer-to-pointer-to-void. That is also why no update is
  necessary for UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  in this fix.

(

Generally speaking, using (VOID *) typedefs for opaque handles is a tragic
mistake in all of the UEFI-related specifications; this practice defeats
any type checking that compilers might help programmers with. The right
way to define an opaque handle is as follows:

  //
  // Introduce the incomplete structure type, and the derived pointer
  // type, in both the specification and the public edk2 headers. Note
  // that the derived pointer type itself is a complete type, and it can
  // be used freely by client code.
  //
  typedef struct SHELL_FILE *SHELL_FILE_HANDLE;

  //
  // Complete the structure type in the edk2 internal C source files.
  //
  struct SHELL_FILE {
    //
    // list fields
    //
  };

This way the structure size and members remain hidden from client code,
but the C compiler can nonetheless catch any invalid conversions between
incompatible XXX_HANDLE types.

)

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoMdeModulePKg/BDS: Build meaningful description for Wi-Fi boot option
Ruiyu Ni [Thu, 20 Apr 2017 03:22:35 +0000 (11:22 +0800)]
MdeModulePKg/BDS: Build meaningful description for Wi-Fi boot option

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdePkg/dsc: add SmmIoLib
Jiewen Yao [Wed, 15 Mar 2017 09:23:46 +0000 (17:23 +0800)]
MdePkg/dsc: add SmmIoLib

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>