]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
5 years agoSecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated
Zhang, Chao B [Fri, 18 May 2018 08:38:18 +0000 (16:38 +0800)]
SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated

Update package format info in _PRS to TcgNvs after memory is allocated.

Change-Id: Icfadb350e60d3ed2df332e92c257ce13309c0018
Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Long Qin <qin.long@intel.com>
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
5 years agoBaseTools: Separate HOST and PREFIX env for GCC tool chain
Liming Gao [Wed, 25 Apr 2018 10:11:42 +0000 (18:11 +0800)]
BaseTools: Separate HOST and PREFIX env for GCC tool chain

The crossing GCC compiler may use the different path for make and gcc tool.
So, GCC_HOST_BIN is introduced for make path. GCC5_BIN is still kept for
gcc path. User needs to set GCC_HOST_BIN besides set GCC5_BIN env if
the default make is not used. Normally, make is in the default system path.
GCC_HOST_BIN is not required to be set.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
5 years agoIntelFrameworkPkg/UefiLib: Fix build fail caused by commit b6d5def2fa
Dandan Bi [Fri, 18 May 2018 06:15:06 +0000 (14:15 +0800)]
IntelFrameworkPkg/UefiLib: Fix build fail caused by commit b6d5def2fa

In commit b6d5def2faf56334128ea2f056356d7e3852831e
when adding 'OUT' decorator for the parameter in AddUnicodeString(),
it delete the function name by mistake. This patch is to fix this
issue.

CC: Marvin Haeuser <Marvin.Haeuser@outlook.com>
CC: Liming Gao <liming.gao@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 agoMdePkg/SmmPeriodicSmiLib: Get Periodic SMI Context More Robustly
Ruiyu Ni [Wed, 9 May 2018 09:36:06 +0000 (17:36 +0800)]
MdePkg/SmmPeriodicSmiLib: Get Periodic SMI Context More Robustly

The PeriodicSmiDispatchFunction() in SmmPeriodicSmiLib may assert
with "Bad CR signature".

Currently, the SetActivePeriodicSmiLibraryHandler() function
(invoked at the beginning of the PeriodicSmiDispatchFunction()
function) attempts to locate the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT
structure pointer for the current periodic SMI from a given
EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT (RegiserContext) structure
pointer (using the CR macro).

The RegisterContext structure pointer passed to the
PeriodicSmiDispatchFunction() is assumed to point to the same
RegisterContext structure address given to the
SmmPeriodicTimerDispatch2 protocol Register() API in
PeriodicSmiEnable().

However, certain SmmPeriodicTimerDispatch2 implementation may copy
the RegisterContext to a local buffer and pass that address as the
context to PeriodicSmiDispatchFunction() in which case usage of the
CR macro to find the parent structure base fails.

The patch uses the LookupPeriodicSmiLibraryHandler() function to
find the PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT structure pointer.
This works even in this scenario since the DispatchHandle returned
from the SmmPeriodicTimerDispatch2 Register() function uniquely
identifies that registration.

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: Liming Gao <liming.gao@intel.com>
5 years agoOvmfPkg/PlatformBootManagerLib: connect Virtio RNG devices again
Laszlo Ersek [Thu, 17 May 2018 19:51:11 +0000 (21:51 +0200)]
OvmfPkg/PlatformBootManagerLib: connect Virtio RNG devices again

Virtio RNG devices are never boot devices, so in commit 245c643cc8b7 we
stopped connecting them. This is a problem because an OS boot loader may
depend on EFI_RNG_PROTOCOL to seed the OS's RNG.

Connect Virtio RNG devices again. And, while commit 245c643cc8b7 removed
that from PlatformBootManagerAfterConsole(), reintroduce it now to
PlatformBootManagerBeforeConsole() -- this way Driver#### options launched
between both functions may access EFI_RNG_PROTOCOL too.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1579518
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/PlatformBootManagerLib: connect Virtio RNG devices again
Laszlo Ersek [Thu, 17 May 2018 19:51:11 +0000 (21:51 +0200)]
ArmVirtPkg/PlatformBootManagerLib: connect Virtio RNG devices again

Virtio RNG devices are never boot devices, so in commit ff1d0fbfbaec we
stopped connecting them. This is a problem because an OS boot loader may
depend on EFI_RNG_PROTOCOL to seed the OS's RNG.

