mirror_edk2.git
3 years agoBaseTools: Fixed the issue of Multiple Skus are always disables
Liming Gao [Fri, 1 Dec 2017 14:00:07 +0000 (22:00 +0800)]
BaseTools: Fixed the issue of Multiple Skus are always disables

When multiple skus are enabled, PCD database should record the supported SKUs.
This patch fixes PCD database to add the missing supported SKUs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Optimize VPD PCD value for the different SKUs
Liming Gao [Fri, 22 Dec 2017 12:19:20 +0000 (20:19 +0800)]
BaseTools: Optimize VPD PCD value for the different SKUs

If VPD PCD value is same in the different SKUs, the different SKUs will
save the same offset for this PCD in VPD region. That means there is only
one PCD value copy in VPD region to save VPD space.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Update SkuId as SKU_ID type to follow current implementation
Liming Gao [Wed, 20 Dec 2017 09:16:28 +0000 (17:16 +0800)]
BaseTools: Update SkuId as SKU_ID type to follow current implementation

Update PCD DB and Default setting format as nature alignment.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Update NV Default Header format to include the max size
Liming Gao [Fri, 22 Dec 2017 12:14:29 +0000 (20:14 +0800)]
BaseTools: Update NV Default Header format to include the max size

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Report Structure PCD value and SKU, DefaultStore info
Liming Gao [Fri, 22 Dec 2017 12:07:54 +0000 (20:07 +0800)]
BaseTools: Report Structure PCD value and SKU, DefaultStore info

https://bugzilla.tianocore.org/show_bug.cgi?id=706
Add Structure PCD support for Build report. Structure PCD field value described
in DEC/DSC will be display in build report. And, PCD value for each SKU and
Default store will also be shown in build report.

Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: PcdDataBase Optimization for multiple SkuIds
Liming Gao [Fri, 22 Dec 2017 12:04:04 +0000 (20:04 +0800)]
BaseTools: PcdDataBase Optimization for multiple SkuIds

https://bugzilla.tianocore.org/show_bug.cgi?id=546
BaseTools will generate the optimized PCD database to save the image size
at build time for multiple SKUs. The optimized PCD database layout will be like
below, the PCD database will be composed of the full default SKU data
(PCD_DATABASE_INIT) and the non-default SKU delta data(PCD_DATABASE_SKU_DELTA).
PCD driver will build HOB to store the full default SKU data, and patch HOB
data based on non-default SKU delta data for the SKU set by SetSku(),
it can save memory resource at boot time.

//
// PCD database layout:
// +---------------------------------+
// | PCD_DATABASE_INIT (DEFAULT SKU) |
// +---------------------------------+
// | PCD_DATABASE_SKU_DELTA (SKU A)  |
// +---------------------------------+
// | PCD_DATABASE_SKU_DELTA (SKU B)  |
// +---------------------------------+
// | ......                          |
// +---------------------------------+
//

BaseTools, PCD database and driver updates are needed for this proposal.
For single SKU (default) case, this proposal is expected to have no impact.
For multi-SKU case, PCD database format will be changed.
So, PcdDataBase Version is also updated from 6 to 7.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Support Structure PCD value inherit between the different SKUs
Liming Gao [Fri, 22 Dec 2017 12:46:15 +0000 (20:46 +0800)]
BaseTools: Support Structure PCD value inherit between the different SKUs

https://bugzilla.tianocore.org/show_bug.cgi?id=543
Structure PCD field value can inherit between the different SKUIds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Collect DynamicHii PCD values and assign it to VPD PCD Value
Liming Gao [Fri, 24 Nov 2017 06:46:58 +0000 (14:46 +0800)]
BaseTools: Collect DynamicHii PCD values and assign it to VPD PCD Value

https://bugzilla.tianocore.org/show_bug.cgi?id=661
Collect all DynamicHii and DynamicExHii PCD value into PCD
PcdNvStoreDefaultValueBuffer, then firmware can access this PCD value
to get the variable default setting.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Support Structure PCD value assignment in DEC/DSC
Liming Gao [Fri, 24 Nov 2017 06:30:11 +0000 (14:30 +0800)]
BaseTools: Support Structure PCD value assignment in DEC/DSC

https://bugzilla.tianocore.org/show_bug.cgi?id=542
This is pure BaseTools enhancement to support PCD with one structure.
User can specify PCD value based on its structure field.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Add PcdValueCommon logic into C source CommonLib
Liming Gao [Thu, 23 Nov 2017 12:49:36 +0000 (20:49 +0800)]
BaseTools: Add PcdValueCommon logic into C source CommonLib

