mirror_edk2.git
4 years agoUefiCpuPkg: Modify CpuIo2Dxe to use new IoLib library
Leo Duran [Fri, 13 Jan 2017 20:09:52 +0000 (04:09 +0800)]
UefiCpuPkg: Modify CpuIo2Dxe to use new IoLib library

The Fifo routines from the UefiCpuPkg/CpuIo2Dxe driver have been
moved to the new BaseIoLibIntrinsic (IoLib class) library.

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Leo Duran <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdePkg: Expand BaseIoLibIntrinsic (IoLib class) library
Leo Duran [Fri, 13 Jan 2017 20:09:51 +0000 (04:09 +0800)]
MdePkg: Expand BaseIoLibIntrinsic (IoLib class) library

The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate
implementations of I/O Fifo routines. This patch clones the I/O Fifo
routines into the BaseIoLibIntrinsic library and expands the IoLib class
to include the ported I/O Fifo routines.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Leo Duran <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoArmVirtPkg/ArmVirtQemu: Install BGRT ACPI table
Bhupesh Sharma [Mon, 16 Jan 2017 15:06:18 +0000 (20:36 +0530)]
ArmVirtPkg/ArmVirtQemu: Install BGRT ACPI table

While debugging OS for ACPI BGRT support (especially on VMs),
it is very useful to have the EFI firmware to export the
ACPI BGRT table.

This patch tries to add this support in ArmVirtPkg.

Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoUefiCpuPkg/MpInitLib: Add missing point mark
Jeff Fan [Thu, 5 Jan 2017 01:59:22 +0000 (09:59 +0800)]
UefiCpuPkg/MpInitLib: Add missing point mark

Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Refine SetTerminalDevicePath
Hao Wu [Thu, 12 Jan 2017 01:45:31 +0000 (09:45 +0800)]
MdeModulePkg/TerminalDxe: Refine SetTerminalDevicePath

Pass '&Node.Header' instead of '&Node' as the 1st parameter to function
SetDevicePathNodeLength().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg DxeCorePerformanceLib: Only support linking with DxeCore
Star Zeng [Thu, 12 Jan 2017 08:27:06 +0000 (16:27 +0800)]
MdeModulePkg DxeCorePerformanceLib: Only support linking with DxeCore

DxeCorePerformanceLib is the performance log manager of PEI and DXE
phase, and it will also produce Performance(Ex) protocol, it should
only support linking with DxeCore.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Remove out-of-dated comments
Ruiyu Ni [Fri, 13 Jan 2017 07:35:19 +0000 (15:35 +0800)]
MdeModulePkg/TerminalDxe: Remove out-of-dated comments

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
hegdenag [Thu, 12 Jan 2017 03:39:38 +0000 (11:39 +0800)]
ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check

When we issue 'ifconfig6 -s <interface> auto' system hangs with
an ASSERT in StrLen. in IfConfig6SetInterfaceInfo, for 'auto' case
we added checks to rule out the invalid inputs like 'host', 'gw'
and 'dns'. To parse through this, we do a VarArg = VarArg->Next but
we dont check new VarArg before calling StrCmp. Fix with a check
in this patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
4 years agoShellPkg/SmbiosView: Add decoding of SMBIOS record type 43
Linson Augustine [Thu, 12 Jan 2017 06:59:36 +0000 (14:59 +0800)]
ShellPkg/SmbiosView: Add decoding of SMBIOS record type 43

Added decoding of the new SMBIOS Type 43 record.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Augustine Linson P <linson.augustine@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoCorebootPayloadPkg: Add APRIORI file in FDF file
Maurice Ma [Tue, 10 Jan 2017 03:36:34 +0000 (19:36 -0800)]
CorebootPayloadPkg: Add APRIORI file in FDF file

Add APRIORI file to allow status code related DXE drivers to
be dispatched earlier so that debug message can also be seen
much earlier. With this, lots of DXE driver debug message will
be missing.

Cc: Prince Agyeman <prince.agyeman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
4 years agoMdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type
Hao Wu [Wed, 11 Jan 2017 01:54:39 +0000 (09:54 +0800)]
MdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type

Refine the codes to compare the definition 'SIZE_4GB' with type
EFI_PHYSICAL_ADDRESS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoSignedCapsulePkg/CapsuleLib: Refine to compare with same type
Hao Wu [Fri, 6 Jan 2017 08:12:59 +0000 (16:12 +0800)]
SignedCapsulePkg/CapsuleLib: Refine to compare with same type

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>
4 years agoSecurityPkg/FmpAuthenticationLib: Refine to compare with same type
Hao Wu [Fri, 6 Jan 2017 08:11:26 +0000 (16:11 +0800)]
SecurityPkg/FmpAuthenticationLib: Refine to compare with same type

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>
4 years agoSecurityPkg/TcgDxe: Refine to compare 2 values with the same type
Hao Wu [Fri, 6 Jan 2017 08:10:09 +0000 (16:10 +0800)]
SecurityPkg/TcgDxe: Refine to compare 2 values with the same type

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>
4 years agoMdeModulePkg/UefiBootManagerLib: Remove redundant type cast
Hao Wu [Thu, 17 Nov 2016 08:25:32 +0000 (16:25 +0800)]
MdeModulePkg/UefiBootManagerLib: Remove redundant type cast

The type of return value for function EfiBootManagerFindLoadOption() is
INTN. When checking its return value, it is unnecessary to type cast -1 to
type UINTN.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
4 years agoMdeModulePkg/Stall: Refine to compare 2 values with the same type
Hao Wu [Fri, 6 Jan 2017 07:18:27 +0000 (15:18 +0800)]
MdeModulePkg/Stall: Refine to compare 2 values with the same type

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoFatPkg: Explicitly declare FAT_CLUSTER_SPECIAL as unsigned type
Hao Wu [Thu, 17 Nov 2016 07:57:43 +0000 (15:57 +0800)]
FatPkg: Explicitly declare FAT_CLUSTER_SPECIAL as unsigned type

