]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
5 years agoShellPkg/UefiShellLib: drop DeviceHandle param of ShellOpenFileByDevicePath()
Laszlo Ersek [Wed, 18 Jul 2018 18:25:25 +0000 (20:25 +0200)]
ShellPkg/UefiShellLib: drop DeviceHandle param of ShellOpenFileByDevicePath()

The ShellOpenFileByDevicePath() API promises to set the DeviceHandle
output parameter to the handle of the filesystem identified by the
FilePath input parameter. However, this doesn't actually happen when the
UEFI Shell 2.0 method is used (which is basically "always" nowadays).

Accordingly, the only caller of ShellOpenFileByDevicePath(), namely
ShellOpenFileByName(), defines a (dummy) local DeviceHandle variable just
so it can call ShellOpenFileByDevicePath().

Remove the useless output parameter.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoSecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with UefiLib API
Laszlo Ersek [Wed, 18 Jul 2018 17:38:40 +0000 (19:38 +0200)]
SecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with UefiLib API

Replace the OpenFileByDevicePath() function with EfiOpenFileByDevicePath()
from UefiLib, correcting the following issues:

- imprecise comments on OpenFileByDevicePath(),
- code duplication between this module and other modules,
- local variable name "EfiSimpleFileSystemProtocol" starting with "Efi"
  prefix,
- bogus "FileHandle = NULL" assignments,
- leaking "Handle1" when the device path type/subtype check or the
  realignment-motivated AllocateCopyPool() fails in the loop,
- stale SHELL_FILE_HANDLE reference in a comment.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Roman Bacik <roman.bacik@broadcom.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoNetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with UefiLib API
Laszlo Ersek [Wed, 18 Jul 2018 17:38:40 +0000 (19:38 +0200)]
NetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with UefiLib API

Replace the OpenFileByDevicePath() function with EfiOpenFileByDevicePath()
from UefiLib, correcting the following issues:

- imprecise comments on OpenFileByDevicePath(),
- code duplication between this module and other modules,
- local variable name "EfiSimpleFileSystemProtocol" starting with "Efi"
  prefix,
- bogus "FileHandle = NULL" assignments,
- passing a potentially unaligned "FILEPATH_DEVICE_PATH.PathName" field to
  a protocol member function (forbidden by the UEFI spec),
- leaking "Handle1" when the device path type/subtype check fails in the
  loop,
- stale SHELL_FILE_HANDLE reference in a comment.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoMdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib API
Laszlo Ersek [Wed, 18 Jul 2018 17:38:40 +0000 (19:38 +0200)]
MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib API

Replace the OpenFileByDevicePath() function with EfiOpenFileByDevicePath()
from UefiLib, correcting the following issues:

- imprecise comments on OpenFileByDevicePath(),
- code duplication between this module and other modules,
- local variable name "EfiSimpleFileSystemProtocol" starting with "Efi"
  prefix,
- bogus "FileHandle = NULL" assignments,
- passing a potentially unaligned "FILEPATH_DEVICE_PATH.PathName" field to
  a protocol member function (forbidden by the UEFI spec),
- leaking "Handle1" when the device path type/subtype check fails in the
  loop,
- stale SHELL_FILE_HANDLE reference in a comment.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoIntelFrameworkPkg/FrameworkUefiLib: introduce EfiOpenFileByDevicePath()
Laszlo Ersek [Fri, 3 Aug 2018 11:12:12 +0000 (13:12 +0200)]
IntelFrameworkPkg/FrameworkUefiLib: introduce EfiOpenFileByDevicePath()

Copy the EfiOpenFileByDevicePath() implementation from the previous
(MdePkg/UefiLib) patch to FrameworkUefiLib.

(Note that the FrameworkUefiLib instance too will be updated for
<https://bugzilla.tianocore.org/show_bug.cgi?id=1074>.)

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdePkg/UefiLib: introduce EfiOpenFileByDevicePath()
Laszlo Ersek [Wed, 18 Jul 2018 15:07:03 +0000 (17:07 +0200)]
MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()

The EfiOpenFileByDevicePath() function centralizes functionality from

- MdeModulePkg/Universal/Disk/RamDiskDxe
- NetworkPkg/TlsAuthConfigDxe
- SecurityPkg/VariableAuthenticated/SecureBootConfigDxe
- ShellPkg/Library/UefiShellLib

unifying the implementation and fixing various bugs.

(Ray suggested that we eliminate the special handling of
EFI_FILE_MODE_CREATE in the "OpenMode" input parameter as well. We plan to
implement that separately, under
<https://bugzilla.tianocore.org/show_bug.cgi?id=1074>.)

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Roman Bacik <roman.bacik@broadcom.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoShellPkg/redirection: Insert \xFEFF for ENV variable redirection
Ruiyu Ni [Thu, 9 Aug 2018 03:43:24 +0000 (11:43 +0800)]
ShellPkg/redirection: Insert \xFEFF for ENV variable redirection

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

Per Shell spec 2.2 chapter 3.4.4.2, Unicode file tag should be
inserted in the output from the input redirected variable, to ensure
it looks like a UCS-2 encode file.

The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoShellPkg/redirection: Insert \xFEFF after converting ASCII to Unicode
Ruiyu Ni [Wed, 8 Aug 2018 10:15:54 +0000 (18:15 +0800)]
ShellPkg/redirection: Insert \xFEFF after converting ASCII to Unicode

When "<a" is used to redirect ASCII file to an application, Shell
core reads the ASCII file and converts the ASCII to Unicode as the
input source of the application.
But per Shell spec, the input source should have \xFEFF to indicate
it's a Unicode stream.
The patch adds the missing \xFEFF.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Optimizing code for function doesn't match
Yunhua Feng [Mon, 6 Aug 2018 01:10:39 +0000 (09:10 +0800)]
BaseTools: Optimizing code for function doesn't match

Optimizing code for function doesn't match name and comment

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

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: Eot - fix variable names
Carsey, Jaben [Tue, 7 Aug 2018 22:37:14 +0000 (06:37 +0800)]
BaseTools: Eot - fix variable names

1) currently a couple classes use m instead of self (including some mixed
functions that should have previously failed).
2) deleted some blank lines.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@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: Update the rule to remove .lib before link it for GCC
Yonghong Zhu [Thu, 9 Aug 2018 01:25:09 +0000 (09:25 +0800)]
BaseTools: Update the rule to remove .lib before link it for GCC