PcdValueCommon is used to calculate structure pcd value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Update Makefile to work at absolute path
Liming Gao [Thu, 23 Nov 2017 12:48:10 +0000 (20:48 +0800)]
BaseTools: Update Makefile to work at absolute path

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools/GenSec: Fix potential null pointer dereference
Hao Wu [Mon, 18 Dec 2017 08:08:52 +0000 (16:08 +0800)]
BaseTools/GenSec: Fix potential null pointer dereference

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenSec: Fix potential memory leak
Hao Wu [Mon, 18 Dec 2017 07:59:53 +0000 (15:59 +0800)]
BaseTools/GenSec: Fix potential memory leak

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenFfs: Enlarge the size of 'AlignmentBuffer'
Hao Wu [Mon, 18 Dec 2017 07:52:33 +0000 (15:52 +0800)]
BaseTools/GenFfs: Enlarge the size of 'AlignmentBuffer'

As a workaround for the static code checkers, enlarge the size of the
string buffer 'AlignmentBuffer' so that it can hold all the digits of an
unsigned 32-bit integer plus the size unit character (e.g. 'M' & 'K').

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/VfrCompile: Resolve uninit class variables in constructor
Hao Wu [Mon, 18 Dec 2017 02:11:57 +0000 (10:11 +0800)]
BaseTools/VfrCompile: Resolve uninit class variables in constructor

The commit initializes those possibly uninitialized class variables in
class constructors.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/VfrCompile: Add/refine boundary checks for strcpy/strcat
Hao Wu [Mon, 18 Dec 2017 01:20:09 +0000 (09:20 +0800)]
BaseTools/VfrCompile: Add/refine boundary checks for strcpy/strcat

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenVtf: Add/refine boundary checks for strcpy/strcat calls
Hao Wu [Mon, 18 Dec 2017 01:19:23 +0000 (09:19 +0800)]
BaseTools/GenVtf: Add/refine boundary checks for strcpy/strcat calls

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenFv: Add/refine boundary checks for strcpy/strcat calls
Hao Wu [Mon, 18 Dec 2017 01:18:58 +0000 (09:18 +0800)]
BaseTools/GenFv: Add/refine boundary checks for strcpy/strcat calls

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenBootSector: Add/refine boundary checks for strcpy/strcat
Hao Wu [Mon, 18 Dec 2017 01:17:52 +0000 (09:17 +0800)]
BaseTools/GenBootSector: Add/refine boundary checks for strcpy/strcat

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/EfiRom: Add/refine boundary checks for strcpy/strcat calls
Hao Wu [Mon, 18 Dec 2017 01:16:00 +0000 (09:16 +0800)]
BaseTools/EfiRom: Add/refine boundary checks for strcpy/strcat calls

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/C/Common: Refine using sprintf() with '%s' in format string
Hao Wu [Mon, 18 Dec 2017 06:26:12 +0000 (14:26 +0800)]
BaseTools/C/Common: Refine using sprintf() with '%s' in format string

The commit removes the usages of sprintf() function calls with '%s' in
the format string. And uses strncpy/strncat instead to ensure the
destination string buffers will not be accessed beyond their boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/C/Common: Add/refine boundary checks for strcpy/strcat calls
Hao Wu [Mon, 18 Dec 2017 00:57:27 +0000 (08:57 +0800)]
BaseTools/C/Common: Add/refine boundary checks for strcpy/strcat calls

Add checks to ensure when the destination string buffer is of fixed
size, the strcpy/strcat functions calls will not access beyond the
boundary.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/GenFv: Add check to ensure the file handle status is correct
Hao Wu [Thu, 30 Nov 2017 08:44:14 +0000 (16:44 +0800)]
BaseTools/GenFv: Add check to ensure the file handle status is correct

Add an extra NULL check for the file handle to ensure that its status is
correct.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/VfrCompile: Assign 'NULL' for closed file handle
Hao Wu [Thu, 30 Nov 2017 08:40:42 +0000 (16:40 +0800)]
BaseTools/VfrCompile: Assign 'NULL' for closed file handle

Assign 'NULL' value to the already-closed file handle to avoid closing
the handle multiple times.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/C/Common: Remove redundant type cast
Hao Wu [Thu, 30 Nov 2017 08:38:47 +0000 (16:38 +0800)]
BaseTools/C/Common: Remove redundant type cast

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/LzmaCompress: Fix possible uninitialized variable
Hao Wu [Thu, 30 Nov 2017 07:22:48 +0000 (15:22 +0800)]
BaseTools/LzmaCompress: Fix possible uninitialized variable

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/EfiRom: Refine the logic in main()
Hao Wu [Thu, 30 Nov 2017 06:42:05 +0000 (14:42 +0800)]
BaseTools/EfiRom: Refine the logic in main()

This commit refines the logic for main(). It makes the logic more
straightforward to prevent possible mis-reports by static code
checkers.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools/C/Common: Add checks for array access
Hao Wu [Thu, 30 Nov 2017 06:29:25 +0000 (14:29 +0800)]
BaseTools/C/Common: Add checks for array access

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoNetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status.
Jiaxin Wu [Thu, 21 Dec 2017 06:34:58 +0000 (14:34 +0800)]
NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status.