In FatPkg, cluster-related varibles are declared as unsigned type (e.g.
UINT32/UINTN). To keep the comparisions involving those variables
type-matched, declare the definition FAT_CLUSTER_SPECIAL as unsigned type
explicitly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdePkg/UefiFileHandleLib: Refine the check for valid Ascii character
Hao Wu [Thu, 17 Nov 2016 06:59:54 +0000 (14:59 +0800)]
MdePkg/UefiFileHandleLib: Refine the check for valid Ascii character

The commit will check if bit 7 is set of an Ascii character to judge its
validity.

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>
4 years agoShellPkg: Update smbiosview command to display Type 3 values
Chris Phillips [Tue, 10 Jan 2017 06:52:40 +0000 (14:52 +0800)]
ShellPkg: Update smbiosview command to display Type 3 values

The smbiosview command was not displaying SMBIOS Type 3 Height, NumberofPowerCords, or SKU Number.
Added handling to display these values.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoNt32Pkg: Fixes to correctly set SMBIOS Type 3
Chris Phillips [Tue, 10 Jan 2017 06:56:43 +0000 (14:56 +0800)]
Nt32Pkg: Fixes to correctly set SMBIOS Type 3

When running Nt32Pkg, SMBIOS Type 3 was missing Height, NumberofPowerCords, and SKU Number.
Also, ContainedElements was not being handled correctly.
Fixed code to add example data, correct some variable names (Assert -> Asset), and properly handle setting the Type 3 values.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoNt32Pkg: Fix code to correctly set SMBIOS Type 2 Length
Chris Phillips [Tue, 10 Jan 2017 16:48:45 +0000 (00:48 +0800)]
Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Length

When running Nt32Pkg, SMBIOS Type 2 had the wrong Length.
Fixed the code to use the correct structure in sizeof, and properly account for ContainedObjectHandles.
Also updated variable names with Assert -> Asset

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdePkg: Add comments for SMBIOS Type 3 structure to cover SKU Number
Chris Phillips [Tue, 10 Jan 2017 06:49:08 +0000 (14:49 +0800)]
MdePkg: Add comments for SMBIOS Type 3 structure to cover SKU Number

Starting with SMBIOS spec version 2.7, Type 3 added SKU Number.
SKU Number is at a variable offset (depends on count and length of Contained Elements), so cannot add SKU Number to the SMBIOS_TABLE_TYPE3 structure.
Adding comments to explain how to get SKU Number.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities.
Jiewen Yao [Mon, 9 Jan 2017 06:33:20 +0000 (14:33 +0800)]
MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities.

When gDS->SetMemorySpaceCapabilities() is called,
current DXE core will sync all GCD attributes to memory map
attributes, including RUNTIME attributes.
It is wrong, because RUNTIME attributes should be set for
runtime memory only.

This fix clears the RUNTIME attributes before convert to UEFI
memory map. So that the UEFI memory map is good after
gDS->SetMemorySpaceCapabilities() is called.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoSecuritPkg: Tcg2Smm: Add PlatformClass to TPM2 Table
Zhang, Chao B [Thu, 12 Jan 2017 02:42:29 +0000 (10:42 +0800)]
SecuritPkg: Tcg2Smm: Add PlatformClass to TPM2 Table

Add PlatformClass info into TPM2 ACPI table, it is only valid with table
Rev 4 and later.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoMdePkg/SmBios.h: Add new defines for SMBIOS record type 43
Linson Augustine [Wed, 11 Jan 2017 09:10:14 +0000 (17:10 +0800)]
MdePkg/SmBios.h: Add new defines for SMBIOS record type 43

Added definitions for the new SMBIOS Type 43 record.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Augustine Linson P <linson.augustine@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoQuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix GCC build issues
Michael Kinney [Tue, 10 Jan 2017 17:41:01 +0000 (09:41 -0800)]
QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix GCC build issues

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

Fix build issues with GCC49.  There are local variables that
may be used before initialized in some paths.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Lee Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Lee Leahy <leroy.p.leahy@intel.com>
4 years agoQuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix SubmitCommand() out size
Michael Kinney [Tue, 10 Jan 2017 17:08:52 +0000 (09:08 -0800)]
QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix SubmitCommand() out size

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

When the Tpm12SubmitCommand() detects a response packet that
is the same size as a TPM_RSP_COMMAND_HDR, it returns
EFI_SUCCESS without reading any additional response packet
information from the TPM.  In that case, the return parameter
OutputParameterBlockSize is not be updated, so the size of
that OutputParameterBlock returned is the value passed in which
could be larger than what is actually returned from the TPM.

Set the OutputParameterBlockSize to the size of the
TPM_RSP_COMMAND_HDR when this specific condition is detected.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Lee Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Lee Leahy <leroy.p.leahy@intel.com>
4 years agoQuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Remove PP Check
Michael Kinney [Tue, 10 Jan 2017 17:02:30 +0000 (09:02 -0800)]
QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Remove PP Check

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

The Tpm12CommandLib in the SecurityPkg was updated to check
the returnCode in the response packet in the following
commit:

https://github.com/tianocore/edk2/commit/950a3bc788b5b101729b26aed3ff75fd2a64a570

The Tpm12DeviceLibAtmelI2C uses the Tpm12PhysicalPresence()
function from the Tpm12CommandLib to verify that the I2C device
is responding to TPM command packets.  However, at this point
the TPM device has not been started, and the TPM properly
responds with an error in the returnCode field of the response
packet.  Before the commit above, the check worked, but the
additional error checking in the commit above now returns an
error and an Atmel I2C is returned as not present.