Connect Virtio RNG devices again. And, while commit ff1d0fbfbaec removed
that from PlatformBootManagerAfterConsole(), reintroduce it now to
PlatformBootManagerBeforeConsole() -- this way Driver#### options launched
between both functions may access EFI_RNG_PROTOCOL too.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: ff1d0fbfbaec55038ccf888759588fa4e21516f4
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1579518
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 agoOvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga
Gerd Hoffmann [Thu, 17 May 2018 09:21:33 +0000 (11:21 +0200)]
OvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga

This makes QemuVideo bind to the secondary-vga device.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoOvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD
Gerd Hoffmann [Thu, 17 May 2018 09:21:32 +0000 (11:21 +0200)]
OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD

Then check for PCI_CLASS_DISPLAY_VGA using the new field.
This allows to enable/disable non-vga display classes per
card entry.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoMdeModulePkg PeiCore: FvCount to be checked for the registered for shadow PEIM
Liming Gao [Wed, 16 May 2018 01:35:01 +0000 (09:35 +0800)]
MdeModulePkg PeiCore: FvCount to be checked for the registered for shadow PEIM

The PEIM in all cached FV image may be in registered for shadow status.
Current logic CurrentPeimFvCount is not enough.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoIntelFrameworkPkg/FrameworkUefiLib: Add 'OUT' decorator where necessary.
Marvin.Haeuser@outlook.com [Sat, 5 May 2018 14:23:55 +0000 (22:23 +0800)]
IntelFrameworkPkg/FrameworkUefiLib: Add 'OUT' decorator where necessary.

The functions AddUnicodeString() and AddUnicodeString2() might return
a new value into their parameter UnicodeStringTable, hence add the
appropiate 'OUT' decorator.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdePkg/UefiLib: Add 'OUT' decorator where necessary.
Marvin.Haeuser@outlook.com [Sat, 5 May 2018 14:23:54 +0000 (22:23 +0800)]
MdePkg/UefiLib: Add 'OUT' decorator where necessary.

The functions AddUnicodeString() and AddUnicodeString2() might return
a new value into their parameter UnicodeStringTable, hence add the
appropiate 'OUT' decorator.

V2: Update FrameworkUefiLib as well.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdePkg/PeiServicesLib: Decorate 'PpiDescriptor' as OPTIONAL for LocatePpi().
Marvin.Haeuser@outlook.com [Sat, 5 May 2018 14:24:50 +0000 (22:24 +0800)]
MdePkg/PeiServicesLib: Decorate 'PpiDescriptor' as OPTIONAL for LocatePpi().

The UEFI PI specification defines PpiDescriptor to be OPTIONAL for
the LocatePpi PEI Service. This patch reflects this in the function
declaration and definition of the corresponding PeiServices library
function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoSecurityPkg/TcgSTorage*Lib.h: Add referenced spec information.
Eric Dong [Tue, 8 May 2018 02:32:53 +0000 (10:32 +0800)]
SecurityPkg/TcgSTorage*Lib.h: Add referenced spec information.

Add link and version info for the referenced spec.

Cc: Jiewen yao <jiewen.yao@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 agoMdePkg/TcgStorage*.h: Add referenced spec information.
Eric Dong [Tue, 8 May 2018 02:32:52 +0000 (10:32 +0800)]
MdePkg/TcgStorage*.h: Add referenced spec information.

Add link and version info for the referenced spec.

Cc: Jiewen yao <jiewen.yao@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 agoBaseTools: Fix --hash Package and Module hash value.
Lin, Derek [Wed, 9 May 2018 09:03:23 +0000 (17:03 +0800)]
BaseTools: Fix --hash Package and Module hash value.

The order of List enumeration is arbitrary.
Need to be sorted while calculating Package/Module hash, otherwise it
generate different hash value even nothing changes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoSecurityPkg/OpalPassword: Fix PSID revert no hint message.
Eric Dong [Mon, 14 May 2018 07:28:40 +0000 (15:28 +0800)]
SecurityPkg/OpalPassword: Fix PSID revert no hint message.

For no warning message when do the PSID revert action, the
message in the popup dialog is not enough. The error use
of NULL for CreatePopUp function caused this regression.
This change fixed it.

Passed Unit Test:
1. Check PSID revert with/without warning message cases.

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: Fix GCC build failure.
Eric Dong [Mon, 14 May 2018 07:25:03 +0000 (15:25 +0800)]
SecurityPkg/TcgStorageOpalLib: Fix GCC build failure.