In HttpBootCallback(), when data type is HttpBootHttpResponse, function may meet
the resource redirect error. In current implementation, function will still go
ahead to find header for HTTP_HEADER_CONTENT_LENGTH, this is not expected. Function
should break in redirect status error handling.

Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wang Fan <fan.wang@intel.com>
3 years agoNetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.
Jiaxin Wu [Thu, 21 Dec 2017 05:32:20 +0000 (13:32 +0800)]
NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.

Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wang Fan <fan.wang@intel.com>
3 years agoCryptoPkg/TlsLib: Add some parameter check and clarification.
Jiaxin Wu [Thu, 21 Dec 2017 05:08:31 +0000 (13:08 +0800)]
CryptoPkg/TlsLib: Add some parameter check and clarification.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoNetworkPkg: Recycle the ICMP error message in PXE driver.
Fu Siyuan [Thu, 21 Dec 2017 07:19:26 +0000 (15:19 +0800)]
NetworkPkg: Recycle the ICMP error message in PXE driver.

This patch updates PxeBcIcmpErrorDpcHandle() and PxeBcIcmp6ErrorDpcHandle() to
recycle the ICMP packet after copy it to PXE mode data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Remove redundant check in PXE driver.
Fu Siyuan [Thu, 21 Dec 2017 07:31:22 +0000 (15:31 +0800)]
NetworkPkg: Remove redundant check in PXE driver.

The IP protocol has been configured to only receive ICMP packet in PXE driver.
So this patch removes the unnecessary check for NextHeader field and replace it
with ASSERT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoMdeModulePkg/DpcLib: return error if failed to locate DPC protocol.
Fu Siyuan [Fri, 22 Dec 2017 06:13:12 +0000 (14:13 +0800)]
MdeModulePkg/DpcLib: return error if failed to locate DPC protocol.

This patch updates the constructor of DpcLib to return error if failed to
locate DPC protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoUefiCpuPkg/MpInitLib: Add missing Guard page setup for APs
Jian J Wang [Thu, 21 Dec 2017 01:25:51 +0000 (09:25 +0800)]
UefiCpuPkg/MpInitLib: Add missing Guard page setup for APs

AP has its own stack for code execution. If PcdCpuStackGuard is enabled,
the page at the bottom of stack of AP will be disabled (NOT PRESENT) to
monitor the stack overflow issue. This requires PcdCpuApStackSize to be
set with value more than one page of memory.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@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: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdeModulePkg: Clarify usage of PcdHeapGuardPropertyMask
Jian J Wang [Thu, 21 Dec 2017 05:06:24 +0000 (13:06 +0800)]
MdeModulePkg: Clarify usage of PcdHeapGuardPropertyMask

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@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>
3 years agoMdeModulePkg/Ip4Dxe: Clean up IP4 interface if failed to open ARP protocol.
Fu Siyuan [Wed, 13 Dec 2017 02:07:46 +0000 (10:07 +0800)]
MdeModulePkg/Ip4Dxe: Clean up IP4 interface if failed to open ARP protocol.

This patch fixes a bug in Ip4ConfigProtocol, that new created IP interface is
not freed if Open ARP protocol failed.

Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/Ip4Dxe: Remove redundant code in Ip4Config2InitInstance().
Fu Siyuan [Wed, 13 Dec 2017 02:21:53 +0000 (10:21 +0800)]
MdeModulePkg/Ip4Dxe: Remove redundant code in Ip4Config2InitInstance().

Instance->Dhcp4Event is not necessary to be created in Ip4Config2InitInstance.
Because it will created in Ip4StartAutoConfig() later.

Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/IpIoLib: Check the input parameters before use them.
Fu Siyuan [Wed, 13 Dec 2017 08:06:42 +0000 (16:06 +0800)]
MdeModulePkg/IpIoLib: Check the input parameters before use them.

This patch updates the DxeIpIoLib to check the input parameters before using.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoMdeModulePkg/IpIoDxe: Update API description to match the function implementation.
Fu Siyuan [Wed, 13 Dec 2017 07:30:14 +0000 (15:30 +0800)]
MdeModulePkg/IpIoDxe: Update API description to match the function implementation.

This patch updates some API descriptions in DxeIpIoLib to match the real
implementation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/IpIoLib: add more error handling code to DxeIpIoLib.
Fu Siyuan [Wed, 13 Dec 2017 07:06:16 +0000 (15:06 +0800)]
MdeModulePkg/IpIoLib: add more error handling code to DxeIpIoLib.

In DxeIpIo, there are several places not check the returned value of called functions.
This patch is to add the error handling to these functions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdePkg Acpi60.h: Add missing PCCT subspace type 1 and 2 definitions
Star Zeng [Wed, 20 Dec 2017 09:18:24 +0000 (17:18 +0800)]
MdePkg Acpi60.h: Add missing PCCT subspace type 1 and 2 definitions

