]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
6 years agoUefiCpuPkg/MtrrLib: Correct debug message
Ruiyu Ni [Thu, 7 Dec 2017 02:48:04 +0000 (10:48 +0800)]
UefiCpuPkg/MtrrLib: Correct debug message

When printing the ascii format of memory attribute in debug message,
%s was used, but %a should be used.
The patch additionally changes %x to %r for EFI_STATUS.

The whole patch doesn't impact functionality of the MtrrLib.
Just debug message fix.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Ming Shao <ming.shao@intel.com>
6 years agoMdeModulePkg: loose VA_COPY with no matching VA_END on a return path
Zenith432 [Sat, 9 Dec 2017 17:04:38 +0000 (01:04 +0800)]
MdeModulePkg: loose VA_COPY with no matching VA_END on a return path

In CheckRemainingSpaceForConsistencyInternal, one of the return paths leaves a loose
VA_COPY with no matching VA_END.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools: Add object_files.lst as dependency of lib target
Yonghong Zhu [Mon, 4 Dec 2017 02:25:43 +0000 (10:25 +0800)]
BaseTools: Add object_files.lst as dependency of lib target

Seems object_files.lst is not added as dependency of lib target, this
patch update BaseTools to generate Makefile with this dependency.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoSecurityPkg:Tcg2Smm:Enabling TPM SIRQ interrupt support
Zhang, Chao B [Fri, 4 Aug 2017 06:48:52 +0000 (14:48 +0800)]
SecurityPkg:Tcg2Smm:Enabling TPM SIRQ interrupt support

1. Report TPM SIRQ interrupt resource through _CRS
2. Expose _SRS to update interrupt resource & FIFO/TIS interrupt related registers
   defined in TCG PC Client Platform TPM Profile (PTP) Specification spec
https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2-0-v43-150126.pdf
Note: IHV/OEM need to carefully verify this feature with OS TPM driver to make sure there is no impact to system/HW

Cc: Long Qin <qin.long@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
6 years agoMdeModulePkg/ScsiDisk: Return EFI_NO_MEDIA when no media presents
Ruiyu Ni [Thu, 7 Dec 2017 09:54:41 +0000 (17:54 +0800)]
MdeModulePkg/ScsiDisk: Return EFI_NO_MEDIA when no media presents

Current code always return EFI_MEDIA_CHANGED no matter the media
is removed from CD/DVD drive or the media is changed.
It doesn't strictly follow the UEFI Spec.
Update code to return EFI_NO_MEDIA when media is removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
6 years agoArmPlatformPkg/LcdPlatformNullLib: fix incorrect library class
Ard Biesheuvel [Fri, 8 Dec 2017 17:09:58 +0000 (17:09 +0000)]
ArmPlatformPkg/LcdPlatformNullLib: fix incorrect library class

Use LcdPlatformLib not LcdPlatformNullLib (which is the name of this
instance) as LIBRARY_CLASS attribute.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: enable NOOPT build
Ard Biesheuvel [Fri, 8 Dec 2017 16:38:49 +0000 (16:38 +0000)]
ArmPlatformPkg: enable NOOPT build

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Suggested-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPkg/PlatformBootManagerLib: print firmware version to console
Ard Biesheuvel [Fri, 8 Dec 2017 14:55:22 +0000 (14:55 +0000)]
ArmPkg/PlatformBootManagerLib: print firmware version to console

If gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString is set to
a non-empty string, print it to the console at boot. Note that this
is independent of DEBUG/RELEASE or graphical vs serial console,
although we do attempt to stay clear of the logo and progress bar
in graphical mode, by printing it top center.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: add package .DSC file
Ard Biesheuvel [Tue, 5 Dec 2017 10:10:47 +0000 (10:10 +0000)]
ArmPlatformPkg: add package .DSC file

Now that we have removed all the cruft from ArmPlatformPkg, add a .DSC
file that builds all the remaining components standalone, i.e., outside
of the context of any particular platform. This is primarily intended
for build time testing.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: add Null implementation of NorFlashPlatformLib
Ard Biesheuvel [Tue, 5 Dec 2017 10:09:59 +0000 (10:09 +0000)]
ArmPlatformPkg: add Null implementation of NorFlashPlatformLib

In order to be able to build ArmPlatformPkg components outside of
the context of a particular platform, add Null implementation of
NorFlashPlatformLib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: add Null implementation of LcdPlatformlLib
Ard Biesheuvel [Tue, 5 Dec 2017 10:08:50 +0000 (10:08 +0000)]
ArmPlatformPkg: add Null implementation of LcdPlatformlLib

In order to be able to build ArmPlatformPkg components outside of
the context of a particular platform, add Null implementation of
LcdPlatformlLib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/PrePeiCoreMPCore: use a unique GUID
Ard Biesheuvel [Tue, 5 Dec 2017 10:04:47 +0000 (10:04 +0000)]
ArmPlatformPkg/PrePeiCoreMPCore: use a unique GUID

PrePeiCoreMPCore reuses the GUID of its unicore sibling, which is
usually fine, given that platforms never include both. However, it
prevents us from creating a package .DSC that does include both, so
update the GUID to a fresh one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused ArmPlatformLibNullSec
Ard Biesheuvel [Tue, 5 Dec 2017 10:03:00 +0000 (10:03 +0000)]
ArmPlatformPkg: remove unused ArmPlatformLibNullSec

ArmPlatformLibNullSec is built from a secondary .inf that omits
ArmPlatformLibNullMem.c from the [Sources] section so the library
can be used in a SEC context. This is slightly dodgy, given that
the resulting library is incomplete. Let's just remove this version,
since it isn't used anywhere anyway.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused SP804 driver and TimerLib implementation
Ard Biesheuvel [Wed, 15 Nov 2017 14:42:05 +0000 (14:42 +0000)]
ArmPlatformPkg: remove unused SP804 driver and TimerLib implementation

None of the platforms we support use these so remove them.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused ArmTrustZone driver
Ard Biesheuvel [Wed, 15 Nov 2017 14:41:26 +0000 (14:41 +0000)]
ArmPlatformPkg: remove unused ArmTrustZone driver

