]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
5 years agoMdeModulePkg/Mtftp4Dxe: Fix invalid configuration of MTFTP local port.
Jiaxin Wu [Mon, 5 Nov 2018 06:46:57 +0000 (14:46 +0800)]
MdeModulePkg/Mtftp4Dxe: Fix invalid configuration of MTFTP local port.

This patch is to fix the invalid setting of MTFTP local port. The
issue can be reproduced by tftp shell command by using [-l port]
option.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
5 years agoOvmfPkg: Replace obsoleted network drivers from platform DSC/FDF.
Fu Siyuan [Tue, 30 Oct 2018 06:49:42 +0000 (14:49 +0800)]
OvmfPkg: Replace obsoleted network drivers from platform DSC/FDF.

V2:
Add missed library instance for NetworkPkg iSCSI driver.

This patch replaces the MdeModulePkg TCP, PXE and iSCSI driver with those
ones in NetworkPkg. These 3 drivers in MdeModulePkg are not being actively
maintained and will be removed from edk2 master soon.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoVlv2TbltDevicePkg: Replace obsoleted drivers from platform DSC/FDF.
Fu Siyuan [Tue, 30 Oct 2018 06:51:16 +0000 (14:51 +0800)]
Vlv2TbltDevicePkg: Replace obsoleted drivers from platform DSC/FDF.

V2:
Add missed library instance for NetworkPkg iSCSI driver.

This patch replaces the MdeModulePkg TCP, PXE and iSCSI driver with those
ones in NetworkPkg. These 3 drivers in MdeModulePkg are not being actively
maintained and will be removed from edk2 master soon.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
5 years agoMaintainer.txt: Add Chao to be co-maintainer of SignedCapsulePkg
Zhang, Chao B [Mon, 5 Nov 2018 14:19:24 +0000 (22:19 +0800)]
Maintainer.txt: Add Chao to be co-maintainer of SignedCapsulePkg

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
5 years agoArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit)
Sumit Garg [Fri, 2 Nov 2018 06:53:14 +0000 (12:23 +0530)]
ArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit)

Correct usage of EFI_PHYSICAL_ADDRESS (always 64-bit) vs. pointers
(depending on architecture).

Reported-by: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoEmulatorPkg: Replace obsoleted network drivers from platform DSC/FDF.
Fu Siyuan [Tue, 30 Oct 2018 06:47:33 +0000 (14:47 +0800)]
EmulatorPkg: Replace obsoleted network drivers from platform DSC/FDF.

This patch replaces the MdeModulePkg TCP, PXE and iSCSI driver with those
ones in NetworkPkg. These 3 drivers in MdeModulePkg are not being actively
maintained and will be removed from edk2 master soon.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoNt32Pkg: Replace obsoleted network drivers from NT32 platform DSC/FDF.
Fu Siyuan [Tue, 30 Oct 2018 06:43:37 +0000 (14:43 +0800)]
Nt32Pkg: Replace obsoleted network drivers from NT32 platform DSC/FDF.

This patch replaces the MdeModulePkg TCP, PXE and iSCSI driver with those
ones in NetworkPkg. These 3 drivers in MdeModulePkg are not being actively
maintained and will be removed from edk2 master soon.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoCorebootPayloadPkg: Remove EdkShellBinPkg in FDF
shenglei [Mon, 5 Nov 2018 03:08:07 +0000 (11:08 +0800)]
CorebootPayloadPkg: Remove EdkShellBinPkg in FDF

Remove EdkShellBinPkg in CorebootPayloadPkg.fdf.
https://bugzilla.tianocore.org/show_bug.cgi?id=1108

v3:Remove FULL_BIN and change SHELL_TYPE from FULL_BIN
to UEFI_BIN.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Change-Id: I4db7068a3a1f68a1f6303079b73dc548c9feb2e3
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
5 years agoBaseTools: Use common cc flag for building PcdValueInit.
BobCF [Fri, 2 Nov 2018 05:56:38 +0000 (13:56 +0800)]
BaseTools: Use common cc flag for building PcdValueInit.

V3:

Update the patch to avoid "reduce" function fail.

V2:
Support to extract the common cc flag from a
combined cc flag string. For example
MSFT:*_*_IA32_CC_FLAGS = /D DISABLE_NEW_DEPRECATED_INTERFACES /DDEF_IA32
MSFT:*_*_X64_CC_FLAGS  = /DDEF_X64 /D DISABLE_NEW_DEPRECATED_INTERFACES

V1:
Use common cc flags for building PcdValueInit. The common
cc flags include the cc flag which is under common arch and
under all build arches.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools build_rule.template: Update aslc rule for XCODE tool chain
Liming Gao [Fri, 2 Nov 2018 15:17:07 +0000 (23:17 +0800)]
BaseTools build_rule.template: Update aslc rule for XCODE tool chain

Update aslc rule to rename the temp output file from .efi to .pecoff.
This change can avoid the conflict .efi file name in output directory.
One is the driver image, another is aslc temp output file.

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 agoShellPkg-ShellApp: Provide fully-qualified path to shell scripts
Jim.Dailey@dell.com [Mon, 29 Oct 2018 21:14:51 +0000 (05:14 +0800)]
ShellPkg-ShellApp: Provide fully-qualified path to shell scripts

Provide fully-qualified path to shell scripts

Section 3.6.2 of version 2.2 of the shell specification requires that
the first positional argument (i.e. arg 0) of a shell script resolves
to "the full path name of the script itself."

Ensure that the startup script and any scripts launched by the shell
meet this requirement.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoShellPkg-UefiShellLib: Add a function to fully-qualify paths
Jim.Dailey@dell.com [Mon, 29 Oct 2018 21:14:36 +0000 (05:14 +0800)]
ShellPkg-UefiShellLib: Add a function to fully-qualify paths

Add a function to return a clean, fully-qualified version of some path.

This function handles a (possibly "dirty") input path that may or may
not include a file system reference.

If it does not include a file system reference, then if the input path
does not begin with a forward or backward slash, then the input path is
relative to the current working directory of the current file system.
Otherwise, it is an absolute path within the current file system.

If it does include a file system reference, it may be a reference to the
current or some other file system.  If the file system reference is not
immediately followed by a forward or backward slash, then the input path
is relative to the current working directory of the given file system.
Otherwise, it is an absolute path within the given file system.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Rollback old change 2a5997f8.
Dong, Eric [Fri, 2 Nov 2018 08:27:48 +0000 (16:27 +0800)]
UefiCpuPkg/MpInitLib: Rollback old change 2a5997f8.

