mirror_edk2.git
2 years agoCryptoPkg IntrinsicLib: Remove GCC -fno-builtin option
Liming Gao [Thu, 6 Apr 2017 08:16:25 +0000 (16:16 +0800)]
CryptoPkg IntrinsicLib: Remove GCC -fno-builtin option

GCC -fno-builtin option is added into tools_def.template at
90defe7198a42b3157ae5d9b93714f891cf06e57.
So, there is no need to set it in module INF file.

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
2 years agoMdeModulePkg RegularExpressionDxe: Remove GCC -fno-builtin option
Liming Gao [Thu, 6 Apr 2017 08:15:09 +0000 (16:15 +0800)]
MdeModulePkg RegularExpressionDxe: Remove GCC -fno-builtin option

GCC -fno-builtin option is added into tools_def.template at
90defe7198a42b3157ae5d9b93714f891cf06e57.
So, there is no need to set it in module INF file.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2 years agoShellPkg/SetVar: Fix typo in comments
Dandan Bi [Thu, 6 Apr 2017 13:55:04 +0000 (21:55 +0800)]
ShellPkg/SetVar: Fix typo in comments

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoFatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF
Ruiyu Ni [Fri, 7 Apr 2017 05:11:45 +0000 (13:11 +0800)]
FatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoShellBinPkg: Ia32/X64 Shell binary update.
Ruiyu Ni [Fri, 7 Apr 2017 05:06:22 +0000 (13:06 +0800)]
ShellBinPkg: Ia32/X64 Shell binary update.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoUefiCpuPkg/CpuFeatures: Change CPU features name to follow IA32 SDM
Jeff Fan [Thu, 6 Apr 2017 05:24:19 +0000 (13:24 +0800)]
UefiCpuPkg/CpuFeatures: Change CPU features name to follow IA32 SDM

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2 years agoUefiCpuPkg/CpuExceptionHandlerLib: Remove white space at first line
Jeff Fan [Fri, 7 Apr 2017 03:19:17 +0000 (11:19 +0800)]
UefiCpuPkg/CpuExceptionHandlerLib: Remove white space at first line

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
2 years agoShellPkg: Fix Shell to not return without startup.nsh after timeout
Ruiyu Ni [Fri, 7 Apr 2017 03:02:47 +0000 (11:02 +0800)]
ShellPkg: Fix Shell to not return without startup.nsh after timeout

When user doesn't press key to exit the timeout waiting in Shell,
and there is no startup.nsh, Shell exits with failure status.
aaf51f08ee104447207bba571649556095befc93 introduced this bug.
The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Chen A Chen <chen.a.chen@intel.com>
2 years agoMdeModulePkg/UefiBootManagerLib: Enhance short-form expanding logic
Ruiyu Ni [Wed, 29 Mar 2017 02:55:43 +0000 (10:55 +0800)]
MdeModulePkg/UefiBootManagerLib: Enhance short-form expanding logic

Old implementation only finds first matched full device path for a
given short-form device path.
The patch adds internal function BmGetNextLoadOptionBuffer() to finds
all matched full device path for a given short-form device path.
There are 6 kinds of device paths. Some of them match to multiple
load options, some of them don't.

1. Media device path:
   Returns multiple load options: The media device path may point
   to a physical BlockIo which contains multiple logic partitions,
   each logic partitions contains \EFI\BOOT\BOOT${ARCH}.EFI.

2. Short-form hard-drive device path:
   Returns one load option because the partition signature is unique.

3. Short-form file-path device path:
   Returns multiple load options: There are multiple SimpleFileSystem
   instances and each contains the same file.

4. Short-form URI device path:
   Returns multiple load options: There are multiple LoadFile
   instances and each can boot.

5. Short-form USB device path:
   Returns multiple load options: There are multiple UsbIo instances
   and each contains the boot-able file.

6. FV device path, device path pointing to SimpleFileSystem, device
   path pointing to LoadFile
   Returns one load option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/CpuExceptionHandlerLib: Trim white space at end of line