Function definition different with function implementation
caused this build failure. Change code to make them
consistent to pass the build.

Done Unit Test:
1. Pass GCC build.

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 agoOvmfPkg/PlatformBootManagerLib: connect consoles unconditionally
Laszlo Ersek [Sat, 12 May 2018 22:13:53 +0000 (00:13 +0200)]
OvmfPkg/PlatformBootManagerLib: connect consoles unconditionally

If both ConIn and ConOut exist, but ConIn references none of the PS/2
keyboard, the USB wild-card keyboard, and any serial ports, then
PlatformInitializeConsole() currently allows the boot to proceed without
any input devices at all. This makes for a bad user experience -- the
firmware menu could only be entered through OsIndications, set by a guest
OS.

Do what ArmVirtQemu does already, namely connect the consoles, and add
them to ConIn / ConOut / ErrOut, unconditionally. (The underlying
EfiBootManagerUpdateConsoleVariable() function checks for duplicates.)

The issue used to be masked by the EfiBootManagerConnectAll() call that
got conditionalized in commit 245c643cc8b7.

This patch is best viewed with "git show -b -W".

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1577546
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 agoMdeModulePkg Variable: Fix the returned status in UpdateVariableStore
cinnamon shia [Fri, 11 May 2018 15:21:12 +0000 (23:21 +0800)]
MdeModulePkg Variable: Fix the returned status in UpdateVariableStore

If Fvb is a NULL, return EFI_UNSUPPORTED.
If the remaining size is not enough, return EFI_OUT_OF_RESOURCES.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Signed-off-by: Ansen Huang <ansen.huang@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg Variable: Fix a corner case issue about setting a variable
cinnamon shia [Fri, 11 May 2018 15:21:11 +0000 (23:21 +0800)]
MdeModulePkg Variable: Fix a corner case issue about setting a variable

Fix the issue that failed to update or add a UEFI variable if the remaining size is equal to the data size
of the variable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Signed-off-by: Ansen Huang <ansen.huang@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoBaseTools: Fix python error with --genfds-multi-thread.
Lin, Derek [Wed, 9 May 2018 09:03:24 +0000 (17:03 +0800)]
BaseTools: Fix python error with --genfds-multi-thread.

When self.Alignment is None, it ran into python error since there is no
strip() in None.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Remove the redundant code
Yonghong Zhu [Wed, 9 May 2018 08:41:28 +0000 (16:41 +0800)]
BaseTools: Remove the redundant code

the ArraySize and Array already be got in line 1093, so this code are
redundant.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Fix generating array's size is incorrect in AutoGen.c
Yunhua Feng [Mon, 7 May 2018 10:26:24 +0000 (18:26 +0800)]
BaseTools: Fix generating array's size is incorrect in AutoGen.c

case example:
DSC:
 [PcdsFixedAtBuild]
  PcdToken.PcdName | "A"
 [Components]
 TestPkg/TestDriver.inf {
  PcdToken.PcdName | {0x41,0x42,0x43,0x44}
 }

Generating the size of array is incorrect in AutoGen.c
 GLOBAL_REMOVE_IF_UNREFERENCED const UINT8
 _gPcd_FixedAtBuild_PcdName[2] = {0x41,0x42,0x43,0x44};

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=950
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: incorrect calculation for 16M
Carsey, Jaben [Tue, 8 May 2018 16:01:35 +0000 (00:01 +0800)]
BaseTools: incorrect calculation for 16M

the "0x" was missing.

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 agoBaseTools/VfrCompile: Avoid using uninitialized pointer
Bi, Dandan [Wed, 9 May 2018 05:02:11 +0000 (13:02 +0800)]
BaseTools/VfrCompile: Avoid using uninitialized pointer

V2:
Add function _INIT_OPHDR_COND () for variable initialization.
Make code logic more clean.

Previously _CLEAR_SAVED_OPHDR () is used for variable
initialization, and we updated it to clean memory.
But _CLEAR_SAVED_OPHDR () is still called for variable
initialization. This will cause uninitialized pointer
will be checked to free and cause unexpected issue.

This patch is to add new function for variable initialization
and keep _CLEAR_SAVED_OPHDR () to clean memory which is
aligned with its function name.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Gary Lin <glin@suse.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 agoIntelSiliconPkg MicrocodeUpdateDxe: Honor FIT table
Star Zeng [Wed, 28 Mar 2018 08:52:12 +0000 (16:52 +0800)]
IntelSiliconPkg MicrocodeUpdateDxe: Honor FIT table

