mirror_edk2.git
2 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix GCC build failure
Dandan Bi [Mon, 30 Jul 2018 01:59:47 +0000 (09:59 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix GCC build failure

Fix following GCC build issues:
1.
xxx/SratParser.c:127:47: error:
initialization from incompatible pointer type
[-Werror=incompatible-pointer-types]
{L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
                                            ^
xxx/SratParser.c:127:47: note:
(near initialization for 'SratApciSapicAffinityParser[6].PrintFormatter')

2.
xxx\UefiShellAcpiViewCommandLib.c:66:14:
error: 'Status' may be used uninitialized in this fu
nction [-Werror=maybe-uninitialized]
   EFI_STATUS Status;
              ^

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@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>
2 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure
Dandan Bi [Mon, 30 Jul 2018 01:31:36 +0000 (09:31 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure

Fix following build error:
UefiShellAcpiViewCommandLib\AcpiParser.c(519) :
error C2308: concatenating mismatched strings
Concatenating wide "ERROR: %a: Offset Mismatch for %s"
with narrow "CurrentOffset = %d FieldOffset = %d"

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@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>
2 years agoShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure
Dandan Bi [Mon, 30 Jul 2018 01:25:11 +0000 (09:25 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure

Fix following build error:
xxx\AcpiParser.c(487) : error C2275: 'UINTN' :
illegal use of this type as an expression
xxx\ProcessorBind.h(224) : see declaration of 'UINTN'
xxx\AcpiParser.c(487) : error C2146: syntax error :
missing ';' before identifier 'OriginalAttribute'
xxx\AcpiParser.c(487) : error C2065: 'OriginalAttribute' :
undeclared identifier
......

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@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>
2 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference
Hao Wu [Mon, 30 Jul 2018 05:20:13 +0000 (13:20 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference

Within function GetUefiMemoryAttributesTable(), add a check to avoid
possible null pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdePkg/SmmMemLib: Avoid possible NULL ptr dereference
Hao Wu [Mon, 30 Jul 2018 05:17:31 +0000 (13:17 +0800)]
MdePkg/SmmMemLib: Avoid possible NULL ptr dereference

Within function SmmMemLibInternalGetUefiMemoryAttributesTable(), add a
check to avoid possible null pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoBaseTools: Update build report for StructurePcd value
Yunhua Feng [Wed, 25 Jul 2018 04:26:09 +0000 (12:26 +0800)]
BaseTools: Update build report for StructurePcd value

Update build report to display the structure Pcd value that from
FDF file.

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>
2 years agoBaseTools: Fix build crash when fdf is empty file
Yunhua Feng [Wed, 25 Jul 2018 04:21:54 +0000 (12:21 +0800)]
BaseTools: Fix build crash when fdf is empty file

Fix build crash when fdf is empty file

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

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>
2 years agoMdeModulePkg DxeCapsuleLibFmp: Fix typo "EsrtSyncFmp" to "SyncEsrtFmp"
Star Zeng [Fri, 27 Jul 2018 11:05:54 +0000 (19:05 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Fix typo "EsrtSyncFmp" to "SyncEsrtFmp"

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoSecurityPkg:DSC: Fix 2 DSC build error
Zhang, Chao B [Sat, 28 Jul 2018 05:33:33 +0000 (13:33 +0800)]
SecurityPkg:DSC: Fix 2 DSC build error

Error is caused by SHA384/SHA512 hash lib change in.

Cc: Bi Dandan <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
2 years agoSecurityPkg: HashLib: Add SHA384, SHA512 HashLib
Zhang, Chao B [Wed, 6 Jun 2018 03:24:54 +0000 (11:24 +0800)]
SecurityPkg: HashLib: Add SHA384, SHA512 HashLib

Add SHA384, 512 Hash lib support. Now only CryptoPkg support PEI/DXE
version.

Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang Chao B <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
2 years agoMdeModulePkg CapsuleApp: Check capsule header for -D and -N options
Star Zeng [Thu, 26 Jul 2018 08:59:43 +0000 (16:59 +0800)]
MdeModulePkg CapsuleApp: Check capsule header for -D and -N options

Then meaningful error message can be shown when the input image is
unexpected.

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>
2 years agoMdeModulePkg CapsuleApp: Prompt info for -C option
Star Zeng [Thu, 26 Jul 2018 02:14:00 +0000 (10:14 +0800)]
MdeModulePkg CapsuleApp: Prompt info for -C 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>
2 years agoMdeModulePkg CapsuleApp: Index need be decimal for -P GET option
Star Zeng [Thu, 26 Jul 2018 01:58:00 +0000 (09:58 +0800)]
MdeModulePkg CapsuleApp: Index need be decimal for -P GET option

Also adjust the help information to be not too long to be suitable
for different display resolutions.

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>
2 years agoMdeModulePkg CapsuleApp: Refine -N option help information
Star Zeng [Wed, 25 Jul 2018 11:26:40 +0000 (19:26 +0800)]
MdeModulePkg CapsuleApp: Refine -N option help information

-N option is used to append a Capsule Header to an existing
FMP capsule image with its ImageTypeId supported by the system.

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>
2 years agoMdeModulePkg CapsuleApp: Fix -D failed to dump Nest FMP capsule
Star Zeng [Thu, 19 Jul 2018 03:03:25 +0000 (11:03 +0800)]
MdeModulePkg CapsuleApp: Fix -D failed to dump Nest FMP capsule

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>
2 years agoMdeModulePkg CapsuleApp: Fix VS2012 build failure caused by 5410502
Star Zeng [Tue, 24 Jul 2018 09:02:47 +0000 (17:02 +0800)]
MdeModulePkg CapsuleApp: Fix VS2012 build failure caused by 5410502

The build failure is like below.
xxx\CapsuleApp.c(868) : error C2275: 'EFI_GUID' :
  illegal use of this type as an expression
        xxx/UefiBaseType.h(29) : see declaration of 'EFI_GUID'
xxx\CapsuleApp.c(868) : error C2146: syntax error :
  missing ';' before identifier 'ImageTypeId'
xxx\CapsuleApp.c(868) : error C2065: 'ImageTypeId' : undeclared identifier
xxx\CapsuleApp.c(869) : error C2275: 'UINTN' :
  illegal use of this type as an expression
        xxx\ProcessorBind.h(224) : see declaration of 'UINTN'
xxx\CapsuleApp.c(869) : error C2146: syntax error :
  missing ';' before identifier 'ImageIndex'
xxx\CapsuleApp.c(869) : error C2065: 'ImageIndex' : undeclared identifier

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
2 years agoMdeModulePkg DxeCapsuleLibFmp: Refine the code to check FmpImageSize
Star Zeng [Thu, 26 Jul 2018 05:57:11 +0000 (13:57 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Refine the code to check FmpImageSize

The code to check FmpImageSize again OFFSET_OF
(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance)
can be refined to check against FmpImageHeaderSize.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdeModulePkg/BdsDxe: Call PlatformBootManagerUnableToBoot()
Ruiyu Ni [Tue, 3 Jul 2018 06:28:50 +0000 (14:28 +0800)]
MdeModulePkg/BdsDxe: Call PlatformBootManagerUnableToBoot()

When no boot option can be launched, BDS core calls
PlatformBootManagerUnableToBoot() to let platform BdsDxe handle it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
2 years agoMdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"
Ruiyu Ni [Tue, 3 Jul 2018 06:16:45 +0000 (14:16 +0800)]
MdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"

Commit d1de487dd2e77f4741abcbd71d19a8c93971fda0
"MdeModulePkg/BdsDxe: fall back to a Boot Manager Menu loop before
 hanging"
changed BDS core to fall back to UI loop when no bootable option
can be launched.
Now since PlatformBootManagerUnableToBoot() is added, the commit
can be reverted.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2 years agoArmVirtPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Wed, 4 Jul 2018 01:43:02 +0000 (09:43 +0800)]
ArmVirtPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
2 years agoArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Wed, 4 Jul 2018 01:32:47 +0000 (09:32 +0800)]
ArmPkg/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2 years agoQuarkPlatform/PlatformBDS: Implement PlatformBootManagerUnableToBoot
Ruiyu Ni [Tue, 3 Jul 2018 06:08:07 +0000 (14:08 +0800)]
QuarkPlatform/PlatformBDS: Implement PlatformBootManagerUnableToBoot

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>