]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
5 years agoNt32Pkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:06:34 +0000 (14:06 +0800)]
Nt32Pkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <Hao.a.wu@intel.com>
5 years agoOvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:04:55 +0000 (14:04 +0800)]
OvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@linaro.org>
5 years agoCorebootPayload/PlatformBDS: Impl PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 05:22:16 +0000 (13:22 +0800)]
CorebootPayload/PlatformBDS: Impl PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
5 years agoMdeModulePkg/PlatformBootManager: Add PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 05:19:28 +0000 (13:19 +0800)]
MdeModulePkg/PlatformBootManager: Add PlatformBootManagerUnableToBoot

The patch adds a new API PlatformBootManagerUnableToBoot()
to PlatformBootManagerLib.
The new API is provided by platform bds library and is called when
no boot option could be launched.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
5 years agoBaseTools: Fix bug about *M value not display decimal and hexadecimal
Yunhua Feng [Tue, 24 Jul 2018 11:30:11 +0000 (19:30 +0800)]
BaseTools: Fix bug about *M value not display decimal and hexadecimal

V2: Add the check for Pcd DatumType

report format like as below:
 *M     Shell.inf         = 0xFF (255)

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Parse decimal format INF_VERSION incorrect
Yunhua Feng [Wed, 25 Jul 2018 03:21:07 +0000 (11:21 +0800)]
BaseTools: Parse decimal format INF_VERSION incorrect

hex number 0x00010019, the major number is 0001, the
minor number is 0019.
the decimal number 1.25, the major number is 1, and the
minor number is 25

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

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice
Thomas Palmer [Tue, 3 Jul 2018 15:32:53 +0000 (23:32 +0800)]
MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice

When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg FvSimpleFileSystemDxe: Fix memory leak in Read function
Vladimir Olovyannikov [Wed, 25 Jul 2018 19:47:49 +0000 (03:47 +0800)]
MdeModulePkg FvSimpleFileSystemDxe: Fix memory leak in Read function

FvSimpleFileSystem on read always allocates a FileBuffer, and never frees
it. This causes memory leaks. It is especially bad for reading scripts
line-by-line. In some cases memory leak can exceed 1GB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vladimir Olovyannikiov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/DxeCore: Not update RtCode in MemAttrTable after EndOfDxe
Jiewen Yao [Fri, 24 Nov 2017 01:21:54 +0000 (09:21 +0800)]
MdeModulePkg/DxeCore: Not update RtCode in MemAttrTable after EndOfDxe

We want to provide precise info in MemAttribTable
to both OS and SMM, and SMM only gets the info at EndOfDxe.
So we do not update RtCode entry in EndOfDxe.

The impact is that if 3rd part OPROM is runtime, it cannot be executed
at UEFI runtime phase.
Currently, we do not see compatibility issue, because the only runtime
OPROM we found before in UNDI, and UEFI OS will not use UNDI interface
in OS.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/PiSmmCpu: Check EFI_RUNTIME_RO in UEFI mem attrib table.
Jiewen Yao [Wed, 22 Nov 2017 15:11:54 +0000 (23:11 +0800)]
UefiCpuPkg/PiSmmCpu: Check EFI_RUNTIME_RO in UEFI mem attrib table.

It treats the UEFI runtime page with EFI_MEMORY_RO attribute as
invalid SMM communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdePkg/SmmMemLib: Check EFI_MEMORY_RO in UEFI mem attrib table.
Jiewen Yao [Wed, 22 Nov 2017 15:11:22 +0000 (23:11 +0800)]
MdePkg/SmmMemLib: Check EFI_MEMORY_RO in UEFI mem attrib table.

It treats the UEFI runtime page with EFI_MEMORY_RO attribute as
invalid SMM communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/DxeCore: Install UEFI mem attrib table at EndOfDxe.
Jiewen Yao [Wed, 22 Nov 2017 14:05:07 +0000 (22:05 +0800)]
MdeModulePkg/DxeCore: Install UEFI mem attrib table at EndOfDxe.

So that the SMM can consume it to set page protection for
the UEFI runtime page with EFI_MEMORY_RO attribute.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/PiSmmCpu: Check for untested memory in GCD
Jiewen Yao [Thu, 2 Nov 2017 11:00:02 +0000 (19:00 +0800)]
UefiCpuPkg/PiSmmCpu: Check for untested memory in GCD

It treats GCD untested memory as invalid SMM
communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdePkg/SmmMemLib: Check for untested memory in GCD
Jiewen Yao [Thu, 2 Nov 2017 10:21:13 +0000 (18:21 +0800)]
MdePkg/SmmMemLib: Check for untested memory in GCD

It treats GCD untested memory as invalid SMM
communication buffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Not use disabled AP when call StartAllAPs.
Eric Dong [Thu, 26 Jul 2018 08:44:22 +0000 (16:44 +0800)]
UefiCpuPkg/MpInitLib: Not use disabled AP when call StartAllAPs.

Base on UEFI spec requirement, StartAllAPs function should not use the APs which has been disabled before. This patch just change current code to follow this rule.

V3 changes:
Only called by StartUpAllAps, WakeUpAp will not wake up the disabled APs, in other cases also need to include the disabled APs, such as CpuDxe driver start up and ChangeApLoopCallback function.

WakeUpAP() is called with (Broadcast && WakeUpDisabledAps) from MpInitLibInitialize(), CollectProcessorCount() and MpInitChangeApLoopCallback() only. The first two run before the PPI or Protocol user has a chance to disable any APs. The last one runs in response to the ExitBootServices and LegacyBoot events, after which the MP protocol is unusable. For this reason, it doesn't matter that an originally disabled AP's state is not restored to Disabled, when
WakeUpAP() is called with (Broadcast && WakeUpDisabledAps).

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/MpInitLib: Remove StartCount and volatile definition.
Eric Dong [Tue, 24 Jul 2018 14:29:53 +0000 (22:29 +0800)]
UefiCpuPkg/MpInitLib: Remove StartCount and volatile definition.

