1. Fix TOCTOU issue in VariableSmm, FtwSmm, FpdtSmm, SmmCorePerformance SMM handler. For VariableSmm, pre-allocate a mVariableBufferPayload buffer with mVariableBufferPayloadSize(match with mVariableBufferPayloadSize in VariableSmmRuntimeDxe) to hold communicate buffer payload to avoid TOCTOU issue.
2. Add check to ensure CommBufferPayloadSize not exceed mVariableBufferPayloadSize or is enough to hold function structure in VariableSmm and FtwSmm.
3. Align FtwGetLastWrite() in FaultTolerantWriteSmmDxe.c to FtwGetLastWrite() in FaultTolerantWrite.c.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14325 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg: Fixed build error 'variable set but not used'

GCC toolchain cannot build ShellPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Signed-off-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14326 6f19259b-4bc3-4df7-8a09-765794883524
Updated connecting HOST version information from 1.3 to 1.3.1.

Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14328 6f19259b-4bc3-4df7-8a09-765794883524
Skip PXE prompt/menu/discover if PXE_DISCOVERY_CONTROL tag bit 3 set.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14332 6f19259b-4bc3-4df7-8a09-765794883524
Check if video device exists before trying to install Video OpROM.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14335 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg: Return an error when it happens

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.Carsey@intel.com>
Reviewed-by: Erik Bjorge <Erik.c.Bjorge@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14336 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg: Update behavior for GetTime() errors.

Please find the attached patch that fixes the ShellPkg when gRT->GetTime() returns an error (eg: early UEFI platform bringup with a RTC controller that is not supported).
On some platforms, gRT->GetTime() might not return EFI_SUCCESS. The Shell must check the return status before to assume the returned time is valid.


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14337 6f19259b-4bc3-4df7-8a09-765794883524
MdeMdeModulePkg/UsbBusDxe: Break device enumeration process if the device descriptor includes 0 configuration.

Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Mike Wu <mike.wu@intel.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14338 6f19259b-4bc3-4df7-8a09-765794883524
MdeMdeModulePkg/Xhci: Clear BIOS_OWN semaphore before halting XHCI controller

Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Steven Shi <steven.shi@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14339 6f19259b-4bc3-4df7-8a09-765794883524
ArmPlatformPkg/Sec: Replaced non-required 'blx' by 'bl'



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14342 6f19259b-4bc3-4df7-8a09-765794883524
ArmPlatformPkg/ArmPlatformLib.h: Removed non-required header file



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14343 6f19259b-4bc3-4df7-8a09-765794883524
ArmPlatformPkg/ArmPlatformLib: Added support for ArmPlatformIsPrimaryCore()

Checking if a core if the primary/boot core used to be done with the macro
IS_PRIMARY_CORE().
Some platforms exposes configuration registers to change the primary core.
Replacing the macro IS_PRIMARY_CORE() by ArmPlatformIsPrimaryCore() allows
some flexibility in the way to check the primary core.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14344 6f19259b-4bc3-4df7-8a09-765794883524
ArmPlatformPkg/ArmPlatformLib: Added ArmPlatformGetPrimaryCoreMpId()

ArmPlatformGetPrimaryCoreMpId returns the MPID of the primary core.
The primary core might not be known at build time (eg: the platform allows
the boot CPU to be changed through board config).

This function is used during the secondary core stack initialization to know
the position of the secondary core in the SoC.
A secondary core that is at the position N, with N greater than the primary
core position, will be at the position N-1 in the list of secondary stacks
(the primary core has its own separate bigger stack).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14345 6f19259b-4bc3-4df7-8a09-765794883524
ARM Packages: Replaced the macro GetCorePositionFromMpId() by the ArmPlatformGetCorePosition()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14346 6f19259b-4bc3-4df7-8a09-765794883524
ArmPlatform/ArmPlatformLib: Introduced ArmPlatformPeiBootAction()

This function allows platform to do any specific actions prior to
the start the PEI phase.
For instance, this function could be used by some platforms to initialize clocks that
are required at the early stage of the PEI phase.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14347 6f19259b-4bc3-4df7-8a09-765794883524