Same change is done for Acpi61.h.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoFatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF
Ruiyu Ni [Fri, 22 Dec 2017 01:40:18 +0000 (09:40 +0800)]
FatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoShellBinPkg: Ia32/X64 Shell binary update.
Ruiyu Ni [Fri, 22 Dec 2017 01:22:05 +0000 (09:22 +0800)]
ShellBinPkg: Ia32/X64 Shell binary update.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoIntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0
Star Zeng [Thu, 21 Dec 2017 02:32:39 +0000 (10:32 +0800)]
IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0

The first 48 bytes contain the microcode update header.
DataSize must be a multiple of DWORDs.
TotalSize is always a multiple of 1024.
Both size of CPU_MICROCODE_EXTENDED_TABLE_HEADER and
CPU_MICROCODE_EXTENDED_TABLE are multiple of DWORDs.

So (ExtendedTableLength & 0x3)!=0 should be
(ExtendedTableLength & 0x3)==0.

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>
Reviewed-by: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
3 years agoArmPkg/ArmMmuLib ARM: fix page size granularity in initial MMU setting
Michael Zimmermann [Wed, 20 Dec 2017 20:51:00 +0000 (20:51 +0000)]
ArmPkg/ArmMmuLib ARM: fix page size granularity in initial MMU setting

From what I can see this bug dates back to the commit from 2011 where
support for this was added: 2cf4b60895f8a

The first problem is that PopulateLevel2PageTable overflows the
translation table buffer because it doesn't verify that the size
actually fits within one level 2 page table.

The second problem is that the loop in FillTranslationTable doesn't
care about the PhysicalBase or the RemainLength and always substracts
one section size from RemainLength.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoMdeModulePkg/Core: Fix incorrect memory map generated in a rare case
Jian J Wang [Sat, 16 Dec 2017 09:22:35 +0000 (17:22 +0800)]
MdeModulePkg/Core: Fix incorrect memory map generated in a rare case

The root cause is that mImagePropertiesPrivateData.CodeSegmentCountMax was
not updated with correct value due to the fact that SortImageRecord() called
before might change the content of current ImageRecord. This will in turn
cause incorrect memory map entries generated in SplitTable().

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoSecurityPkg TcgMor: Remove wrong comments
Star Zeng [Mon, 18 Dec 2017 06:19:43 +0000 (14:19 +0800)]
SecurityPkg TcgMor: Remove wrong comments

and free the HandleBuffer after used.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdePkg MemoryOverwriteControl.h: Correct typo 'bi' to 'bit'
Star Zeng [Fri, 4 Aug 2017 07:07:08 +0000 (15:07 +0800)]
MdePkg MemoryOverwriteControl.h: Correct typo 'bi' to 'bit'

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoShellPkg: Fix a build error in Ping6 shell command.
fanwang2 [Mon, 18 Dec 2017 09:41:48 +0000 (17:41 +0800)]
ShellPkg: Fix a build error in Ping6 shell command.

Last check in involved a build error, this patch is to
fix this issue.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
fanwang2 [Mon, 18 Dec 2017 01:21:22 +0000 (09:21 +0800)]
ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.

Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting
state handling, and it is forward compatible. So apply this Api in ShellPkg.

V2:
   *Define time period in a macro instead of hard code.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Signed-off-by: fanwang2 <fan.wang@intel.com>
3 years agoNetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
fanwang2 [Mon, 18 Dec 2017 01:20:26 +0000 (09:20 +0800)]
NetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.

Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting
state handling, and it is forward compatible. So apply this Api in NetworkPkg.

V2:
   *Define time period in a macro instead of hard code.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Signed-off-by: fanwang2 <fan.wang@intel.com>
3 years agoMdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
fanwang2 [Mon, 18 Dec 2017 01:16:36 +0000 (09:16 +0800)]
MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.

Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting
state handling, and it is forward compatible. So apply this Api in MdeModulePkg.

V2:
   *Define time period in a macro instead of hard code.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Signed-off-by: fanwang2 <fan.wang@intel.com>
3 years agoMdeModulePkg/IpIoLib: return error instead of ASSERT if input parameter is incorrect.
Fu Siyuan [Wed, 13 Dec 2017 06:41:37 +0000 (14:41 +0800)]
MdeModulePkg/IpIoLib: return error instead of ASSERT if input parameter is incorrect.

This patch updates the DxeIpIoLib to return EFI_INVALID_PARAMETER instead of
ASSERT if the input pointers are not correct.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/Ip4Dxe: return error on memory allocate failure instead of ASSERT.
Fu Siyuan [Wed, 13 Dec 2017 02:42:42 +0000 (10:42 +0800)]
MdeModulePkg/Ip4Dxe: return error on memory allocate failure instead of ASSERT.

This patch updates the IP4 driver to use error status code instead of ASSERT
if failed to allocate memory buffer.