It is the second step for
https://bugzilla.tianocore.org/show_bug.cgi?id=540.

V2: Use error handling instead of ASSERT for FIT table checking result.

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>
5 years agoMdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling
Ruiyu Ni [Mon, 23 Apr 2018 06:20:26 +0000 (14:20 +0800)]
MdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling

RootBridgeIo.PollMem()/PollIo() originally don't count the IO/MMIO
access overhead when delaying.
The patch changes the implementation to count the access overhead
so that the actually delay equals to user required delay.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
5 years agoIntelFrameworkModule/LegacyBios: Use reserved memory for legacy data
Ruiyu Ni [Wed, 25 Apr 2018 07:05:54 +0000 (15:05 +0800)]
IntelFrameworkModule/LegacyBios: Use reserved memory for legacy data

Certain Legacy USB implementation needs to access legacy data (BDA,
etc.) from SMM environment. While currently it's not allowed to
access BS memory from SMM after EndofDxe, change the legacy data
to use reserved memory type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/SecMain: Add NORETURN decorator to SecStartup().
Marvin H?user [Tue, 27 Feb 2018 16:50:59 +0000 (00:50 +0800)]
UefiCpuPkg/SecMain: Add NORETURN decorator to SecStartup().

The function SecStartup() is not supposed to return. Hence, add the
NORETURN decorator.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoCryptoPkg/CrtLibSupport: add secure_getenv() stub function
Laszlo Ersek [Mon, 7 May 2018 19:59:23 +0000 (21:59 +0200)]
CryptoPkg/CrtLibSupport: add secure_getenv() stub function

The Fedora distro ships a modified OpenSSL 1.1.0 package stream. One of
their patches calls the secure_getenv() C library function. We already
have a stub for getenv(); it applies trivially to secure_getenv() as well.
Add the secure_getenv() stub so that edk2 can be built with Fedora's
OpenSSL 1.1.0 sources.

Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Long Qin <qin.long@intel.com>
5 years agoMdeModulePkg/AcpiPlatformDxe: Unload after execution.
Marvin.Haeuser@outlook.com [Mon, 7 May 2018 09:08:06 +0000 (17:08 +0800)]
MdeModulePkg/AcpiPlatformDxe: Unload after execution.

AcpiPlatformDxe solely performs one-time tasks and does not expose
any services or create any events. Hence it can safely be unloaded
after the Entry Point execution by returning an error code.

V2: Return EFI_REQUEST_UNLOAD_IMAGE.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg CapsuleApp: Check Buffer against NULL before freeing it
Star Zeng [Thu, 26 Apr 2018 09:16:47 +0000 (17:16 +0800)]
MdeModulePkg CapsuleApp: Check Buffer against NULL before freeing it

If the capsule from command line is not present,
Buffer will be random value when freeing it in DumpCapsule(),
then ASSERT will happen or other memory pool may be freed.

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>
5 years agoBaseTools: Correct the variable name
Yonghong Zhu [Mon, 7 May 2018 05:41:27 +0000 (13:41 +0800)]
BaseTools: Correct the variable name

the commit bff74750 introduce a undefined variable name 'scope' cause build
failure, it should use 'Scope'.

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 agoBaseTools: Retrieve /U and -U CC flags to structure PcdValueInit Makefile
Liming Gao [Fri, 4 May 2018 05:28:10 +0000 (13:28 +0800)]
BaseTools: Retrieve /U and -U CC flags to structure PcdValueInit Makefile

/D and -D flags have been added. So, /U and -U flags should be added.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoSecurityPkg/OpalPassword: Add support for pyrite 2.0 devices.
Eric Dong [Mon, 7 May 2018 05:27:40 +0000 (13:27 +0800)]
SecurityPkg/OpalPassword: Add support for pyrite 2.0 devices.

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: Add supports for pyrite 2.0 spec.
Eric Dong [Mon, 7 May 2018 05:31:43 +0000 (13:31 +0800)]
SecurityPkg/TcgStorageOpalLib: Add supports for pyrite 2.0 spec.

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 agoMdePkg: Add Feature definitions added in pyrite 2.0 spec.
Eric Dong [Thu, 3 May 2018 03:07:10 +0000 (11:07 +0800)]
MdePkg: Add Feature definitions added in pyrite 2.0 spec.

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 agoNetworkPkg/NetworkPkg.dsc: Add the instance of library class [SafeIntLib].
Jiaxin Wu [Fri, 4 May 2018 03:48:43 +0000 (11:48 +0800)]
NetworkPkg/NetworkPkg.dsc: Add the instance of library class [SafeIntLib].