Jeff Fan [Fri, 7 Apr 2017 02:00:59 +0000 (10:00 +0800)]
UefiCpuPkg/CpuExceptionHandlerLib: Trim white space at end of line

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
2 years agoSourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
Jeff Fan [Sat, 1 Apr 2017 12:27:16 +0000 (20:27 +0800)]
SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Consume new APIs
Jeff Fan [Sat, 1 Apr 2017 11:39:22 +0000 (19:39 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Consume new APIs

Consuming PeCoffSerachImageBase() from PeCoffGetEntrypointLib and consuming
DumpCpuContext() from CpuExceptionHandlerLib to replace its own implementation.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoUefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation
Jeff Fan [Sat, 1 Apr 2017 06:16:41 +0000 (14:16 +0800)]
UefiCpuPkg/CpuExceptionHandlerLib: Add DumpCpuContext() implementation

Export DumpCpuCotext() to display CPU Context. We will invoke
PeCoffGetEntrypointLib's PeCoffSerachImageBase() to get PE/COFF image base.
Display exception data bit value for page fault exception.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoMdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()
Jeff Fan [Sat, 1 Apr 2017 05:53:08 +0000 (13:53 +0800)]
MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext()

This API is used to display exception type and all processor context for debug
purpose.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoMdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()
Jeff Fan [Sat, 1 Apr 2017 05:29:00 +0000 (13:29 +0800)]
MdePkg/PeCoffGetEntryPointLib: Add PeCoffSerachImageBase()

This new API only works on DEBUG build. It will search the PE/COFF image base
forward the input address in this PE/COFF image and returns it.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@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>
2 years agoArmPlatformPkg/PL111LcdArmVExpressLib: use write-combine mapping for VRAM
Ard Biesheuvel [Thu, 6 Apr 2017 12:16:35 +0000 (13:16 +0100)]
ArmPlatformPkg/PL111LcdArmVExpressLib: use write-combine mapping for VRAM

Replace the uncached memory mapping of the framebuffer with a write-
combining one. This improves performance, and avoids issues with
unaligned accesses and DC ZVA instructions performed by the accelerated
memcpy/memset routines.

Instead of manipulating the memory attributes directly, use the
SetMemorySpaceAttributes() DXE services, which validates the attributes
against the capabilities of the region before making the actual change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/HdLcdArmVExpressLib: use write-combine mapping for VRAM
Ard Biesheuvel [Thu, 6 Apr 2017 11:59:38 +0000 (12:59 +0100)]
ArmPlatformPkg/HdLcdArmVExpressLib: use write-combine mapping for VRAM

Replace the uncached memory mapping of the framebuffer with a write-
combining one. This improves performance, and avoids issues with
unaligned accesses and DC ZVA instructions performed by the accelerated
memcpy/memset routines.

Instead of manipulating the memory attributes directly, use the
SetMemorySpaceAttributes() DXE services, which validates the attributes
against the capabilities of the region before making the actual change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/PL111LcdArmVExpressLib: fix incorrect FreePool () call
Ard Biesheuvel [Thu, 6 Apr 2017 12:10:41 +0000 (13:10 +0100)]
ArmPlatformPkg/PL111LcdArmVExpressLib: fix incorrect FreePool () call

When we fail to modify the memory attributes for the VRAM allocation,
the allocation - which was made using AllocatePages() - is freed using
FreePool(). This is incorrect by itself, but it masks a second bug, i.e.,
that the address of the allocation is not in VramBaseAddress but in
*VramBaseAddress. So fix both issues.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/HdLcdArmVExpressLib: fix incorrect FreePool () call
Ard Biesheuvel [Thu, 6 Apr 2017 12:06:53 +0000 (13:06 +0100)]
ArmPlatformPkg/HdLcdArmVExpressLib: fix incorrect FreePool () call

When we fail to modify the memory attributes for the VRAM allocation,
the allocation - which was made using AllocatePages() - is freed using
FreePool(). This is incorrect by itself, but it masks a second bug, i.e.,
that the address of the allocation is not in VramBaseAddress but in
*VramBaseAddress. So fix both issues.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/FVP: map motherboard VRAM as uncached memory
Ard Biesheuvel [Thu, 6 Apr 2017 13:05:12 +0000 (14:05 +0100)]
ArmPlatformPkg/FVP: map motherboard VRAM as uncached memory

The VRAM of the PL111 on the FVP Base/Foundation models is described as
device memory rather than uncached memory, which is not an accurate
description of the nature of the region (i.e., a framebuffer), and may
result in problems when using accelerated string routines to access the
region, since this may legally involve unaligned accesses or DC ZVA
instructions, which are not allowed on device mappings.

So split of the 8 MB VRAM region into a separate region, and map it using
memory attributes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoCryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.
Qin Long [Fri, 31 Mar 2017 14:12:45 +0000 (22:12 +0800)]
CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.

There are some explicit time(NULL) calls in openssl-1.1.0xx source,
but the dummy time() wrapper in ConstantTimeClock.c (used by PEI
and SMM module) has no any checks on NULL parameter. This is one bug
and will cause the memory access issue.
This patch adds the NULL parameter checking in time() wrapper.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoCryptoPkg: Fix possible unresolved external symbol issue.
Qin Long [Sat, 1 Apr 2017 03:30:55 +0000 (11:30 +0800)]
CryptoPkg: Fix possible unresolved external symbol issue.

The compiler (visual studio) may optimize some explicit strcmp call
in openssl source to use the intrinsic memcmp call.
In CrtLibSupport.h, we just use #define to mapping memcmp to
CompareMem API. So in Link phase, this kind of intrinsic optimization
will cause the "unresolved external symbol" error. For example:
    OpensslLib.lib(v3_utl.obj) : error LNK2001:
                               unresolved external symbol _memcmp

This patch will keep the memcmp mapping, and provide extra Intrinsic
memcmp wrapper to satisfy the symbol link.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoCryptoPkg/OpensslLib: Suppress extra build warnings in openssl source
Qin Long [Fri, 31 Mar 2017 11:31:23 +0000 (19:31 +0800)]
CryptoPkg/OpensslLib: Suppress extra build warnings in openssl source

(Need further follow-ups as described in
    https://bugzilla.tianocore.org/show_bug.cgi?id=455)

This patch added some extra build options to suppress possible warnings
when building openssl source under GCC48 and VS2010. Including:

Adding "-Wno-error=maybe-uninitialized" to suppress the following GCC48
build warning:
  OpensslLib/openssl/ssl/statem/statem_clnt.c:2543:9: error: "len" may
     be used uninitialized in this function [-Werror=maybe-uninitialized]
       len += pskhdrlen;
           ^

And adding "/wd4306" to suppress the following VS2010 build warning:
  openssl\crypto\asn1\tasn_dec.c(795) : warning C4306: 'type cast' :
               conversion from 'int' to 'ASN1_VALUE *' of greater size

Cc: Ting Ye <ting.ye@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoCryptoPkg: Move openssl and CRT headers to private include section
Long Qin [Thu, 6 Apr 2017 05:53:06 +0000 (13:53 +0800)]
CryptoPkg: Move openssl and CRT headers to private include section

Moving the header files for openssl and CRT wrappers to the private
include section, since these files should be referenced by CryptoPkg
internally. This update was supported by new [Includes.Common.Private]
setting in Package DEC file.
The external consumer modules should only use the interfaces defined
in BaseCryptLib.h to access crypto functions. This change will be
helpful to immediately detect any illegal direct reference to internal
openssl headers.
The Perl script "process_files.pl" was also updated to reflect the new
private include path.

Cc: Gao Liming <liming.gao@intel.com>
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: Ye Ting <ting.ye@intel.com>
2 years agoArmPkg: remove ArmCpuLib header and implementations
Ard Biesheuvel [Fri, 31 Mar 2017 08:45:35 +0000 (09:45 +0100)]
ArmPkg: remove ArmCpuLib header and implementations

Remove ArmCpuLib entirely. It is no longer used.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoUefiCpuPkg/MpLib.c: Load microcode before mtrr sync per IA32 SDM
Jeff Fan [Sat, 1 Apr 2017 13:29:54 +0000 (21:29 +0800)]
UefiCpuPkg/MpLib.c: Load microcode before mtrr sync per IA32 SDM

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=453
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2 years agoBaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Liming Gao [Thu, 6 Apr 2017 00:45:32 +0000 (08:45 +0800)]
BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain

Now, -fno-builtin option is added for the specific GCC tool chain.
It is a generic option. It can be moved to common GCC option to keep
the consistent compiler option.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
2 years agoSecurityPkg: SecureBootConfigDxe: Update CloseEnrolledFile comment
Zhang, Chao B [Thu, 6 Apr 2017 07:13:57 +0000 (15:13 +0800)]
SecurityPkg: SecureBootConfigDxe: Update CloseEnrolledFile comment

Update function CloseEnrolledFile comment introduced in
4de754e15fec9c94ce7677904efd0022c211721b

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
2 years agoNetworkPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:10:39 +0000 (10:10 +0800)]
NetworkPkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
2 years agoMdePkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:05:54 +0000 (10:05 +0800)]
MdePkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2 years agoSignedCapsulePkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:03:57 +0000 (10:03 +0800)]
SignedCapsulePkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoIntelFsp2WrapperPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:02:29 +0000 (10:02 +0800)]
IntelFsp2WrapperPkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoIntelFsp2Pkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:01:09 +0000 (10:01 +0800)]
IntelFsp2Pkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoCryptoPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 01:53:07 +0000 (09:53 +0800)]
CryptoPkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
2 years agoBaseTools: update error message for SKUID_IDENTIFIER format
Yonghong Zhu [Sat, 1 Apr 2017 05:57:16 +0000 (13:57 +0800)]
BaseTools: update error message for SKUID_IDENTIFIER format