The fix is to remove the call to the Tpm12PhysicalPresence()
API in the Tpm12CommandLib from the Tpm12RequestUseTpm() API.
The Atmel I2C TPM device is detected if a byte can be read
from the slave address assigned to the Atmel I2C device.
When the startup command is sent to the TPM later, the
command and response packet processing will be verified, and
if the I2C device is not an Atmel TPM, it will be detected
at that point.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Lee Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Lee Leahy <leroy.p.leahy@intel.com>
4 years agoShellPkg/Shell: Add double quotes to args with white space
Michael Kinney [Fri, 6 Jan 2017 22:30:44 +0000 (14:30 -0800)]
ShellPkg/Shell: Add double quotes to args with white space

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

When the ShellLib ShellExecute() API or the Shell
Protocol Execute() API are used to execute a
command, the arguments are parsed to produce the
Argc/Argv list in the Shell Parameters Protocol and
double quotes are removed from arguments that are
surrounded by double quotes.  This is the required
behavior of the Shell Parameters Protocol.

The ProcessCommandLine() function in the shell
implementation uses the Argc/Argv list from the
Shell Parameters Protocol to assemble a new command
line, but the double quotes that may have been
originally present for an argument are not preserved.

ProcessCommandLine() is updated to check if an
argument added to the generated command line
contains one or more white space characters, and
if it does, double quotes are added around the
argument.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Fix driver model bug
Ruiyu Ni [Tue, 10 Jan 2017 06:04:00 +0000 (14:04 +0800)]
MdeModulePkg/TerminalDxe: Fix driver model bug

TerminalDxe driver contains bugs in its DriverBindingStart():
1. It cannot be started AGAIN using a different terminal type;
2. It doesn't install SimpleTextInput/SimpleTextOut when
   ConIn/ConOut doesn't contain its device path. The check is
   duplicated of the same logic in ConPlatform driver and can
   be removed.

The patch optimized the code to remove the unnecessary
gEfiCallerIdGuid protocol installation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Remove unnecessary NULL pointer check
Ruiyu Ni [Tue, 10 Jan 2017 05:55:22 +0000 (13:55 +0800)]
MdeModulePkg/TerminalDxe: Remove unnecessary NULL pointer check

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Separate state machine start/stop logic
Ruiyu Ni [Tue, 10 Jan 2017 05:25:27 +0000 (13:25 +0800)]
MdeModulePkg/TerminalDxe: Separate state machine start/stop logic

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Refine SetTerminalDevicePath
Ruiyu Ni [Tue, 10 Jan 2017 05:17:35 +0000 (13:17 +0800)]
MdeModulePkg/TerminalDxe: Refine SetTerminalDevicePath

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Refine InitializeTerminalConsoleTextMode
Ruiyu Ni [Tue, 10 Jan 2017 05:11:25 +0000 (13:11 +0800)]
MdeModulePkg/TerminalDxe: Refine InitializeTerminalConsoleTextMode

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Separate controller name init logic
Ruiyu Ni [Tue, 10 Jan 2017 05:05:46 +0000 (13:05 +0800)]
MdeModulePkg/TerminalDxe: Separate controller name init logic

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Add TerminalTypeFromGuid internal function
Ruiyu Ni [Tue, 10 Jan 2017 03:33:51 +0000 (11:33 +0800)]
MdeModulePkg/TerminalDxe: Add TerminalTypeFromGuid internal function

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Replace macro with enum for terminal types
Ruiyu Ni [Tue, 10 Jan 2017 03:23:17 +0000 (11:23 +0800)]
MdeModulePkg/TerminalDxe: Replace macro with enum for terminal types

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoSecurityPkg: Tcg2Smm: Fix incompatible change
Zhang, Chao B [Wed, 11 Jan 2017 08:10:29 +0000 (16:10 +0800)]
SecurityPkg: Tcg2Smm: Fix incompatible change

Address incompatible change introduced in patch
8f07a374b1d0497b6676491de8cbe2f08f4f7e9f

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoMdePkg: Tpm2Acpi.h: Fix incompatible change
Zhang, Chao B [Wed, 11 Jan 2017 08:07:08 +0000 (16:07 +0800)]
MdePkg: Tpm2Acpi.h: Fix incompatible change

Fix incompatible change.  Some modules are still referencing old definition.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoShellPkg/HandleParsingLib: Fix build failure due to missing semicolon
Ruiyu Ni [Wed, 11 Jan 2017 05:14:40 +0000 (13:14 +0800)]
ShellPkg/HandleParsingLib: Fix build failure due to missing semicolon

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoShellPkg/dh: Support dump from GUID and "decode" parameter
Ruiyu Ni [Mon, 9 Jan 2017 02:51:58 +0000 (10:51 +0800)]
ShellPkg/dh: Support dump from GUID and "decode" parameter

To follow Shell spec 2.2, change "dh" to support dump from
protocol GUID and support "decode" parameter to dump the
GUID/name mapping.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/Dh: Fix coding style issues
Chen A Chen [Thu, 5 Jan 2017 05:29:50 +0000 (13:29 +0800)]
ShellPkg/Dh: Fix coding style issues

The change doesn't impact the functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/HandleParsingLib: Add new API GetAllMappingGuids
Chen A Chen [Thu, 29 Dec 2016 06:52:45 +0000 (14:52 +0800)]
ShellPkg/HandleParsingLib: Add new API GetAllMappingGuids

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/HandleParsingLib: Return NULL name for unknown GUID
Ruiyu Ni [Mon, 9 Jan 2017 08:45:40 +0000 (16:45 +0800)]
ShellPkg/HandleParsingLib: Return NULL name for unknown GUID

GetStringNameFromGuid() returns NULL for unknown GUID, instead of
returning "UnknownDevice".
The behavior change matches ShellProtocol.GetGuidName().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/HandleParsingLib: Rename global variables
Ruiyu Ni [Mon, 9 Jan 2017 05:21:28 +0000 (13:21 +0800)]
ShellPkg/HandleParsingLib: Rename global variables

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoCorebootPayloadPkg: Remove improper build flags in DSC file
Maurice Ma [Tue, 10 Jan 2017 03:31:29 +0000 (19:31 -0800)]
CorebootPayloadPkg: Remove improper build flags in DSC file