Reviewed-by: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoEmbeddedPkg: add ConsolePrefDxe to package .dsc
Leif Lindholm [Fri, 15 Dec 2017 16:22:03 +0000 (16:22 +0000)]
EmbeddedPkg: add ConsolePrefDxe to package .dsc

Add an entry for ConsolePrefDxe under [Components.common],
to permit building standalone.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoMdeModulePkg/Variable/RuntimeDxe: Modify function return status
chenc2 [Thu, 7 Dec 2017 05:38:03 +0000 (13:38 +0800)]
MdeModulePkg/Variable/RuntimeDxe: Modify function return status

Make VariableServiceSetVariable and VariableServiceQueryVariableInfo
functions return status following UEFI 2.7 spec.

Cc: Zhang Chao <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: chenc2 <chen.a.chen@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
3 years agoUefiCpuPkg: Singularize function name
Song, BinX [Mon, 11 Dec 2017 08:16:54 +0000 (16:16 +0800)]
UefiCpuPkg: Singularize function name

Change GetSupportPcds and GetConfigurationPcds to be singular

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoMdeModulePkg/DxeIplPeim: fix incorrect page table split during protecting
Jian J Wang [Fri, 15 Dec 2017 02:25:12 +0000 (10:25 +0800)]
MdeModulePkg/DxeIplPeim: fix incorrect page table split during protecting

The root cause of this issue is that, during splitting page table, the page
size should be the value of next level (smaller one) instead of current level.
The wrong page size will then cause wrong page table introduced, which will
break the normal boot.

Validation works include booting to Windows 10 and Fedora 26 on real Intel
platform and OVMF emulated platform in addition to manual checks on page
table with JTAG tool.

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: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler()
Star Zeng [Thu, 14 Dec 2017 08:20:32 +0000 (16:20 +0800)]
MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler()

As some implementation of SMM Child Dispatcher (including SxDispatch)
may deny the handler registration after SmmReadyToLock, using
SxDispatch in SmmReadyToBootHandler() will be too late.

This patch updates code to use SxDispatch in SmmEndOfDxeHandler()
instead of SmmReadyToBootHandler().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdePkg/Include/Pi: Modify specification number encoding
Hao Wu [Thu, 6 Jul 2017 05:08:28 +0000 (13:08 +0800)]
MdePkg/Include/Pi: Modify specification number encoding

Change the PEI and DXE service table revisions to 1.6.

The SMM part is already done by commit:
07c6a47e70ba54709b0e26237770f3c38685e860 &
2f208e59e4b994978a1a24affc306eb694a00327

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg/UefiSpec.h: Update the UEFI version to reflect new revision
Hao Wu [Wed, 14 Jun 2017 07:47:38 +0000 (15:47 +0800)]
MdePkg/UefiSpec.h: Update the UEFI version to reflect new revision

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoNetworkPkg/UefiPxeBcDxe: Allow the NULL configuration for NewStationIP/NewSubnetMask
Jiaxin Wu [Wed, 13 Dec 2017 08:58:01 +0000 (16:58 +0800)]
NetworkPkg/UefiPxeBcDxe: Allow the NULL configuration for NewStationIP/NewSubnetMask

According the UEFI Spec for PxeBc.SetStationIP():
If NewStationIP is NULL, then the current IP address will not be modified.
...
If NewSubnetMask is NULL, then the current subnet mask will not be modified.

Currently, EfiPxeBcSetStationIP() doesn't comply with UEFI Spec. This patch is
to fix the issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/UefiPxeBcDxe: Correct the handle for PXE Base Code Callback Protocol.
Jiaxin Wu [Tue, 12 Dec 2017 07:26:49 +0000 (15:26 +0800)]
NetworkPkg/UefiPxeBcDxe: Correct the handle for PXE Base Code Callback Protocol.

According UEFI Spec:
The PXE Base Code Callback Protocol must be on the same handle as the PXE
Base Code Protocol.

But current implementation doesn't follow that. This patch is fix that issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/UefiPxeBcDxe: Fix Pxe.Dhcp() return status code.
Jiaxin Wu [Tue, 12 Dec 2017 03:02:47 +0000 (11:02 +0800)]
NetworkPkg/UefiPxeBcDxe: Fix Pxe.Dhcp() return status code.

According UEFI Spec, if valid PXE offer is not received, Pxe.Dhcp()
should return EFI_NO_RESPONSE, but currently, EFI_TIMEOUT is returned
from Pxe.Dhcp().

This patch is to fix the above issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg PiSmmCore: Ensure SxDispatch not NULL before dereferenced
Star Zeng [Wed, 13 Dec 2017 03:26:23 +0000 (11:26 +0800)]
MdeModulePkg PiSmmCore: Ensure SxDispatch not NULL before dereferenced

Cc: Hao Wu <hao.a.wu@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>
3 years agoUefiCpuPkg: Check invalid RegisterCpuFeature parameter
Song, BinX [Wed, 13 Dec 2017 02:35:15 +0000 (10:35 +0800)]
UefiCpuPkg: Check invalid RegisterCpuFeature parameter