In some special cases, after BSP sends Init-sipi-sipi signal
AP needs more time to start the Ap procedure. In this case
BSP may think AP has finished its task but in fact AP hasn't began
yet.

Rollback former change to keep the status which only be used
when AP really finished task.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMaintainers.txt: Change package maintainer of UefiCpuPkg
Ruiyu Ni [Fri, 2 Nov 2018 09:21:37 +0000 (17:21 +0800)]
Maintainers.txt: Change package maintainer of UefiCpuPkg

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMaintainers.txt: Change package maintainer of IntelSiliconPkg
Ruiyu Ni [Fri, 2 Nov 2018 09:19:03 +0000 (17:19 +0800)]
Maintainers.txt: Change package maintainer of IntelSiliconPkg

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
5 years agoBaseTools: Check the max size for string PCD.
Zhao, ZhiqiangX [Wed, 31 Oct 2018 10:35:47 +0000 (18:35 +0800)]
BaseTools: Check the max size for string PCD.

According to PCD_DATABASE_INIT in
edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h,
the max size for string PCD should not exceed USHRT_MAX 65535(0xffff).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
5 years agoMdePkg/Base.h: Implement BASE_CR() via OFFSET_OF().
Marvin.Haeuser@outlook.com [Wed, 31 Oct 2018 20:08:35 +0000 (04:08 +0800)]
MdePkg/Base.h: Implement BASE_CR() via OFFSET_OF().

Replace the current NULL pointer dereference to retrieve Field's
offset with a call to OFFSET_OF().  This is implemented via
__builtin_offsetof for GCC and Clang, which eliminates UB caught by
Clang UndefinedBehaviorSanitizer.

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 agoBaseTools tools_def.template: Add GCC link script option in ASLDLINK_FLAGS
Liming Gao [Thu, 1 Nov 2018 14:35:29 +0000 (22:35 +0800)]
BaseTools tools_def.template: Add GCC link script option in ASLDLINK_FLAGS

GCC link script is used to discard the unused section data from ELF image.
ASLDLINK_FLAGS requires it to remove the unnecessary section data, then
GenFw can be used to retrieve the correct data section from ELF image.

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 agoBaseTools: Add checking to EFI variable attribute.
Feng, Bob C [Thu, 1 Nov 2018 15:07:01 +0000 (23:07 +0800)]
BaseTools: Add checking to EFI variable attribute.

This patch is going to add a check that only if the
attribute of a EFI variable include 'NV', it will be
added into PcdNvStoreDefaultValueBuffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg: Remove the trailing space in three source files.
Liming Gao [Thu, 1 Nov 2018 13:36:09 +0000 (21:36 +0800)]
MdeModulePkg: Remove the trailing space in three source files.

The recent changes in these three source files introduce the trailing space.
This patch removes them to follow edk2 coding style.

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 agoBaseTools/Eot: Remove a duplication code in EotMain class
Hess Chen [Wed, 31 Oct 2018 05:53:27 +0000 (13:53 +0800)]
BaseTools/Eot: Remove a duplication code in EotMain class

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Add special handle for '\' use in Pcd Value
zhijufan [Wed, 17 Oct 2018 05:57:01 +0000 (13:57 +0800)]
BaseTools: Add special handle for '\' use in Pcd Value

V2: Follow PEP8 to not multiples import on one line

Case:
gEfiOzmosisPkgTokenSpaceGuid.PcdBootLogFolderPath|L"\\Logs\\"|VOID*|12

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1287
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
5 years agoBaseTools: Fix merge in FDF parser for OptionROM override
Tomas Pilar [Mon, 29 Oct 2018 16:52:53 +0000 (00:52 +0800)]
BaseTools: Fix merge in FDF parser for OptionROM override

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Tomas Pilar <tpilar@solarflare.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg/PiSmmIpl: Do not reset SMRAM to UC when CPU driver runs
Ruiyu Ni [Mon, 22 Oct 2018 09:03:07 +0000 (17:03 +0800)]
MdeModulePkg/PiSmmIpl: Do not reset SMRAM to UC when CPU driver runs

Today's PiSmmIpl implementation initially sets SMRAM to WB to speed
up the SMM core/modules loading before SMM CPU driver runs.
When SMM CPU driver runs, PiSmmIpl resets the SMRAM to UC. It's done
in SmmIplDxeDispatchEventNotify(). COMM_BUFFER_SMM_DISPATCH_RESTART
is returned from SMM core that SMM CPU driver is just dispatched.

Since now the SMRR is widely used to control the SMRAM cache setting.
It's not needed to reset the SMRAM to UC anymore.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
5 years agoNetworkPkg/TlsDxe: Fix failure to process multiple TLS records.
Jiaxin Wu [Tue, 30 Oct 2018 03:30:08 +0000 (11:30 +0800)]
NetworkPkg/TlsDxe: Fix failure to process multiple TLS records.

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

Current implementation failed to parse the multiple TLS record
messages due to the incorrect pointer of TLS record header. This
patch is to resolve that problem.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
5 years agoNetworkPkg/Mtftp6Dxe: Remove the trailing white spaces.
Jiaxin Wu [Wed, 31 Oct 2018 08:29:24 +0000 (16:29 +0800)]
NetworkPkg/Mtftp6Dxe: Remove the trailing white spaces.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
5 years agoFmpDevicePkg DSC: Add NOOPT target to verify NOOPT target
Liming Gao [Tue, 30 Oct 2018 07:50:09 +0000 (15:50 +0800)]
FmpDevicePkg DSC: Add NOOPT target to verify NOOPT target

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 agoBaseTools ConvertFceToStructurePcd: Fix the array value with empty string
Liming Gao [Tue, 30 Oct 2018 14:59:45 +0000 (22:59 +0800)]
BaseTools ConvertFceToStructurePcd: Fix the array value with empty string

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 agoCryptoPkg/BaseCryptLib: Fix potential integer overflow issue.
Long Qin [Wed, 24 Oct 2018 13:16:42 +0000 (21:16 +0800)]
CryptoPkg/BaseCryptLib: Fix potential integer overflow issue.

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

The LookupFreeMemRegion() in RuntimeMemAllocate.c is used to look-up
free memory region for runtime resource allocation, which was designed
to support runtime authenticated variable service.
The ReqPages in this function is the required pages to be allocated,
which depends on the malloc() call in internal OpenSSL routines. The
direct offset subtractions on ReqPages may bring possible integer
overflow issue.