Per DSC spec, the SkuUiName use '|' as separator, so this patch update
the error message to use '|' but not space as separator.

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>
2 years agoBaseTools: Add the missing copyrights in BrotliCompress.bat
Liming Gao [Wed, 5 Apr 2017 04:57:27 +0000 (12:57 +0800)]
BaseTools: Add the missing copyrights in BrotliCompress.bat

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2 years agoMdeModulePkg: Remove unsupported PcdExpression usage in module INF
Liming Gao [Fri, 31 Mar 2017 05:03:59 +0000 (13:03 +0800)]
MdeModulePkg: Remove unsupported PcdExpression usage in module INF

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

PcdExpression used in INF to control PCD and Source is unsupported feature.
Current sample usage in module INF brings confuse.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2 years agoSecurityPkg: SecureBootConfigDxe: Support AUTH_2 enrollment to DBX
Zhang, Chao B [Tue, 28 Feb 2017 02:23:19 +0000 (10:23 +0800)]
SecurityPkg: SecureBootConfigDxe: Support AUTH_2 enrollment to DBX

Update SecureBootConfigDxe to support AUTH_2 format data enrollment
to DBX.
Free opened file handle resource after exit PK/KEK/DB/DBX/DBT
enrollment page.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
2 years agoUefiCpuPkg: Fix typos in UefiCpuPkg.dec
Dandan Bi [Wed, 5 Apr 2017 14:32:16 +0000 (22:32 +0800)]
UefiCpuPkg: Fix typos in UefiCpuPkg.dec

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoMdeModulePkg: move PlatformHasAcpiGuid from EmbeddedPkg
Ard Biesheuvel [Wed, 5 Apr 2017 09:35:06 +0000 (10:35 +0100)]
MdeModulePkg: move PlatformHasAcpiGuid from EmbeddedPkg