We met a case on GCC toolchain for increment build. the case is user
build Helloworld first, then rename the source file Helloworld.c to
Helloworld_new.c and also update the file name to Helloworld_new.c in
.inf file's [sources] section. finally, he rebuild it again.
It cause build failure due to multiple definition of `UefiMain' because
in the .lib file it both have Helloworld.obj and Helloworld_new.obj.
current we use the option 'cr' to create the .lib file while the 'r'
cmd means replace existing or insert new files into the archive. so
in this patch before we create the .lib file, we delete it first.

Cc: Liming Gao <liming.gao@intel.com>
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: Clean up not used code in BuildClassObject
Yonghong Zhu [Mon, 13 Aug 2018 01:11:37 +0000 (09:11 +0800)]
BaseTools: Clean up not used code in BuildClassObject

V2: Add back "from Common.DataType import *"

1. Remove some import statement that are not used.
2. Remove the Type value in the LibraryClassObject because we don't
actually use it.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
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: Add Dns and BluetoothLE DevicePath
Yunhua Feng [Mon, 6 Aug 2018 07:37:01 +0000 (15:37 +0800)]
BaseTools: Add Dns and BluetoothLE DevicePath

Add Dns and BluetoothLE for support DevicePath

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: Remove duplicate function declaration
Yunhua Feng [Wed, 8 Aug 2018 01:58:46 +0000 (09:58 +0800)]
BaseTools: Remove duplicate function declaration

Remove duplicate function declaration

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 agoIntelFrameworkModulePkg/Csm: Set CSM memory executable
Ruiyu Ni [Mon, 6 Aug 2018 09:56:37 +0000 (17:56 +0800)]
IntelFrameworkModulePkg/Csm: Set CSM memory executable

Commit b22a62be5cdc8fd19d87ec1ecfa5b28fb9be50ad
* IntelFrameworkModule/LegacyBios:Use reserved memory for legacy data
allocates reserved memory for holding legacy code/data.

But with PcdDxeNxMemoryProtectionPolicy set to certain value to
forbid execution when code is in certain type of memory, it's
possible that a platform forbids execution when code is in reserved
memory. The patch calls GCD service to allow such case otherwise
CPU exception may occur.

Code execution in BSCode area should be enabled by platform by
default.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jian Wang <jian.j.wang@intel.com>
5 years agoShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare
Ruiyu Ni [Tue, 7 Aug 2018 09:13:07 +0000 (17:13 +0800)]
ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare

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

Per Shell spec, the environment variable has a case-sensitive name.
But today's implementation of EfiShellSetEnv() compares the
environment variable name case insensitively, which causes variable
like "CWD" cannot be set due to "cwd" is pre-defined variable.

The patch fixes this issue.

The EfiShellGetEnv() doesn't have such issue because it will
call into ShellFindEnvVarInList() which uses StrCmp().

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jim Dailey <jim_dailey@dell.com>
5 years agoBaseTools/Ecc: Fix import issues
hchen30 [Wed, 8 Aug 2018 03:18:06 +0000 (11:18 +0800)]
BaseTools/Ecc: Fix import issues

1. Complete the full path for import statement. Use "EccMain" to
replace "Ecc" for the absolute path support.
2. Fix some issues on configuration file.
3. Fix an issue of RaiseError not working in EdkLogger.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Fix report flexible value issue
Yunhua Feng [Tue, 7 Aug 2018 06:23:32 +0000 (14:23 +0800)]
BaseTools: Fix report flexible value issue

Report flexible value in INF file encounter error

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: Remove the redundant if statement
Yonghong Zhu [Fri, 10 Aug 2018 06:47:35 +0000 (14:47 +0800)]
BaseTools: Remove the redundant if statement

after analysis the BuildOptionValue function, we found the if statement
IsFieldValueAnArray is redundant because ValueExpressionEx will handle
it.

Cc: Liming Gao <liming.gao@intel.com>
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 agoMdeModulePkg SmmLockBox: Return actual data length in SmmLockBoxRestore
Star Zeng [Mon, 13 Aug 2018 08:50:37 +0000 (16:50 +0800)]
MdeModulePkg SmmLockBox: Return actual data length in SmmLockBoxRestore

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

Current code only returns actual data length in case of return status
buffer too small.
If caller provided a buffer that's large enough to restore data from
lock box, actual data length is not returned. It needs to be updated
in case of return status as success as well.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Anbazhagan Baraneedharan <anbazhagan@hp.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 agoUefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation.
Eric Dong [Fri, 10 Aug 2018 02:59:26 +0000 (10:59 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation.

V1 changes:
> Current code logic can't confirm CpuS3DataDxe driver start before
> CpuFeaturesDxe driver. So the assumption in CpuFeaturesDxe not valid.
> Add implementation for AllocateAcpiCpuData function to remove this
> assumption.

V2 changes:
> Because CpuS3Data memory will be copy to smram at SmmReadToLock point,
> so the memory type no need to be ACPI NVS type, also the address not
> limit to below 4G.
> This change remove the limit of ACPI NVS memory type and below 4G.

V3 changes:
> Remove function definition in header file.
> Add STATIC in function implementation.

Pass OS boot and resume from S3 test.

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

Reported-by: Marvin Häuser <Marvin.Haeuser@outlook.com>
Suggested-by: Fan Jeff <vanjeff_919@hotmail.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Fan Jeff <vanjeff_919@hotmail.com>
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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation.
Eric Dong [Fri, 10 Aug 2018 02:53:45 +0000 (10:53 +0800)]
UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation.

Because PrepareApStartupVector() stores StackAddress to
"mExchangeInfo->StackStart" (which has type (VOID*)), and because
"UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.nasm" reads the latter with:

         add  edi, StackStartAddressLocation
         add  rax, qword [edi]
         mov  rsp, rax
         mov  qword [edi], rax

in long-mode code. So code can remove below 4G limitation.

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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.
Eric Dong [Fri, 10 Aug 2018 02:41:04 +0000 (10:41 +0800)]
UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation.

Because CpuS3Data memory will be copy to smram at SmmReadyToLock point,
the memory type no need to be ACPI NVS type, also the address not
limit to below 4G.

This change remove the limit of ACPI NVS memory type and below 4G.

Pass OS boot and resume from S3 test.

Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Fan Jeff <vanjeff_919@hotmail.com>
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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation.
Eric Dong [Fri, 10 Aug 2018 02:28:50 +0000 (10:28 +0800)]
UefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation.

ACPI_CPU_DATA structure first introduced to save data in
normal boot phase. Also this data will be used in S3 phase
by one PEI driver. So in first phase, this data is been
defined to use ACPI NVS memory type and must below 4G.

Later in order to fix potential security issue,
PiSmmCpuDxeSmm driver added logic to copy ACPI_CPU_DATA
(except ResetVector and Stack buffer) to  smram at smm
ready to lock point. ResetVector must below 1M and Stack
buffer is write only in S3 phase, so these two fields not
copy to smram. Also PiSmmCpuDxeSmm driver owned the task
to restore the CPU setting and it's a SMM driver.

After above change, the acpi nvs memory type and below 4G
limitation is no longer needed.

This change remove the limitation in the comments for
ACPI_CPU_DATA definition.

Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Fan Jeff <vanjeff_919@hotmail.com>
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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.
Eric Dong [Fri, 10 Aug 2018 02:27:42 +0000 (10:27 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram.

Current implementation will copy GDT/IDT at SmmReadyToLock point
from ACPI NVS memory to Smram. Later at S3 resume phase, it restore
the memory saved in Smram to ACPI NVS. It can directly use GDT/IDT
saved in Smram instead of restore the original ACPI NVS memory.
This patch do this change.

Test Done:
  Do the OS boot and S3 resume test.

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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
5 years agoSecurityPkg/TcgStorageCoreLib.h: Use ascii instead of unicode.
Eric Dong [Thu, 9 Aug 2018 05:12:32 +0000 (13:12 +0800)]
SecurityPkg/TcgStorageCoreLib.h: Use ascii instead of unicode.

_FILE_ parameter is an ASCII string. Current implementation used
as unicode string instead of ascii string. This patch fixed this
issue.

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

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed_off_by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoBaseTools: Remove a unused function.
Feng, Bob C [Tue, 10 Jul 2018 02:05:44 +0000 (10:05 +0800)]
BaseTools: Remove a unused function.

the call statement of _CheckDuplicateInFV() was commented out
in 2014. There is no call statement of _CheckDuplicateInFV(),
so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTool: Fixed the bug of Boolean Hii Pcd packing.
Liming Gao [Fri, 10 Aug 2018 08:12:26 +0000 (16:12 +0800)]
BaseTool: Fixed the bug of Boolean Hii Pcd packing.

When packing HiiPcd into PcdNvStoreDefaultValueBuffer,
The boolean type pcd value packing incorrect.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdePkg Cper.h: Add generic error macros for ARM platform
Ming Huang [Sun, 12 Aug 2018 14:01:48 +0000 (07:01 -0700)]
MdePkg Cper.h: Add generic error macros for ARM platform

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>
5 years agoVlv2TbltDevicePkg: Removing ipf which from edk2.
chenc2 [Fri, 29 Jun 2018 03:39:22 +0000 (11:39 +0800)]
Vlv2TbltDevicePkg: Removing ipf which from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
5 years agoQuarkSocPkg: Removing ipf which is no longer supported from edk2.
chenc2 [Fri, 29 Jun 2018 03:32:05 +0000 (11:32 +0800)]
QuarkSocPkg: Removing ipf which is no longer supported from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
5 years agoQuarkPlatformPkg: Removing ipf which is no longer supported from edk2.
chenc2 [Fri, 29 Jun 2018 03:31:36 +0000 (11:31 +0800)]
QuarkPlatformPkg: Removing ipf which is no longer supported from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
5 years agoNetworkPkg: Removing ipf which is no longer supported from edk2.
chenc2 [Fri, 29 Jun 2018 03:28:12 +0000 (11:28 +0800)]
NetworkPkg: Removing ipf which is no longer supported from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
5 years agoCorebootPayloadPkg: Removing ipf from edk2.
chenc2 [Fri, 29 Jun 2018 03:17:21 +0000 (11:17 +0800)]
CorebootPayloadPkg: Removing ipf from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ma, Maurice <maurice.ma@intel.com>
5 years agoCorebootModulePkg: Removing ipf from edk2.
chenc2 [Fri, 29 Jun 2018 03:16:48 +0000 (11:16 +0800)]
CorebootModulePkg: Removing ipf from edk2.

Removing rules for Ipf sources file:
* Remove the source file which path with "ipf" and also listed in
  [Sources.IPF] section of INF file.
* Remove the source file which listed in [Components.IPF] section
  of DSC file and not listed in any other [Components] section.
* Remove the embedded Ipf code for MDE_CPU_IPF.

Removing rules for Inf file:
* Remove IPF from VALID_ARCHITECTURES comments.
* Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section.
* Remove the INF which only listed in [Components.IPF] section in DSC.
* Remove statements from [BuildOptions] that provide IPF specific flags.
* Remove any IPF sepcific sections.

Removing rules for Dec file:
* Remove [Includes.IPF] section from Dec.

Removing rules for Dsc file:
* Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC.
* Remove any IPF specific sections.
* Remove statements from [BuildOptions] that provide IPF specific flags.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ma, Maurice <maurice.ma@intel.com>
5 years agoUefiCpuPkg: Removing ipf which is no longer supported from edk2.
Chen A Chen [Mon, 2 Jul 2018 01:36:12 +0000 (09:36 +0800)]
UefiCpuPkg: Removing ipf which is no longer supported from edk2.

Merge [Sources.Ia32, Sources.X64] to [Sources] after removing IPF. Also
change other similar parts in this file.

Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoVlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg
Michael D Kinney [Wed, 30 May 2018 23:03:32 +0000 (16:03 -0700)]
Vlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
5 years agoVlv2TbltDevicePkg/Capsule: Add scripts to generate capsules
Michael D Kinney [Wed, 30 May 2018 23:02:02 +0000 (16:02 -0700)]
Vlv2TbltDevicePkg/Capsule: Add scripts to generate capsules

Use GenerateCapsule to generate capsules for MinnowMax
debug and release builds and sample devices.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
5 years agoVlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances
Michael D Kinney [Fri, 16 Mar 2018 18:32:16 +0000 (11:32 -0700)]
Vlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
5 years agoVlv2TbltDevicePkg/Override/Bds: Add test key notification
Kinney, Michael D [Mon, 16 Apr 2018 04:59:40 +0000 (21:59 -0700)]
Vlv2TbltDevicePkg/Override/Bds: Add test key notification

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
5 years agoMaintainers.txt: Add FmpDevicePkg maintainers
Michael D Kinney [Thu, 9 Aug 2018 21:09:15 +0000 (14:09 -0700)]
Maintainers.txt: Add FmpDevicePkg maintainers

This patch adds maintainers for the FmpDevicePkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoSecurityPkg: HashLib: Update HashLib file GUID
Zhang, Chao B [Thu, 9 Aug 2018 06:01:44 +0000 (14:01 +0800)]
SecurityPkg: HashLib: Update HashLib file GUID

2 file GUIDs conflict with existing SHA256 Lib. Update them.

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>
5 years agoSecurityPkg/Library/Tpm2DeviceLibDTpm: fix s/Constructor/CONSTRUCTOR
Marc-André Lureau [Thu, 9 Aug 2018 14:33:19 +0000 (16:33 +0200)]
SecurityPkg/Library/Tpm2DeviceLibDTpm: fix s/Constructor/CONSTRUCTOR

The library constructor is not being called because of the typo,
causing TPM2 detection/initialization to fail.

This fixes OVMF TPM2 regression since commit f15cb995bb38.
https://bugzilla.tianocore.org/show_bug.cgi?id=1075

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Zhang Chao B <chao.b.zhang@intel.com>
Cc: Long Qin <qin.long@intel.com>
Fixes: f15cb995bb3880b77e15afe6facd3da05e599a17
Contributed-under: TianoCore Contribution Agreement 1.1
Reported-by: Ricardo Araújo <ricardo@lsd.ufcg.edu.br>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
5 years agoFmpDevicePkg FmpDxe: Lock variables in entrypoint instead of callback
Star Zeng [Tue, 7 Aug 2018 10:01:12 +0000 (18:01 +0800)]
FmpDevicePkg FmpDxe: Lock variables in entrypoint instead of callback

Current code locks variables in PcdFmpDeviceLockEventGuid callback by
VariableLock protocol whose interface will be closed at EndOfDxe.
So the PcdFmpDeviceLockEventGuid callback needs be executed before
the EndOfDxe callback in Variable driver.
When PcdFmpDeviceLockEventGuid = gEfiEndOfDxeEventGroupGuid, the
callback's execution sequence depends on the callback's TPL and
registration sequence.
When PcdFmpDeviceLockEventGuid = gEfiEventReadyToBootGuid, the
PcdFmpDeviceLockEventGuid callback will be executed after the
EndOfDxe callback in Variable driver, the locking will fail.

The patch moves the variables locking logic to entrypoint.
The patch also moves the IsLockFmpDeviceAtLockEventGuidRequired ()
checking to entrypoint.

The entrypoint's final return status should be better to depend on
the return status of RegisterFmpInstaller/InstallFmpInstance, but not
gBS->CreateEventEx.
So the patch also moves the RegisterFmpInstaller/InstallFmpInstance
calling to the end of entrypoint.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoMdeModulePkg ErstFmpDxe: Create ESRT in ReadyToBoot event
Star Zeng [Mon, 6 Aug 2018 07:46:36 +0000 (15:46 +0800)]
MdeModulePkg ErstFmpDxe: Create ESRT in ReadyToBoot event

Current code just creates ESRT entry in FMP notification
and installs ESRT configuration table in ReadyToBoot event.

The LastAttemptVersion and LastAttemptStatus in ESRT will
be out of date after system continues to boot without reset
after capsule update (reset is not required or capsule update
is failed).

This patches updates the code to create ESRT based on all
FMP instances in ReadyToBoot event.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Need repopulate after SetImage is called
Star Zeng [Mon, 6 Aug 2018 07:44:59 +0000 (15:44 +0800)]
FmpDevicePkg FmpDxe: Need repopulate after SetImage is called

No need repopulate if SetImage is not called.
But need repopulate after SetImage is called to update
LastAttemptVersion and LastAttemptStatus

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoBaseTools: Use gGuidPattern for Guid regular expression
Yunhua Feng [Mon, 6 Aug 2018 01:02:25 +0000 (09:02 +0800)]
BaseTools: Use gGuidPattern for Guid regular expression

Use GlobalData.py gGuidPattern for Guid regular expression

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 agoPatchCheck - add error message for invalid parameter
Jaben Carsey [Thu, 2 Aug 2018 23:21:06 +0000 (07:21 +0800)]
PatchCheck - add error message for invalid parameter

Currently if an invalid parameter is passed, it gives a stack trace.
This changes it to an error message.

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>
Tested-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Debug message make confused
Yunhua Feng [Mon, 6 Aug 2018 01:08:55 +0000 (09:08 +0800)]
BaseTools: Debug message make confused

Debug message make confused

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

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: Fix incorrect %EDK_TOOLS_PATH%
Yunhua Feng [Tue, 7 Aug 2018 01:35:33 +0000 (09:35 +0800)]
BaseTools: Fix incorrect %EDK_TOOLS_PATH%

For non-root folder, such as "X:\test", the EDK_TOOLS_PATH will
resolve to "X:\test\edk2\BaseTools". This is OK.

But if WORKSPACE is at a root folder, such as "X:\", the EDK_TOOLS_PATH
will look like "X:\\BaseTools". The *double backslash* can fail the command
like "del" and thus affect the %ERRORLEVEL% variable, which may break
subsequent build processing.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoShellPkg/acpi: Fix XCODE5 X64 build failure
Ruiyu Ni [Mon, 6 Aug 2018 06:29:00 +0000 (14:29 +0800)]
ShellPkg/acpi: Fix XCODE5 X64 build failure

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
5 years agoOvmfPkg/PlatformDebugLibIoPort: fix port detection for use in the DXE Core
Laszlo Ersek [Thu, 2 Aug 2018 23:29:13 +0000 (01:29 +0200)]
OvmfPkg/PlatformDebugLibIoPort: fix port detection for use in the DXE Core

The DXE Core is one of those modules that call
ProcessLibraryConstructorList() manually.

Before DxeMain() [MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c] calls
ProcessLibraryConstructorList(), and through it, our
PlatformDebugLibIoPortConstructor() function, DxeMain() invokes the
DEBUG() macro multiple times. That macro lands in our
PlatformDebugLibIoPortFound() function -- which currently relies on the
"mDebugIoPortFound" global variable that has (not yet) been set by the
constructor. As a result, early debug messages from the DXE Core are lost.

Move the device detection into PlatformDebugLibIoPortFound(), also caching
the fact (not just the result) of the device detection.

(We could introduce a separate DebugLib instance just for the DXE Core,
but the above approach works for all modules that currently consume the
PlatformDebugLibIoPort instance (which means "everything but SEC").)

This restores messages such as:

> CoreInitializeMemoryServices:
>   BaseAddress - 0x7AF21000 Length - 0x3CDE000 MinimalMemorySizeNeeded - 0x10F4000

Keep the empty constructor function -- OVMF's DebugLib instances have
always had constructors; we had better not upset constructor dependency
ordering by making our instance(s) constructor-less.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Fixes: c09d9571300a089c35f5df2773b70edc25050d0d
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
[lersek@redhat.com: sanitize blank lines around "mDebugIoPortChecked"]

5 years agoMdeModulePkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:14:04 +0000 (10:14 +0800)]
MdeModulePkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
Now the DxeSmmPerformanceLib is not used by
any module. So remove it from edk2 code base to
avoid being used by mistake.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoShellPkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:10:49 +0000 (10:10 +0800)]
ShellPkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.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: Jaben Carsey <jaben.carsey@intel.com>
5 years agoVlv2TbltDevicePkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:10:15 +0000 (10:10 +0800)]
Vlv2TbltDevicePkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.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: David Wei <david.wei@intel.com>
5 years agoQuarkPlatformPkg: Remove DxeSmmPerformanceLib
Dandan Bi [Tue, 17 Jul 2018 02:06:34 +0000 (10:06 +0800)]
QuarkPlatformPkg: Remove DxeSmmPerformanceLib

DxeSmmPerformanceLib previously is used by DP tool.
But in new pweformance infrastructure, we have updated
Dp tool to get the performance data from firmware
performance data table in ACPI.
So remove the usage of DxeSmmPerformanceLib here.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.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 agoBaseTools/BinToPcd: Open output file as text file
Kinney, Michael D [Fri, 3 Aug 2018 20:47:33 +0000 (04:47 +0800)]
BaseTools/BinToPcd: Open output file as text file

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

Undo changes from following commit:

https://github.com/tianocore/edk2/commit/83964ebc5e74549d6efc7134af19150a0b2079aa

Change the open mode for the output file from 'wb' to 'w' so the
output file is written as a text file and not a binary file.

This resolves the issue where the text file was not writable from
Python 3.x and also removes b'' from output file when the string
was encoded as a bytearray.

Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by:YanYan Sun <yanyan.sun@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoShellPkg/acpi: Code cleanup to pass static code checker
Ruiyu Ni [Fri, 3 Aug 2018 02:46:34 +0000 (10:46 +0800)]
ShellPkg/acpi: Code cleanup to pass static code checker

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
5 years agoMdePkg/BaseLib: Add an additional check within AsciiStriCmp
Ruiyu Ni [Fri, 3 Aug 2018 02:42:45 +0000 (10:42 +0800)]
MdePkg/BaseLib: Add an additional check within AsciiStriCmp

This commit adds an addtional check in AsciiStriCmp. It
explicitly checks the end of the sting pointed by 'SecondString' to make
the code logic easier for reading and to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
5 years agoBaseTools/Pkcs7Sign: Add PKCS7 test key include files
Kinney, Michael D [Mon, 16 Apr 2018 05:02:05 +0000 (22:02 -0700)]
BaseTools/Pkcs7Sign: Add PKCS7 test key include files

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

Add PCD statement include files for the PKCS7 test key.
* gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer
* gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr

These include files can be used in !include statements in PCD
sections of a platform DSC file to assign these PCDs to the
test key certificate values.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit
Marcin Wojtas [Thu, 2 Aug 2018 20:50:54 +0000 (22:50 +0200)]
ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit

According to the SBSA specification the Watchdog Compare
Register is split into two separate 32bit registers.
EDK2 code uses a single 64bit transaction to update
them, which can be problematic, depending on the SoC
implementation and could result in unpredictable behavior.

Fix this by modifying WatchdogWriteCompareRegister routine to
use two consecutive 32bit writes to the Watchdog Compare Register
Low and High, using new dedicated macros.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoBaseTools: Guid.xref doesn't specify the correct GUID value for Driver
Yunhua Feng [Tue, 31 Jul 2018 01:44:41 +0000 (09:44 +0800)]
BaseTools: Guid.xref doesn't specify the correct GUID value for Driver

In DSC, we can define the driver with the different FILE GUID. So this
driver name and its FILE GUID should also be listed in Build output
Guid.xref. But now, Guid.xref still lists the driver MODULE_GUID.

The case in Platform.dsc:
  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
    <Defines>
      FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2
    <LibraryClasses>
      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
  }

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/BinToPcd: Encode string returned from ByteArray()
Kinney, Michael D [Thu, 2 Aug 2018 21:22:23 +0000 (14:22 -0700)]
BaseTools/BinToPcd: Encode string returned from ByteArray()

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

The ByteArray() method returns a string with the hex bytes of
a PCD value.  Make sure the string is always encoded as a string,
so it can be used to build a complete PCD statement string and be
written out to a file.  This change is required for Python 3.x
compatibility.

Cc: YanYan Sun <yanyan.sun@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoNetworkPkg/HttpDxe: Strip square brackets in IPv6 expressed HostName.
Jiaxin Wu [Fri, 20 Jul 2018 02:30:13 +0000 (10:30 +0800)]
NetworkPkg/HttpDxe: Strip square brackets in IPv6 expressed HostName.

*v2: Optimize the patch by calculating AsciiStrSize() only once.

In URI, the colon (:) is used to terminate the HostName path before
a port number. However, if HostName is expressed as IPv6 format, colon
characters in IPv6 addresses will conflict with the colon before port
number. To alleviate this conflict in URI, the IPv6 expressed HostName
are enclosed in square brackets ([]). To record the real IPv6 HostName,
square brackets should be stripped.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoMdeModulePkg DxeCapsuleLibFmp: Add NULL check to the return buffers
Star Zeng [Thu, 2 Aug 2018 01:14:59 +0000 (09:14 +0800)]
MdeModulePkg DxeCapsuleLibFmp: Add NULL check to the return buffers

Add NULL check to the return buffers from GetFmpHandleBufferByType().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Hao A Wu <Hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao A Wu <Hao.a.wu@intel.com>
5 years agoMdeModulePkg/BdsDxe: Move display of test key usage into BDS module
Kinney, Michael D [Wed, 21 Mar 2018 02:34:55 +0000 (19:34 -0700)]
MdeModulePkg/BdsDxe: Move display of test key usage into BDS module

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Remove useless lib mapping in dsc
Star Zeng [Wed, 1 Aug 2018 07:44:43 +0000 (00:44 -0700)]
FmpDevicePkg: Remove useless lib mapping in dsc

NOTE: This patch is based on thread
https://lists.01.org/pipermail/edk2-devel/2018-July/027810.html.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Fix XCODE build failure
Star Zeng [Wed, 1 Aug 2018 08:24:53 +0000 (16:24 +0800)]
FmpDevicePkg FmpDxe: Fix XCODE build failure

FmpDxe.c:517:18: error: equality comparison with extraneous
parentheses [-Werror,-Wparentheses-equality]

NOTE: This patch is based on thread
https://lists.01.org/pipermail/edk2-devel/2018-July/027810.html.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Use local variable to store test key digest size
Star Zeng [Tue, 31 Jul 2018 02:25:49 +0000 (10:25 +0800)]
FmpDevicePkg FmpDxe: Use local variable to store test key digest size

Some static tool reports "the condition in 'if' statement is constant".

This patch updates the code to use local variable to store test key
digest size. It can pass the static tool's check.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg: Fix code style issue
Star Zeng [Mon, 30 Jul 2018 09:47:57 +0000 (17:47 +0800)]
FmpDevicePkg: Fix code style issue

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Initialize DeviceLibLowestSupportedVersion
Star Zeng [Mon, 30 Jul 2018 02:35:09 +0000 (10:35 +0800)]
FmpDevicePkg FmpDxe: Initialize DeviceLibLowestSupportedVersion

Some static tool reports "DeviceLibLowestSupportedVersion" is used,
but is uninitialized. It is false positive reporting based because
DeviceLibLowestSupportedVersion will have assigned value after
FmpDeviceGetLowestSupportedVersion() returns SUCCESS.

This patch updates the code to initialize
DeviceLibLowestSupportedVersion
to DEFAULT_LOWESTSUPPORTEDVERSION before calling
FmpDeviceGetLowestSupportedVersion().
It can pass the static tool's check.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Return UNSUPPORTED if device has been locked
Star Zeng [Sat, 28 Jul 2018 13:56:47 +0000 (21:56 +0800)]
FmpDevicePkg FmpDxe: Return UNSUPPORTED if device has been locked

Instead of EFI_ACCESS_DENIED which is not defined in retval by
UEFI spec, return UNSUPPORTED if device has been locked in
SetTheImage().

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Add comment in mFmpDeviceLocked's declaration
Star Zeng [Sat, 28 Jul 2018 01:57:01 +0000 (09:57 +0800)]
FmpDevicePkg FmpDxe: Add comment in mFmpDeviceLocked's declaration

Add comment in mFmpDeviceLocked's declaration to make it more clear.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Use Attributes to know whether reset is required
Star Zeng [Wed, 18 Jul 2018 11:00:32 +0000 (19:00 +0800)]
FmpDevicePkg FmpDxe: Use Attributes to know whether reset is required

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

Use Attributes to know whether reset is required and remove
PcdFmpDeviceSystemResetRequired.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Check ImageIndex first before Image/ImageSize
Star Zeng [Sat, 28 Jul 2018 01:22:03 +0000 (09:22 +0800)]
FmpDevicePkg FmpDxe: Check ImageIndex first before Image/ImageSize

It does not make sense to check the Image/ImageSize if ImageIndex
has been invalid.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2
Star Zeng [Sat, 28 Jul 2018 01:16:54 +0000 (09:16 +0800)]
FmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg: Remove DisplayUpdateProgressLib mapping for FmpDxe
Star Zeng [Sat, 28 Jul 2018 01:11:19 +0000 (09:11 +0800)]
FmpDevicePkg: Remove DisplayUpdateProgressLib mapping for FmpDxe

FmpDxe does not consume DisplayUpdateProgressLib, so remove the
mapping in FmpDevicePkg.dsc.
Also rename the ESRT GUIDs.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Fix typo "EFI_SECURITY_VIOLATIO"
Star Zeng [Fri, 27 Jul 2018 11:11:10 +0000 (19:11 +0800)]
FmpDevicePkg FmpDxe: Fix typo "EFI_SECURITY_VIOLATIO"

Fix typo "EFI_SECURITY_VIOLATIO" to "EFI_SECURITY_VIOLATION".

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Add EFI_ABORTED in retval of CheckTheImage()
Star Zeng [Wed, 25 Jul 2018 10:26:43 +0000 (18:26 +0800)]
FmpDevicePkg FmpDxe: Add EFI_ABORTED in retval of CheckTheImage()

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Check Progress!= NULL before calling Progress(100)
Star Zeng [Wed, 25 Jul 2018 10:22:54 +0000 (18:22 +0800)]
FmpDevicePkg FmpDxe: Check Progress!= NULL before calling Progress(100)

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg: Add DISABLE_NEW_DEPRECATED_INTERFACES build options
Star Zeng [Wed, 25 Jul 2018 09:22:10 +0000 (17:22 +0800)]
FmpDevicePkg: Add DISABLE_NEW_DEPRECATED_INTERFACES build options

Add DISABLE_NEW_DEPRECATED_INTERFACES build options to make sure
no deprecated interface used in this package.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg: Remove IPF
Star Zeng [Fri, 20 Jul 2018 09:19:56 +0000 (17:19 +0800)]
FmpDevicePkg: Remove IPF

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Return 0 when LSV check is not required
Star Zeng [Thu, 19 Jul 2018 10:29:52 +0000 (18:29 +0800)]
FmpDevicePkg FmpDxe: Return 0 when LSV check is not required

Current code return 1 when LSV check is not required,
but 1 LSV will make 0 Version capsule image update failed.

0 LSV is valid, this patch updates the code to return 0 when
LSV check is not required
We can see even the DEFAULT_LOWESTSUPPORTEDVERSION is 0.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg FmpDxe: Update function comment for FmpDxeEntryPoint
Star Zeng [Thu, 19 Jul 2018 05:44:28 +0000 (13:44 +0800)]
FmpDevicePkg FmpDxe: Update function comment for FmpDxeEntryPoint

FmpDxeEntryPoint is used by both FmpDxe and FmpDxeLib.

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoFmpDevicePkg: Add DSC file to build all package components
Kinney, Michael D [Wed, 4 Apr 2018 17:31:50 +0000 (10:31 -0700)]
FmpDevicePkg: Add DSC file to build all package components

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Adds a DSC file that is used to verify that all of the
FmpDevicePkg libraries and modules build without error.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add FmpDxe module
Kinney, Michael D [Wed, 4 Apr 2018 17:31:06 +0000 (10:31 -0700)]
FmpDevicePkg: Add FmpDxe module

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

The FmpDxe directory contains 2 INF files.  FmpDxe.inf
is a DXE driver that is used in a platform to add a
Firmware Management Protocol for firmware device that
supports firmware updates.

FmpDxeLib.inf is a NULL library instance with the exact
same functionality as FmpDxe.inf, but allows the the
Firmware Management Protocol feature to be added to
an existing device driver.

The FmpDxe component is intended to be used "as is"
with no need for any device specific or platform specific
changes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add library instances
Kinney, Michael D [Wed, 4 Apr 2018 17:27:21 +0000 (10:27 -0700)]
FmpDevicePkg: Add library instances

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Add library instances for FmpDeviceLib, CapsuleUpdatePolicyLib,
and FmpPayloadHeaderLib.

Library Classes
===============
* FmpDeviceLibNull - Non-functional template of the FmpDeviceLib
  that can be used as a starting point for an FmpDeviceLib for
  a specific firmware storage device.
* CapsuleUpdatePolicyLibNull - Functional template of the
  CapsuleUpdatePolicyLib that can be used as a starting point
  of a platform specific implementation.
* FmpPayloadHeaderLibV1 - Version 1 of the FmpPayloadHeaderLib.
  This library is indented to be used "as is" with no need for
  any device specific or platform specific changes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoFmpDevicePkg: Add package, library classes, and PCDs
Kinney, Michael D [Wed, 14 Mar 2018 22:05:29 +0000 (15:05 -0700)]
FmpDevicePkg: Add package, library classes, and PCDs

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Create FmpDevicePkg with library classes and PCDs used to
customize the behavior of a Firmware Management Protocol
instance.

Library Classes
===============
* FmpDeviceLib - Provides firmware device specific services
  to support updates of a firmware image stored in a firmware
  device.
* CapsuleUpdatePolicyLib - Provides platform policy services
  used during a capsule update.
* FmpPayloadHeaderLib - Provides services to retrieve values
  from a capsule's FMP Payload Header.  The structure is not
  included in the library class.  Instead, services are
  provided to retrieve information from the FMP Payload Header.
  If information is added to the FMP Payload Header, then new
  services may be added to this library class to retrieve the
  new information.

PCDs set per module
====================
* PcdFmpDeviceSystemResetRequired - Indicates if a full
  system reset is required before a firmware update to a
  firmware devices takes effect
* PcdFmpDeviceTestKeySha256Digest - The SHA-256 hash of a
  PKCS7 test key that is used to detect if a test key is
  being used to authenticate capsules.  Test key detection
  is disabled by setting the value to {0}.
* PcdFmpDeviceProgressColor - The color of the progress bar
  during a firmware update.
* PcdFmpDeviceImageIdName - The Null-terminated Unicode
  string used to fill in the ImageIdName field of the
  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned
  by the GetImageInfo() service of the Firmware Management
  Protocol for the firmware device.
* PcdFmpDeviceBuildTimeLowestSupportedVersion - The build
  time value used to fill in the LowestSupportedVersion field
  of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is
  returned by the GetImageInfo() service of the Firmware
  Management Protocol.
* PcdFmpDeviceProgressWatchdogTimeInSeconds - The time in
  seconds to arm a watchdog timer during the update of a
  firmware device.

PCDs set per module or for entire platform
==========================================
* PcdFmpDevicePkcs7CertBufferXdr - One or more PKCS7
  certificates used to verify a firmware device capsule
  update image.
* PcdFmpDeviceLockEventGuid - An event GUID that locks
  the firmware device when the event is signaled.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoBaseTools/Capsule: Support capsules without a payload header
Kinney, Michael D [Sun, 29 Jul 2018 17:57:12 +0000 (10:57 -0700)]
BaseTools/Capsule: Support capsules without a payload header

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

Update --dump-info and --decode to show auth header information
even if a payload header is not present.  The --decode operation
still fails if a payload header is not present.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Prevent traceback during signing operations
Kinney, Michael D [Sun, 29 Jul 2018 17:01:37 +0000 (10:01 -0700)]
BaseTools/Capsule: Prevent traceback during signing operations

https://bugzilla.tianocore.org/show_bug.cgi?id=1046
https://bugzilla.tianocore.org/show_bug.cgi?id=1048
https://bugzilla.tianocore.org/show_bug.cgi?id=1050

Remove raise statements that generate Tracebacks that were only
intended for development/debug.  With the raise statements removed
proper error messages are shown.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Update file header with tool limitations
Kinney, Michael D [Sat, 28 Jul 2018 07:32:34 +0000 (00:32 -0700)]
BaseTools/Capsule: Update file header with tool limitations

Update file header to state that the tool does not support:
* Multiple payloads
* Drivers
* Vendor code bytes

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Update help for --fw-version and --lsv
Kinney, Michael D [Sat, 28 Jul 2018 07:18:40 +0000 (00:18 -0700)]
BaseTools/Capsule: Update help for --fw-version and --lsv

Update help to state that --fw-version and -=-lsv are required
for encode operations that sign a payload.

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Do not support -o with --dump-info
Kinney, Michael D [Sat, 28 Jul 2018 07:10:51 +0000 (00:10 -0700)]
BaseTools/Capsule: Do not support -o with --dump-info

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Fix CertType GUID byte order
Kinney, Michael D [Sat, 28 Jul 2018 07:00:08 +0000 (00:00 -0700)]
BaseTools/Capsule: Fix CertType GUID byte order

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Remove support for PopulateSystemTable
Kinney, Michael D [Fri, 27 Jul 2018 19:31:22 +0000 (12:31 -0700)]
BaseTools/Capsule: Remove support for PopulateSystemTable

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/Capsule: Add max value checks to Capsule Generation tools
Kinney, Michael D [Fri, 27 Jul 2018 19:27:19 +0000 (12:27 -0700)]
BaseTools/Capsule: Add max value checks to Capsule Generation tools

https://bugzilla.tianocore.org/show_bug.cgi?id=1021
https://bugzilla.tianocore.org/show_bug.cgi?id=1022
https://bugzilla.tianocore.org/show_bug.cgi?id=1026

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools GenerateCapsule: Change property to executable for Linux
Star Zeng [Mon, 16 Jul 2018 10:22:47 +0000 (18:22 +0800)]
BaseTools GenerateCapsule: Change property to executable for Linux

Cc: Michael D Kinney <michael.d.kinney@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>
5 years agoBaseTools/Capsule: Add Capsule Generation Tools
Kinney, Michael D [Wed, 2 May 2018 03:54:46 +0000 (20:54 -0700)]
BaseTools/Capsule: Add Capsule Generation Tools

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

Based on content from the following branch

https://github.com/Microsoft/MS_UEFI/tree/share/beta/CapsuleTools

* Convert C tools to Python
* Add common python modules to:
    BaseTools/Source/Python/Common/Uefi/Capsule
    BaseTools/Source/Python/Common/Edk2/Capsule
* Add GenerateCapsule.py to BaseTools/Source/Python/Capsule
* Add Windows and Posix wrappers for GenerateCapsule.py

usage: GenerateCapsule [-h] [-o OUTPUTFILE] (-e | -d | --dump-info)
                       [--capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}]
                       [--capoemflag CAPSULEOEMFLAG] [--guid GUID]
                       [--hardware-instance HARDWAREINSTANCE]
                       [--monotonic-count MONOTONICCOUNT]
                       [--fw-version FWVERSION] [--lsv LOWESTSUPPORTEDVERSION]
                       [--pfx-file SIGNTOOLPFXFILE]
                       [--signer-private-cert OPENSSLSIGNERPRIVATECERTFILE]
                       [--other-public-cert OPENSSLOTHERPUBLICCERTFILE]
                       [--trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE]
                       [--signing-tool-path SIGNINGTOOLPATH] [--version] [-v]
                       [-q] [--debug [0-9]]
                       InputFile

Generate a capsule. Copyright (c) 2018, Intel Corporation. All rights
reserved.

positional arguments:
  InputFile             Input binary payload filename.

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUTFILE, --output OUTPUTFILE
                        Output filename.
  -e, --encode          Encode file
  -d, --decode          Decode file
  --dump-info           Display FMP Payload Header information
  --capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}
                        Capsule flag can be PersistAcrossReset, or
                        PopulateSystemTable or InitiateReset or not set
  --capoemflag CAPSULEOEMFLAG
                        Capsule OEM Flag is an integer between 0x0000 and
                        0xffff.
  --guid GUID           The FMP/ESRT GUID in registry format. Required for
                        encode operations.
  --hardware-instance HARDWAREINSTANCE
                        The 64-bit hardware instance. The default is
                        0x0000000000000000
  --monotonic-count MONOTONICCOUNT
                        64-bit monotonic count value in header. Default is
                        0x0000000000000000.
  --fw-version FWVERSION
                        The 32-bit version of the binary payload (e.g.
                        0x11223344 or 5678).
  --lsv LOWESTSUPPORTEDVERSION
                        The 32-bit lowest supported version of the binary
                        payload (e.g. 0x11223344 or 5678).
  --pfx-file SIGNTOOLPFXFILE
                        signtool PFX certificate filename.
  --signer-private-cert OPENSSLSIGNERPRIVATECERTFILE
                        OpenSSL signer private certificate filename.
  --other-public-cert OPENSSLOTHERPUBLICCERTFILE
                        OpenSSL other public certificate filename.
  --trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE
                        OpenSSL trusted public certificate filename.
  --signing-tool-path SIGNINGTOOLPATH
                        Path to signtool or OpenSSL tool. Optional if path to
                        tools are already in PATH.
  --version             show program's version number and exit
  -v, --verbose         Turn on verbose output with informational messages
                        printed, including capsule headers and warning
                        messages.
  -q, --quiet           Disable all messages except fatal errors.
  --debug [0-9]         Set debug level

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Use pickle to replace cPickle
Yunhua Feng [Tue, 31 Jul 2018 08:32:57 +0000 (16:32 +0800)]
BaseTools: Use pickle to replace cPickle

Use pickle to replace cPickle because of python3 removed cPickle

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: remove unused import thread
Yunhua Feng [Tue, 31 Jul 2018 07:19:28 +0000 (15:19 +0800)]
BaseTools: remove unused import thread

remove unused import thread

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>