V2:
Update function name, add more detail description.
V1:
Check and assert invalid RegisterCpuFeature function parameter

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoNetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
Jiaxin Wu [Wed, 29 Nov 2017 06:35:01 +0000 (14:35 +0800)]
NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.

This patch is to resolve the issue reported @
https://bugzilla.tianocore.org/show_bug.cgi?id=804.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
Jiaxin Wu [Wed, 29 Nov 2017 06:34:26 +0000 (14:34 +0800)]
MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.

This patch is to resolve the issue reported @
https://bugzilla.tianocore.org/show_bug.cgi?id=804.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/Ip4Dxe: Cleanup the resource after error happen during Ip4StartAutoConfig().
Jiaxin Wu [Tue, 5 Dec 2017 06:23:39 +0000 (14:23 +0800)]
MdeModulePkg/Ip4Dxe: Cleanup the resource after error happen during Ip4StartAutoConfig().

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received...
Jiaxin Wu [Thu, 7 Dec 2017 10:37:03 +0000 (18:37 +0800)]
MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data.

This patch is to discard the normal ICMP packets and recycle the received
ICMP data to avoid the memory leak.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Heyi Guo <heyi.guo@linaro.org>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Tested-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoBaseTools: enable hash value check for single module build
Yonghong Zhu [Tue, 12 Dec 2017 07:20:18 +0000 (15:20 +0800)]
BaseTools: enable hash value check for single module build

This patch enables hash value check for single module build to decide
whether we can skip to build this module.

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>
3 years agoBaseTools: back up the binary files when hash value is same
Yonghong Zhu [Tue, 12 Dec 2017 07:18:22 +0000 (15:18 +0800)]
BaseTools: back up the binary files when hash value is same

V2: change to use InfBuildData but not ModuleAutoGen

We meet the case that first build with --hash option, then build it
again with --hash and --binary-destination option, since the hash value
is same, tool will not build the driver again, it cause the binary
files are not backed up.

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>
3 years agoBaseTools: Not cache the .efi file location into build option
Yonghong Zhu [Wed, 6 Dec 2017 09:36:56 +0000 (17:36 +0800)]
BaseTools: Not cache the .efi file location into build option

We don't need cache the .efi file location into build option, otherwise
when we change the --binary-destination location, it would cause the
hash value is different.

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>
3 years agoBaseTools: Fix the incorrect indent introduced by 37de70
Yonghong Zhu [Wed, 13 Dec 2017 01:59:44 +0000 (09:59 +0800)]
BaseTools: Fix the incorrect indent introduced by 37de70

The incorrect indent introduced by 37de70, it cause PEIM in sub FV
image can't be rebased. Then it block some platform can't boot.

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>
3 years agoMdeModulePkg/PiSmmCore: Fix issues in Heap Guard
Jian J Wang [Mon, 11 Dec 2017 01:32:27 +0000 (09:32 +0800)]
MdeModulePkg/PiSmmCore: Fix issues in Heap Guard

One issue is that macros defined in HeapGuard.h

    GUARD_HEAP_TYPE_PAGE
    GUARD_HEAP_TYPE_POOL

doesn't match the definition of PCD PcdHeapGuardPropertyMask in
MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1
of them.

Another is that method AdjustMemoryF() will return a bigger NumberOfPages than
the value passed in. This is caused by counting twice of a shared Guard page
which can be used for both head and tail Guard of the memory before it and
after it. This happens only when partially freeing just one page in the middle
of a bunch of allocated pages. The freed page should be turned into a new
Guard page.

Cc: Jie Lin <jie.lin@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: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg/DxeCore: Fix issues in Heap Guard
Jian J Wang [Sat, 9 Dec 2017 11:15:49 +0000 (19:15 +0800)]
MdeModulePkg/DxeCore: Fix issues in Heap Guard

One issue is that macros defined in HeapGuard.h

    GUARD_HEAP_TYPE_PAGE
    GUARD_HEAP_TYPE_POOL

doesn't match the definition of PCD PcdHeapGuardPropertyMask in
MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1
of them.

Another is that method AdjustMemoryF() will return a bigger NumberOfPages than
the value passed in. This is caused by counting twice of a shared Guard page
which can be used for both head and tail Guard of the memory before it and
after it. This happens only when partially freeing just one page in the middle
of a bunch of allocated pages. The freed page should be turned into a new
Guard page.

Cc: Jie Lin <jie.lin@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: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoUefiCpuPkg/CpuDxe: suppress invalid warning about uninitialized variable
Jian J Wang [Tue, 12 Dec 2017 03:12:12 +0000 (11:12 +0800)]
UefiCpuPkg/CpuDxe: suppress invalid warning about uninitialized variable