This driver is no longer used anywhere so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused PL310 driver
Ard Biesheuvel [Wed, 15 Nov 2017 14:39:30 +0000 (14:39 +0000)]
ArmPlatformPkg: remove unused PL310 driver

This driver is not used by any platforms so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove PL34xDmc driver
Ard Biesheuvel [Wed, 15 Nov 2017 14:33:50 +0000 (14:33 +0000)]
ArmPlatformPkg: remove PL34xDmc driver

Remove PL34xDmc driver which is not used by any platforms

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused PL35x driver
Ard Biesheuvel [Wed, 15 Nov 2017 14:31:05 +0000 (14:31 +0000)]
ArmPlatformPkg: remove unused PL35x driver

No platform uses this so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused PL301Axi driver
Ard Biesheuvel [Wed, 15 Nov 2017 14:29:35 +0000 (14:29 +0000)]
ArmPlatformPkg: remove unused PL301Axi driver

No platforms use this driver so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/LcdGraphicsOutputDxe: move headers into driver directory
Ard Biesheuvel [Mon, 4 Dec 2017 21:57:55 +0000 (21:57 +0000)]
ArmPlatformPkg/LcdGraphicsOutputDxe: move headers into driver directory

The HdLcd.h and PL111Lcd.h header files are internal headers that should
not be used by other drivers. So move them from Include/Drivers into the
driver directory instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: add missing library class declarations to .dec file
Ard Biesheuvel [Thu, 16 Nov 2017 17:20:18 +0000 (17:20 +0000)]
ArmPlatformPkg: add missing library class declarations to .dec file

Add ArmPlatformLib, LcdPlatformlib and NorFlashPlatformLib to the
[LibraryClasses] section of ArmPlatformPkg.dec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove old PL011UartLib implementation
Ard Biesheuvel [Thu, 16 Nov 2017 17:17:05 +0000 (17:17 +0000)]
ArmPlatformPkg: remove old PL011UartLib implementation

Remove the PL011UartLib implementation that has been superseded by
the one under Library/

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove BootMonFs and ArmShellCmdRunAxf
Ard Biesheuvel [Wed, 15 Nov 2017 16:21:53 +0000 (16:21 +0000)]
ArmPlatformPkg: remove BootMonFs and ArmShellCmdRunAxf

These modules have been imported into edk2-platforms where they belong
so remove them from the main EDK2 branch.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove ArmPlatformSysConfigLib library class
Ard Biesheuvel [Wed, 15 Nov 2017 14:27:49 +0000 (14:27 +0000)]
ArmPlatformPkg: remove ArmPlatformSysConfigLib library class

The only remaining user of ArmPlatformSysConfigLib has absorbed this
definition into its own edk2-platforms package, so let's remove it from
the shared code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove ArmVExpressPkg
Ard Biesheuvel [Wed, 15 Nov 2017 13:48:50 +0000 (13:48 +0000)]
ArmPlatformPkg: remove ArmVExpressPkg

Remove ArmVExpressPkg from EDK2 now that its contents have moved into
edk2-platforms/Platform/ARM where they belong.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove NorFlashArmVExpressLib
Ard Biesheuvel [Wed, 15 Nov 2017 12:13:34 +0000 (12:13 +0000)]
ArmPlatformPkg: remove NorFlashArmVExpressLib

Remove NorFlashArmVExpressLib now that it has been moved into edk2-platforms
where it belongs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoBaseTool/tools_def GCC5: enable optimization for ARM/AARCH64 DEBUG builds
Ard Biesheuvel [Thu, 7 Dec 2017 08:53:03 +0000 (08:53 +0000)]
BaseTool/tools_def GCC5: enable optimization for ARM/AARCH64 DEBUG builds

Enable optimization for DEBUG builds, to make it more usable in terms of
performance, and to give more coverage to the LTO builds. Also, some
diagnostics are only enabled when optimization is enabled.
NOOPT builds can now also be created, which will retain the behavior DEBUG
builds had previously.

Note that this aligns ARM and AARCH64 with the x86 architectures, which
already use optimization for DEBUG builds.

In order to preserve existing behavior for users of older toolchains,
keep GCC49 and older as-is.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools/tools_def CLANG38: add -Wno-unused-const-variable
Ard Biesheuvel [Thu, 7 Dec 2017 08:49:47 +0000 (08:49 +0000)]
BaseTools/tools_def CLANG38: add -Wno-unused-const-variable