Current CorebootPayloadPkgIa32X64.dsc contains "-flto" flag to
request GCC link time optimization. However, this feature is
only supported by newer GCC compiler, and it will break the
debug build with GCC4.8. To fix it, the extra compiling flags
are removed. It allows the default build flags set by the EDKII
build environment to be used.

With this fix, CorebootPayloadPkg 64bit debug build can pass
using GCC 4.8.

Cc: Prince Agyeman <prince.agyeman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoArmPlatformPkg/ArmJunoDxe: Set Marvell Yukon MAC address
Daniil Egranov [Mon, 9 Jan 2017 21:20:51 +0000 (15:20 -0600)]
ArmPlatformPkg/ArmJunoDxe: Set Marvell Yukon MAC address

The patch reads a valid MAC address from the Juno IOFPGA registers
and pushes it into onboard Marvell Yukon NIC.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov <daniil.egranov@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoOvmgPkg/PlatformBootManagerLib: Add Debug Agent console
Michael Kinney [Fri, 23 Dec 2016 00:49:05 +0000 (16:49 -0800)]
OvmgPkg/PlatformBootManagerLib: Add Debug Agent console

The Debug Agent in the SourceLevelDebugPkg can multiplex
both source level debug messages and console messages on
the same UART.  When this is done, the Debug Agent owns
the UART device and an additional device handle with a
Serial I/O Protocol is produced with a VenHw device path
node.

In order for a platform to provide a UART based console
when the Debug Agent is using the same UART device, the
PlatformBootManagerLib must consider the SerialI/O
Protocol produces by the Debug Agent as one of the
supported consoles.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoNt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'
Michael Kinney [Sat, 7 Jan 2017 19:13:32 +0000 (11:13 -0800)]
Nt32Pkg/WinNtSimpleFileSystemDxe: Fix ASSERT() parsing '\'

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

If Nt32 is built using UEFI Shell from the ShellPkg sources,
an ASSERT() is generated when a single '\' character is
entered at the shell prompt.

The WinNtSimpleFileSystemDxe module GetNextFileNameToken()
function breaks a file path up into tokens, but it does not
handle the case where a FileName ends in a '\' character.
It returns an empty string instead of NULL.  The fix is
to set *FileName to NULL if the remaining file path is an
empty string.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdePkg/Include: Add include file to FileHandleLib.h
Michael Kinney [Wed, 4 Jan 2017 17:06:32 +0000 (09:06 -0800)]
MdePkg/Include: Add include file to FileHandleLib.h

FileHandleLib.h uses the data type EFI_FILE_INFO,
so this library class should include <Guid/FileInfo.h>.

Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
Michael Kinney [Wed, 4 Jan 2017 21:32:53 +0000 (13:32 -0800)]
MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages

If a BaseAddress of NULL is passed into DXE Core services
CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
DEBUG() messages are enabled, then a NULL pointer reference
is made.  The parameter check for BaseAddress is performed
in the function CoreAllocateSpace() after the DEBUG()
messages.  A check is added in the DEBUG() messages to
prevent the NULL pointer reference.

This issue was found with PI SCTs with DEBUG messages
enabled in the DXE Core.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoSecurityPkg: Tcg2ConfigDxe/Tcg2Smm: Fix TPM2 HID issue
Zhang, Chao B [Tue, 10 Jan 2017 06:53:08 +0000 (14:53 +0800)]
SecurityPkg: Tcg2ConfigDxe/Tcg2Smm: Fix TPM2 HID issue

Fix wrong TPM2 HID generation logic.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoSecurityPkg: Tcg2Config: TPM2 ACPI Table Rev Option
Zhang, Chao B [Fri, 23 Dec 2016 08:55:32 +0000 (16:55 +0800)]
SecurityPkg: Tcg2Config: TPM2 ACPI Table Rev Option

Add TPM2 ACPI Table Rev Option in Tcg2Config UI. Rev 4 is defined in
TCG ACPI Specification 00.37

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoMdePkg: Tpm2Acpi.h: Update TPM2 ACPI table version
Zhang, Chao B [Mon, 26 Dec 2016 02:50:36 +0000 (10:50 +0800)]
MdePkg: Tpm2Acpi.h: Update TPM2 ACPI table version

Update TPM2 ACPI Table revision to 4. New version & data structure is
defined in TCG ACPI Spec 00.37

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoOvmfPkg/SmmControl2Dxe: correct PCI_CONFIG_READ_WRITE in S3 boot script
Laszlo Ersek [Thu, 1 Dec 2016 01:20:15 +0000 (02:20 +0100)]
OvmfPkg/SmmControl2Dxe: correct PCI_CONFIG_READ_WRITE in S3 boot script

EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE expects the PCI address to
access in UEFI encoding, not in edk2/PciLib encoding.

Introduce the POWER_MGMT_REGISTER_Q35_EFI_PCI_ADDRESS() macro, and with
it, store the ICH9_GEN_PMCON_1 register's address to the boot script in
UEFI representation.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoSecurityPkg Tcg2ConfigDxe: Refine debug message and comments
Star Zeng [Mon, 9 Jan 2017 05:36:41 +0000 (13:36 +0800)]
SecurityPkg Tcg2ConfigDxe: Refine debug message and comments

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoMdePkg/BaseLib: Add safe string functions [U|A]StrnTo[A|U]StrS
Hao Wu [Tue, 13 Dec 2016 08:00:35 +0000 (16:00 +0800)]
MdePkg/BaseLib: Add safe string functions [U|A]StrnTo[A|U]StrS

Add the following 2 APIs:
UnicodeStrnToAsciiStrS
AsciiStrnToUnicodeStrS