Cc: Eric Dong <eric.dong@intel.com>
Cc: Wu Hao <hao.a.wu@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>
Reviewed-by: Wu Hao <hao.a.wu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmPlatformPkg: retire obsolete PCDs
Ard Biesheuvel [Fri, 8 Dec 2017 18:15:08 +0000 (18:15 +0000)]
ArmPlatformPkg: retire obsolete PCDs

Retire a whole bunch of ArmPlatformPkg PCDs that are either related
to the ARM BDS, to secure world execution or to stuff that has been
migrated to edk2-platforms.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg: remove old PL111/HdLcd driver code
Ard Biesheuvel [Fri, 8 Dec 2017 16:57:00 +0000 (16:57 +0000)]
ArmPlatformPkg: remove old PL111/HdLcd driver code

Now that LcdGraphicsOutputDxe has been refactored, remove the old code
that is no longer used.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg: create hw-agnostic LcdGraphicsOutputDxe driver
Ard Biesheuvel [Fri, 1 Dec 2017 11:01:02 +0000 (11:01 +0000)]
ArmPlatformPkg: create hw-agnostic LcdGraphicsOutputDxe driver

Create a new LcdGraphicsOutputDxe driver from the existing sources that
takes its hardware abstractions from a LcdHwLib library instance rather
than from a .c file linked directly. All we need is a new .inf file, and
a minimal tweak to LcdGraphicsOutputDxe.h to reuse the LcdHwlib prototypes
rather than open code them.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
[ardb: add it to ArmPlatformPkg.dsc so we can build test it standalone]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg: implement LcdHwLib for HdLcd
Ard Biesheuvel [Fri, 1 Dec 2017 10:20:25 +0000 (10:20 +0000)]
ArmPlatformPkg: implement LcdHwLib for HdLcd

Convert the HdLcd specific code of LcdGraphicsOutputDxe into a LcdHwlib
implementation that we will wire up later into LcdGraphicsOutputDxe.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg: implement LcdHwLib for PL111
Ard Biesheuvel [Fri, 1 Dec 2017 09:58:26 +0000 (09:58 +0000)]
ArmPlatformPkg: implement LcdHwLib for PL111

Convert the PL111 specific code of LcdGraphicsOutputDxe into a LcdHwlib
implementation that we will wire up later into LcdGraphicsOutputDxe.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg: introduce LcdHwLib library class
Ard Biesheuvel [Fri, 1 Dec 2017 09:41:10 +0000 (09:41 +0000)]
ArmPlatformPkg: introduce LcdHwLib library class

Add the declaration and include file for the new LcdHwLib library class,
which will allow us to abstract away from platform  variations in the
LCD graphics output driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
[ardb: add NULL implementation as well and add it to ArmPlatformPkg.dsc]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoMdePkg: correct and clarify documentation of VA_LIST in Base.h
Zenith432 [Tue, 12 Dec 2017 17:12:11 +0000 (18:12 +0100)]
MdePkg: correct and clarify documentation of VA_LIST in Base.h

This is to resolve bug 457.
https://bugzilla.tianocore.org/show_bug.cgi?id=457

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
[lersek@redhat.com: reconstruct commit from patch pasted into email]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
3 years agoSecurityPkg:Tcg2Smm: Update Interrupt resource name
Zhang, Chao B [Tue, 12 Dec 2017 07:38:20 +0000 (15:38 +0800)]
SecurityPkg:Tcg2Smm: Update Interrupt resource name

Update TPM interrupt resource descriptor name for better compatibility to
old ASL compiler.

Cc: Long Qin <qin.long@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoMdeModulePkg/PiSmmCore: fix GCC build error
Laszlo Ersek [Tue, 12 Dec 2017 11:14:35 +0000 (12:14 +0100)]
MdeModulePkg/PiSmmCore: fix GCC build error