This patch is to add the extra parameter checks to remove this possible
overflow risk.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
5 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix build failure.
Eric Dong [Tue, 30 Oct 2018 03:02:11 +0000 (11:02 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix build failure.

Build UefiCpuPkg with below configuration:
Architecture(s)  = IA32
Build target     = NOOPT
Toolchain        = VS2015x86

Below error info shows up:
DxeRegisterCpuFeaturesLib.lib(CpuFeaturesInitialize.obj) :
error LNK2001: unresolved external symbol __allmul

Valid mDependTypeStr type only have 5 items, use UINT32 type cast
to fix this error.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMdeModulePkg/UdfDxe: Memory free/use after free in ResolveSymlink()
Hao Wu [Tue, 30 Oct 2018 01:17:04 +0000 (09:17 +0800)]
MdeModulePkg/UdfDxe: Memory free/use after free in ResolveSymlink()

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

For function ResolveSymlink(), the below codes:

    if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent,
                    sizeof (UDF_FILE_INFO)) != 0) {
      CleanupFileInformation (&PreviousFile);
    }

    CopyMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO));

If the contents in 'PreviousFile' and 'File' are the same, call to
"CleanupFileInformation (&PreviousFile);" will free the buffers in 'File'
as well. This will lead to potential memory double free/use after free
issues.

This commit will add additional check to address the above issue.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoMdeModulePkg/UdfDxe: Content check for 'File' in ResolveSymlink()
Hao Wu [Tue, 30 Oct 2018 01:11:57 +0000 (09:11 +0800)]
MdeModulePkg/UdfDxe: Content check for 'File' in ResolveSymlink()

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

The content within 'File' is the output data for ResolveSymlink(). This
commit will add checks to ensure the content in 'File' is valid.
Otherwise, possible null pointer dereference issue will occur during the
subsequent usage of the data returned by ResolveSymlink().

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoMdeModulePkg/UdfDxe: Check 'Component Type' within a Path Component
Hao Wu [Tue, 30 Oct 2018 01:06:48 +0000 (09:06 +0800)]
MdeModulePkg/UdfDxe: Check 'Component Type' within a Path Component

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

According to the ECMA-167 standard (3rd Edition - June 1997), Section
14.16.1.1, valid values are 1 to 5. All other values will be treated as a
corrupted volume.

This commit will add such check within function ResolveSymlink().

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoArmPkg/OpteeLib: Add APIs to communicate with OP-TEE
Sumit Garg [Mon, 22 Oct 2018 06:29:36 +0000 (11:59 +0530)]
ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