This patch is to add the instance of library class [SafeIntLib] to fix the
NetworkPkg build error, which is caused by the commit of 2167c7f7 that the
TlsLib will always consume SafeIntLib.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Bi Dandan <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
5 years agoBaseTools/Conf: Add /Gw optimisation option for VS2017 IA32 and X64
Pete Batard [Tue, 24 Apr 2018 16:10:11 +0000 (00:10 +0800)]
BaseTools/Conf: Add /Gw optimisation option for VS2017 IA32 and X64

This option, which is used in VS2015 and earlier toolchains, was missing
for VS2017. Applying it greatly reduces the size of generated binaries.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Ecc - add dict for config file to internal translation
Carsey, Jaben [Fri, 4 May 2018 20:25:16 +0000 (04:25 +0800)]
BaseTools: Ecc - add dict for config file to internal translation

Commit eece4292acc80 changed a variable name, which was tied directly to
a config file entry. This seperates the internal variable names from
the config file entries by having the internal dict accessed through a
translation of key words.

added a test when this is run straight from command line.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: dont make iterator into list if not needed
Carsey, Jaben [Fri, 27 Apr 2018 22:32:54 +0000 (06:32 +0800)]
BaseTools: dont make iterator into list if not needed

functions (like join) can use the iterator just as easily.

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 agoBaseTools: use set instead of list
Carsey, Jaben [Fri, 27 Apr 2018 22:32:56 +0000 (06:32 +0800)]
BaseTools: use set instead of list

as we only do membership (in) testing for this, set is better

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 agoBaseTools: create base expression class
Carsey, Jaben [Fri, 27 Apr 2018 22:32:55 +0000 (06:32 +0800)]
BaseTools: create base expression class

this class has a fucntion to share between Exception and RangeExpression
change both classes to call this function init in their init

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 agoBaseTools: refactor Depex optomization
Carsey, Jaben [Fri, 27 Apr 2018 22:32:53 +0000 (06:32 +0800)]
BaseTools: refactor Depex optomization

No need to make a list from the set.  just pop the item off.

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 agoBaseTools: Remove lists form set construction
Carsey, Jaben [Fri, 27 Apr 2018 22:32:52 +0000 (06:32 +0800)]
BaseTools: Remove lists form set construction

There is no need to make a list to make a set.  remove lists
that are only used in constructing sets.

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 agoBaseTools: missed a copyright update
Carsey, Jaben [Fri, 27 Apr 2018 22:32:51 +0000 (06:32 +0800)]
BaseTools: missed a copyright update

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 agoBaseTools: GenFds - use existing shared string
Carsey, Jaben [Fri, 27 Apr 2018 22:32:50 +0000 (06:32 +0800)]
BaseTools: GenFds - use existing shared string

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 agoBaseTools: remove unused variable
Carsey, Jaben [Fri, 27 Apr 2018 22:32:49 +0000 (06:32 +0800)]
BaseTools: remove unused variable

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 agoBaseTools: standardize GUID and pack size
Carsey, Jaben [Fri, 27 Apr 2018 22:32:48 +0000 (06:32 +0800)]
BaseTools: standardize GUID and pack size

currently GUID packing and pack size determination is spread
throughout the code. This introduces a shared function and dict and
routes all code paths through them.

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 agoBaseTools: AutoGen - add Opcode constants
Carsey, Jaben [Fri, 27 Apr 2018 22:32:47 +0000 (06:32 +0800)]
BaseTools: AutoGen - add Opcode constants