The patch includes below changes:
(1) It removes "volatile" from RunningCount, because only the BSP modifies it.
(2) When we detect a timeout in CheckAllAPs(), and collect the list of failed CPUs, the size of the list is derived from the following difference, before the patch:
  StartCount - FinishedCount
where "StartCount" is set by the BSP at startup, and FinishedCount is incremented by the APs themselves.
Here the patch replaces this difference with
  StartCount - RunningCount
that is, the difference is no more calculated from the BSP's startup counter and the AP's shared finish counter, but from the RunningCount measurement that the BSP does itself, in CheckAllAPs().
(3) Finally, the patch changes the meaning of RunningCount. Before the patch, we have:
- StartCount: the number of APs the BSP stars up,
- RunningCount: the number of finished APs that the BSP collected
After the patch, StartCount is removed, and RunningCount is *redefined* as the following difference:
  OLD_StartCount - OLD_RunningCount
Giving the number of APs that the BSP started up but hasn't collected yet.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/MpInitLib: Remove redundant CpuStateFinished State.
Eric Dong [Tue, 24 Jul 2018 14:25:41 +0000 (22:25 +0800)]
UefiCpuPkg/MpInitLib: Remove redundant CpuStateFinished State.

Current CPU state definition include CpuStateIdle and CpuStateFinished.
After investigation, current code can use CpuStateIdle to replace the
CpuStateFinished. It will reduce the state number and easy for maintenance.

> Before this patch, the state transitions for an AP are:
>
>   Idle ----> Ready ----> Busy ----> Finished ----> Idle
>        [BSP]       [AP]       [AP]           [BSP]
>
> After the patch, the state transitions for an AP are:
>
>   Idle ----> Ready ----> Busy ----> Idle
>        [BSP]       [AP]       [AP]

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoMdeModulePkg/DxeLoadFunc: Add use case for new Perf macro
Dandan Bi [Wed, 11 Jul 2018 04:47:45 +0000 (12:47 +0800)]
MdeModulePkg/DxeLoadFunc: Add use case for new Perf macro

Add an example case for the usage of
PERF_EVENT_SIGNAL_BEGIN/PERF_EVENT_SIGNAL_END

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoSecurityPkg/Tcg: Add use case for new Perf macro
Dandan Bi [Tue, 17 Jul 2018 05:09:02 +0000 (13:09 +0800)]
SecurityPkg/Tcg: Add use case for new Perf macro

Add an example case for the usage of
PERF_CALLBACK_BEGIN/PERF_CALLBACK_END

Cc: Liming Gao <liming.gao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Chao Zhang<chao.b.zhang@intel.com>
5 years agoShellPkg/Dp: Cumulate the perf data of "DB:Stop"
Dandan Bi [Thu, 19 Jul 2018 03:26:21 +0000 (11:26 +0800)]
ShellPkg/Dp: Cumulate the perf data of "DB:Stop"

Currently DP tool will cumulate the performance data for
Driver Binding Support/Start, will count the number they
appears, and record the maximum/minimum time value...
Now add Driver Binding Stop performance data to the
cumulative data to keep consistency.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools/Ecc: Add some new checkpoints
Hess Chen [Mon, 23 Jul 2018 05:57:57 +0000 (13:57 +0800)]
BaseTools/Ecc: Add some new checkpoints

1. Add a checkpoint to check NO TABs.
2. Add a checkpoint to check line ending with CRLF.
3. Add a checkpoint to check no trailing spaces.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoShellPkg: add UefiShellAcpiViewCommandLib.inf to ShellPkg.dsc
AlexeiFedorov [Tue, 17 Jul 2018 10:59:25 +0000 (03:59 -0700)]
ShellPkg: add UefiShellAcpiViewCommandLib.inf to ShellPkg.dsc

This patch adds UefiShellAcpiViewCommandLib INF file into
[Components] section of ShellPkg.dsc so this library can be built
in ShellPkg level build.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools Script: Add the script to generate Structure PCD setting
Liming Gao [Tue, 17 Jul 2018 03:42:21 +0000 (11:42 +0800)]
BaseTools Script: Add the script to generate Structure PCD setting

Here is this script usage.
1. Build one platform.
2. Use FCE tool to read HII config from the generated FD image.
FCE read -i Platform.fd > Config.txt
3. Call the script to generate StructurePcd setting.
ConvertFceToStructurePcd.py -p Build\PlatformPkg\DEBUG_VS2015x86 \
-c Config.txt -o OutputDir
OutputDir directory has StructurePcd.dec, StructurePcd.dsc, StructurePcd.inf.
4. Refer to wiki https://github.com/lgao4/edk2/wiki/StructurePcd-Enable-Steps
to enable structure pcd in this platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Fix build report for *P and *M flag incorrectly
Yunhua Feng [Mon, 16 Jul 2018 08:05:42 +0000 (16:05 +0800)]
BaseTools: Fix build report for *P and *M flag incorrectly

Flag *M for INF defined value and DSC components value
Flag *P only for platform defined value

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: AutoGen - change class variable to funciton variable
Jaben Carsey [Thu, 19 Jul 2018 17:57:39 +0000 (01:57 +0800)]
BaseTools: AutoGen - change class variable to funciton variable

This variable is only used in one function, make it local there.
Also when iterating on the variable, use dict.items() to get value
instead of re-looking up the value multiple times.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoArmVirtPkg: remove wrong and superfluous ResourcePublicationLib resolution
Laszlo Ersek [Tue, 24 Jul 2018 12:57:07 +0000 (14:57 +0200)]
ArmVirtPkg: remove wrong and superfluous ResourcePublicationLib resolution

The class name for the "PeiResourcePublicationLib" instance is just
"ResourcePublicationLib", not "PeiResourcePublicationLib". However, no
module included in the ArmVirtPkg platforms depends on this lib class;
remove its resolution.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoOvmfPkg: Correct ResourcePublicationLib class name in DSC/INF files
Liming Gao [Tue, 24 Jul 2018 02:23:28 +0000 (10:23 +0800)]
OvmfPkg: Correct ResourcePublicationLib class name in DSC/INF files