> MdeModulePkg/Core/PiSmmCore/PiSmmCore.c: In function
> 'SmmReadyToBootHandler':
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.c:323:14: error: passing argument
> 3 of 'SmmLocateProtocol' from incompatible pointer type [-Werror]
>               );
>               ^
> In file included from MdeModulePkg/Core/PiSmmCore/PiSmmCore.c:15:0:
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h:586:1: note: expected 'void **'
> but argument is of type 'struct EFI_SMM_SX_DISPATCH2_PROTOCOL **'
>  SmmLocateProtocol (
>  ^
> cc1: all warnings being treated as errors

Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Fixes: 7b9b55b2ef7be13608605dc58a54b9ca04be4e40
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
3 years agoMdeModulePkg/Ip4Dxe: fix ICMP echo reply memory leak
Heyi Guo [Mon, 11 Dec 2017 11:11:48 +0000 (19:11 +0800)]
MdeModulePkg/Ip4Dxe: fix ICMP echo reply memory leak

When UEFI receives ICMP echo packets it will enter Ip4IcmpReplyEcho
function, and then call Ip4Output. However, if Ip4Output gets some
error and exits early, e.g. fails to find the route entry, memory
buffer of "Data" gets no chance to be freed and memory leak will be
caused. If there is such an attacker in the network, we will see UEFI
runs out of memory and system hangs.

So we explicitly free the memory when error status is returned.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Junbiao Hong <hongjunbiao@huawei.com>
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg/DnsDxe: Avoid to access the freed memory buffer.
Jiaxin Wu [Fri, 17 Nov 2017 03:09:01 +0000 (11:09 +0800)]
NetworkPkg/DnsDxe: Avoid to access the freed memory buffer.

The HostNameToIp() is a asynchronous function, so the caller
may free the HostName buffer immediately once HostNameToIp()
is returned. Then DNS driver may access the freed memory buffer
later.

This patch is to fix above issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/DnsDxe: Fix the potential memory leak issue.
Jiaxin Wu [Fri, 1 Dec 2017 08:30:18 +0000 (16:30 +0800)]
NetworkPkg/DnsDxe: Fix the potential memory leak issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.
Jiaxin Wu [Thu, 16 Nov 2017 06:28:33 +0000 (14:28 +0800)]
NetworkPkg/DnsDxe: Update RetryCount/RetryInterval to comply with UEFI spec.

According to UEFI spec:
"Retry number if no response received after RetryInterval. If zero, use
the parameter configured through Dns.Configure() interface."
"Minimum interval of retry is 2 second. If the retry interval is less
than 2 second, then use the 2 second. If zero, use the parameter configured
through Dns.Configure() interface."

For both DNS.HostNameToIp and DNS.GeneralLookUp, the value of RetryCount /
RetryInterval need to be updated to comply with UEFI spec.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/DnsDxe: Remove the unnecessary if condition check in DNS.Config
Jiaxin Wu [Thu, 16 Nov 2017 01:03:08 +0000 (09:03 +0800)]
NetworkPkg/DnsDxe: Remove the unnecessary if condition check in DNS.Config

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoEmbeddedPkg/PrePiLib: add support for v2 sections
Michael Zimmermann [Tue, 12 Dec 2017 06:49:28 +0000 (07:49 +0100)]
EmbeddedPkg/PrePiLib: add support for v2 sections

Implement the missing support for FFS files whose size equals
or exceeds 16 MiB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoMdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS
Star Zeng [Fri, 8 Dec 2017 10:57:29 +0000 (18:57 +0800)]
MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS

Otherwise, LegacyBoot may be triggered wrongly by other code in UEFI OS,
or vice versa.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdeModulePkg PiSmmCore: Only install EndOfS3Resume during S3 resume
Star Zeng [Fri, 8 Dec 2017 10:44:40 +0000 (18:44 +0800)]
MdeModulePkg PiSmmCore: Only install EndOfS3Resume during S3 resume

Otherwise, it may be triggered wrongly by other code in OS.

This patch is to use S3 entry callback to determine if it will be
during S3 resume, and check it in SmmReadyToBootHandler().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@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>
3 years agoMdeModulePkg: Rename SmmEndOfS3ResumeProtocolGuid to EndOfS3ResumeGuid
Star Zeng [Fri, 8 Dec 2017 09:36:09 +0000 (17:36 +0800)]
MdeModulePkg: Rename SmmEndOfS3ResumeProtocolGuid to EndOfS3ResumeGuid

Rename SmmEndOfS3ResumeProtocolGuid to EndOfS3ResumeGuid as the GUID
may be used to install PPI in future to notify PEI phase code.

The references in UefiCpuPkg are also being updated.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoMdeModulePkg PiSmmIpl: Add missing update to the prototype
Star Zeng [Tue, 12 Dec 2017 08:13:39 +0000 (16:13 +0800)]
MdeModulePkg PiSmmIpl: Add missing update to the prototype

It is missing to update the prototype of SmmCommunicationCommunicate()
in d1632f694be027dee87dd18fa8172d674221face.

This patch is to add it.

Cc: Dandan Bi <dandan.bi@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: Dandan Bi <dandan.bi@intel.com>
3 years agoBaseTools: Update BrotliCompress script to handle the different input format
Liming Gao [Fri, 8 Dec 2017 04:39:13 +0000 (12:39 +0800)]
BaseTools: Update BrotliCompress script to handle the different input format

After this update, BrotliCompress can support below styles.
BrotliCompress -e InputFile -o OutputFile
BrotliCompress -e -o OutputFile InputFile

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoMdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.
Fu Siyuan [Tue, 5 Dec 2017 06:22:48 +0000 (14:22 +0800)]
MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.

This patch updates TcpIoConnect() and TcpIoAccept() that the Tcp.Cancel()
should be invoked to cancel the corresponding request when timeout occurs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.
Fu Siyuan [Tue, 5 Dec 2017 06:10:40 +0000 (14:10 +0800)]
MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.

For TcpIoConnect() and TcpIoAccept(), this patch adds the check for Timeout event
before calling CheckEvent() service so as to avoid the unnecessary function call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>