add constants for dependency expression opcode strings
use these new opcode string constants

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 agoBaseTools: remove redundant content in InfSectionParser
Carsey, Jaben [Fri, 27 Apr 2018 22:32:45 +0000 (06:32 +0800)]
BaseTools: remove redundant content in InfSectionParser

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 agoBaseTools: remove unused member variable
Carsey, Jaben [Fri, 27 Apr 2018 22:32:44 +0000 (06:32 +0800)]
BaseTools: remove unused member variable

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 agoBaseTools: AutoGen - refactor more functions only called in __init__
Carsey, Jaben [Fri, 27 Apr 2018 22:32:43 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor more functions only called in __init__

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 agoBaseTools: AutoGen - refactor function to remove extra variables
Carsey, Jaben [Fri, 27 Apr 2018 22:32:42 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor function to remove extra variables

we dont need to keep data we already have in different formats...

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 agoBaseTools: Refactor to share GUID packing function
Carsey, Jaben [Fri, 27 Apr 2018 22:32:41 +0000 (06:32 +0800)]
BaseTools: Refactor to share GUID packing function

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 agoBaseTools: AutoGen - remove another function no one calls
Carsey, Jaben [Fri, 27 Apr 2018 22:32:40 +0000 (06:32 +0800)]
BaseTools: AutoGen - remove another function no one calls

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 agoBaseTools: AutoGen - move function to clean file namespace
Carsey, Jaben [Fri, 27 Apr 2018 22:32:39 +0000 (06:32 +0800)]
BaseTools: AutoGen - move function to clean file namespace

the function is only used in one other function.
just move it there.

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 agoBaseTools: AutoGen - remove function no one calls
Carsey, Jaben [Fri, 27 Apr 2018 22:32:38 +0000 (06:32 +0800)]
BaseTools: AutoGen - remove function no one calls

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 agoBaseTools: refactor __init__ functions to not compute temporary variable
Carsey, Jaben [Fri, 27 Apr 2018 22:32:37 +0000 (06:32 +0800)]
BaseTools: refactor __init__ functions to not compute temporary variable

just assign correct value to member variable in __init__ or call
parent __init__

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 agoBaseTools: AutoGen - no need to recompute
Carsey, Jaben [Fri, 27 Apr 2018 22:32:36 +0000 (06:32 +0800)]
BaseTools: AutoGen - no need to recompute

looping over a list and recomputing the same value has no impact on final 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: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: AutoGen - refactor out a useless class
Carsey, Jaben [Fri, 27 Apr 2018 22:32:35 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor out a useless class

this class was never instantiated.  the static function was called.
save the function, remove the rest.

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 agoBaseTools: AutoGen - refactor out a list
Carsey, Jaben [Fri, 27 Apr 2018 22:32:34 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor out a list

the lists were used in __init__ then converted to sets
instead just use the sets from the begining

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 agoBaseTools: AutoGen - refactor out functions only called in __init__
Carsey, Jaben [Fri, 27 Apr 2018 22:32:33 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor out functions only called in __init__

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 agoBaseTools: move PCD size calculation functions to PcdClassObject
Carsey, Jaben [Fri, 27 Apr 2018 22:32:32 +0000 (06:32 +0800)]
BaseTools: move PCD size calculation functions to PcdClassObject

move both GetPcdMaxSize and GetPcdSize to the PcdClassObject.
fix MAX_SIZE_TYPE to have int values

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 agoBaseTools: Workspace - refactor a dict
Carsey, Jaben [Fri, 27 Apr 2018 22:32:31 +0000 (06:32 +0800)]
BaseTools: Workspace - refactor a dict

change a dict to a set since we never examine the contents, just the keys.

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 agoBaseTools: remove Compound statements
Carsey, Jaben [Fri, 27 Apr 2018 22:32:30 +0000 (06:32 +0800)]
BaseTools: remove Compound statements

split them into 2 seperate lines.

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 agoBaseTools: eliminate {} from dictionary contructor call
Carsey, Jaben [Fri, 27 Apr 2018 22:32:29 +0000 (06:32 +0800)]
BaseTools: eliminate {} from dictionary contructor call

no need to construct 2 dictionaries.

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 agoBaseTools: refactor to use list not dict
Carsey, Jaben [Fri, 27 Apr 2018 22:32:28 +0000 (06:32 +0800)]
BaseTools: refactor to use list not dict

since we never access the values in the copied dict, just use a list instead.

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 agoBaseTools: AutoGen - UniClassObject refactor static methods
Carsey, Jaben [Fri, 27 Apr 2018 22:32:27 +0000 (06:32 +0800)]
BaseTools: AutoGen - UniClassObject refactor static methods

change methods which do not use self to @staticmethod
change their calls to use class name instead of instance

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 agoBaseTools: AutoGen - remove global line
Carsey, Jaben [Fri, 27 Apr 2018 22:32:26 +0000 (06:32 +0800)]
BaseTools: AutoGen - remove global line

this serves no purpose since we dont change the global or assign to it.

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 agoBaseTools: Eot - refactor global data
Carsey, Jaben [Fri, 27 Apr 2018 22:32:25 +0000 (06:32 +0800)]
BaseTools: Eot - refactor global data

remove unused lists, dicts, and duplicate variables

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 agoBaseTools: Eot - remove unused lists
Carsey, Jaben [Fri, 27 Apr 2018 22:32:24 +0000 (06:32 +0800)]
BaseTools: Eot - remove unused lists

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 agoBaseTools: AutoGen - refactor class factory
Carsey, Jaben [Fri, 27 Apr 2018 22:32:23 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor class factory

since instances are not added to cache, the factory does nothing.

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 agoBaseTools: AutoGen - share StripComments API
Carsey, Jaben [Fri, 27 Apr 2018 22:32:22 +0000 (06:32 +0800)]
BaseTools: AutoGen - share StripComments API

add the API root in one class file.
delete the static API out of both classes.
share it in the single location.

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 agoBaseTools: AutoGen - GenVar refactor static methods
Carsey, Jaben [Fri, 27 Apr 2018 22:32:21 +0000 (06:32 +0800)]
BaseTools: AutoGen - GenVar refactor static methods

change methods which do not use self to @staticmethod
change their calls to use class name instead of instance

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 agoBaseTools: AutoGen - refactor dictionary access
Carsey, Jaben [Fri, 27 Apr 2018 22:32:20 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor dictionary access

dont use dict.get() inside loops of dictionary contents. its not needed.

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 agoBaseTools: AutoGen - refactor assemble_variable
Carsey, Jaben [Fri, 27 Apr 2018 22:32:19 +0000 (06:32 +0800)]
BaseTools: AutoGen - refactor assemble_variable

make this function @staticmethod since self parameter is not used.
change valuelist to valuedict since it is a dictionary.

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 agoBaseTools: this function has no purpose.
Carsey, Jaben [Fri, 27 Apr 2018 22:32:18 +0000 (06:32 +0800)]
BaseTools: this function has no purpose.

it looks like a old POC of the concepts then used to make the classes
in the 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: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: check before accessing members in __eq__
Carsey, Jaben [Fri, 27 Apr 2018 22:32:17 +0000 (06:32 +0800)]
BaseTools: check before accessing members in __eq__

minimize risk for exceptions.

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 agoBaseTools: AutoGen - update to remove duplicate constant value
Carsey, Jaben [Fri, 27 Apr 2018 22:32:16 +0000 (06:32 +0800)]
BaseTools: AutoGen - update to remove duplicate constant value

PCD size by type is shared.  just use it.

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 agoBaseTools: FdfParser - update to remove duplicate constant value
Carsey, Jaben [Fri, 27 Apr 2018 22:32:15 +0000 (06:32 +0800)]
BaseTools: FdfParser - update to remove duplicate constant value

PCD size by type is shared so this change both removes duplication
and makes the function work for all numeric PCD types.

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 agoMdeModulePkg/Terminal: Check status of OpenProtocol in BindingStart
Ruiyu Ni [Fri, 13 Apr 2018 04:13:52 +0000 (12:13 +0800)]
MdeModulePkg/Terminal: Check status of OpenProtocol in BindingStart

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoSecurityPkg/UserProfileManagerDxe: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:33:14 +0000 (04:33 +0800)]
SecurityPkg/UserProfileManagerDxe: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoSecurityPkg/UserIdentifyManagerDxe: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:33:13 +0000 (04:33 +0800)]
SecurityPkg/UserIdentifyManagerDxe: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoSecurityPkg/PwdCredentialProviderDxe: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:33:12 +0000 (04:33 +0800)]
SecurityPkg/PwdCredentialProviderDxe: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoSecurityPkg/Tcg2Config: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:33:11 +0000 (04:33 +0800)]
SecurityPkg/Tcg2Config: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg/DriverHealthManagerDxe: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:32:27 +0000 (04:32 +0800)]
MdeModulePkg/DriverHealthManagerDxe: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg/RamDiskDxe: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:32:26 +0000 (04:32 +0800)]
MdeModulePkg/RamDiskDxe: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg/UiApp: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:32:25 +0000 (04:32 +0800)]
MdeModulePkg/UiApp: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoIntelFrameworkModulePkg/LegacyBootMaintUiLib: Update RouteConfig function
Thomas Palmer [Wed, 18 Apr 2018 20:31:35 +0000 (04:31 +0800)]
IntelFrameworkModulePkg/LegacyBootMaintUiLib: Update RouteConfig function