These APIs are used to enhance APIs UnicodeStrToAsciiStrS and
AsciiStrToUnicodeStrS (without 'n' in names) by:
1. Adds an input parameter 'Length' to specify the maximum number of
Ascii/Unicode characters to convert.
2. Adds an output parameter 'DestinationLength' to indicate the number of
Ascii/Unicode characters successfully converted.

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>
4 years agoMdePkg/BaseLib: Enhance the return value for string to uint functions
Hao Wu [Wed, 14 Dec 2016 03:04:48 +0000 (11:04 +0800)]
MdePkg/BaseLib: Enhance the return value for string to uint functions

For the following 8 APIs in MdePkg/BaseLib:
[Ascii]StrDecimalToUintn
[Ascii]StrDecimalToUint64
[Ascii]StrHexToUintn
[Ascii]StrHexToUint64

They will ASSERT for DEBUG build when the input string exceeds the range
of UINTN/UINT64. However, for RELEASE build, incorrect value will be
returned.

This commit refines those APIs to direcly call their enhanced counterparts
(with trailing 'S' in API names) so as to remove those exceed-range ASSERT
checks and to make those APIs to return MAX_UINTN/MAX_UINT64 instead.

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>
4 years agoMdePkg/BaseLib: Add safe string functions that convert str to value
Hao Wu [Mon, 12 Dec 2016 00:58:51 +0000 (08:58 +0800)]
MdePkg/BaseLib: Add safe string functions that convert str to value

Add the following 8 APIs:
[Ascii]StrDecimalToUintnS
[Ascii]StrDecimalToUint64S
[Ascii]StrHexToUintnS
[Ascii]StrHexToUint64S

These safe version APIs are used to enhance their counterpart (APIs
without trailing 'S' in function names).

These safe version APIs perform checks to the input string and will return
relative status to reflect the check result:
When the input string exceeds the range of UINTN/64, these APIs will
return RETURN_UNSUPPORTED and store MAX_UINTN/64 in the output data.
When no conversion can be performed for the input string, these APIs will
return RETURN_SUCCESS and store 0 in the output data.

The optional parameter 'EndPointer', if provided, will point to the
character that stopped the scan.

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>
4 years agoMdePkg/BaseLib: Add safe string functions [Ascii]StrnSizeS
Hao Wu [Fri, 9 Dec 2016 07:53:06 +0000 (15:53 +0800)]
MdePkg/BaseLib: Add safe string functions [Ascii]StrnSizeS

Add StrnSizeS() and AsciiStrnSizeS() APIs.

These 2 safe version APIs are used to replace StrSize() and
AsciiStrSize(). Those two APIs use similar checks as [Ascii]StrnLenS().

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>
4 years agoSecurityPkg Tcg2ConfigDxe: Typecast to (CHAR8*) as para of AsciiStrSize
Star Zeng [Mon, 9 Jan 2017 02:04:45 +0000 (10:04 +0800)]
SecurityPkg Tcg2ConfigDxe: Typecast to (CHAR8*) as para of AsciiStrSize

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoOvmfPkg: Install BGRT ACPI table
Bhupesh Sharma [Fri, 6 Jan 2017 09:47:15 +0000 (15:17 +0530)]
OvmfPkg: Install BGRT ACPI table

While debugging OS for ACPI BGRT support (especially on VMs),
it is very useful to have the EFI firmware (OVMF in most cases
which use Tianocore) to export the ACPI BGRT table.

This patch tries to add this support in OvmfPkg.

Tested this patch in the following environments:

1. On both RHEL7.3 and Fedora-25 VM guests running on a Fedora-24 Host:
   - Ensured that the BGRT logo is properly prepared and
     can be viewed with user-space tools (like 'Gwenview' on KDE,
     for example):

     $ file /sys/firmware/acpi/bgrt/image
     /sys/firmware/acpi/bgrt/image: PC bitmap, Windows 3.x format, 193 x
     58 x 24

2. On a Windows-10 VM Guest running on a Fedora-24 Host:
   - Ensured that the BGRT ACPI table is properly prepared and can be
     read with freeware tool like FirmwareTablesView:

     ==================================================
     Signature         : BGRT
     Firmware Provider : ACPI
     Length            : 56
     Revision          : 1
     Checksum          : 129
     OEM ID            : INTEL
     OEM Table ID      : EDK2
     OEM Revision      : 0x00000002
     Creator ID        : 0x20202020
     Creator Revision  : 0x01000013
     Description       :
     ==================================================

Note from Laszlo Ersek <lersek@redhat.com>: without the BGRT ACPI table,
Windows 8 and Windows 10 first clear the screen, then display a blue,
slanted Windows picture above the rotating white boot animation. With the
BGRT ACPI table, Windows 8 and Windows 10 don't clear the screen, the blue
Windows image is not displayed, and the rotating white boot animation is
shown between the firmware's original TianoCore boot splash and (optional)
"Start boot option" progress bar.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: cover effect on Windows 8/10 boot anim. in commit msg]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume
Ruiyu Ni [Thu, 5 Jan 2017 01:56:11 +0000 (09:56 +0800)]
MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume

When firmware boots to UiApp, the memory type information settings
are saved to NV storage and the settings in HOB are changed as well.
Because UiApp is an APPLICATION type of boot option, system doesn't
reset when settings change.
But when user selects OS to boot in UiApp, because the settings in HOB
was updated when booting to UiApp, the BDS doesn't think the settings
change, expected reset doesn't happen.

The patch fixes this issue to not update the settings in HOB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
4 years agoShellPkg: Fix a bug ">>v" cannot append data to environment variable
Chen A Chen [Wed, 4 Jan 2017 03:28:03 +0000 (11:28 +0800)]
ShellPkg: Fix a bug ">>v" cannot append data to environment variable