Add following APIs to communicate with OP-TEE pseudo/early TAs:
1. OpteeInit
2. OpteeOpenSession
3. OpteeCloseSession
4. OpteeInvokeFunc

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix ASSERT for success.
Marvin H?user [Sun, 28 Oct 2018 08:51:23 +0000 (16:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix ASSERT for success.

Index is initialized to MAX_UINT16 as default failure value, which
is what the ASSERT is supposed to test for.  The ASSERT condition
however can never return FALSE for INT16 != int, as due to
Integer Promotion[1], Index is converted to int, which can never
result in -1.

Furthermore, Index is used as a for loop index variable inbetween its
initialization and the ASSERT, so the value is unconditionally
overwritten too.

Fix the ASSERT check to compare Index to its upper boundary, which it
will be equal to if the loop was not broken out of on success.

[1] ISO/IEC 9899:2011, 6.5.9.4

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoUefiCpuPkg/MpInitLib: Fix ASSERT for success.
Marvin H?user [Sun, 28 Oct 2018 08:51:22 +0000 (16:51 +0800)]
UefiCpuPkg/MpInitLib: Fix ASSERT for success.

Index is initialized to MAX_UINT16 as default failure value, which
is what the ASSERT is supposed to test for.  The ASSERT condition
however can never return FALSE for INT16 != int, as due to
Integer Promotion[1], Index is converted to int, which can never
result in -1.

Furthermore, Index is used as a for loop index variable inbetween its
initialization and the ASSERT, so the value is unconditionally
overwritten too.

Fix the ASSERT check to compare Index to its upper boundary, which it
will be equal to if the loop was not broken out of on success.

[1] ISO/IEC 9899:2011, 6.5.9.4

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg/Core: fix an issue of potential NULL pointer access
Jian J Wang [Mon, 29 Oct 2018 08:20:44 +0000 (16:20 +0800)]
MdeModulePkg/Core: fix an issue of potential NULL pointer access

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

This issue is introduced by bb685071c2602cf786ea84c69bbebf2158194a38.

The *MemorySpaceMap assigned with NULL (line 1710) value might be
accessed (line 1726/1730) without any sanity check. Although it won't
happen in practice because of line 1722, we still need to add check
against NULL to make static code analyzer happy.

1710  *MemorySpaceMap       = NULL;
....  ...
1722  if (DescriptorCount == *NumberOfDescriptors) {
....  ...
1726    Descriptor = *MemorySpaceMap;
....  ...
1730        BuildMemoryDescriptor (Descriptor, Entry);

Tests:
  Pass build and boot to shell.

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoMdeModulePkg/UsbBusDxe: Add missing "return NULL" in UsbCreateDesc()
Ruiyu Ni [Mon, 29 Oct 2018 03:54:45 +0000 (11:54 +0800)]
MdeModulePkg/UsbBusDxe: Add missing "return NULL" in UsbCreateDesc()

When (Len < Offset) is TRUE, indicating the data to visit is beyond
the boundary, the error message is printed but the function doesn't
return NULL.

It's a typo when modifying the commit 4c034bf62.

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 agoIntelFsp2Pkg: Fixed potentially NULL pointer accessing
Chasel, Chiu [Fri, 26 Oct 2018 07:12:33 +0000 (15:12 +0800)]
IntelFsp2Pkg: Fixed potentially NULL pointer accessing

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

When copying IDT table in SecMain, the pointer might be
NULL so added the check to fix it.

Test: Verified on internal platform and boots successfully.

Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
5 years agoMdeModulePkg/UsbBusPei: Reject descriptor whose length is bad
Ruiyu Ni [Thu, 25 Oct 2018 10:09:46 +0000 (18:09 +0800)]
MdeModulePkg/UsbBusPei: Reject descriptor whose length is bad

Today's implementation doesn't check whether the length of
descriptor is valid before using it.

The patch fixes this issue by syncing the similar fix to UsbBusDxe.
70c3c2370a2aefe71cf0f6c1a1e063f7d74e1d79
*MdeModulePkg/UsbBus: Reject descriptor whose length is bad

Additionally the patch also rejects the data when length is
larger than sizeof (PeiUsbDevice->ConfigurationData).

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: Jiewen Yao <jiewen.yao@intel.com>
5 years agoMdeModulePkg/UsbBusPei: Fix out-of-bound read access to descriptors
Ruiyu Ni [Thu, 25 Oct 2018 09:07:12 +0000 (17:07 +0800)]
MdeModulePkg/UsbBusPei: Fix out-of-bound read access to descriptors

Today's implementation reads the Type/Length field in the USB
descriptors data without checking whether the offset to read is
beyond the data boundary.

The patch fixes this issue by syncing the fix in commit
4c034bf62cbc1f3c5f4b5df25de97f0f528132b2
*MdeModulePkg/UsbBus: Fix out-of-bound read access to descriptors

ParsedBytes in UsbBusPei.GetExpectedDescriptor() is different from
Consumed in UsbBusDxe.UsbCreateDesc().
ParsedBytes is the offset of found descriptor while Consumed is
offset of next descriptor of found one.

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: Jiewen Yao <jiewen.yao@intel.com>
5 years agoNetworkPkg/Mtftp6Dxe: Correct the total received and saved block number.
Jiaxin Wu [Thu, 25 Oct 2018 07:16:13 +0000 (15:16 +0800)]
NetworkPkg/Mtftp6Dxe: Correct the total received and saved block number.

The block returned from Mtftp6RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
5 years agoMdeModulePke/Mtftp4Dxe: Correct the total received and saved block number.
Jiaxin Wu [Thu, 25 Oct 2018 07:31:10 +0000 (15:31 +0800)]
MdeModulePke/Mtftp4Dxe: Correct the total received and saved block number.

The block returned from Mtftp4RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
5 years agoMdeModulePkg EhciDxe: Use common buffer for AsyncInterruptTransfer
Star Zeng [Thu, 25 Oct 2018 08:20:34 +0000 (16:20 +0800)]
MdeModulePkg EhciDxe: Use common buffer for AsyncInterruptTransfer

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

In current code, EhcMonitorAsyncRequests (timer handler) will do
unmap and map operations for AsyncIntTransfers to "Flush data from
PCI controller specific address to mapped system memory address".
EhcMonitorAsyncRequests
  EhcFlushAsyncIntMap
    PciIo->Unmap
      IoMmu->SetAttribute
    PciIo->Map
      IoMmu->SetAttribute

This may impact the boot performance.

Since the data buffer for EhcMonitorAsyncRequests is internal
buffer, we can allocate common buffer by PciIo->AllocateBuffer
and map the buffer with EfiPciIoOperationBusMasterCommonBuffer,
then the unmap and map operations can be removed.

///
/// Provides both read and write access to system memory by
/// both the processor and a bus master. The buffer is coherent
/// from both the processor's and the bus master's point of view.
///
EfiPciIoOperationBusMasterCommonBuffer,

Test done:
USB KB works normally.
USB disk read/write works normally.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoMdeModulePkg XhciDxe: Use common buffer for AsyncInterruptTransfer
Star Zeng [Thu, 25 Oct 2018 08:20:27 +0000 (16:20 +0800)]
MdeModulePkg XhciDxe: Use common buffer for AsyncInterruptTransfer

V3:
Call XhcFreeUrb after XhcCreateTransferTrb fails in XhcCreateTrb.

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

In current code, XhcMonitorAsyncRequests (timer handler) will do
unmap and map operations for AsyncIntTransfers to "Flush data from
PCI controller specific address to mapped system memory address".
XhcMonitorAsyncRequests
  XhcFlushAsyncIntMap
    PciIo->Unmap
      IoMmu->SetAttribute
    PciIo->Map
      IoMmu->SetAttribute

This may impact the boot performance.

Since the data buffer for XhcMonitorAsyncRequests is internal
buffer, we can allocate common buffer by PciIo->AllocateBuffer
and map the buffer with EfiPciIoOperationBusMasterCommonBuffer,
then the unmap and map operations can be removed.

///
/// Provides both read and write access to system memory by
/// both the processor and a bus master. The buffer is coherent
/// from both the processor's and the bus master's point of view.
///
EfiPciIoOperationBusMasterCommonBuffer,

Test done:
USB KB works normally.
USB disk read/write works normally.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoMdeModulePkg EhciDxe: Extract new EhciInsertAsyncIntTransfer function
Star Zeng [Wed, 24 Oct 2018 11:27:22 +0000 (19:27 +0800)]
MdeModulePkg EhciDxe: Extract new EhciInsertAsyncIntTransfer function

V3:
Match function parameter name and description between
EhciSched.c and EhciSched.h.

V2:
Add the missing "gBS->FreePool (Data);".

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

Extract new EhciInsertAsyncIntTransfer function from
EhcAsyncInterruptTransfer.

It is code preparation for following patch,
no essential functional change.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoMdeModulePkg XhciDxe: Extract new XhciInsertAsyncIntTransfer function
Star Zeng [Mon, 22 Oct 2018 08:29:03 +0000 (16:29 +0800)]
MdeModulePkg XhciDxe: Extract new XhciInsertAsyncIntTransfer function

V3:
Match function parameter name and description between
XhciSched.c and XhciSched.h.

V2:
Add the missing "FreePool (Data);".
Remove the unnecessary indentation change.

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

Extract new XhciInsertAsyncIntTransfer function from
XhcAsyncInterruptTransfer.

It is code preparation for following patch,
no essential functional change.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
5 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix GCC build failure.
Dong, Eric [Sat, 27 Oct 2018 09:09:21 +0000 (17:09 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix GCC build failure.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg/Core: correct one coding style
Jian J Wang [Sat, 27 Oct 2018 02:12:13 +0000 (10:12 +0800)]
MdeModulePkg/Core: correct one coding style

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

Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
5 years agoBaseTools: Sync the DevicePath Function update from MdePkg
Feng, YunhuaX [Fri, 26 Oct 2018 08:37:14 +0000 (16:37 +0800)]
BaseTools: Sync the DevicePath Function update from MdePkg

Update the AcpiExp, USBxxx, Sata, VENDOR_DEVICE_PATH.

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: Rollback Filter out unused structure pcds
Feng, Bob C [Fri, 26 Oct 2018 14:34:52 +0000 (22:34 +0800)]
BaseTools: Rollback Filter out unused structure pcds

This reverts commit 51d17bb7b0da0d9c9e91c226f1982d7020f43795.
commit 51d17bb7b0da0d9c9e91c226f1982d7020f43795 adds new check
of Pcds in the platform unused library INF files.
It breaks the existing platform.
To avoid the impact, roll back this change first.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob C Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg RegularExpressionDxe: Remove unknown build option for XCODE
Liming Gao [Fri, 26 Oct 2018 02:33:24 +0000 (10:33 +0800)]
MdeModulePkg RegularExpressionDxe: Remove unknown build option for XCODE

This patch makes RegularExpressionDxe pass XCODE5 build.

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 agoBaseTools: Allow multiple PciDeviceId in Fdf OptionROM override
Tomas Pilar [Wed, 24 Oct 2018 11:42:36 +0000 (19:42 +0800)]
BaseTools: Allow multiple PciDeviceId in Fdf OptionROM override

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Tomas Pilar <tpilar@solarflare.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools: Fix BPDG tool print traceback info issue
Feng, YunhuaX [Thu, 25 Oct 2018 05:51:01 +0000 (13:51 +0800)]
BaseTools: Fix BPDG tool print traceback info issue

Fix BPDG tool print traceback info issue
and remove abundant code

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoMdeModulePkg/Core: fix an IA32 build failure
Jian J Wang [Fri, 26 Oct 2018 04:45:07 +0000 (12:45 +0800)]
MdeModulePkg/Core: fix an IA32 build failure

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

The failure is caused by data type conversion between UINTN and UINT64,
which is checked in at 63ebde8ef6d4ff497d054ccc010904ecd4441198.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/HiiDB: Make sure database update behaviors are atomic
Dandan Bi [Fri, 12 Oct 2018 10:13:19 +0000 (18:13 +0800)]
MdeModulePkg/HiiDB: Make sure database update behaviors are atomic

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

When update contents in HiiDatabase, like:
1. Add/update/remove package list
2. Add/update string
3. Add/update image
We should make these operations atomic to prevent the
potential issue that the one update operation with
higher TPL may interrupt another.
This commit is to make the HiiDatabase update behaviors
atomic by adding EfiAcquireLock/EfiReleaseLock function.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoMdeModulePkg/HiiDB: Reorganize codes of exporting HII settings
Dandan Bi [Thu, 11 Oct 2018 06:37:09 +0000 (14:37 +0800)]
MdeModulePkg/HiiDB: Reorganize codes of exporting HII settings

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

Function "HiiGetConfigurationSetting" may be called
when HiiDatabase contents have been updated.
And it is just to call function "HiiGetDatabaseInfo" to
get the contents in HiiDatabase and call function
"HiiGetConfigRespInfo" and get the configuration response
string form HII drivers.

So here we can remove function "HiiGetConfigurationSetting"
and make caller to call "HiiGetDatabaseInfo" and
"HiiGetConfigRespInfo" directly.

And thus it also can distinguish which code blocks are to
operate HiiDatabase contents and which code blocks are not.
Then it's easy to know which code blocks should be atomic
when updating HiiDatabase contents.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Roll back code modify by commit 9e47e6f90880
Feng, YunhuaX [Fri, 26 Oct 2018 06:07:59 +0000 (14:07 +0800)]
BaseTools: Roll back code modify by commit 9e47e6f90880

Roll back code modify by commit 9e47e6f90880,
if ForceRebase not False or True, the GenFv command not need add parameter

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>
5 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Support combo CPU feature style.
Eric Dong [Thu, 25 Oct 2018 06:50:22 +0000 (14:50 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Support combo CPU feature style.

Current code assume only one dependence (before or after) for one
feature. Enhance code logic to support feature has two dependence
(before and after) type.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoIntelFsp2Pkg: Fix GCC49/XCODE build failure
Chasel, Chiu [Fri, 26 Oct 2018 02:41:49 +0000 (10:41 +0800)]
IntelFsp2Pkg: Fix GCC49/XCODE build failure

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

Fixed potentially uninitialized variable build failure
caused by commit: b1cc6f672f3b924cdb190e5b92db3b47f46a8911

Test: Verified on internal platform and boots successfully.

Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix build failure for VS2012 and GCC49.
Eric Dong [Thu, 25 Oct 2018 02:12:52 +0000 (10:12 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix build failure for VS2012 and GCC49.

Code initialized in function can't be correctly detected by build tool.
Add code to clearly initialize the local variable before use it.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Clean up useless code.
Eric Dong [Thu, 25 Oct 2018 02:03:57 +0000 (10:03 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Clean up useless code.

Remove useless code after change 93324390.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove white space at line end.
Eric Dong [Thu, 25 Oct 2018 01:51:29 +0000 (09:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove white space at line end.

Remove extra white space at the end of line.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix ECC issues.
Eric Dong [Thu, 25 Oct 2018 01:51:00 +0000 (09:51 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix ECC issues.

Changes include:
1. Remove extra white space at the end of line.
2. Add comments for the new add function parameter.
3. Update IN OUT tag for function parameter.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/CpuCommonFeaturesLib: Remove white space at line end.
Eric Dong [Thu, 25 Oct 2018 01:49:35 +0000 (09:49 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: Remove white space at line end.

Remove extra white space at the end of line.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix build failure for VS2012 and GCC49.
Eric Dong [Thu, 25 Oct 2018 01:42:09 +0000 (09:42 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix build failure for VS2012 and GCC49.

Code initialized in function can't be correctly detected by build tool.
Add code to clearly initialize the local variable before use it.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoBaseTools:Not miss the full assign value of FixedAtBuild structure PCD
Zhaozh1x [Wed, 24 Oct 2018 12:31:23 +0000 (20:31 +0800)]
BaseTools:Not miss the full assign value of FixedAtBuild structure PCD

For structure PCD, if it is a FixedAtBuild PCD, the full assign value in
dsc file should not be missed when updating the structure PCD value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
5 years agoMdeModulePkg/Core: add freed-memory guard feature
Jian J Wang [Wed, 24 Oct 2018 04:47:45 +0000 (12:47 +0800)]
MdeModulePkg/Core: add freed-memory guard feature

Freed-memory guard is used to detect UAF (Use-After-Free) memory issue
which is illegal access to memory which has been freed. The principle
behind is similar to pool guard feature, that is we'll turn all pool
memory allocation to page allocation and mark them to be not-present
once they are freed.

This also implies that, once a page is allocated and freed, it cannot
be re-allocated. This will bring another issue, which is that there's
risk that memory space will be used out. To address it, the memory
service add logic to put part (at most 64 pages a time) of freed pages
back into page pool, so that the memory service can still have memory
to allocate, when all memory space have been allocated once. This is
called memory promotion. The promoted pages are always from the eldest
pages which haven been freed.

This feature brings another problem is that memory map descriptors will
be increased enormously (200+ -> 2000+). One of change in this patch
is to update MergeMemoryMap() in file PropertiesTable.c to allow merge
freed pages back into the memory map. Now the number can stay at around
510.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoMdeModulePkg/Core: prevent re-acquire GCD memory lock
Jian J Wang [Wed, 24 Oct 2018 03:28:32 +0000 (11:28 +0800)]
MdeModulePkg/Core: prevent re-acquire GCD memory lock

This issue is hidden in current code but exposed by introduction
of freed-memory guard feature due to the fact that the feature
will turn all pool allocation to page allocation.

The solution is moving the memory allocation in CoreGetMemorySpaceMap()
to be out of the GCD memory map lock.

   CoreDumpGcdMemorySpaceMap()
=> CoreGetMemorySpaceMap()
=> CoreAcquireGcdMemoryLock () *
   AllocatePool()
=> InternalAllocatePool()
=> CoreAllocatePool()
=> CoreAllocatePoolI()
=> CoreAllocatePoolPagesI()
=> CoreAllocatePoolPages()
=> FindFreePages()
=> PromoteMemoryResource()
=> CoreAcquireGcdMemoryLock()  **

Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
5 years agoUefiCpuPkg/CpuDxe: prevent recursive calling of InitializePageTablePool
Jian J Wang [Wed, 24 Oct 2018 03:21:04 +0000 (11:21 +0800)]
UefiCpuPkg/CpuDxe: prevent recursive calling of InitializePageTablePool

The freed-memory guard feature will cause a recursive calling
of InitializePageTablePool(). This is due to a fact that
AllocateAlignedPages() is used to allocate page table pool memory.
This function will most likely call gBS->FreePages to free unaligned
pages and then cause another round of page attributes change, like
below (freed pages will be always marked not-present if freed-memory
guard is enabled)

   FreePages() <===============|
=> CpuSetMemoryAttributes()    |
=> <if out of page table>      |
=> InitializePageTablePool()   |
=> AllocateAlignedPages()      |
=> FreePages() ================|

The solution is add a global variable as a lock in page table pool
allocation function and fail any other requests if it has not been
done.

Since this issue will only happen if free-memory guard is enabled,
it won't affect CpuSetMemoryAttributes() in default build of a BIOS.

If free-memory guard is enabled, it only affect the pages
(failed to mark them as not-present) freed in AllocateAlignedPages().

Since those freed pages haven't been used yet (their addresses not
yet exposed to code outside AllocateAlignedPages), it won't compromise
the freed-memory guard feature.

This change will just fail the CpuSetMemoryAttributes() called from
FreePages() but it won't fail the FreePages(). So the error status
won't be propagated upper layer of code.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoUefiCpuPkg/CpuDxe: consider freed-memory guard in non-stop mode
Jian J Wang [Wed, 24 Oct 2018 02:48:37 +0000 (10:48 +0800)]
UefiCpuPkg/CpuDxe: consider freed-memory guard in non-stop mode

Non-stop mode was introduced / explained in commit 8f2613628acf
("MdeModulePkg/MdeModulePkg.dec: add new settings for PCDs",
2018-08-30).

The macro HEAP_GUARD_NONSTOP_MODE was added to CpuDxe in commit
dcc026217fdc ("UefiCpuPkg/CpuDxe: implement non-stop mode for uefi",
2018-08-30).

Another instance of the macro HEAP_GUARD_NONSTOP_MODE was added to
PiSmmCpuDxeSmm -- with BIT1|BIT0 replaced with BIT3|BIT2 -- in commit
09afd9a42a7f ("UefiCpuPkg/PiSmmCpuDxeSmm: implement non-stop mode for
SMM", 2018-08-30)

Since the freed-memory guard is for UEFI-only. This patch only updates
HEAP_GUARD_NONSTOP_MODE in "UefiCpuPkg/CpuDxe/CpuDxe.h" (add BIT4).

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
5 years agoMdeModulePkg: introduce UEFI freed-memory guard bit in HeapGuard PCD
Jian J Wang [Wed, 24 Oct 2018 02:26:07 +0000 (10:26 +0800)]
MdeModulePkg: introduce UEFI freed-memory guard bit in HeapGuard PCD

UAF (Use-After-Free) memory issue is kind of illegal access to memory
which has been freed. It can be detected by a new freed-memory guard
enforced onto freed memory.

BIT4 of following PCD is used to enable the freed-memory guard feature.

  gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask

Please note this feature is for debug purpose and should not be enabled
in product BIOS, and cannot be enabled with pool/page heap guard at the
same time. It's disabled by default.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoMdeModulePkg: cleanup Heap Guard pool/page type PCD documentation
Jian J Wang [Wed, 24 Oct 2018 02:14:43 +0000 (10:14 +0800)]
MdeModulePkg: cleanup Heap Guard pool/page type PCD documentation

This cleanup is meant for avoiding misuse of newly introduced BIT4
(UAF detection) of PCD PcdHeapGuardPropertyMask, because it applies
to all types of physical memory. In another words,
PcdHeapGuardPoolType and PcdHeapGuardPageType don't have effect to
the BIT4 of PcdHeapGuardPropertyMask.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agoSecurityPkg/Include/Library/TcgStorageOpalLib.h: Update Pyrite spec revision.
Eric Dong [Fri, 26 Oct 2018 01:14:02 +0000 (09:14 +0800)]
SecurityPkg/Include/Library/TcgStorageOpalLib.h: Update Pyrite spec revision.

Pyrite 2.0 spec has been published, update the spec link info for this file.

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/GenFds: create and use new variable in FdfParser
Carsey, Jaben [Tue, 23 Oct 2018 17:29:24 +0000 (01:29 +0800)]
BaseTools/GenFds: create and use new variable in FdfParser

replace lots of '}' and "}" with a shared new consistent variable.

Cc: Bob Feng <bob.c.feng@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: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
5 years agoBaseTools/GenFds: refactor FdfParser warnings
Carsey, Jaben [Tue, 23 Oct 2018 17:29:23 +0000 (01:29 +0800)]
BaseTools/GenFds: refactor FdfParser warnings

make functions for common error messages
refactor to use these functions

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/GenFds: remove MacroDict parameter
Jaben Carsey [Tue, 23 Oct 2018 17:29:22 +0000 (01:29 +0800)]
BaseTools/GenFds: remove MacroDict parameter

The MacroDict parameter goes around in circles through 4 functions without use.
1. GetSectionData calls into GetLeafSection, otherwise doesn?t use MacroDict
2. GetLeafSection calls into GetFileStatement, otherwise doesn?t use MacroDict
3. GetFileStatement calls into GetFilePart, otherwise doesn?t use MacroDict
4. GetFilePart calls into GetSectionData, otherwise doesn?t use MacroDict
Go to 1 and repeat forever.

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: refactor class FV
Carsey, Jaben [Tue, 23 Oct 2018 17:29:21 +0000 (01:29 +0800)]
Basetools/GenFds: refactor class FV

1) initialize UiFvName via __init__ parameter. No change to default behavior.
2) initialize 3 empty lists in __init__. Curently not guarenteed initialized.

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/GenFds: change objects to sets
Carsey, Jaben [Tue, 23 Oct 2018 17:29:20 +0000 (01:29 +0800)]
BaseTools/GenFds: change objects to sets

Change lists and tuples used solely for "in" testing to sets.
These operations are not order dependent.
fixed some line length for PEP8 compliance on some.

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: cleanup GenFds
Carsey, Jaben [Tue, 23 Oct 2018 17:29:19 +0000 (01:29 +0800)]
BaseTools/GenFds: cleanup GenFds

1) remove wildcard imports and use explicit imports
2) refactor to use shared variables from Common/DataType
3) rename to not shadow imports
4) don't assign a variable in a loop (just do final assignment)
5) remove spaces, parens, unused or commented out code, etc.
6) merge unnecessary parent classes into child
7) refactor to share DXE and PEI apriori GUIDs from one place
  this includes changes to Build and EOT files
8) for PEP8, dont use __ for custom methods.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob C Feng <bob.c.feng@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 agoMaintainers.txt: add DynamicTablesPkg
Leif Lindholm [Tue, 2 Oct 2018 15:56:08 +0000 (16:56 +0100)]
Maintainers.txt: add DynamicTablesPkg

DynamicTablesPkg has been in edk2-staging[1] for some time now, and it is
time for it to move into the main tree.
[1] https://github.com/tianocore/edk2-staging/tree/dynamictables

Add Evan and Sami as maintainers of the new package, and let them bring
it in themselves.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
5 years agoIntelFsp2Pkg: FSP should not override IDT
Chasel, Chiu [Fri, 19 Oct 2018 09:10:30 +0000 (17:10 +0800)]
IntelFsp2Pkg: FSP should not override IDT

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

FSP should not override IDT table when it is initialized
by boot loader. IDT should be re-initialized in FSP only
when it is invalid.
To mitigate temporary memory usage a PCD
PcdFspMaxInterruptSupported created for platform to decide
how many interrupts the FSP IDT table can support.

Test: Verified on internal platform and boots successfully.

Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
5 years agoBaseTools: list .nasm include inc files as its dependency
zhijufan [Wed, 24 Oct 2018 01:08:39 +0000 (09:08 +0800)]
BaseTools: list .nasm include inc files as its dependency

.nasm source file may include some header files.
header file should be listed in Makefile as .nasm source file
dependency.
But now, BaseTools doesn't find them and list them in Makefile.
This is a missing, because original ASM file supports 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: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Fix VPD PCD Sub-section display bug
Yonghong Zhu [Tue, 23 Oct 2018 08:14:28 +0000 (16:14 +0800)]
BaseTools: Fix VPD PCD Sub-section display bug

original we get the VPD PCD items from the VPDGuid.map file in the FV
output folder. but this logic doesn't work when 1) there only have
single non Default SKU, 2) there have multiple SKU with same value.
Now we change it to get the really VPD Pcd items that already display
in the PCD section of the report.

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: Fix the bug for Pcd used in command line's override
Yonghong Zhu [Wed, 24 Oct 2018 06:46:09 +0000 (14:46 +0800)]
BaseTools: Fix the bug for Pcd used in command line's override

V2: remove the not used parameter i

Fix the bug for Pcd used in command line not override the Pcd used
in the [component] driver's sub-section.

Case:
DSC file:
[PcdsFixedAtBuild]
TokenSpaceGuid.PcdTest

[Components]
 TestPkg/TestDriver.inf {
  <PcdsFixedAtBuild>
  TokenSpaceGuid.PcdTest|"b"
  }

build command with --pcd TokenSpaceGuid.PcdTest="AAAABB"

Then we found the Pcd value in the AutoGen.c file is incorrect,
because of the incorrect logic that use the pcd in the [component]
section to re-override it.

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/NvmExpressDxe: Refine PassThru IO queue creation behavior
Hao Wu [Tue, 23 Oct 2018 12:57:43 +0000 (20:57 +0800)]
MdeModulePkg/NvmExpressDxe: Refine PassThru IO queue creation behavior

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

For the PassThru() service of NVM Express Pass Through Protocol, the
current implementation (function NvmExpressPassThru()) will only use the
IO Completion/Submission queues created internally by this driver during
the controller initialization process. Any other IO queues created will
not be consumed.

So the value is little to accept external IO Completion/Submission queue
creation request. This commit will refine the behavior of function
NvmExpressPassThru(), it will only accept driver internal IO queue
creation commands and will return "EFI_UNSUPPORTED" for external ones.

Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMdeModulePkg/NvmExpressDxe: Always copy CQ entry to PassThru packet
Hao Wu [Thu, 18 Oct 2018 04:52:04 +0000 (12:52 +0800)]
MdeModulePkg/NvmExpressDxe: Always copy CQ entry to PassThru packet

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

According to the the NVM Express spec Revision 1.1, for some commands,
command-related information will be stored in the Dword 0 of the
completion queue entry.

One case is for the Get Features Command (Section 5.9.2 of the spec),
Dword 0 of the completion queue entry may contain feature information.

Hence, this commit will always copy the content of completion queue entry
to the PassThru packet regardless of the execution result of the command.

Cc: Liangcheng Tang <liangcheng.tang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMdeModulePkg/NvmExpressDxe: Refine data buffer & len check in PassThru
Hao Wu [Wed, 17 Oct 2018 02:50:51 +0000 (10:50 +0800)]
MdeModulePkg/NvmExpressDxe: Refine data buffer & len check in PassThru

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

According to the the NVM Express spec Revision 1.1, for some commands
(like Get/Set Feature Command, Figure 89 & 90 of the spec), the Memory
Buffer maybe optional although the command opcode indicates there is a
data transfer between host & controller (Get/Set Feature Command, Figure
38 of the spec).

Hence, this commit refine the checks for the 'TransferLength' and
'TransferBuffer' field of the EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
structure to address this issue.

Cc: Liangcheng Tang <liangcheng.tang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoIntelSiliconPkg VTdDxe: Report status code for VTd error
Star Zeng [Wed, 24 Oct 2018 02:27:48 +0000 (10:27 +0800)]
IntelSiliconPkg VTdDxe: Report status code for VTd error

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

Current code only uses DEBUG() for VTd error.
This patch updates to also report status code for VTd error.

Test done:
Created case that has VTd error and confirmed the error
status code could be reported as expected.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@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 agoIntelSiliconPkg VTdDxe: Option to force no early access attr request
Star Zeng [Wed, 17 Oct 2018 09:43:28 +0000 (17:43 +0800)]
IntelSiliconPkg VTdDxe: Option to force no early access attr request

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

To have high confidence in usage for platform, add option (BIT2 of
PcdVTdPolicyPropertyMask) to force no IOMMU access attribute request
recording before DMAR table is installed.

Check PcdVTdPolicyPropertyMask BIT2 before RequestAccessAttribute()
and ProcessRequestedAccessAttribute(), then RequestAccessAttribute(),
ProcessRequestedAccessAttribute() and mAccessRequestXXX variables
could be optimized by compiler when PcdVTdPolicyPropertyMask BIT2 = 1.

Test done:
1: Created case that has IOMMU access attribute request before DMAR
   table is installed, ASSERT was triggered after setting
   PcdVTdPolicyPropertyMask BIT2 to 1.

2. Confirmed RequestAccessAttribute(), ProcessRequestedAccessAttribute()
   and mAccessRequestXXX variables were optimized by compiler after
   setting PcdVTdPolicyPropertyMask BIT2 to 1.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@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/UsbBus: Removing trailing spaces
Ruiyu Ni [Thu, 25 Oct 2018 03:19:14 +0000 (11:19 +0800)]
MdeModulePkg/UsbBus: Removing trailing spaces

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoBaseTools: Move PcdValueInit to platform build folder
BobCF [Mon, 22 Oct 2018 03:24:13 +0000 (11:24 +0800)]
BaseTools: Move PcdValueInit to platform build folder

PcdValueInit tool is platform scope.
It should be generated into Platform output directory.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob C Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTool: Filter out unused structure pcds
BobCF [Fri, 19 Oct 2018 12:00:09 +0000 (20:00 +0800)]
BaseTool: Filter out unused structure pcds

The current code handle all the structure pcds
even if there is no module or library use them.
This patch is going to filter out the unused structure pcds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools: Remove Arch specific build options for PcdValueInit tool.
BobCF [Thu, 18 Oct 2018 05:32:40 +0000 (13:32 +0800)]
BaseTools: Remove Arch specific build options for PcdValueInit tool.

PcdValueInit tool is Arch independent, the Arch specific
build options should be removed from PcdValueInit makefile.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob C Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
5 years agoBaseTools:Translate the StructurePCD value in field to correct format.
Zhaozh1x [Thu, 18 Oct 2018 09:46:40 +0000 (17:46 +0800)]
BaseTools:Translate the StructurePCD value in field to correct format.

For StructurePCD value got from DSC file, translate its field value in to
correct format in report.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
5 years agoBaseTools: Not convert the void* pcd string in command line to array.
Zhaozh1x [Fri, 19 Oct 2018 12:11:01 +0000 (20:11 +0800)]
BaseTools: Not convert the void* pcd string in command line to array.

For void* type pcd in command line, if its value is string, code should
not convert the void* pcd string in command line to array, otherwise it
will make the pcd value in report not match its real raw value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
5 years agoBaseTools: add ASSERT checker for array buffer in fdf and command line
Zhaozh1x [Mon, 22 Oct 2018 08:23:18 +0000 (16:23 +0800)]
BaseTools: add ASSERT checker for array buffer in fdf and command line

For structure PCD in fdf file and command line,
1. use compiler time assert to check the array index, report error
if array index exceeds the array number.
2. use compiler time assert to check the array size, report error
if the user declared size in header file is smaller than the user
used in fdf file and command line.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
5 years agoMdePkg: Handle AcpiExp device path when optional para is not specified
Dandan Bi [Fri, 12 Oct 2018 02:18:28 +0000 (10:18 +0800)]
MdePkg: Handle AcpiExp device path when optional para is not specified

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

AcpiExp text device path: AcpiExp(HID,CID,UIDSTR)
And according to UEFI spec, the CID parameter is optional
and has a default value of 0. But current implementation
miss to check following cases for the AcpiExp.
FromText:when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR)
ToText: when the CID is 0 in the node structure

This commit is to do the enhancement.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@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: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMdePkg: Handle USBxxx device path when optional para is not specified
Dandan Bi [Fri, 12 Oct 2018 02:18:27 +0000 (10:18 +0800)]
MdePkg: Handle USBxxx device path when optional para is not specified

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

According to UEFI spec,
for the Messaging Device Path with USB Class SubType, some paras
are optional in the text device path.
Take UsbClass(VID,PID,Class,SubClass,Protocol) for example,
The VID is an integer between 0 and 65535 and is optional. The
default value is 0xFFFF.
The PID is an integer between 0 and 65535 and is optional. The
default value is 0xFFFF.
The Class is an integer between 0 and 255 and is optional. The
default value is 0xFF.
The SubClass is an integer between 0 and 255 and is optional. The
default value is 0xFF.
The Protocol is an integer between 0 and 255 and is optional. The
default value is 0xFF.
So if any the optional para is not specified in the text device,
we should set related para in the node structure to default value.

This commit is to do the enhancement for USB Class device path
when optional para is not specified

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@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: Ruiyu Ni <ruiyu.ni@intel.com>
5 years agoMdePkg: Handle Sata device path when optional para is not specified
Dandan Bi [Fri, 12 Oct 2018 02:18:26 +0000 (10:18 +0800)]
MdePkg: Handle Sata device path when optional para is not specified

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

Sata device path format:Sata(HPN, PMPN, LUN)
According to UEFI Spec, the PMPN is an integer between
0 and 65535 and is optional. If not provided, the default is 0xFFFF.

This commit is to do the enhancement for Sata device path
when optional para is not specified.

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