According to UEFI spec, the RouteConfig protocol function should populate
the Progress pointer with an address inside Configuration.  This patch
ensures that these functions are compliant when EFI_NOT_FOUND is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdePkg/DevicePathToText: Fix iSCSI.Lun byte order issue
Ruiyu Ni [Mon, 5 Mar 2018 03:27:34 +0000 (11:27 +0800)]
MdePkg/DevicePathToText: Fix iSCSI.Lun byte order issue

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: remove unused MigrationUtilities.py
Carsey, Jaben [Fri, 20 Apr 2018 15:51:46 +0000 (23:51 +0800)]
BaseTools: remove unused MigrationUtilities.py

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 agoBaseTools: remove redundant if comparison
Carsey, Jaben [Fri, 20 Apr 2018 15:51:42 +0000 (23:51 +0800)]
BaseTools: remove redundant if comparison

inherently python will check string and list for None and having data

if <x> in [None, ''] and similar are superflous.

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 agoBaseTools: replace string with predefined constant
Carsey, Jaben [Thu, 26 Apr 2018 16:57:57 +0000 (00:57 +0800)]
BaseTools: replace string with predefined constant

v2 - add missing namespace.

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 agoBaseTools: Replace Binary File type strings with predefined constant
Carsey, Jaben [Thu, 26 Apr 2018 16:57:56 +0000 (00:57 +0800)]
BaseTools: Replace Binary File type strings with predefined constant