Given the agreement on the edk2-devel regarding the fact that the
notion whether or not a 'platform has ACPI' is a universal one, move
the PlatformHasAcpi GUID to MdeModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Zeng, Star" <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmJunoDxe: simplify ACPI table installation
Ard Biesheuvel [Thu, 30 Mar 2017 13:03:54 +0000 (14:03 +0100)]
ArmPlatformPkg/ArmJunoDxe: simplify ACPI table installation

Having a three way conditional with callbacks would make sense if the
callbacks weren't (a) identical and (b) didn't return TRUE all the
time. So get rid of the kludge.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmJunoPkg: remove PCI host bridge driver
Ard Biesheuvel [Thu, 30 Mar 2017 10:38:09 +0000 (11:38 +0100)]
ArmPlatformPkg/ArmJunoPkg: remove PCI host bridge driver

We are switching the Juno platform to the generic host bridge driver,
which involves implementing PciHostBridgeLib for this platform, and
plugging it into MdeModulePkg's PciHostBridgeDxe.inf.

Since the platform descriptions no longer live in upstream EDK2, the
PciHostBridgeLib implementation (which reuses some of the code removed
here) will live there as well. But this PciHostBridgeDxe driver is no
longer used, so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmJunoDxe: don't register OnEndOfDxe event on rev R0
Ard Biesheuvel [Tue, 4 Apr 2017 11:58:58 +0000 (12:58 +0100)]
ArmPlatformPkg/ArmJunoDxe: don't register OnEndOfDxe event on rev R0

The ArmJunoDxe driver code registers a callback for the EndOfDxe event,
at which time it does some manipulation of the PCI peripherals on the
board. Given that R0 has no working PCIe, instead of conditionally
performing these operations, omit the registration of the
callback altogether on that platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmJunoDxe: use the generic non-discoverable device support
Ard Biesheuvel [Thu, 30 Mar 2017 09:31:44 +0000 (10:31 +0100)]
ArmPlatformPkg/ArmJunoDxe: use the generic non-discoverable device support

Replace the open coded reimplementation of 'PCI emulation' with a pair
of calls into NonDiscoverableDeviceRegistrationLib to register the OHCI
and EHCI controllers. These will be picked up by the generic driver instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmJunoDxe: remove BdsLib dependency
Ard Biesheuvel [Thu, 30 Mar 2017 12:57:00 +0000 (13:57 +0100)]
ArmPlatformPkg/ArmJunoDxe: remove BdsLib dependency

The ArmJunoDxe driver does not actually depend on the deprecated BdsLib
so remove the dependency declaration from the INF file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency
Ard Biesheuvel [Wed, 29 Mar 2017 12:13:26 +0000 (13:13 +0100)]
ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency

Remove ArmShellCmdRunAxf's dependency on the deprecated BdsLib by
cloning the ShutdownUefiBootServices() routine into a local source
file; this is the only BdsLib feature 'runaxf' depends on.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2 years agoUefiCpuPkg/CpuFeatures: Change files format to DOS
Jeff Fan [Wed, 5 Apr 2017 08:33:16 +0000 (16:33 +0800)]
UefiCpuPkg/CpuFeatures: Change files format to DOS

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2 years agoShellPkg/setvar: Add assertion indicating TempData shouldn't be NULL
Ruiyu Ni [Wed, 5 Apr 2017 05:56:30 +0000 (13:56 +0800)]
ShellPkg/setvar: Add assertion indicating TempData shouldn't be NULL

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoUefiCpuPkg/MtrrLib:Fix VS2012 build failure
Dandan Bi [Wed, 5 Apr 2017 01:00:01 +0000 (09:00 +0800)]
UefiCpuPkg/MtrrLib:Fix VS2012 build failure

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoMdeModulePkg/UefiHiiLib:Fix incorrect comparison expression
Dandan Bi [Sat, 1 Apr 2017 02:31:14 +0000 (10:31 +0800)]
MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression

Fix the incorrect comparison between pointer and constant zero character.

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

V2: The pointer StringPtr points to a string returned
by ExtractConfig/ExportConfig, if it is NULL, function
InternalHiiIfrValueAction will return FALSE. So in
current usage model, the StringPtr can not be NULL before
using it, so we can add ASSERT here.

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>
2 years agoBaseTools/UPT: Fix a parser issue
Hess Chen [Sat, 1 Apr 2017 05:33:05 +0000 (13:33 +0800)]
BaseTools/UPT: Fix a parser issue

Update the method to get PCD information and support empty section.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2 years agoBaseTools/UPT: Support Unicode path
Hess Chen [Sat, 1 Apr 2017 05:33:04 +0000 (13:33 +0800)]
BaseTools/UPT: Support Unicode path

Update the IpiDb.py to support Unicode path for localization

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2 years agoBaseTools/UPT: Use a simple way to get package path
Hess Chen [Sat, 1 Apr 2017 05:33:03 +0000 (13:33 +0800)]
BaseTools/UPT: Use a simple way to get package path

Instead of parsing all content of DEC file, just get the package
path only to save time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2 years agoArmVirtPkg/ArmVirtQemuKernel: increase slack space for DTB
Ard Biesheuvel [Tue, 4 Apr 2017 14:40:01 +0000 (15:40 +0100)]
ArmVirtPkg/ArmVirtQemuKernel: increase slack space for DTB

The relocatable build of ArmVirtQemuKernel is designed to be executed
from RAM, and contains some scratch memory at the start of the image
to use as a stack very early on, and to preserve the DTB image received
from QEMU while it discovers and initializes memory.

It turns out that 8 KB is a bit on the small side here, especially when
executing with secure world emulation enabled, in which case there are
additional nodes present.

So increase the slack space to 32 KB.

While at it, remove a stale Xen reference that was copy/pasted when this
file was created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg/PlatformPeiLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:20:12 +0000 (14:20 +0100)]
ArmVirtPkg/PlatformPeiLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:07:16 +0000 (14:07 +0100)]
ArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 12:55:44 +0000 (13:55 +0100)]
ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain memory nodes whose status is set to 'secure'. Similarly,
the status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoNetworkPkg: Fix some bugs related to iSCSI keyword configuration.
Zhang, Lubo [Fri, 24 Mar 2017 08:43:04 +0000 (16:43 +0800)]
NetworkPkg: Fix some bugs related to iSCSI keyword configuration.

Add check logic and error message for some keywords validity.
show target address in URL format and MAC address correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
2 years agoMdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero
Jiaxin Wu [Sat, 1 Apr 2017 00:21:03 +0000 (08:21 +0800)]
MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero

UINTN is unsigned integer, so it's pointless to compare it with zero.

Cc: Bi Dandan <dandan.bi@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
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: Zhang Lubo <lubo.zhang@intel.com>
2 years agoBaseTools: Enhance StrDefs.h to include ImageDefs.h
Yonghong Zhu [Fri, 31 Mar 2017 14:05:28 +0000 (22:05 +0800)]
BaseTools: Enhance StrDefs.h to include ImageDefs.h

Enhance StrDefs.h to include ImageDefs.h for VfrCompiler to support
IMAGE_TOKEN usage.

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>
2 years agoBaseTools: Enhance expression to support some more operation
Yonghong Zhu [Fri, 31 Mar 2017 13:47:59 +0000 (21:47 +0800)]
BaseTools: Enhance expression to support some more operation

Enhance expression to support some more operation that allowed in the
spec, eg: *, /, %, <<, >>, ~.

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>
2 years agoVlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib
Ruiyu Ni [Sat, 1 Apr 2017 05:14:57 +0000 (13:14 +0800)]
Vlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib

Recent ConPlatformDxe driver change depends on UefiBootManagerLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoMdePkg/Shell.h: Update Shell version from 2.1 to 2.2
Ruiyu Ni [Fri, 31 Mar 2017 14:23:13 +0000 (22:23 +0800)]
MdePkg/Shell.h: Update Shell version from 2.1 to 2.2