When ">v" is used to redirect the command output to environment
variable, the ending "\r\n\0" is removed before setting to environment
variable but the length is not updated.
It causes ">>v" fails to append data to the environment variable
created by ">v".
The patch fixes the above bug.

Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoSecurityPkg Tcg2ConfigDxe: Add setup option to configure PPI version
Star Zeng [Fri, 9 Dec 2016 07:53:22 +0000 (15:53 +0800)]
SecurityPkg Tcg2ConfigDxe: Add setup option to configure PPI version

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

gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer was
introduced to configure physical presence interface version. but test
or user needs to build different images to support different versions
separately as the PCD does not support Dynamic types.

This patch is to extend the PCD to support Dynamic types and add a
setup option in Tcg2ConfigDxe driver to configure the physical
presence interface version, the PCD needs to be DynamicHii type and
maps to the setup option.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoBaseTools: not report error for the optional items in the FmpTokens
Yonghong Zhu [Wed, 4 Jan 2017 02:40:54 +0000 (10:40 +0800)]
BaseTools: not report error for the optional items in the FmpTokens

<FmpTokens> in the FDF spec defined some optional items, eg: IMAGE_INDEX,
HARDWARE_INSTANCE. but current tool report error if no such item is exist
in the FDF file.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=293
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>
4 years agoCryptoPkg/TlsLib: Refine the coding style.
Jiaxin Wu [Thu, 5 Jan 2017 03:37:06 +0000 (11:37 +0800)]
CryptoPkg/TlsLib: Refine the coding style.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoMdePkg, NetworkPkg: Refine the coding style.
Jiaxin Wu [Thu, 5 Jan 2017 03:34:07 +0000 (11:34 +0800)]
MdePkg, NetworkPkg: Refine the coding style.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoSecurityPkg: TcgPei: Sync TCG PP lifetime lock state
Zhang, Chao B [Fri, 6 Jan 2017 01:27:15 +0000 (09:27 +0800)]
SecurityPkg: TcgPei: Sync TCG PP lifetime lock state

Sync TCG lifetime lock state after performing PP command.
Later logic checks such state.

Cc: Long Qin <qin.long@intel.com>
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>
4 years agoSecurityPkg: Tcg2ConfigDxe: Remove duplicate local variable
Zhang, Chao B [Fri, 6 Jan 2017 01:13:13 +0000 (09:13 +0800)]
SecurityPkg: Tcg2ConfigDxe: Remove duplicate local variable

Remove duplicate local status variable declaration.

Cc: Bi Dandan <dandan.bi@intel.com>
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>
4 years agoMdeModulePkg/StaControllerDxe: Fix coding style issue
Dandan Bi [Thu, 5 Jan 2017 02:17:23 +0000 (10:17 +0800)]
MdeModulePkg/StaControllerDxe: Fix coding style issue