BINARY_FILE_TYPE_FW was 'FW'
BINARY_FILE_TYPE_GUID was 'GUID'
BINARY_FILE_TYPE_PREEFORM was 'PREEFORM'
BINARY_FILE_TYPE_UEFI_APP was 'UEFI_APP'
BINARY_FILE_TYPE_UNI_UI was 'UNI_UI'
BINARY_FILE_TYPE_UNI_VER was 'UNI_VER'
BINARY_FILE_TYPE_LIB was 'LIB'
BINARY_FILE_TYPE_PE32 was 'PE32'
BINARY_FILE_TYPE_PIC was 'PIC'
BINARY_FILE_TYPE_PEI_DEPEX was 'PEI_DEPEX'
BINARY_FILE_TYPE_DXE_DEPEX was 'DXE_DEPEX'
BINARY_FILE_TYPE_SMM_DEPEX was 'SMM_DEPEX'
BINARY_FILE_TYPE_TE was 'TE'
BINARY_FILE_TYPE_VER was 'VER'
BINARY_FILE_TYPE_UI was 'UI'
BINARY_FILE_TYPE_BIN was 'BIN'
BINARY_FILE_TYPE_FV was 'FV'

v2 - split apart FV and GUID types with different meanings.

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 agoBaseTools: Replace PCD type strings with predefined constant
Carsey, Jaben [Thu, 26 Apr 2018 16:57:55 +0000 (00:57 +0800)]
BaseTools: Replace PCD type strings with predefined constant

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 agoBaseTools: DataType - cleanup list constants
Carsey, Jaben [Fri, 20 Apr 2018 15:51:37 +0000 (23:51 +0800)]
BaseTools: DataType - cleanup list constants

remove unused ones
convert lists used for membership testing to sets
use shared ones not local ones

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 agoBaseTools: Replace EDK Component strings with predefined constant
Carsey, Jaben [Fri, 27 Apr 2018 14:04:15 +0000 (22:04 +0800)]
BaseTools: Replace EDK Component strings with predefined constant

EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY'
EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE'
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM'
EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION'

v2 - revert 2 files.  will update later in own patches.
v3 - fix v2

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 agoBaseTools: Share a dictionary instead of keeping multiples
Carsey, Jaben [Fri, 20 Apr 2018 15:51:35 +0000 (23:51 +0800)]
BaseTools: Share a dictionary instead of keeping multiples

Move a dictionary to a shared location and use from there

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 agoBaseTools: Define and use a set for common list
Carsey, Jaben [Fri, 20 Apr 2018 15:51:34 +0000 (23:51 +0800)]
BaseTools: Define and use a set for common list

share a set for both PEI module types

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>