All the Shell 2.2 features are implemented except DMEM/MM
changes which are pending on spec change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Kinney D Michael <kinney.d.michael@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile
Jeff Fan [Tue, 28 Mar 2017 06:01:24 +0000 (14:01 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile

SmmProfile feature required to protect all SMM ranges by structure
mProtectionMemRangeTemplate. This update is to add additonal save SMM ranges
into mProtectionMemRangeTemplate besides the range specified by
mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range
Jeff Fan [Tue, 28 Mar 2017 05:51:52 +0000 (13:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range

Internal function IsInSmmRanges() is added t check SMM range by saved SMM ranges
beside by mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables
Jeff Fan [Tue, 28 Mar 2017 00:48:17 +0000 (08:48 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables

v2:
  Add #define SMRR_MAX_ADDRESS to clarify SMRR requirement.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@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>
2 years agoUefiCpuPkg/MtrrLib: Fix GCC build failure
Ruiyu Ni [Fri, 31 Mar 2017 14:04:17 +0000 (22:04 +0800)]
UefiCpuPkg/MtrrLib: Fix GCC build failure

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2 years agoShellPkg/setvar: Support data format in Shell 2.2 spec
Chen A Chen [Wed, 29 Mar 2017 02:23:09 +0000 (10:23 +0800)]
ShellPkg/setvar: Support data format in Shell 2.2 spec

Shell 2.2 spec defines =0x/=0X, =H/=h, =S, =L and =P for
hex number, hex array, ascii string, unicode string and
device path data.
The patch adds such support.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
2 years agoEmbeddedPkg/DtPlatformDxe: load platform DTB via new library
Ard Biesheuvel [Wed, 29 Mar 2017 11:05:01 +0000 (12:05 +0100)]
EmbeddedPkg/DtPlatformDxe: load platform DTB via new library

To give platforms some room to decide which DTB is suitable and where
to load it from, load the DTB image indirectly via the new
DtPlatformDtbLoaderLib library class.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoEmbeddedPkg: add base DtPlatformDtbLoaderLib implementation
Ard Biesheuvel [Fri, 31 Mar 2017 10:35:13 +0000 (11:35 +0100)]
EmbeddedPkg: add base DtPlatformDtbLoaderLib implementation

Introduce an implementation of the new DtPlatformDtbLoaderLib library
class that simply retrieves the first raw section of an FV file named
'gDtPlatformDefaultDtbFileGuid'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoEmbeddedPkg: add DtPlatformDtbLoaderLib library class
Ard Biesheuvel [Fri, 31 Mar 2017 10:32:36 +0000 (11:32 +0100)]
EmbeddedPkg: add DtPlatformDtbLoaderLib library class

To abstract the way a platform reasons about which DTB is appropriate,
and the way it ultimately supplies the DTB image, introduce a new library
class to encapsulate this functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoEmbeddedPkg: add DtPlatformDxe to .dsc file
Ard Biesheuvel [Fri, 31 Mar 2017 12:16:40 +0000 (13:16 +0100)]
EmbeddedPkg: add DtPlatformDxe to .dsc file

Add the new DtPlatformDxe driver to EmbeddedPkg's .dsc file so that
we can build it outside the context of a platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override
Ard Biesheuvel [Wed, 29 Mar 2017 17:50:39 +0000 (18:50 +0100)]
ArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override

In general, we should not present two separate (and inevitably different)
hardware descriptions to the OS, in the form of ACPI tables and a device
tree blob. For this reason, we recently added the logic to ArmVirtQemu to
only expose the ACPI 2.0 entry point if no DT binary is being passed, and
vice versa.

However, this is arguably a regression for those who relied on DT
descriptions being available, even if the former behavior can be
restored by passing the -no-acpi switch to QEMU.

So allow a secret handshake with the UEFI Shell, to set a variable that
will result in ACPI to be disabled on subsequent boots even if -no-acpi
was not passed on the QEMU command line.

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =01

To delete the variable and revert to the old situation, simply omit the
value after the =

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
2 years agoBeagleBoardPkg: add missing BootLogoLib resolution
Ard Biesheuvel [Fri, 31 Mar 2017 09:44:32 +0000 (10:44 +0100)]
BeagleBoardPkg: add missing BootLogoLib resolution

Recent changes to the PlatformBootManagerLib implementation in ArmPkg
require its users to define a resolution for BootLogoLib. So add this
missing resolution to Beagle.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoBeagleBoardPkg: remove ArmCpuLib reference
Ard Biesheuvel [Fri, 31 Mar 2017 08:44:02 +0000 (09:44 +0100)]
BeagleBoardPkg: remove ArmCpuLib reference

ArmCpuLib is not used, and will be removed. So drop the reference from
our .DSC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg: remove ArmCpuLib references
Ard Biesheuvel [Fri, 31 Mar 2017 08:43:14 +0000 (09:43 +0100)]
ArmVirtPkg: remove ArmCpuLib references

ArmCpuLib is never used anywhere, and is about to be removed. So remove
any references from our .DSC files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoBaseTools/GCC AARCH64: force disable PIC code generation
Ard Biesheuvel [Fri, 31 Mar 2017 08:22:56 +0000 (09:22 +0100)]
BaseTools/GCC AARCH64: force disable PIC code generation

As a security measure, some distro toolchains now default to PIC code
generation, allowing executables (as opposed to shared libraries) using
the objects to be built as PIE binaries, which can be loaded at a random
virtual offset.

However, our ELF to PE/COFF generation code does not deal with the
resulting relocation types (i.e., GOT based), and so the use of PIC code
leads to GenFw errors.

Given that
a) our non-PIC PE/COFF executables are already relocatable,
b) PIC code leads to all symbol references to be indirected via GOT
   entries containing absolute addresses, each requiring an entry in the
   relocation table,
c) the AArch64 ISA makes it perfectly feasible to built PIE executables
   from non-PIC code,

there is absolutely no upside to using PIC code for building EDK2 modules,
and so we're better off simply disabling it unconditionally.

Note that when running under the OS, the GOT has an additional advantage,
i.e., that all .text/.rodata pages remain clean and so can be shared between
processes. This does not apply to the UEFI environment, however.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2 years agoUefiCpuPkg/MtrrLib: All functions use definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 11:48:29 +0000 (19:48 +0800)]
UefiCpuPkg/MtrrLib: All functions use definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker
Ruiyu Ni [Fri, 2 Sep 2016 10:10:45 +0000 (18:10 +0800)]
UefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR
Ruiyu Ni [Fri, 2 Sep 2016 04:09:54 +0000 (12:09 +0800)]
UefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR

The new algorithm finds out the more optimal MTRR solution for
current memory type settings.
Compare against the original algorithm, the new one guarantees
to find the correct MTRR solution, but doesn't guarantee to
find the most optimal MTRR solution.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h
Ruiyu Ni [Fri, 2 Sep 2016 12:23:35 +0000 (20:23 +0800)]
UefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions
Ruiyu Ni [Fri, 2 Sep 2016 02:45:53 +0000 (10:45 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr
Ruiyu Ni [Fri, 2 Sep 2016 02:41:28 +0000 (10:41 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:35:45 +0000 (10:35 +0800)]
UefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:27:29 +0000 (10:27 +0800)]
UefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h
Ruiyu Ni [Tue, 23 Aug 2016 02:38:02 +0000 (10:38 +0800)]
UefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoUefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs
Ruiyu Ni [Thu, 18 Aug 2016 07:34:54 +0000 (15:34 +0800)]
UefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoBaseTools: Update Brotli and BrotliCompress mode and format
Song, BinX [Thu, 30 Mar 2017 08:23:10 +0000 (16:23 +0800)]
BaseTools: Update Brotli and BrotliCompress mode and format

V2:
- Update correct patch info

V1:
- Add x mode for Brotli and BrotliCompress
- Change Brotli and BrotliCompress format from DOS to UNIX

Cc: Liming Gao <liming.gao@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>
2 years agoMdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.
Jiewen Yao [Mon, 27 Mar 2017 15:01:02 +0000 (23:01 +0800)]
MdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.

Issue reported at bugzillar 445.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2 years agoOvmfPkg: Allow multiple add-pointer linker commands to same ACPI table
Phil Dennis-Jordan [Thu, 30 Mar 2017 10:40:57 +0000 (23:40 +1300)]
OvmfPkg: Allow multiple add-pointer linker commands to same ACPI table

ACPI tables may contain multiple fields which point to the same
destination table. For example, in some revisions, the FADT contains
both DSDT and X_DSDT fields, and they may both point to the DSDT.

Previously, if Qemu created QEMU_LOADER_ADD_POINTER linker commands for
such instances, the linking process would attempt to install the same
pointed-to table repeatedly. For tables of which there must only be one
instance, the call to AcpiProtocol->InstallAcpiTable() would fail during
the second linker command pointing to the same table, thus entirely
aborting the ACPI table linking process. In the case of tables of which
there may be multiple instances, the table would end up duplicated.

This change adds a memoisation data structure which tracks the table
pointers that have already been processed; even if the same pointer is
encountered multiple times, it is only processed once.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: DSDT<->XSDT typo, debug msg, and coding style fixups]
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=368
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2 years agoCryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module
Qin Long [Thu, 30 Mar 2017 07:53:21 +0000 (15:53 +0800)]
CryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module

The memory free operation is empty function in PEI. The compiler
optimization will bring the build warning in openssl/crypto/mem.c:
      warning C4718: 'CRYPTO_free': recursive call has no side
                     effects, deleting
This patch uses '/wd4718' to silence the build warning for PEI
module building.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
2 years agoMdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid
Jiaxin Wu [Mon, 27 Mar 2017 06:45:50 +0000 (14:45 +0800)]
MdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid

Cc: Zhang Lubo <lubo.zhang@intel.com>
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: Zhang Lubo <lubo.zhang@intel.com>
2 years agoMdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing
Jiaxin Wu [Fri, 24 Mar 2017 01:53:50 +0000 (09:53 +0800)]
MdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing

For current iSCSI protocol parsing, UINT16 truncation may be happened. Since
the Spec already have declaimed that 0 is TCP Protocol and 1+ is reserved, the
parsing can be refined as below:

  if (StrCmp (ProtocolStr, L"TCP") == 0) {
    ISCSIDevPath->NetworkProtocol = 0;
  } else {
    //
    // Undefined and reserved.
    //
    ISCSIDevPath->NetworkProtocol = 1;
  }

Cc: Warner Losh <imp@bsdimp.com>
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: Warner Losh <imp@bsdimp.com>
2 years agoNetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6
Jiaxin Wu [Thu, 23 Mar 2017 03:35:14 +0000 (11:35 +0800)]
NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6

According UEFI Spec, set to zero StationIp means to let the underlying
IPv6 driver choose a source address. But currently, DNSv6 always return
EFI_NO_MAPPING. The issue is caused by below bugs in DnsDxe:
* Incorrect TPL(TPL_CALLBACK) usage during UDP configuration.
* Failed to create the timer used to get IPv6 mapping
* Doesn't check the Ip6Mode.IsStarted flag.

Cc: Zhang Lubo <lubo.zhang@intel.com>
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: Zhang Lubo <lubo.zhang@intel.com>
2 years agoMdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch
Ard Biesheuvel [Mon, 27 Mar 2017 12:22:16 +0000 (13:22 +0100)]
MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch

The EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro is abused in the PeiCore
code to decide whether the system we are compiling for can deal with
executable code being copied elsewhere and executed from there.

As stated in the comment, this is fundamentally a property of the compiler
target, and so this should be made dependent on MDE_CPU_xxx preprocessor
defines, and not on whether or not the runtime target can deal with
PE/COFF images of a certain machine type.

On X86/IA32, this mostly boils down to the same thing, but not on other
architectures, so let's clean this up.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2 years agoMdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64
Ard Biesheuvel [Mon, 27 Mar 2017 11:19:53 +0000 (12:19 +0100)]
MdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64

Add a mapping for EFI_IMAGE_MACHINE_AARCH64 to mMachineTypeInfo[]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2 years agoBaseTools: Update Pkcs7 and RSA2048 tool with shell=True
Yonghong Zhu [Tue, 28 Mar 2017 07:04:13 +0000 (15:04 +0800)]
BaseTools: Update Pkcs7 and RSA2048 tool with shell=True

Pkcs7Sign, Rsa2048Sha256Sign and Rsa2048Sha256GenerateKeys doesn't work
on Linux. It needs to be changed with shell=True.

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>
2 years agoCryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.
Qin Long [Thu, 23 Mar 2017 12:53:45 +0000 (20:53 +0800)]
CryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.

This patch update the wrapper implementation in TlsLib to align
with the latest OpenSSL-1.1.0xx API changes.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Palmer Thomas <thomas.palmer@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
2 years agoCryptoPkg: Update PK Cipher Wrappers work with opaque objects.
Qin Long [Tue, 21 Mar 2017 14:58:07 +0000 (22:58 +0800)]
CryptoPkg: Update PK Cipher Wrappers work with opaque objects.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updates Public Key Cipher Wrapper implementations in
BaseCryptLib to use the accessor APIs for opaque object access.
The impacted interfaces includes RSA, DH, X509, PKCS7, etc.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.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>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
2 years agoCryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.
Qin Long [Thu, 23 Mar 2017 12:47:34 +0000 (20:47 +0800)]
CryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updated HMAC Wrapper implementation with opaque
HMAC_CTX object.
The HmacXXGetContextSize() is marked as deprecated, and updated
to use the fixed HMAC_CTX size, which is just kept for compatibility.
New APIs (HmacXXNew(), HmacXXFree()) were added  as the recommended
HMAC_CTX usage interfaces for HMAC-XXXX operations.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.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>
Tested-by: Laszlo Ersek <lersek@redhat.com>