ResourcePublicationLib class name is ResourcePublicationLib.
INF and DSC files are updated to use the correct one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Dongao Guo <dongao.guo@intel.com>
[lersek@redhat.com: insert empty line between commit msg body and tags]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoBaseTools: Fix the different token with the same PCD
Yunhua Feng [Fri, 20 Jul 2018 07:51:39 +0000 (15:51 +0800)]
BaseTools: Fix the different token with the same PCD

If the different token with the same PCD names are used in the driver,
build can pass. If the different token with the same PCD name are used
in the different library, then the driver build will fail. The reason
is that the driver autogen.c is not generated correctly for the second
case. BaseTools should check the duplicated PCD name is the driver and
its linked libraries.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoBaseTools: Correct _PCD_PATCHABLE_TokenName_SIZE's value
Yonghong Zhu [Mon, 23 Jul 2018 03:58:22 +0000 (11:58 +0800)]
BaseTools: Correct _PCD_PATCHABLE_TokenName_SIZE's value

current if user use PatchPcdSetPtr in library, it will report the
_PCD_PATCHABLE_TokenName_SIZE is not defined.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoUefiCpuPkg/CpuMpPei: Correct BIST PPI logic.
Marvin H?user [Sat, 21 Jul 2018 22:17:17 +0000 (06:17 +0800)]
UefiCpuPkg/CpuMpPei: Correct BIST PPI logic.

Currently, the SecPlatformInformation2 PPI is installed when either
there is none present or the present one doesn't lack data.
Update the logic to only install the SecPlatformInformation2 PPI when
it's not already installed so that an up-to-date PPI remains the only
one and unchanged.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoBaseTools/AutoGen: Update header file for MM modules.
Supreeth Venkatesh [Tue, 3 Jul 2018 10:00:35 +0000 (18:00 +0800)]
BaseTools/AutoGen: Update header file for MM modules.

This patch corrects the Module Type Header file for Management Mode(MM)
as specified in PI v1.6 Specification. Also, it updates parameter for
auto generated template functions from EFI_SMM_SYSTEM_TABLE2 to
EFI_MM_SYSTEM_TABLE.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: ElfConvert Tool update VerboseMsg to same with the comment
Yonghong Zhu [Fri, 13 Jul 2018 03:28:33 +0000 (11:28 +0800)]
BaseTools: ElfConvert Tool update VerboseMsg to same with the comment

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=994
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Use EFI_UNSUPPORTED for incorrect Argc case
Star Zeng [Fri, 13 Jul 2018 08:00:15 +0000 (16:00 +0800)]
MdeModulePkg CapsuleApp: Use EFI_UNSUPPORTED for incorrect Argc case

Align code to use EFI_UNSUPPORTED for all incorrect Argc cases.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Check capsule header before using its Flags
Star Zeng [Fri, 13 Jul 2018 07:50:16 +0000 (15:50 +0800)]
MdeModulePkg CapsuleApp: Check capsule header before using its Flags

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Show clear message when option is unrecognized
Star Zeng [Fri, 13 Jul 2018 07:28:21 +0000 (15:28 +0800)]
MdeModulePkg CapsuleApp: Show clear message when option is unrecognized

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Do not parse bits in CapsuleFlags of ESRT
Star Zeng [Fri, 13 Jul 2018 07:16:02 +0000 (15:16 +0800)]
MdeModulePkg CapsuleApp: Do not parse bits in CapsuleFlags of ESRT

According to UEFI spec, only bits 0-15 of CapsuleFlags are
meaningful and CapsuleGuid specific, CAPSULE_FLAGS_PERSIST_ACROSS_RESET
CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE/CAPSULE_FLAGS_INITIATE_RESET
defined in UEFI spec are in bits 16-31, they should not be parsed in
CapsuleFlags of ESRT.

CapsuleFlags
The capsule flags field contains the CapsuleGuid flags (bits 0-15)
as defined in the EFI_CAPSULE_HEADER that will be set in the capsule
header.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Fix memory leak in DumpFmpImage()
Star Zeng [Fri, 13 Jul 2018 07:04:16 +0000 (15:04 +0800)]
MdeModulePkg CapsuleApp: Fix memory leak in DumpFmpImage()

Image buffer should be freed after using.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Check Arg count for -P GET option
Star Zeng [Wed, 11 Jul 2018 08:35:02 +0000 (16:35 +0800)]
MdeModulePkg CapsuleApp: Check Arg count for -P GET option

Also add help info for CapsuleApp -P GET option.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoBaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
Yunhua Feng [Fri, 13 Jul 2018 09:05:20 +0000 (17:05 +0800)]
BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section

V3: Add some invalid type and datum check

V2: limit the PCD used in the [Depex] section should be used in the module

The PCD item used in INF [Depex] section must be defined as FixedAtBuild
type and VOID* datum type, and the size of the PCD must be 16 bytes.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=443
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg: TpmMeasureLib: Re-prioritize TCG/TCG2 protocol
Zhang, Chao B [Sat, 21 Jul 2018 03:20:24 +0000 (11:20 +0800)]
MdeModulePkg: TpmMeasureLib: Re-prioritize TCG/TCG2 protocol

TPM1.2 is obsoleted by TPM2.0. switch TCG/TCG2 protocol check to apply this
trend

Cc: Long, Qin <qin.long@intel.com>
Cc: Yao, Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Yao, Jiewen <jiewen.yao@intel.com>
5 years agoMdeModulePkg: Variable: Re-prioritize TCG/TCG2 protocol
Zhang, Chao B [Sat, 21 Jul 2018 03:19:07 +0000 (11:19 +0800)]
MdeModulePkg: Variable: Re-prioritize TCG/TCG2 protocol

TPM1.2 is obsoleted by TPM2.0. switch TCG/TCG2 protocol check to apply this
trend

Cc: Long, Qin <qin.long@intel.com>
Cc: Yao, Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Yao, Jiewen <jiewen.yao@intel.com>
5 years agoSecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler
Zhang, Chao B [Thu, 19 Jul 2018 09:56:38 +0000 (17:56 +0800)]
SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler

Add more logic to filter invalid function parameter in MOR Control SMI handler

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
5 years agoOvmfPkg/XenPvBlkDxe: remove gEfiDevicePathProtocolGuid from [Protocols]
Laszlo Ersek [Thu, 19 Jul 2018 17:43:41 +0000 (19:43 +0200)]
OvmfPkg/XenPvBlkDxe: remove gEfiDevicePathProtocolGuid from [Protocols]

XenPvBlkDxe doesn't reference gEfiDevicePathProtocolGuid; remove it from
the INF file.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Steven Shi <steven.shi@intel.com>
Reported-by: Steven Shi <steven.shi@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1034
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agoStandaloneMmPkg: Describe the declaration and definition files.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:30 +0000 (23:05 +0800)]
StandaloneMmPkg: Describe the declaration and definition files.

This patch describes the package declarations and definitions
for creating standalone management mode image with
core/foundation and drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg: Add CPU driver suitable for ARM Platforms.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:29 +0000 (23:05 +0800)]
StandaloneMmPkg: Add CPU driver suitable for ARM Platforms.

This patch adds a simple CPU driver that exports the
EFI_MM_CONFIGURATION_PROTOCOL to allow registration of the Standalone
MM Foundation entry point. It preserves the existing notification
mechanism for the configuration protocol.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
5 years agoStandaloneMmPkg: Add an AArch64 specific entry point library.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:28 +0000 (23:05 +0800)]
StandaloneMmPkg: Add an AArch64 specific entry point library.

The Standalone MM environment runs in S-EL0 in AArch64 on ARM Standard
Platforms and is initialised during the SEC phase. ARM Trusted firmware
in EL3 is responsible for initialising the architectural context for
S-EL0 and loading the Standalone MM image. The memory allocated to this
image is marked as RO+X. Heap memory is marked as RW+XN.

Certain actions have to be completed prior to executing the generic code
in the Standalone MM Core module. These are:

1. Memory permission attributes for each section of the Standalone MM
   Core module need to be changed prior to accessing any RW data.

2. A Hob list has to be created with information that allows the MM
   environment to initialise and dispatch drivers.

Furthermore, this module is responsible for handing over runtime MM
events to the Standalone MM CPU driver and returning control to ARM
Trusted Firmware upon event completion. Hence it needs to know the CPU
driver entry point.

This patch implements an entry point module that ARM Trusted Firmware
jumps to in S-EL0. It then performs the above actions before calling the
Standalone MM Foundation entry point and handling subsequent MM events.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
5 years agoStandaloneMmPkg/Core: Implementation of Standalone MM Core Module.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:27 +0000 (23:05 +0800)]
StandaloneMmPkg/Core: Implementation of Standalone MM Core Module.

Management Mode (MM) is a generic term used to describe a secure
execution environment provided by the CPU and related silicon that is
entered when the CPU detects a MMI. For x86 systems, this can be
implemented with System Management Mode (SMM). For ARM systems, this can
be implemented with TrustZone (TZ).
A MMI can be a CPU instruction or interrupt. Upon detection of a MMI, a
CPU will jump to the MM Entry Point and save some portion of its state
(the "save state") such that execution can be resumed.
The MMI can be generated synchronously by software or asynchronously by
a hardware event. Each MMI source can be detected, cleared and disabled.
Some systems provide for special memory (Management Mode RAM or MMRAM)
which is set aside for software running in MM. Usually the MMRAM is
hidden during normal CPU execution, but this is not required. Usually,
after MMRAM is hidden it cannot be exposed until the next system reset.

The MM Core Interface Specification describes three pieces of the PI
Management Mode architecture:
1. MM Dispatch
   During DXE, the DXE Foundation works with the MM Foundation to
   schedule MM drivers for execution in the discovered firmware volumes.
2. MM Initialization
   MM related code opens MMRAM, creates the MMRAM memory map, and
   launches the MM Foundation, which provides the necessary services to
   launch MM-related drivers. Then, sometime before boot, MMRAM is
   closed and locked. This piece may be completed during the
   SEC, PEI or DXE phases.
3. MMI Management
   When an MMI generated, the MM environment is created and then the MMI

   sources are detected and MMI handlers called.

This patch implements the MM Core.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoStandaloneMmPkg: MM driver entry point library.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:26 +0000 (23:05 +0800)]
StandaloneMmPkg: MM driver entry point library.

This patch implements module entry point library for Standalone
management mode (MM) Drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg/HobLib: Add HOB Library for management mode.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:25 +0000 (23:05 +0800)]
StandaloneMmPkg/HobLib: Add HOB Library for management mode.

The Standalone MM environment is initialized during the SEC phase on ARM
Standard Platforms. The MM Core driver implements an entry point module
which is architecture specific and runs prior to the generic core driver
code. The former creates a Hob list that the latter consumes. This
happens in the same phase.

This patch implements a Hob library that can be used by the entry point
module to produce a Hob list and by the core driver code to consume it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg/MemoryAllocationLib: Add MM memory allocation library.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:24 +0000 (23:05 +0800)]
StandaloneMmPkg/MemoryAllocationLib: Add MM memory allocation library.

This patch implements management mode memory allocation services.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg/MemLib: Add Standalone MM instance of memory check library.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:23 +0000 (23:05 +0800)]
StandaloneMmPkg/MemLib: Add Standalone MM instance of memory check library.

MM memory check library library implementation. This library consumes
MM_ACCESS_PROTOCOL to get MMRAM information. In order to use this
library instance, the platform should produce all MMRAM range via
MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core
and MM driver) and/or specific dedicated hardware.

This patch provides services for MM Memory Operation.
The management mode Mem Library provides function for checking if buffer
is outside MMRAM and valid. It also provides functions for copy data
from MMRAM to non-MMRAM, from non-MMRAM to MMRAM,
from non-MMRAM to non-MMRAM, or set data in non-MMRAM.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg/FvLib: Add a common FV Library for management mode.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:22 +0000 (23:05 +0800)]
StandaloneMmPkg/FvLib: Add a common FV Library for management mode.