Remove the empty line.

Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/DxeCapsuleLibFmp: Fix incorrect MODULE_TYPE
Dandan Bi [Thu, 5 Jan 2017 05:03:53 +0000 (13:03 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Fix incorrect MODULE_TYPE

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg: Add Pcd PROMPT/HELP & Chang default setting
Zhang, Chao B [Thu, 5 Jan 2017 02:16:16 +0000 (10:16 +0800)]
SecurityPkg: Add Pcd PROMPT/HELP & Chang default setting

Update PCD PcdTcg2PhysicalPresenceFlags default setting. Also add PROMPT,
HELP string.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoSecuritPkg: Tcg2: Fix coding style issue
Zhang, Chao B [Thu, 5 Jan 2017 02:11:07 +0000 (10:11 +0800)]
SecuritPkg: Tcg2: Fix coding style issue

Fix coding style issue

Cc: Bi Dandan <dandan.bi@intel.com>
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>
4 years agoSecurityPkg: Tcg2ConfigDxe: Display TPM2 HID in Tcg2Config
Zhang, Chao B [Thu, 29 Dec 2016 08:21:02 +0000 (16:21 +0800)]
SecurityPkg: Tcg2ConfigDxe: Display TPM2 HID in Tcg2Config

Display TPM2 HID from TPM2 ACPI device object in Tcg2Config UI

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoBaseTools: fix the bug for Mixed Pcd display in the report
Yonghong Zhu [Fri, 30 Dec 2016 06:54:34 +0000 (14:54 +0800)]
BaseTools: fix the bug for Mixed Pcd display in the report

Fix the bug to not display the mixed PCD in the Global PCD section, and
correct the Pcd display name.

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>
4 years agoBaseTools toolsetup.bat: set PATH to include Bin Win32 directory
Liming Gao [Thu, 29 Dec 2016 02:52:01 +0000 (10:52 +0800)]
BaseTools toolsetup.bat: set PATH to include Bin Win32 directory

Bin Win32 directory includes antlr.exe. This tool is used when compile
BaseTools source code. So, set it into PATH first.

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>
4 years agoBaseTools toolsetup.bat: Set env when the binary tools are missing
Liming Gao [Thu, 29 Dec 2016 02:52:00 +0000 (10:52 +0800)]
BaseTools toolsetup.bat: Set env when the binary tools are missing

BASE_TOOLS_PATH is required to be set when the binary tools are missing.

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>
4 years agoSecurityPkg: Tcg2Smm: Update HID patch logic
Zhang, Chao B [Wed, 4 Jan 2017 02:29:28 +0000 (10:29 +0800)]
SecurityPkg: Tcg2Smm: Update HID patch logic

Update HID patch logic. NOOP in ASL template may cause syntax error when
disassembled and recompiled.

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
4 years agoNetworkPkg/Ip6Dxe: Fix the potential NULL pointer free
Jiaxin Wu [Tue, 3 Jan 2017 03:27:38 +0000 (11:27 +0800)]
NetworkPkg/Ip6Dxe: Fix the potential NULL pointer free

Ip6ConfigSetDnsServer may cause ASSERT if the invalid DNS
server address received. The issue is triggered by the NULL
pointer(Tmp) free.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoMdeModulePkg/Ip4Dxe: Fix the potential NULL pointer free
Jiaxin Wu [Thu, 29 Dec 2016 07:57:39 +0000 (15:57 +0800)]
MdeModulePkg/Ip4Dxe: Fix the potential NULL pointer free

Ip4Config2SetDnsServer may cause ASSERT if the invalid DNS
server address received. The issue is triggered by the NULL
pointer(Tmp) free.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoVlv2TbltDevicePkg/BootScriptSaveDxe: save 64-bit LoopTimes
Laszlo Ersek [Wed, 30 Nov 2016 19:31:18 +0000 (20:31 +0100)]
Vlv2TbltDevicePkg/BootScriptSaveDxe: save 64-bit LoopTimes

The BootScriptMemPoll() helper function does the following:

- pop LoopTimes from the variable argument list as UINT64, then truncate
  it to UINTN,

- pass the truncated value to S3BootScriptSaveMemPoll() as last argument.

The truncation to UINTN is now superfluous, thanks to the patch titled
"MdePkg, MdeModulePkg: S3BootScriptSaveMemPoll(): accept 64-bit
LoopTimes".

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoMdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes
Laszlo Ersek [Wed, 30 Nov 2016 19:19:06 +0000 (20:19 +0100)]
MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes

The BootScriptWriteMemPoll() helper function in both drivers does the
following:

- pop Delay from the variable argument list as UINT64, then truncate it to
  UINTN,

- divide Delay by 10, using DivU64x32Remainder(), then store the quotient
  in LoopTimes (also UINTN),

- pass LoopTimes to S3BootScriptSaveMemPoll() as last argument.

The truncation to UINTN is superfluous and wrong in this logic (not to
mention incompatible with the PI spec); it prevents callers from
specifying Delays longer than 0xFFFF_FFFF * 100ns (approximately 429
seconds == 7 minutes 9 seconds) on Ia32. In particular it prevents callers
from specifying an infinite timeout (for example, 0xFFFF_FFFF_FFFF_FFFF *
100ns, approximately 58494 years).

Change the type of Delay and LoopTimes to UINT64. Keep the same logic,
just remove the truncations. The resultant LoopTimes values can be safely
passed to S3BootScriptSaveMemPoll() thanks to the previous patch.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoMdePkg, MdeModulePkg: S3BootScriptSaveMemPoll(): accept 64-bit LoopTimes
Laszlo Ersek [Wed, 30 Nov 2016 19:07:50 +0000 (20:07 +0100)]
MdePkg, MdeModulePkg: S3BootScriptSaveMemPoll(): accept 64-bit LoopTimes

The BaseNull instance of S3BootScriptLib obviously doesn't care about the
type of the S3BootScriptSaveMemPoll() function's LoopTimes parameter; this
lib instance doesn't do anything with the parameters received in
S3BootScriptSaveMemPoll().

The PiDxe instance saves the LoopTimes parameter in
EFI_BOOT_SCRIPT_MEM_POLL.LoopTimes. This target field already has UINT64
type. Furthermore, the BootScriptExecuteMemPoll() function in the same
library instance already uses a local UINT64 variable called LoopTimes to
count up to EFI_BOOT_SCRIPT_MEM_POLL.LoopTimes. This means that the the
UINTN type for S3BootScriptSaveMemPoll()'s LoopTimes parameter is an
unnecessary restriction.

The callers of S3BootScriptSaveMemPoll() will be updated in the next
patches, functionally. At this stage, they will continue to compile, since
UINT64 parameters can accept UINTN arguments.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoMdeModulePkg/PrintLib: Add missing return status check for Print APIs
Hao Wu [Fri, 23 Dec 2016 05:04:38 +0000 (13:04 +0800)]
MdeModulePkg/PrintLib: Add missing return status check for Print APIs

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

For the following APIs in PrintLib instance
MdeModulePkg\Library\DxePrintLibPrint2Protocol:
UnicodeVSPrint
UnicodeSPrint
UnicodeVSPrintAsciiFormat
UnicodeSPrintAsciiFormat
AsciiVSPrint
AsciiSPrint
AsciiVSPrintUnicodeFormat
AsciiSPrintUnicodeFormat

The internal function DxePrintLibPrint2ProtocolVaListToBaseList() will be
called to convert a VA_LIST to a BASE_LIST. However, those APIs miss
checking the return value of the internal function.

This commit adds codes to check the return value. If the VA_LIST fails to
be converted to a BASE_LIST, those PrintLib APIs will return 0 and leave
the output 'StartOfBuffer' unmodified.

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>
4 years agoUefiCpuPkg/MpInitLib: Set initialize value of TimerPeriod
Jeff Fan [Thu, 29 Dec 2016 01:29:23 +0000 (09:29 +0800)]
UefiCpuPkg/MpInitLib: Set initialize value of TimerPeriod

This fix is to pass VS2010/VS2012 build.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoBaseTools: Fix the bug for RAW file alignment value support
Yonghong Zhu [Tue, 27 Dec 2016 09:52:12 +0000 (17:52 +0800)]
BaseTools: Fix the bug for RAW file alignment value support

Fix the bug for RAW file to support Align=32 and Align=64. Current FDF
spec FfsAlignmentValues support this two values, while it is not the
valid value for GenFfs. So this patch add the logic to handle it.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=248
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>
4 years agoNetworkPkg/NetworkPkg.dsc: Move TLS modules to the supported components
Jiaxin Wu [Wed, 28 Dec 2016 11:32:18 +0000 (19:32 +0800)]
NetworkPkg/NetworkPkg.dsc: Move TLS modules to the supported components

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoBaseTools/Ecc: Fix the issue of not recognizing "FILE_GUID"
Hess Chen [Tue, 27 Dec 2016 10:10:48 +0000 (18:10 +0800)]
BaseTools/Ecc: Fix the issue of not recognizing "FILE_GUID"

Fix the issue of not recognizing "FILE_GUID"

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
4 years agoNt32Pkg SecMain: Update SecMain.inf to support VS2015x86 X64 Mode
chanuei [Tue, 18 Oct 2016 02:45:02 +0000 (10:45 +0800)]
Nt32Pkg SecMain: Update SecMain.inf to support VS2015x86 X64 Mode

In V2:
  Add the specific LIB path in IA32 LINK path.

Update SecMain.inf to support VS2015x86 X64 Mode Build.
After this change, X64 Native Tools Command Prompt is not
required to be trig. NT32 IA32 and X64 can be built in the same
environment. It simplifies NT32 X64 build. New build command:
edksetup.bat --nt32
build -p Nt32Pkg\Nt32Pkg.dsc -a X64  # for 64
build -p Nt32Pkg\Nt32Pkg.dsc -a IA32 # for 32

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Chan <chanuei@sina.com>
Tested-by: Liming Gao <liming.gao@intel.com>
4 years agoSecurityPkg: Tcg2PhysicalPresence: Define TCG2 PP Flags Initial Pcd
Zhang, Chao B [Tue, 27 Dec 2016 08:47:06 +0000 (16:47 +0800)]
SecurityPkg: Tcg2PhysicalPresence: Define TCG2 PP Flags Initial Pcd

Define PcdTcg2PhysicalPresenceFlags to initialize TCG2 PP Flags setting.

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoSecurityPkg: Tcg2Smm: TPM2 Vendor specific HID
Zhang, Chao B [Wed, 21 Dec 2016 06:31:47 +0000 (14:31 +0800)]
SecurityPkg: Tcg2Smm: TPM2 Vendor specific HID

Update TPM2 HID using vendor ManufacturerID & FirmwareVersion1.

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoShellPkg/cd: Fix "cd" to support "fs0:dir" (no slash after ':')
Ruiyu Ni [Wed, 21 Dec 2016 08:04:19 +0000 (16:04 +0800)]
ShellPkg/cd: Fix "cd" to support "fs0:dir" (no slash after ':')

When "fs0:dir"(drive letter without slash) is used as destination
of "cd", "cd" tries to change to "dir" in root directory of "fs0:".
It's incorrect. The correct behavior is to change to "dir" in
current directory of "fs0:"

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoMdePkg/BaseLib: Fix PathCleanUpDirectories to correctly handle "\.\"
Ruiyu Ni [Wed, 21 Dec 2016 07:21:32 +0000 (15:21 +0800)]
MdePkg/BaseLib: Fix PathCleanUpDirectories to correctly handle "\.\"

The old code incorrectly cleans path like "fs0:\abc\.\.." to
"fs0:\abc", instead of "fs0:\"

The patch fixes this bug.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Set new AP to idle state after switching BSP
Jeff Fan [Mon, 26 Dec 2016 11:16:23 +0000 (19:16 +0800)]
UefiCpuPkg/MpInitLib: Set new AP to idle state after switching BSP

We need to set new AP to idle state if it is expected to be waken up by new BSP
later.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>
4 years agoUefiCpuPkg/MpInitLib: Disable and restore system timer interrupt
Jeff Fan [Mon, 26 Dec 2016 11:13:44 +0000 (19:13 +0800)]
UefiCpuPkg/MpInitLib: Disable and restore system timer interrupt

We need to disable system timer interrup to avoid generating the pending
interrupt on the old BSP.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>
4 years agoUefiCpuPkg/MpInitLib: Swap local APIC timer interrupt state
Jeff Fan [Mon, 26 Dec 2016 08:55:12 +0000 (16:55 +0800)]
UefiCpuPkg/MpInitLib: Swap local APIC timer interrupt state

We need to swap local APIC timer interrupt state between old BSP and new BSP.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>
4 years agoUefiCpuPkg/MpInitLib: Move save/restore interrupt to SwitchBSPWorker()
Jeff Fan [Mon, 26 Dec 2016 08:52:48 +0000 (16:52 +0800)]
UefiCpuPkg/MpInitLib: Move save/restore interrupt to SwitchBSPWorker()

During switching BSP phase, we need to disable CPU interruput to prevent stack
crashed by Timer interrupt handle. But when we enabled source debugging feature,
debug timer interrupt handler (existing on both PEI and DXE) also could crash
the stack used during switching BSP. So,we need to move save/restore interrupt
to SwitchBSPWorker().

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>
4 years agoUefiCpuPkg/MpInitLib: Sync BSP's local APIC timer settings to APs
Jeff Fan [Mon, 26 Dec 2016 08:44:24 +0000 (16:44 +0800)]
UefiCpuPkg/MpInitLib: Sync BSP's local APIC timer settings to APs

If APs are waken up by INIT-SIPI-SIPI command, they will lose original local
APIC timer setting. As a result, the timer library instance based on local APIC
timer cannot work on APs function.

This fix is to save BSP's local APIC timer settings before waking up APs and
to sync to APs when APs wakeup by INIT-SIPI-SIPI command.

Setting BSP's current counter to AP's initial counter could make sure BSP and
APs have same counter value across BSP switching.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>
4 years agoUefiCpuPkg/DxeMpInitLib: Support source debugging on AP function
Jeff Fan [Mon, 26 Dec 2016 08:28:58 +0000 (16:28 +0800)]
UefiCpuPkg/DxeMpInitLib: Support source debugging on AP function

The current DxeDebugAgentLib supports source debugging on AP function. This
update is to update DxeMpInitLib to consume Debug Agent Library by
DEBUG_AGENT_INIT_DXE_AP flag. Thus, we could source debugging AP function
invoked by CPU MP Protocol.

However, current SecPeiDebugAgentLib does not support source debugging on AP
function invoked by CPU MP PPI. I have submitted one bugzilla to add this
support at https://bugzilla.tianocore.org/show_bug.cgi?id=308.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@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>