Commit 8b6366f87584 ("BaseTools/GCC: set -Wno-unused-const-variable
on RELEASE builds") suppresses warnings about unused constant
variables in RELEASE builds when building with GCC, given that they
break the build under our warnings-as-errors policy.

Do the same for CLANG38.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=790
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Shi Steven <steven.shi@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools/tools_def: add CLANG38 LTO versions for AARCH64 and ARM
Ard Biesheuvel [Wed, 6 Dec 2017 11:30:05 +0000 (11:30 +0000)]
BaseTools/tools_def: add CLANG38 LTO versions for AARCH64 and ARM

Extend the CLANG38 toolchain definition so it can be used for
ARM and AARCH64 as well. Note that this requires llvm-ar and
the LLVMgold.so linker plugin.

In preparation of doing the same for GCC5, this toolchain version
also departs from the custom of using -O0 for DEBUG builds, which
makes them needlessly slow. Instead, let's add a NOOPT flavor as
well, and enable optimization for DEBUG like the other architectures
do. (Note that this will require some trivial changes to the platform
description files)

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: align ERROR/WARNING/RETURN macros with MdePkg versions
Leif Lindholm [Tue, 5 Dec 2017 16:10:15 +0000 (16:10 +0000)]
BaseTools: align ERROR/WARNING/RETURN macros with MdePkg versions

BaseTools' BaseTypes.h defined the ENCODE_ERROR macro as
 #define ENCODE_ERROR(a)              ((RETURN_STATUS)(MAX_BIT | (a)))
whereas MdePkg defines it as
 #define ENCODE_ERROR(StatusCode)     ((RETURN_STATUS)(MAX_BIT | (StatusCode)))

When building with GCC 6.3 (at least) the former triggers
"error: overflow in implicit constant conversion [-Werror=overflow]"
Resolve this by aligning it with the latter one.

This also requires aligning the BaseTools typedef of RETURN_STATUS with
the MdePkg one: INTN -> UINTN.

While at it, update adjacent ENCODE_WARNING and RETURN_ERROR as well.

Add an explicit initialization of *Alignment to 0 in GenFfs.c
GetAlignmentFromFile to get rid of a warning occuring with GCC after
this change (-Werror=maybe-uninitialized).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/DxeIpl: Enable paging for Stack Guard
Jian J Wang [Thu, 7 Dec 2017 12:17:49 +0000 (20:17 +0800)]
MdeModulePkg/DxeIpl: Enable paging for Stack Guard

Stack guard feature makes use of paging mechanism to monitor if there's a
stack overflow occurred during boot.

This patch will check setting of PCD PcdCpuStackGuard. If it's TRUE, DxeIpl
will setup page table and set the page at which the stack base locates to be
NOT PRESENT. If stack is used up and memory access cross into the last page
of it, #PF exception will be triggered.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoMdeModulePkg/Core/Dxe: Call new API InitializeCpuExceptionHandlersEx instead
Jian J Wang [Thu, 7 Dec 2017 12:17:32 +0000 (20:17 +0800)]
MdeModulePkg/Core/Dxe: Call new API InitializeCpuExceptionHandlersEx instead

Original API InitializeCpuExceptionHandlers is used in DxeMain to initialize
exception handlers but it does not support setting up stack switch required
by Stack Guard feature. Using the new API instead to make sure Stack Guard
feature is applicable to most part of code.

Since this API is called before memory service initialization, there's no
way to call AllocateXxx API to reserve memory. Global variables are used
for this special case. GDT table is reserved at least 2KB which should be
big enough for all current use cases.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoUefiCpuPkg/CpuDxe: Initialize stack switch for MP
Jian J Wang [Thu, 7 Dec 2017 12:17:05 +0000 (20:17 +0800)]
UefiCpuPkg/CpuDxe: Initialize stack switch for MP

In current MP implementation, BSP and AP shares the same exception
configuration. Stack switch required by Stack Guard feature needs that BSP
and AP have their own configuration. This patch adds code to ask BSP and AP
to do exception handler initialization separately.

Since AP is not supposed to do memory allocation, all memory needed to
setup stack switch will be reserved in BSP and pass to AP via new API

  EFI_STATUS
  EFIAPI
  InitializeCpuExceptionHandlersEx (
    IN EFI_VECTOR_HANDOFF_INFO            *VectorInfo OPTIONAL,
    IN CPU_EXCEPTION_INIT_DATA            *InitData OPTIONAL
    );

Following two new PCDs are introduced to configure how to setup new stack
for specified exception handlers.

  gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList
  gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoUefiCpuPkg/MpLib: Add GDTR, IDTR and TR in saved AP data
Jian J Wang [Thu, 7 Dec 2017 12:16:29 +0000 (20:16 +0800)]
UefiCpuPkg/MpLib: Add GDTR, IDTR and TR in saved AP data

In current implementation of CPU MP service, AP is initialized with data
copied from BSP. Stack switch required by Stack Guard feature needs different
GDT, IDT table and task gates for each logic processor. This patch adds GDTR,
IDTR and TR into structure CPU_VOLATILE_REGISTERS and related code in save
and restore methods. This can make sure that any changes to GDT, IDT and task
gate for an AP will be kept from overwritten by BSP settings.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoArmPkg/ArmExceptionLib: Add implementation of new API
Jian J Wang [Thu, 7 Dec 2017 12:16:04 +0000 (20:16 +0800)]
ArmPkg/ArmExceptionLib: Add implementation of new API

This patch add implementation of following new API introduced into
CpuExceptionHandlerLib. Since this lib hasn't support Stack Guard
and stack switch, the new method just calls original
InitializeCpuExceptionHandlers.

  EFI_STATUS
  EFIAPI
  InitializeCpuExceptionHandlersEx (
    IN EFI_VECTOR_HANDOFF_INFO            *VectorInfo OPTIONAL,
    IN CPU_EXCEPTION_INIT_DATA            *InitDataEx OPTIONAL
    );

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoMdeModulePkg/CpuExceptionHandlerLibNull: Add new API implementation
Jian J Wang [Thu, 7 Dec 2017 12:15:30 +0000 (20:15 +0800)]
MdeModulePkg/CpuExceptionHandlerLibNull: Add new API implementation

This patch add implementation of new API InitializeCpuExceptionHandlersEx
introduced into CpuExceptionHandlerLib on behalf of Stack Guard feature.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoUefiCpuPkg/CpuExceptionHandlerLib: Add stack switch support
Jian J Wang [Thu, 7 Dec 2017 12:15:12 +0000 (20:15 +0800)]
UefiCpuPkg/CpuExceptionHandlerLib: Add stack switch support

If Stack Guard is enabled and there's really a stack overflow happened during
boot, a Page Fault exception will be triggered. Because the stack is out of
usage, the exception handler, which shares the stack with normal UEFI driver,
cannot be executed and cannot dump the processor information.

Without those information, it's very difficult for the BIOS developers locate
the root cause of stack overflow. And without a workable stack, the developer
cannot event use single step to debug the UEFI driver with JTAG debugger.

In order to make sure the exception handler to execute normally after stack
overflow. We need separate stacks for exception handlers in case of unusable
stack.

IA processor allows to switch to a new stack during handling interrupt and
exception. But X64 and IA32 provides different ways to make it. X64 provides
interrupt stack table (IST) to allow maximum 7 different exceptions to have
new stack for its handler. IA32 doesn't have IST mechanism and can only use
task gate to do it since task switch allows to load a new stack through its
task-state segment (TSS).

The new API, InitializeCpuExceptionHandlersEx, is implemented to complete
extra initialization for stack switch of exception handler. Since setting
up stack switch needs allocating new memory for new stack, new GDT table
and task-state segment but the initialization method will be called in
different phases which have no consistent way to reserve those memory, this
new API is allowed to pass the reserved resources to complete the extra
works. This is cannot be done by original InitializeCpuExceptionHandlers.

Considering exception handler initialization for MP situation, this new API
is also necessary, because AP is not supposed to allocate memory. So the
memory needed for stack switch have to be reserved in BSP before waking up
AP and then pass them to InitializeCpuExceptionHandlersEx afterwards.

Since Stack Guard feature is available only for DXE phase at this time, the
new API is fully implemented for DXE only. Other phases implement a dummy
one which just calls InitializeCpuExceptionHandlers().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoMdePkg/BaseLib: Add stack switch related definitions for IA32
Jian J Wang [Thu, 7 Dec 2017 12:14:35 +0000 (20:14 +0800)]
MdePkg/BaseLib: Add stack switch related definitions for IA32

The new definitions include two structures

  IA32_TASK_STATE_SEGMENT
  IA32_TSS_DESCRIPTOR

two macros

  IA32_GDT_TYPE_TSS
  IA32_GDT_ALIGNMENT

and one API

  VOID
  EFIAPI
  AsmWriteTr (
    IN UINT16 Selector
    );

They're needed to setup task gate and interrupt stack table for stack switch.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoMdeModulePkg/CpuExceptionHandlerLib.h: Add a new API InitializeCpuExceptionHandlersEx
Jian J Wang [Thu, 7 Dec 2017 12:14:10 +0000 (20:14 +0800)]
MdeModulePkg/CpuExceptionHandlerLib.h: Add a new API InitializeCpuExceptionHandlersEx

A new API InitializeCpuExceptionHandlersEx() is introduced to support
initializing exception handlers with extra functionalities which need
extra init data, such as stack switch for Stack Guard feature.

EFI_STATUS
  EFIAPI
  InitializeCpuExceptionHandlersEx (
    IN EFI_VECTOR_HANDOFF_INFO            *VectorInfo OPTIONAL,
    IN CPU_EXCEPTION_INIT_DATA            *InitData OPTIONAL
    );

By default, this method should include all functionalities implemented by
InitializeCpuExceptionHandlers(), plus extra initialization works, if any.
This is could be done by calling InitializeCpuExceptionHandlers() directly
in this method besides the extra works.

InitData is optional and its use and content are processor arch dependent.
The typical usage of it is to convey resources which have to be reserved
elsewhere and are necessary for the extra initialization of exception.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoUefiCpuPkg/UefiCpuPkg.dec: Add two new PCDs for stack switch
Jian J Wang [Thu, 7 Dec 2017 12:13:30 +0000 (20:13 +0800)]
UefiCpuPkg/UefiCpuPkg.dec: Add two new PCDs for stack switch

Stack switch is required by Stack Guard feature. Following two PCDs are
introduced to simplify the resource allocation for initializing stack switch.

  gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList
  gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize

PcdCpuStackSwitchExceptionList is used to specify which exception will
have separate stack for its handler. For Stack Guard feature, #PF must
be specified at least.

PcdCpuKnownGoodStackSize is used to specify the size of knwon good stack for an
exception handler. Cpu driver or other drivers should use this PCD to reserve
new stack memory for exceptions specified by above PCD.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoMdeModulePkg/metafile: Add PCD PcdCpuStackGuard
Jian J Wang [Thu, 12 Oct 2017 04:28:47 +0000 (12:28 +0800)]
MdeModulePkg/metafile: Add PCD PcdCpuStackGuard

PcdCpuStackGuard is introduced to enable/disable Stack Guard feature.
Its value is FALSE by default. This feature is suggested to be enabled
only if the cpu driver and CpuExceptionHandlerLib have supported stack
switch for the processor used in platform. Otherwise the exception dump
message won't be printed out when there's a stack overflow happened.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
6 years agoIntelFrameworkModulePkg/KeyboardDxe: Use macro to enable/disable page 0
Jian J Wang [Thu, 7 Dec 2017 09:00:50 +0000 (17:00 +0800)]
IntelFrameworkModulePkg/KeyboardDxe: Use macro to enable/disable page 0

Current implementation uses following two methods

    EnableNullDetection()
    DisableNullDetection()

to enable/disable page 0. These two methods will check PCD
PcdNullPointerDetectionPropertyMask to know if the page 0 is disabled or not.
This is due to the fact that old GCD service doesn't provide paging related
attributes of memory block. Since this issue has been fixed, GCD services
can be used to determine the paging status of page 0. This is also make it
possible to just use a new macro

    ACCESS_PAGE0_CODE(
      <code accessing page 0>
    );

to replace above methods to do the same job, which also makes code more
readability.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoIntelFrameworkModulePkg/LegacyBios: Use macro to enable/disable page 0
Jian J Wang [Thu, 7 Dec 2017 09:00:23 +0000 (17:00 +0800)]
IntelFrameworkModulePkg/LegacyBios: Use macro to enable/disable page 0

Current implementation uses following two methods

    EnableNullDetection()
    DisableNullDetection()

to enable/disable page 0. These two methods will check PCD
PcdNullPointerDetectionPropertyMask to know if the page 0 is disabled or not.
This is due to the fact that old GCD service doesn't provide paging related
attributes of memory block. Since this issue has been fixed, GCD services
can be used to determine the paging status of page 0. This is also make it
possible to just use a new macro

    ACCESS_PAGE0_CODE(
      <code accessing page 0>
    );

to replace above methods to do the same job, which also makes code more
readability.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoIntelFrameworkPkg/LegacyBios.h: Add a macro to guarantee page 0 access
Jian J Wang [Tue, 5 Dec 2017 07:57:38 +0000 (15:57 +0800)]
IntelFrameworkPkg/LegacyBios.h: Add a macro to guarantee page 0 access

Due to the introduction of NULL pointer detection feature, page 0 will be
disabled if the feature is enabled, which will cause legacy code failed to
update legacy data in page 0. This macro is introduced to make sure the
page 0 is enabled before those code and restore the original status of it
afterwards.

Another reason to introduce this macro is to eliminate the dependency on
the PcdNullPointerDetectionPropertyMask. Because this is a new PCD, it
could cause some backward compatibility issue for some old packages.

This macro will simply check if the page 0 is disabled or not. If it's
disabled, it will enable it before code updating page 0 and disable it
afterwards. Otherwise, this macro will do nothing to page 0.

The usage of the macro will be look like (similar to DEBUG_CODE macro):

    ACCESS_PAGE0_CODE(
      <code accessing page 0>
    );

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoSourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol
Michael Kinney [Tue, 23 May 2017 23:21:13 +0000 (07:21 +0800)]
SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol

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

The same issue is reported again by GCC. Resend this patch again.
This patch renames the duplicated function name to fix it.

The SecPeiDebugAgentLib uses the global variable
mMemoryDiscoveredNotifyList for a PPI notification on
the Memory Discovered PPI.  This same variable name is
used in the DxeIplPeim for the same PPI notification.

The XCODE5 tool chain detects this duplicate symbol
when the OVMF platform is built with the flag
-D SOURCE_DEBUG_ENABLE.

The fix is to rename this global variable in the
SecPeiDebugAgentLib library.

Cc: Andrew Fish <afish@apple.com>
Cc: Jeff Fan <jeff.fan@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: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoSignedCapsulePkg: Update EdkiiSystemCapsuleLib to check PCD value
Liming Gao [Tue, 28 Nov 2017 03:26:34 +0000 (11:26 +0800)]
SignedCapsulePkg: Update EdkiiSystemCapsuleLib to check PCD value

If PCD value is not set, register PcdCallBack to hook PCD value set

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoUefiCpuPkg: Update SecCore to get BFV size based on BFV header FvLength
Liming Gao [Wed, 6 Dec 2017 08:02:28 +0000 (16:02 +0800)]
UefiCpuPkg: Update SecCore to get BFV size based on BFV header FvLength

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoUefiCpuPkg: SmmCpuFeaturesLib Add the missing ASM_PFX in nasm code
Liming Gao [Thu, 7 Dec 2017 03:42:10 +0000 (11:42 +0800)]
UefiCpuPkg: SmmCpuFeaturesLib Add the missing ASM_PFX in nasm code

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoUefiCpuPkg: PiSmmCpuDxeSmm Add the missing ASM_PFX in nasm code
Liming Gao [Thu, 30 Nov 2017 07:24:19 +0000 (15:24 +0800)]
UefiCpuPkg: PiSmmCpuDxeSmm Add the missing ASM_PFX in nasm code

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoUefiCpuPkg PiSmmCpuDxeSmm: SMM profile and static paging mutual exclusion
Star Zeng [Thu, 7 Dec 2017 09:00:48 +0000 (17:00 +0800)]
UefiCpuPkg PiSmmCpuDxeSmm: SMM profile and static paging mutual exclusion

SMM profile and static paging could not be enabled at the same time,
this patch is to add check and comments to make sure it.

Similar comments are also added for the case of static paging and
heap guard for SMM.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoMdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
fanwang2 [Fri, 8 Dec 2017 01:08:24 +0000 (09:08 +0800)]
MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection

AIP may not support detecting network media state, in this case,
should call NetLibDetectMedia to get media state. This patch is to
fix this issue.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoUefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
Star Zeng [Wed, 6 Dec 2017 11:02:04 +0000 (19:02 +0800)]
UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case

Only DumpCpuContext in error case, otherwise there will be too many
debug messages from DumpCpuContext() when SmmProfile feature is enabled
by setting PcdCpuSmmProfileEnable to TRUE. Those debug messages are not
needed for SmmProfile feature as it will record those information to
buffer for further dump.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
6 years agoBaseTools: Fix GenSec can't found the depex file
Yunhua Feng [Thu, 7 Dec 2017 03:35:16 +0000 (11:35 +0800)]
BaseTools: Fix GenSec can't found the depex file

Filter the FileList when multiple genfds thread options is not enabled.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdePkg: Arm/AArch64 - filter #pragma pack() when __ASSEMBLER__
Leif Lindholm [Wed, 6 Dec 2017 16:57:55 +0000 (16:57 +0000)]
MdePkg: Arm/AArch64 - filter #pragma pack() when __ASSEMBLER__

clang, when used as a preprocessor for dtc, does not discard #pragma
statements although -x assembler-with-cpp is specified. This causes dtc
to barf at a #pragma pack() statement that is already filtered out for
__GNUC__. So add a check to also filter this out if __ASSEMBLER__.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg PiSmmIpl: Handle CommSize OPTIONAL case
Star Zeng [Tue, 7 Nov 2017 05:42:21 +0000 (13:42 +0800)]
MdeModulePkg PiSmmIpl: Handle CommSize OPTIONAL case

Handle CommSize OPTIONAL case for SmmCommunicate.
And return EFI_ACCESS_DENIED when CommunicationBuffer
is not valid for SMM to access.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdePkg MmCommunication.h: Follow PI spec to update EFI_MM_COMMUNICATE
Star Zeng [Tue, 5 Dec 2017 03:23:18 +0000 (11:23 +0800)]
MdePkg MmCommunication.h: Follow PI spec to update EFI_MM_COMMUNICATE

Follow PI spec (>= 1.5) to add new return status code description
and make CommSize OPTIONAL.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoEmulatorPkg: Fix build failure due to Tftp library removal
Ruiyu Ni [Tue, 28 Nov 2017 07:51:17 +0000 (15:51 +0800)]
EmulatorPkg: Fix build failure due to Tftp library removal

The TFTP command was converted from a NULL class library instance to
a dynamic shell command in commit 0961002352e9.

The ShellLib and FileHandleLib resolutions are moved from
Shell app <LibraryClasses> to [LibraryClasses.common]
because dynamic shell commands implemented as DXE_DRIVER modules
also depend on these libraries.

PcdShellLibAutoInitialize must be set to FALSE for both the shell app
itself and the dynamic shell command modules.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
6 years agoEmbeddedPkg: AndroidBootApp: fix clang compilation
Leif Lindholm [Wed, 6 Dec 2017 17:29:26 +0000 (17:29 +0000)]
EmbeddedPkg: AndroidBootApp: fix clang compilation

Address an incorrect function prototype (using ; instead of ,)
in AndroidBootImg.h.

Also restructure code slightly to avoid a "may be used uninitialized"
warning.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoArmVirtPkg: add NOOPT target to platform .DSCs
Ard Biesheuvel [Wed, 6 Dec 2017 11:35:15 +0000 (11:35 +0000)]
ArmVirtPkg: add NOOPT target to platform .DSCs

In order to allow the ArmVirtPkg platforms to be built using the
NOOPT target, add it explicitly to the BUILD_TARGETS define.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoMdeModulePkg/NetLib: Add NetLibDetectMediaWaitTimeout() API to support EFI_NOT_READY...
fanwang2 [Wed, 6 Dec 2017 05:00:21 +0000 (13:00 +0800)]
MdeModulePkg/NetLib: Add NetLibDetectMediaWaitTimeout() API to support EFI_NOT_READY media state detection

In wireless connection, connecting state needs to be cared more
about. ECR 1772 redefined the state EFI_NOT_READY to represent
connecting state and can be retrieved from Aip protocol. This
patch adds a new API to check media state at a specified time
interval when network is connecting until the connection process
finishes or timeout.

V2:
  * Return error status code directly when Aip protocol falied to detect
    media rather than wait for another time's check.
  * Set media state default value to EFI_SUCCESS since some platforms may
    not support retrieving media state from Aip protocol.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoBaseTools: Fix GenSec GCC make failure
Yonghong Zhu [Tue, 5 Dec 2017 13:52:40 +0000 (21:52 +0800)]
BaseTools: Fix GenSec GCC make failure

It is a regression bug introduced by the patch b37b108, it cause GenSec
make failure on GCC Env.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'
Hao Wu [Tue, 5 Dec 2017 05:13:07 +0000 (13:13 +0800)]
MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'

This commit removes unnecessary parentheses in 'if' statements to
resolve the build failures by the XCODE5 tool chain.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'
Hao Wu [Mon, 4 Dec 2017 05:19:28 +0000 (13:19 +0800)]
MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'

This commit removes unnecessary parentheses in 'if' statements to
resolve the build failures by the XCODE5 tool chain.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO level
Laszlo Ersek [Mon, 4 Dec 2017 19:21:56 +0000 (20:21 +0100)]
MdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO level

In commit 7eb927db3e25 ("MdeModulePkg/DxeCore: implement memory protection
policy", 2017-02-24), we added two informative messages with the
InitializeDxeNxMemoryProtectionPolicy() function:

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
> active memory regions

and

> InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to
> inactive memory regions

The messages don't report errors or warnings, thus downgrade their log
masks from DEBUG_ERROR to DEBUG_INFO.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1520485
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoNetworkPkg: Update IScsiDxe to pass XCODE build
Liming Gao [Tue, 28 Nov 2017 03:19:23 +0000 (11:19 +0800)]
NetworkPkg: Update IScsiDxe to pass XCODE build

Fix the warning equality comparison with extraneous parentheses
[-Werror,-Wparentheses-equality].

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liang Vincent <vincent.liang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: Update PeiCore to pass XCODE tool chain
Liming Gao [Tue, 28 Nov 2017 03:19:58 +0000 (11:19 +0800)]
MdeModulePkg: Update PeiCore to pass XCODE tool chain

It fixes the warning for loop has empty body [-Werror,-Wempty-body].

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liang Vincent <vincent.liang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg CapsulePei: Sort and merge memory resource entries
Star Zeng [Fri, 17 Nov 2017 05:56:37 +0000 (13:56 +0800)]
MdeModulePkg CapsulePei: Sort and merge memory resource entries

Sort and merge memory resource entries to handle the case that
the memory resource HOBs are reported differently between
BOOT_ON_FLASH_UPDATE boot mode and normal boot mode, and the
capsule buffer from UpdateCapsule at normal boot sits across
two memory resource descriptors at BOOT_ON_FLASH_UPDATE boot mode.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Dakota Chiang <dakota.chiang@intel.com>
Tested-by: Dakota Chiang <dakota.chiang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
6 years agoBaseTools: Update Makefile to support FFS file generation
Yonghong Zhu [Wed, 22 Nov 2017 07:42:25 +0000 (15:42 +0800)]
BaseTools: Update Makefile to support FFS file generation

Update Makefile to support FFS file generation with new build option
--genfds-multi-thread.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Update Gensec to set PROCESSING_REQUIRED value
Yonghong Zhu [Wed, 29 Nov 2017 03:45:22 +0000 (11:45 +0800)]
BaseTools: Update Gensec to set PROCESSING_REQUIRED value

This patch add new option --dummy file, and we compare the dummpy file
with input file to decide whether we need to set PROCESSING_REQUIRED
value.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Update Trim to generate VfrBinOffset Binary
Yonghong Zhu [Thu, 28 Sep 2017 23:54:12 +0000 (07:54 +0800)]
BaseTools: Update Trim to generate VfrBinOffset Binary

Its usage is
"Trim --Vfr-Uni-Offset -o $(OUTPUT_DIR)(+)$(MODULE_NAME)VfrOffset.sec
--ModuleName=$(MODULE_NAME) --DebugDir=$(DEBUG_DIR)"

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoBaseTools: GenFfs support to get alignment value from SectionFile
Yonghong Zhu [Thu, 28 Sep 2017 23:53:30 +0000 (07:53 +0800)]
BaseTools: GenFfs support to get alignment value from SectionFile

Update GenFfs tool to get alignment value from SectionFile when use
the new option -n 0.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/NvmExpressDxe: fix error status override
Heyi Guo [Mon, 4 Dec 2017 02:27:54 +0000 (10:27 +0800)]
MdeModulePkg/NvmExpressDxe: fix error status override

Commit f6b139b added return status handling to PciIo->Mem.Write.
However, the second status handling will override EFI_DEVICE_ERROR
returned in this branch:

  //
  // Check the NVMe cmd execution result
  //
  if (Status != EFI_TIMEOUT) {
    if ((Cq->Sct == 0) && (Cq->Sc == 0)) {
      Status = EFI_SUCCESS;
    } else {
      Status = EFI_DEVICE_ERROR;
               ^^^^^^^^^^^^^^^^

Since PciIo->Mem.Write will probably return SUCCESS, it causes
NvmExpressPassThru to return SUCCESS even when DEVICE_ERROR occurs.
Callers of NvmExpressPassThru will then continue executing which may
cause further unexpected results, e.g. DiscoverAllNamespaces couldn't
break out the loop.

So we save previous status before calling PciIo->Mem.Write and restore
the previous one if it already contains error.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoArmPlatformPkg/LcdGraphicsOutputDxe: remove VExpressPkg dependency
Ard Biesheuvel [Mon, 4 Dec 2017 20:46:57 +0000 (20:46 +0000)]
ArmPlatformPkg/LcdGraphicsOutputDxe: remove VExpressPkg dependency

The two instantiations of LcdGraphicsOutputDxe reference VExpressPkg.dec
without actually relying on anything it defines. In preparation of
moving out VExpressPkg into edk2-platforms, drop these references so we
can keep LcdGraphicsOutputDxe in EDK2.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove PlatformIntelBdsLib
Ard Biesheuvel [Mon, 4 Dec 2017 16:15:35 +0000 (16:15 +0000)]
ArmPlatformPkg: remove PlatformIntelBdsLib

Now that the last user has switched to the generic BDS, the
PlatformIntelBdsLib code in ArmPlatformPkg is no longer used, so
remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmVirtPkg/ArmVirtXen: move from Intel to generic BDS
Ard Biesheuvel [Thu, 30 Nov 2017 20:28:23 +0000 (20:28 +0000)]
ArmVirtPkg/ArmVirtXen: move from Intel to generic BDS

ArmVirtXen is the only remaining consumer of ArmPlatformPkg's
PlatformIntelBdsLib implementation, which is tightly coupled to the
deprecated Intel BDS. So move ArmVirtXen to the generic BDS as well,
allowing us to get rid of PlatformIntelBdsLib entirely.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Julien Grall <julien.grall@linaro.org>
6 years agoShellPkg/ShellPkg.dec: Change comments for PcdShellLibAutoInitialize
Ruiyu Ni [Wed, 29 Nov 2017 08:21:46 +0000 (16:21 +0800)]
ShellPkg/ShellPkg.dec: Change comments for PcdShellLibAutoInitialize

When Dynamic command drivers links to ShellLib, the ShellLib
constructor shouldn't be called because the Shell and ShellParameters
protocols don't exist when the driver starts.
So it's required to set PcdShellLibAutoInitialize to FALSE for
dynamic command drivers.
Update the comments in DEC file to describe such requirement
for this PCD.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoQuarkPlatformPkg: Use DpDynamicCommand to replace PerformancePkg/dp
Ruiyu Ni [Wed, 29 Nov 2017 08:12:40 +0000 (16:12 +0800)]
QuarkPlatformPkg: Use DpDynamicCommand to replace PerformancePkg/dp

Remove FvSimpleFileSystemDxe from Quark.dsc/fdf because it's not
needed by using DpDynamicCommand driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
6 years agoVlv2TbltDevicePkg: Use DpDynamicCommand to replace PerformancePkg/dp
Ruiyu Ni [Wed, 29 Nov 2017 05:36:37 +0000 (13:36 +0800)]
Vlv2TbltDevicePkg: Use DpDynamicCommand to replace PerformancePkg/dp

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: David David <david.wei@intel.com>
6 years agoMdeModulePkg DxeCore: Support USED_SIZE FV_EXT_TYPE
Star Zeng [Tue, 28 Nov 2017 09:04:23 +0000 (17:04 +0800)]
MdeModulePkg DxeCore: Support USED_SIZE FV_EXT_TYPE

The USED_SIZE FV_EXT_TYPE is introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg DxeCore: Check FvImage alignment
Star Zeng [Tue, 28 Nov 2017 02:47:19 +0000 (10:47 +0800)]
MdeModulePkg DxeCore: Check FvImage alignment

No need to allocate aligned buffer if FvImage has been
at required alignment.

Then the code logic will be aligned with ProcessFvFile() in
MdeModulePkg/Core/Pei/FwVol/FwVol.c.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg PeiCore: Support USED_SIZE FV_EXT_TYPE
Star Zeng [Wed, 22 Nov 2017 08:13:09 +0000 (16:13 +0800)]
MdeModulePkg PeiCore: Support USED_SIZE FV_EXT_TYPE

The USED_SIZE FV_EXT_TYPE is introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdePkg PiFirmwareVolume.h: Add USED_SIZE FV_EXT_TYPE definitions
Star Zeng [Tue, 21 Nov 2017 10:51:19 +0000 (18:51 +0800)]
MdePkg PiFirmwareVolume.h: Add USED_SIZE FV_EXT_TYPE definitions

The definitions are introduced by PI 1.6 spec.

The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find
out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV.

When the FV gets shadowed into memory you only need to copy the used
bytes into memory and fill the rest of the memory buffer with the
erase value.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoIntelSiliconPkg: Update MicrocodeUpdate build path in dsc
Star Zeng [Fri, 1 Dec 2017 01:19:19 +0000 (09:19 +0800)]
IntelSiliconPkg: Update MicrocodeUpdate build path in dsc

That was missed in 43e12eeac8b125165b8a93c3501925a8893544ef.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoArmPlatformPkg/PrePi: remove bogus IntelFrameworkModulePkg reference
Ard Biesheuvel [Thu, 30 Nov 2017 15:11:45 +0000 (15:11 +0000)]
ArmPlatformPkg/PrePi: remove bogus IntelFrameworkModulePkg reference

PrePi does not use anything from IntelFrameworkModulePkg so remove
the reference from its [Packages] sections.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory
Meenakshi Aggarwal [Tue, 19 Sep 2017 12:32:09 +0000 (18:02 +0530)]
ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory

Now that PrePi no longer exposes its internal code via special HOBs,
we can remove the special handling of the primary FV, which needed to
be reserved so that DXE core could call into the PE/COFF and LZMA
libraries in the PrePi module.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
[ardb: updated commit log]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/PrePi: don't expose PE/COFF and LZMA libraries via HOBs
Ard Biesheuvel [Thu, 30 Nov 2017 15:18:39 +0000 (15:18 +0000)]
ArmPlatformPkg/PrePi: don't expose PE/COFF and LZMA libraries via HOBs

Avoid the need to preserve all memory exposed by PrePi indefinitely
by removing the 'feature' that exposes the PE/COFF and LZMA libraries
via special HOBs to other modules that may want to reuse the code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoBeagleBoardPkg: clone MemoryInitPeiLib
Ard Biesheuvel [Thu, 30 Nov 2017 15:00:23 +0000 (15:00 +0000)]
BeagleBoardPkg: clone MemoryInitPeiLib

The common MemoryInitPeiLib implementation preserves the primary FV
holding the PrePi module and the compressed secondary FV, and removes
the memory it occupies from the memory map, hiding it from the OS.

The only platform that actual requires this is BeagleBoardPkg, since
it exposes the PeCoff and LZMA libraries in PrePi to DXE core via
special HOBs. So let's give BeagleBoard its own MemoryInitPeiLib, so
that we can clean up the generic version.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoBeagleBoardPkg: create private PrePi implementation
Ard Biesheuvel [Thu, 30 Nov 2017 14:52:31 +0000 (14:52 +0000)]
BeagleBoardPkg: create private PrePi implementation

Clone the PrePi implementation for BeagleBoardPkg, so we can start
removing some of the awkward optimizations that we'd rather not keep
in reference code. Note that we only clone the unicore ARM flavor,
which is all we need for BeagleBoard.

In the case of PrePi, it involves libraries included by the SEC
startup code that are exposed to DXE core via HOBs containing function
pointers, which forces us to keep the primary FV reserved in memory.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/PrePi: call all constructors by hand
Ard Biesheuvel [Thu, 30 Nov 2017 15:09:48 +0000 (15:09 +0000)]
ArmPlatformPkg/PrePi: call all constructors by hand

Call ProcessLibraryConstructorList () to invoke all library constructors
by hand rather than calling only some of them explicitly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoEmbeddedPkg BeagleBoardPkg: move special HOB reuse libraries into platform
Ard Biesheuvel [Thu, 30 Nov 2017 14:41:07 +0000 (14:41 +0000)]
EmbeddedPkg BeagleBoardPkg: move special HOB reuse libraries into platform

The BeagleBoard platform uses PeCoffLib and CustomDecompressLib
implementations that invoke the library code that resides in the PrePi
module via pointers exposed via special GUIDed HOBs. This is a nice hack,
but not necessarily something we want to carry in reference code.

So as a first step, move the libraries that expose this reused code into
BeagleBoardPkg, and remove it from EmbeddedPkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: move internal PL031 header into driver directory
Ard Biesheuvel [Thu, 16 Nov 2017 16:34:49 +0000 (16:34 +0000)]
ArmPlatformPkg: move internal PL031 header into driver directory

Move the internal PL031 RTC header file into the driver directory.
It shouldn't be referenced directly by other modules anyway.

While at it, sort the includes as well.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: move internal SP805 header into driver directory
Ard Biesheuvel [Thu, 16 Nov 2017 16:33:06 +0000 (16:33 +0000)]
ArmPlatformPkg: move internal SP805 header into driver directory

Move the internal SP805 watchdog header file into the driver directory.
It shouldn't be referenced directly by other modules anyway.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: move internal PL061 header into driver directory
Ard Biesheuvel [Thu, 16 Nov 2017 16:30:55 +0000 (16:30 +0000)]
ArmPlatformPkg: move internal PL061 header into driver directory

Move the internal PL061 GPIO header file into the driver directory.
It shouldn't be referenced directly by other modules anyway.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove ArmPlatformInitializeSystemMemory
Ard Biesheuvel [Thu, 30 Nov 2017 14:00:28 +0000 (14:00 +0000)]
ArmPlatformPkg: remove ArmPlatformInitializeSystemMemory

The function ArmPlatformInitializeSystemMemory() is defined by
ArmPlatformLib, but is only ever called when using the PrePeiCore
flavor of the startup code. Also, none of the remaining upstream
platforms actually implement anything in that function in the first
place. So let's just remove it altogether.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/ArmPlatformLib: remove ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR
Ard Biesheuvel [Thu, 30 Nov 2017 13:54:15 +0000 (13:54 +0000)]
ArmPlatformPkg/ArmPlatformLib: remove ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR

The ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR struct type is defined but
never used anywhere. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: remove unused ArmVExpressLibCTA9x4 code
Ard Biesheuvel [Thu, 30 Nov 2017 13:52:03 +0000 (13:52 +0000)]
ArmPlatformPkg: remove unused ArmVExpressLibCTA9x4 code

ArmVExpressLibCTA9x4 is unused, and rather outdated, given that it is
the last ArmPlatformLib implementation that executes both in the secure
and non-secure worlds, which is a model we no longer support for ARM
systems. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg/Documentation: remove outdated porting manual
Ard Biesheuvel [Thu, 30 Nov 2017 13:44:02 +0000 (13:44 +0000)]
ArmPlatformPkg/Documentation: remove outdated porting manual

Having a special porting manual for ARM platforms in general suggests
that ARM platforms are fundamentally different from ones based on other
architectures that are supported by UEFI. There may be some truth to
that, but the porting manual in Documentation/ArmPlatformPkg.txt is
hopelessly outdated, and did not give the best advice in the first
place*. So remove it.

* ArmPlatformLib as the mother of all platform abstractions is rather
  unwieldy, and using ArmVExpressLibCTA9x4 as a template is not that
  great an idea either.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoBeagleBoardPkg: add CapsuleLib resolution
Leif Lindholm [Thu, 30 Nov 2017 13:59:32 +0000 (13:59 +0000)]
BeagleBoardPkg: add CapsuleLib resolution

Commit 4bbcc285d5f7 ("ArmPkg/PlatformBootManagerLib: process pending
capsules") added a dependency on CapsuleLib. Add DxeCapsuleLibNull
resolution to BeagleBoardPkg.dsc to resolve this.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoOmap35xxPkg: add GetTimeInNanoSecond implementation
Leif Lindholm [Thu, 30 Nov 2017 13:55:59 +0000 (13:55 +0000)]
Omap35xxPkg: add GetTimeInNanoSecond implementation

Commit a63be426f8e3 ("ArmPlatformPkg: Store initial timer value") caused
BeagleBoard to stop building, due to Omap35xxTimerLib lacking an
implementation of GetTimeInNanoSecond (). So add one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoBeagleBoardPkg: Fix build failure due to Tftp library removal
Ruiyu Ni [Wed, 29 Nov 2017 10:15:00 +0000 (18:15 +0800)]
BeagleBoardPkg: Fix build failure due to Tftp library removal

The TFTP command was converted from a NULL class library
instance to a dynamic shell command in commit 0961002352e9.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>