This patch implements a firmware volume library that can be used by the
Standalone management mode core module to parse the firmware volume.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoStandaloneMmPkg: Delete StandaloneMmPkg file.
Supreeth Venkatesh [Fri, 13 Jul 2018 15:05:21 +0000 (23:05 +0800)]
StandaloneMmPkg: Delete StandaloneMmPkg file.

This patch deletes "StandaloneMmPkg" which was created as a file
intially. This patch enables creation of "StandaloneMmPkg" as a folder.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
5 years agoUefiCpuPkg/CpuDxe: fix incorrect check of SMM mode
Jian J Wang [Fri, 13 Jul 2018 04:46:58 +0000 (12:46 +0800)]
UefiCpuPkg/CpuDxe: fix incorrect check of SMM mode

Current IsInSmm() method makes use of gEfiSmmBase2ProtocolGuid.InSmm() to
check if current processor is in SMM mode or not. But this is not correct
because gEfiSmmBase2ProtocolGuid.InSmm() can only detect if the caller is
running in SMRAM or from SMM driver. It cannot guarantee if the caller is
running in SMM mode. Because SMM mode will load its own page table, adding
an extra check of saved DXE page table base address against current CR3
register value can help to get the correct answer for sure (in SMM mode or
not in SMM mode).

There's indiscriminate uses of Context.X64 and Context.Ia32 in code which
is not a good coding practice and will cause potential issue. In addition,
the related structure type definition is not packed and has also potential
issue. This will not be covered by this patch but be tracked by a bug below.

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

This is an issue caused by check-in at

  2a1408d1d739ead00c96397549be7a9fc53c9c6e

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/MpInitLib: Fix VS2012 build failure
Eric Dong [Fri, 20 Jul 2018 01:36:41 +0000 (09:36 +0800)]
UefiCpuPkg/MpInitLib: Fix VS2012 build failure

Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Remove useless code.
Eric Dong [Thu, 19 Jul 2018 12:11:21 +0000 (20:11 +0800)]
UefiCpuPkg/MpInitLib: Remove useless code.

Remove the useless code error added by change
58942277bcbf41abda5f6e3a1c89d571105d5983.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/MpInitLib: Optimize get processor number performance.
Eric Dong [Wed, 4 Jul 2018 08:29:07 +0000 (16:29 +0800)]
UefiCpuPkg/MpInitLib: Optimize get processor number performance.

Current function has low performance because it calls GetApicId
in the loop, so it maybe called more than once.

New logic call GetApicId once and base on this value to search
the processor.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <vanjeff_919@hotmail.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoOvmfPkg/AcpiPlatformDxe: clean up libs and protos in "AcpiPlatformDxe.inf"
Laszlo Ersek [Wed, 18 Jul 2018 12:00:25 +0000 (14:00 +0200)]
OvmfPkg/AcpiPlatformDxe: clean up libs and protos in "AcpiPlatformDxe.inf"

None of the source files referenced by "AcpiPlatformDxe.inf" #include
"MdePkg/Include/Library/DxeServicesLib.h" or use interfaces declared
therein, so drop DxeServicesLib from [LibraryClasses].

"AcpiPlatformDxe.inf" references "AcpiPlatform.c", which installs ACPI
tables built into the firmware image from under "OvmfPkg/AcpiTables/", in
case dynamically generated ACPI tables are not available from Xen or QEMU.
For this, the driver consumes gEfiFirmwareVolume2ProtocolGuid. Account for
that in [Protocols].

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Reported-by: Steven Shi <steven.shi@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1014
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoUefiCpuPkg/MpInitLib: Fix S3 resume hang issue.
Eric Dong [Wed, 27 Jun 2018 08:42:51 +0000 (16:42 +0800)]
UefiCpuPkg/MpInitLib: Fix S3 resume hang issue.

When resume from S3 and CPU loop mode is MWait mode,
if driver calls APs to do task at EndOfPei point, the
APs can't been wake up and bios hang at that point.

The root cause is PiSmmCpuDxeSmm driver wakes up APs
with HLT mode during S3 resume phase to do SMM relocation.
After this task, PiSmmCpuDxeSmm driver not restore APs
context which make CpuMpPei driver saved wake up buffer
not works.

The solution for this issue is let CpuMpPei driver hook
S3SmmInitDone ppi notification. In this notify function,
it check whether Cpu Loop mode is not HLT mode. If yes,
CpuMpPei driver will set a flag to force BSP use INIT-SIPI
-SIPI command to wake up the APs.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Load uCode once for each core.
Eric Dong [Thu, 12 Jul 2018 10:21:01 +0000 (18:21 +0800)]
UefiCpuPkg/MpInitLib: Load uCode once for each core.

The SDM requires only one thread per core to load the
microcode.

This change enables this solution.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Use BSP uCode for APs if possible.
Eric Dong [Wed, 11 Jul 2018 11:07:28 +0000 (19:07 +0800)]
UefiCpuPkg/MpInitLib: Use BSP uCode for APs if possible.

Search uCode costs much time, if AP has same processor type
with BSP, AP can use BSP saved uCode info to get better performance.

This change enables this solution.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Relocate uCode to memory to save time.
Eric Dong [Fri, 13 Jul 2018 00:40:27 +0000 (08:40 +0800)]
UefiCpuPkg/MpInitLib: Relocate uCode to memory to save time.

Read uCode from memory has better performance than from flash.
But it needs extra effort to let BSP copy uCode from flash to
memory. Also BSP already enable cache in SEC phase, so it use
less time to relocate uCode from flash to memory. After
verification, if system has more than one processor, it will
reduce some time if load uCode from memory.

This change enable this optimization.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoBaseTools: Remove the duplicate Pcd items
Yonghong Zhu [Fri, 13 Jul 2018 08:07:06 +0000 (16:07 +0800)]
BaseTools: Remove the duplicate Pcd items

The case is the Pcd item both used in 1 module inf and 1 lib inf, and
in the DSC component section, it override the Pcd value.
In the module, the pcd value is the override value, but in the lib inf
the pcd value is the value that in the DSC PCD section's value, then it
cause the Pcd value is different in the module and lib. but actually we
only need use the Pcd value in the module to decide whether it use the
same value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoSecurityPkg:Tcg: Fix comment typos
Zhang, Chao B [Mon, 16 Jul 2018 07:12:15 +0000 (15:12 +0800)]
SecurityPkg:Tcg: Fix comment typos

"Triggle" is a typo. Replace it with "Trigger"

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: Long Qin <qin.long@intel.com>
5 years agoBaseTools: Fixed build Ovmfpkg failed issue.
BobCF [Mon, 16 Jul 2018 09:38:44 +0000 (17:38 +0800)]
BaseTools: Fixed build Ovmfpkg failed issue.

Fixed the regression issues caused by 543f5ac30facfbb40eafb2b4908649a427784080

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Use absolute import in Scripts
Gary Lin [Fri, 13 Jul 2018 10:18:47 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Scripts

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in Workspace
Gary Lin [Fri, 13 Jul 2018 10:18:46 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Workspace

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in UPT
Gary Lin [Fri, 13 Jul 2018 10:18:45 +0000 (18:18 +0800)]
BaseTools: Use absolute import in UPT

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in Table
Gary Lin [Fri, 13 Jul 2018 10:18:44 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Table

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in Eot
Gary Lin [Fri, 13 Jul 2018 10:18:43 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Eot

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in Ecc
Gary Lin [Fri, 13 Jul 2018 10:18:42 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Ecc

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Treat Ecc.py as a python module
Gary Lin [Fri, 13 Jul 2018 10:18:41 +0000 (18:18 +0800)]
BaseTools: Treat Ecc.py as a python module

Since Ecc.py import modules from its own directory, add "-m" to the
python parameters so that they can import its own modules after adopting
absolute import.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in Common
Gary Lin [Fri, 13 Jul 2018 10:18:40 +0000 (18:18 +0800)]
BaseTools: Use absolute import in Common

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in BPDG
Gary Lin [Fri, 13 Jul 2018 10:18:39 +0000 (18:18 +0800)]
BaseTools: Use absolute import in BPDG

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Treat BPDG.py as a python module
Gary Lin [Fri, 13 Jul 2018 10:18:38 +0000 (18:18 +0800)]
BaseTools: Treat BPDG.py as a python module

Since BPDG.py import modules from its own directory, add "-m" to the
python parameters so that they can import its own modules after adopting
absolute import.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in AutoGen
Gary Lin [Fri, 13 Jul 2018 10:18:37 +0000 (18:18 +0800)]
BaseTools: Use absolute import in AutoGen

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Move ImageBinDict to GenFdsGlobalVariable.py
Gary Lin [Fri, 13 Jul 2018 10:18:36 +0000 (18:18 +0800)]
BaseTools: Move ImageBinDict to GenFdsGlobalVariable.py

Move "ImageBinDict" from GenFds.py to GenFdsGlobalVariable.py so that we
can remove the requirement to import GenFds.GenFds in Capsule.py, Fd.py and
Fv.py. This breaks the following circular imports:

* GenFds.FdfParser => GenFds.Capsule => GenFds.GenFds => GenFds.FdfParser
* GenFds.FdfParser => GenFds.Fd => GenFds.GenFds => GenFds.FdfParser
* GenFds.FdfParser => GenFds.Fd => GenFds.Fv => GenFds.GenFds =>
  GenFds.FdfParser

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Move FindExtendTool to GenFdsGlobalVariable.py
Gary Lin [Fri, 13 Jul 2018 10:18:35 +0000 (18:18 +0800)]
BaseTools: Move FindExtendTool to GenFdsGlobalVariable.py

Importing "FindExtendTool" from GenFds.GenFds could create the following
circular imports:

* GenFds.FdfParser => GenFds.Capsule => GenFds.GenFds => GenFds.FdfParser
* GenFds.FdfParser => GenFds.Fd => GenFds.Fv => GenFds.AprioriSection =>
  GenFds.FfsFileStatement => GenFds.GuidSection => GenFds.GenFds =>
  GenFds.FdfParser

This commit moves "FindExtendTool" to GenFdsGlobalVariable.py to break
the circles. Besides, FindExtendTool is tweaked slightly with the
following changes:

ToolDefClassObject.ToolDefDict => ToolDefDict
TAB_GUID => DataType.TAB_GUID
TAB_TOD_DEFINES_TARGET => DataType.TAB_TOD_DEFINES_TARGET
TAB_TOD_DEFINES_TOOL_CHAIN_TAG => DataType.TAB_TOD_DEFINES_TOOL_CHAIN_TAG
TAB_TOD_DEFINES_TARGET_ARCH => DataType.TAB_TOD_DEFINES_TARGET_ARCH

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Move OverrideAttribs to OptRomInfStatement.py
Gary Lin [Fri, 13 Jul 2018 10:18:34 +0000 (18:18 +0800)]
BaseTools: Move OverrideAttribs to OptRomInfStatement.py

Move "class OverrideAttribs" to OptRomInfStatement.py to remove
"import OptionRom" which may form a circular import:
GenFds.OptionRom => GenFds.OptRomInfStatement => GenFds.OptionRom

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Use absolute import in GenFds
Gary Lin [Fri, 13 Jul 2018 10:18:33 +0000 (18:18 +0800)]
BaseTools: Use absolute import in GenFds

Based on "futurize -f libfuturize.fixes.fix_absolute_import"

Since circular import is not allowed after adopting absolute import, the
following changes are applied to break the circles.

* BaseTools/Source/Python/GenFds/Capsule.py
  - Delay "from .GenFds import GenFds" until GenCapsule()
  - Delay "from .GenFds import FindExtendTool" until GenFmpCapsule()
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.Capsule => GenFds.GenFds =>
  GenFds.FdfParser

* BaseTools/Source/Python/GenFds/Fd.py
  - Delay "from .GenFds import GenFds" until GenFd()
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.GenFds =>
  GenFds.FdfParser

* BaseTools/Source/Python/GenFds/Fv.py
  - Delay "from .GenFds import GenFds" until AddToBuffer()
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.Fv =>
  GenFds.GenFds => GenFds.FdfParser

* BaseTools/Source/Python/GenFds/GuidSection.py
  - Delay "from .GenFds import FindExtendTool" until GuidSection()
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.Fv =>
  GenFds.AprioriSection => GenFds.FfsFileStatement => GenFds.GuidSection =>
  GenFds.GenFds => GenFds.FdfParser

* BaseTools/Source/Python/GenFds/OptRomInfStatement.py
  - Delay "from . import OptionRom" until __GetOptRomParams()
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.OptionRom =>
  GenFds.OptRomInfStatement => GenFds.OptionRom

* BaseTools/Source/Python/GenFds/OptionRom.py
  - Remove the unused "from GenFds import GenFds"
  To break the circle:
  AutoGen.AutoGen => GenFds.FdfParser => GenFds.OptionRom =>
  GenFds.GenFds => GenFds.FdfParser

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Treat GenFds.py as a python module
Gary Lin [Fri, 13 Jul 2018 10:18:32 +0000 (18:18 +0800)]
BaseTools: Treat GenFds.py as a python module

Since GenFds.py import modules from its own directory, add "-m" to the
python parameters so that they can import its own modules after adopting
absolute import.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Enable structure pcd in FDF file
BobCF [Fri, 22 Jun 2018 09:14:13 +0000 (17:14 +0800)]
BaseTools: Enable structure pcd in FDF file

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg/PerformanceMeasurement.h: Correct the license
Dandan Bi [Thu, 12 Jul 2018 13:58:28 +0000 (21:58 +0800)]
MdeModulePkg/PerformanceMeasurement.h: Correct the license

Corrected to use the BSD license.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Dmitry Antipov <dmanti@microsoft.com>
5 years agoArmVirtPkg/ArmVirtQemu: enable the IPv6 stack
Laszlo Ersek [Thu, 12 Jul 2018 23:41:12 +0000 (01:41 +0200)]
ArmVirtPkg/ArmVirtQemu: enable the IPv6 stack

Add the IPv6 stack to ArmVirtQemu with a cumulative port of the following
OvmfPkg commits:

36c6413f76e5 "OvmfPkg: enable the IPv6 support", 2014-12-19

96302b80d90e "OvmfPkg: Enable Network2 Shell Commands for IPv6",
               2016-03-08

6d0f8941bdc2 "OvmfPkg: always resolve OpenSslLib, IntrinsicLib and
               BaseCryptLib", 2017-01-17

32e22f20c985 "OvmfPkg: correct the IScsiDxe module included for the IPv6
               stack", 2017-01-17

The IPv6-enabled IScsiDxe driver depends on BaseCryptLib, and the
"CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf" instance depends on
IntrinsicLib and OpensslLib. This is why commit 6d0f8941bdc2 is relevant.

However, unlike in OvmfPkg, in ArmVirtPkg we'll precisely track the
firmware features that require these library classes. (The OvmfPkg
discussion was quite complex, and the OvmfPkg solution was a compromise:
<http://mid.mail-archive.com/1484569332-13440-1-git-send-email-jiaxin.wu@intel.com>.)

The ArmVirtXen platform is not extended with the relevant drivers because
currently it doesn't include any networking support.

Cc: Julien Grall <julien.grall@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1007
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoArmVirtPkg: unify HttpLib resolutions in "ArmVirt.dsc.inc"
Laszlo Ersek [Thu, 12 Jul 2018 23:41:11 +0000 (01:41 +0200)]
ArmVirtPkg: unify HttpLib resolutions in "ArmVirt.dsc.inc"

We already resolve a number of networking-related library classes in
ArmVirt.dsc.inc; follow suit with HttpLib.

Cc: Julien Grall <julien.grall@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1007
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoShellPkg/TftpDynamicCommand: Fix the potential assertion and memory leak issue.
Jiaxin Wu [Thu, 26 Apr 2018 06:13:57 +0000 (14:13 +0800)]
ShellPkg/TftpDynamicCommand: Fix the potential assertion and memory leak issue.

This patch is to fix the issue reported from
https://bugzilla.tianocore.org/show_bug.cgi?id=925.

DataSize variable was not assigned the value if ShellOpenFileByName returns error.
In the such a case, it should not be used to FreePages. Instead, DataSize can be
used to record the file size once DownloadFile successfully.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Jaben Carsey <jaben.carsey@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: Jaben Carsey <jaben.carsey@intel.com>
5 years agoMdeModulePkg CapsuleApp: Fix typo EFI_CAPSULE_RPORT_GUID
Star Zeng [Wed, 11 Jul 2018 03:48:37 +0000 (11:48 +0800)]
MdeModulePkg CapsuleApp: Fix typo EFI_CAPSULE_RPORT_GUID

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Refine -D option help information
Star Zeng [Wed, 11 Jul 2018 03:47:24 +0000 (11:47 +0800)]
MdeModulePkg CapsuleApp: Refine -D option help information

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoMdeModulePkg CapsuleApp: Check Arg count for -D option
Star Zeng [Wed, 11 Jul 2018 03:45:50 +0000 (11:45 +0800)]
MdeModulePkg CapsuleApp: Check Arg count for -D option

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
5 years agoSecurityPkg: Fix assert when setting key from eMMC/SD/USB
Roman Bacik [Tue, 10 Jul 2018 22:51:05 +0000 (15:51 -0700)]
SecurityPkg: Fix assert when setting key from eMMC/SD/USB

When secure boot is enabled, if one loads keys from a FAT formatted
eMMC/SD/USB when trying to provision PK/KEK/DB keys via the menu,
an assert in StrLen() occurs.
This is because the filename starts on odd address, which is not a uint16
aligned boundary: https://bugzilla.tianocore.org/show_bug.cgi?id=1003

There are further known issues with the OpenFileByDevicePath() function;
those are tracked by
<https://bugzilla.tianocore.org/show_bug.cgi?id=1008>.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
[lersek@redhat.com: whitespace fixes]
[lersek@redhat.com: reference TianoCore BZ#1008]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoBaseTool: Fixed the incorrect cache key.
bob.c.feng@intel.com [Tue, 10 Jul 2018 16:19:24 +0000 (00:19 +0800)]
BaseTool: Fixed the incorrect cache key.

This patch is to fix the incorrect cache key of
skip ModuleAutoGen cache.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Avoid calling PEI services from AP
Ni, Ruiyu [Mon, 2 Jul 2018 06:01:35 +0000 (14:01 +0800)]
UefiCpuPkg/MpInitLib: Avoid calling PEI services from AP

Today's MpInitLib PEI implementation directly calls
PeiServices->GetHobList() from AP which may cause racing issue.

This patch fixes this issue by duplicating IDT for APs.
Because CpuMpData structure is stored just after IDT, the CpuMPData
address equals to IDTR.BASE + IDTR.LIMIT + 1.

v2:
  1. Add ALIGN_VALUE() on BufferSize.
  2. Add ASSERT() to make sure no memory usage outside of the allocated buffer.
  3. Add more comments in InitConfig path when restoring CpuData[0].VolatileRegisters.

Cc: Jeff Fan <vanjeff_919@hotmail.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Fish Andrew <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoNetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.
Jiaxin Wu [Mon, 2 Jul 2018 01:48:12 +0000 (09:48 +0800)]
NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

*v2: Resolve the conflict commit.

*v3: Fixed the failure if BodyLength in HTTP token is less than the received
size of HTTPS message.

HttpBodyParserCallback function is to parse the HTTP(S) message body so as to
confirm whether there is the next message header. But it doesn't record the
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Gary Lin <glin@suse.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>
Tested-by: Gary Lin <glin@suse.com>
5 years agoBaseTools/GenFw: Disable support for R_X86_64_32S
Zenith432 [Tue, 10 Jul 2018 08:50:36 +0000 (16:50 +0800)]
BaseTools/GenFw: Disable support for R_X86_64_32S

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

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools/GenFw: Add X64 GOTPCREL Support to GenFw
Zenith432 [Mon, 9 Jul 2018 12:58:15 +0000 (20:58 +0800)]
BaseTools/GenFw: Add X64 GOTPCREL Support to GenFw

Adds support for the following X64 ELF relocations to GenFw
  R_X86_64_GOTPCREL
  R_X86_64_GOTPCRELX
  R_X86_64_REX_GOTPCRELX

Background:
The GCC49 and GCC5 toolchains use the small pie model for X64.  In the
small pie model, gcc emits a GOTPCREL relocation whenever C code takes
the address of a global function.  The emission of GOTPCREL is mitigated
by several factors
1. In GCC49, all global symbols are declared hidden thereby eliminating
the emission of GOTPCREL.
2. In GCC5, LTO is used.  In LTO, the complier first creates intermediate
representation (IR) files.  During the static link stage, the LTO compiler
combines all IR files as a single compilation unit, using linker symbol
assistance to generate code.  Any global symbols defined in the IR that
are not referenced from outside the IR are converted to local symbols -
thereby eliminating the emission of GOTPCREL for them.
3. The linker (binutils ld) further transforms any GOTPCREL used with
the movq opcode to a direct rip-relative relocation used with the leaq
opcode.  This linker optimization can be disabled with the option
-Wl,--no-relax.  Furthermore, gcc is able to emit GOTPCREL with other
opcodes
  - pushq opcode for passing arguments to functions.
  - addq/subq opcodes for pointer arithmetic.
These other opcode uses are not transformed by the linker.
Ultimately, in GCC5 there are some emissions of GOTPCREL that survive
all these mitigations - if C code takes the address of a global function
defined in assembly code - and performs pointer arithmetic on the
address - then the GOTPCREL remains in the final linker product.
A GOTPCREL relocation today causes the build to stop since GenFw does
not handle them.  It is possible to eliminate any remaining GOTPCREL
emissions by manually declaring the global symbols causing them to have
hidden visibility.  This patch is offered instead to allow GenFw to
handle any residual GOTPCREL.

Cc: Shi Steven <steven.shi@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg CapsuleApp: Fix NestedCapsuleHeader->Flags assigned wrong
Star Zeng [Tue, 10 Jul 2018 10:12:56 +0000 (18:12 +0800)]
MdeModulePkg CapsuleApp: Fix NestedCapsuleHeader->Flags assigned wrong

(FwType == ESRT_FW_TYPE_DEVICEFIRMWARE) ? system : device
should be
(FwType == ESRT_FW_TYPE_SYSTEMFIRMWARE) ? system : device

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ming Shao <ming.shao@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>
5 years agoSignedCapsulePkg RecoveryModuleLoadPei: Fix typo 'Press' to 'Process'
Star Zeng [Tue, 10 Jul 2018 09:19:15 +0000 (17:19 +0800)]
SignedCapsulePkg RecoveryModuleLoadPei: Fix typo 'Press' to 'Process'

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ming Shao <ming.shao@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>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Fix typo 'Press' to 'Process'
Star Zeng [Tue, 10 Jul 2018 09:18:27 +0000 (17:18 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Fix typo 'Press' to 'Process'

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ming Shao <ming.shao@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>
5 years agoSecurityPkg/OpalPassword: Fixed input correct password not works issue
Eric Dong [Tue, 10 Jul 2018 02:30:20 +0000 (10:30 +0800)]
SecurityPkg/OpalPassword: Fixed input correct password not works issue

When user input error password exceed the max allowed times, opal device
will return Invalid type error code even user input the correct password.
In this case, opal driver needs to force user shutdown the system before
let user input new password.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoSecurityPkg/TcgStorageOpalLib: Return AUTHORITY_LOCKED_OUT error.
Eric Dong [Tue, 10 Jul 2018 02:24:30 +0000 (10:24 +0800)]
SecurityPkg/TcgStorageOpalLib: Return AUTHORITY_LOCKED_OUT error.

Caller need to known this error to handle specially, but current
error status not has specified value for this type. In order to
keep compatibility, here use TcgResultFailureInvalidType as an
replacement.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>