mirror_edk2.git
3 years agoIntelSiliconPkg IntelVTdDxe: Use TPL to protect list/engine operation
Star Zeng [Thu, 4 Jan 2018 02:33:42 +0000 (10:33 +0800)]
IntelSiliconPkg IntelVTdDxe: Use TPL to protect list/engine operation

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 agoIntelSiliconPkg IntelVTdDxe: Signal AcpiNotificationFunc() initially
Star Zeng [Wed, 3 Jan 2018 06:00:03 +0000 (14:00 +0800)]
IntelSiliconPkg IntelVTdDxe: Signal AcpiNotificationFunc() initially

Signal AcpiNotificationFunc() initially for the case that
DMAR table has been installed when creating event.

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/DxeNetLib: Fix an error in packet length counting.
Wang Fan [Wed, 3 Jan 2018 02:24:53 +0000 (10:24 +0800)]
MdeModulePkg/DxeNetLib: Fix an error in packet length counting.

* In old implementation, the operation len-- assumes AsciiSPrint()
  has counted NULL terminator, and it's not correct. This patch is
  to fix this issue.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoMdeModulePkg/DxeNetLib: Add parameter check and ASSERT handling.
Wang Fan [Wed, 3 Jan 2018 02:18:29 +0000 (10:18 +0800)]
MdeModulePkg/DxeNetLib: Add parameter check and ASSERT handling.

* Library API should check the input parameters before use, or
  ASSERT to tell it has to meet some requirements. But in DxeNetLib,
  not all functions follows this rule.
* ASSERT shouldn't be used as error handling, add some handling code
  for errors.
* Add some ASSERT commence in function notes.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoMdeModulePkg/DxeNetLib: Fix a potential issue in macro definition.
Wang Fan [Tue, 2 Jan 2018 02:56:44 +0000 (10:56 +0800)]
MdeModulePkg/DxeNetLib: Fix a potential issue in macro definition.

The NIC_ITEM_CONFIG_SIZE macro in DxeNetLib is defined as:
sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) *
MAX_IP4_CONFIG_IN_VARIABLE. This macro should be surrounded
with parenthesis to avoid being incorrectly used.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Update PXE driver to check for NULL pointer before use it.
Fu Siyuan [Tue, 2 Jan 2018 05:25:59 +0000 (13:25 +0800)]
NetworkPkg: Update PXE driver to check for NULL pointer before use it.

This patch is to fix the issue that dereferencing of "This" (EFI_LOAD_FILE_PROTOCOL)
in EfiPxeLoadFile() is happening before the NULL check.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Add assert for buffer pointer from DHCP driver.
Fu Siyuan [Tue, 2 Jan 2018 05:18:17 +0000 (13:18 +0800)]
NetworkPkg: Add assert for buffer pointer from DHCP driver.

The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check
during DHCP process, the DHCP driver should make sure Packet and NewPacket
has meaningful value. This patch adds assert for this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Fix memory leak problem in PXE driver.
Fu Siyuan [Tue, 2 Jan 2018 03:52:40 +0000 (11:52 +0800)]
NetworkPkg: Fix memory leak problem in PXE driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Check allocated buffer pointer before use.
Fu Siyuan [Tue, 2 Jan 2018 03:44:21 +0000 (11:44 +0800)]
NetworkPkg: Check allocated buffer pointer before use.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg: Abort the PXE process if DHCP has been started by other instance.
Fu Siyuan [Tue, 2 Jan 2018 03:41:24 +0000 (11:41 +0800)]
NetworkPkg: Abort the PXE process if DHCP has been started by other instance.

PXE need to use extended DHCP options and check received offers in callback
function, so there is no need to continue the PXE process if DHCP driver has
been started by other instance but not PXE driver itself.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoBaseTools: Fix compile error on VS2010
Yonghong Zhu [Wed, 3 Jan 2018 04:54:46 +0000 (12:54 +0800)]
BaseTools: Fix compile error on VS2010

VS2010 also defined RSIZE_MAX, so we undef it first.

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/DevicePath: fix GCC build error in print_mem(), and clean it up
Laszlo Ersek [Tue, 2 Jan 2018 17:16:36 +0000 (01:16 +0800)]
BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it up

Currently "BaseTools/Source/C/DevicePath/DevicePath.c" fails to build with
GCC48:

> DevicePath.c: In function 'print_mem':
> DevicePath.c:109:5: error: 'for' loop initial declarations are only
> allowed in C99 mode
>      for (size_t i=0; i<n; i++) {
>      ^
> DevicePath.c:109:5: note: use option -std=c99 or -std=gnu99 to compile
> your code

In addition, the print_mem() function does not conform to the edk2 coding
style:

- we use CamelCase and no underscores in identifiers,
- the types and type qualifiers should follow the edk2 style,
- initialization as part of definition is forbidden for local variables.

Clean these up.

While updating the print_mem()/PrintMem() call sites, also remove the
superfluous parentheses around the second argument.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Fixes: 7dbc50bd244d95fdc1741b9cfc561f0bfd724de1
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools CommonLib: Fix printf %llx issue on UINT64
Liming Gao [Tue, 2 Jan 2018 12:41:43 +0000 (20:41 +0800)]
BaseTools CommonLib: Fix printf %llx issue on UINT64

UINT64 is defined as the different type for the different ARCHs. To
let it work for all archs and compilers, add (unsigned long long) for
the input value together with %llx.

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: Add error handling when IP address is Class E
Wang Fan [Wed, 3 Jan 2018 02:39:46 +0000 (10:39 +0800)]
MdeModulePkg: Add error handling when IP address is Class E

The Dhcp4.TransmitReceive() API should be able to use at any time according
to UEFI spec. While in classless addressing network, the netmask must be
explicitly provided together with the station address.
But if the DHCP instance haven't be configured with a valid netmask, we need
compute it according to the classful addressing rule. In such case, if the
user configures with class E IP address, ASSERT will happen, we need to handle
this case and return error status code.

Cc: Jiaxin Wu <jiaxin.wu@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: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoBaseTools: Fix the regression bug of a74398 for SubFv Image
Yonghong Zhu [Tue, 2 Jan 2018 10:19:36 +0000 (18:19 +0800)]
BaseTools: Fix the regression bug of a74398 for SubFv Image

in version a74398 we use guid value and Fv name as ffs dir for FILE
statement, this patch apply this rule on subFv image.

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: resolve initialization order errors in VfrFormPkg.h
zenith432 [Wed, 6 Dec 2017 16:46:37 +0000 (16:46 +0000)]
BaseTools: resolve initialization order errors in VfrFormPkg.h

clang generates many warnings
warning: field 'XXX' is uninitialized when used here [-Wuninitialized]
for VfrFormPkg.h.

VfrFormPkg.h defines many classes derived from CIfrObj (along with other
base classes.)
Each of these derived classes defines a non-static member field that serves
as a duplicate pointer to an original pointer defined in the CIfrObj base
class, but cast to a different pointer type.
The derived class constructor passes the duplicate pointer to base class
constructors:
1) Once passes the address of the duplicate pointer to the CIfrObj
   constructor to have it initialized.
2) Then passes the duplicate pointer to one or more subsequent base class
   constructors to be used.
Both 1) and 2) constitute undefined behavior in C++.  C++ prescribes that
base classes are initialized before non-static members when initializing a
derived class.  So when base class constructors are executing, it is not
permitted to assume any non-static members of the derived class exist (even
to the stage of having their storage allocated.)

clang does not issue warnings for 1), but issues warnings -Wuninitialized
for 2).

This coding methodology is resolved as follows:
a) The CIfrObj object accessor method for retrieving the original pointer
   is revised to a template member function that returns the original
   pointer cast to a desired target type.
b) The call to CIfrObj constructor is no longer used to initialize the
   duplicate pointer in the derived class.
c) Any subsequent calls to a base class constructor that need to use the
   pointer, retrieve it from the CIfrObj base class using the template
   accessor method.
d) If the derived class makes no further use of the pointer, then the
   duplicate pointer defined in it is eliminated.
e) If the derived class needs the duplicate pointer for other use, the
   duplicate pointer remains in the derived class and is initialized in
   proper order from the original pointer in CIfrObj.
f) Existing source code that previously used the CIfrObj pointer accessor
   method is revised to use the template method.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: silence parentheses-equality warning
zenith432 [Sat, 9 Dec 2017 10:41:48 +0000 (10:41 +0000)]
BaseTools: silence parentheses-equality warning

Some code generated by antlr causes clang to emit warning
warning: equality comparison with extraneous parentheses
  [-Wparentheses-equality]
The warning is suppressed specifically for clang without affecting other
compilers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: eliminate unused expression result
zenith432 [Sat, 9 Dec 2017 10:14:41 +0000 (10:14 +0000)]
BaseTools: eliminate unused expression result

Remove some code generated by antlr that causes clang to emit warning
warning: expression result unused [-Wunused-value]

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: correct mal-typed CVfrDLGLexer::errstd
zenith432 [Sat, 9 Dec 2017 09:38:51 +0000 (09:38 +0000)]
BaseTools: correct mal-typed CVfrDLGLexer::errstd

The member function CVfrDLGLexer::errstd is intended as an override virtual
function of DLGLexerBase::errstd, but due to mismatched prototype, it
didn't override, and never got called.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg/DxePrintLibPrint2Protocol: Fix incomplete print output
Wang, Jian J [Tue, 2 Jan 2018 08:20:21 +0000 (16:20 +0800)]
MdeModulePkg/DxePrintLibPrint2Protocol: Fix incomplete print output

This is caused by a previous patch which tried to fix string over-read.
It's found that that patch for PrintLib in MdePkg will cause premature
terminating of loop used to traversing format string and cause incomplete
string output. Because this library uses similar code to do the same
job, it has the same issue too. So the fix is also the same.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdePkg/BasePrintLib: Fix incomplete print output
Wang, Jian J [Tue, 2 Jan 2018 08:20:20 +0000 (16:20 +0800)]
MdePkg/BasePrintLib: Fix incomplete print output

This is caused by previous patch which tried to fix string over-read,
which breaks UEFI menu rendering: the following

/------------------------------------------------------------------------------\
|                               Device Manager                                 |
\------------------------------------------------------------------------------/

is rendered as

/\
|                               Device Manager                                 |
\/.0                                                 2.00 GHz

(the spurious digits are SMBIOS data from the home screen)

The problem appears to be that the CHAR16 value of BOXDRAW_HORIZONTAL
equals 0x2500, which means that testing ArgumentString[] != '\0'
(which tests the low byte only) will yield FALSE and terminate the
loop prematurely.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg VarCheckPcd: Make sure the bin at required alignment
Star Zeng [Fri, 29 Dec 2017 10:12:36 +0000 (18:12 +0800)]
MdeModulePkg VarCheckPcd: Make sure the bin at required alignment

According to UEFI/PI spec, the AllocateXXXPool() interfaces should
return eight-byte aligned buffer that satisfies the required
HEADER_ALIGNMENT which is 4.

This patch adds ASSERT to make sure the bin at required alignment,
that can help catch the issue earlier about incorrect aligned buffer
returned from AllocateXXXPool().

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: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg VarCheckHii: Make sure the bin at required alignment
Star Zeng [Fri, 29 Dec 2017 10:10:36 +0000 (18:10 +0800)]
MdeModulePkg VarCheckHii: Make sure the bin at required alignment

According to UEFI/PI spec, the AllocateXXXPool() interfaces should
return eight-byte aligned buffer that satisfies the required
HEADER_ALIGNMENT which is 4.

This patch adds ASSERT to make sure the bin at required alignment,
that can help catch the issue earlier about incorrect aligned buffer
returned from AllocateXXXPool().

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: Jian J Wang <jian.j.wang@intel.com>
3 years agoUefiCpuPkg CpuExceptionHandlerLib: Enhance DumpModuleImageInfo()
Star Zeng [Wed, 27 Dec 2017 09:24:04 +0000 (17:24 +0800)]
UefiCpuPkg CpuExceptionHandlerLib: Enhance DumpModuleImageInfo()

Enhance DumpModuleImageInfo() for page fault with I/D set.

If it is page fault with I/D set, the (E/R)IP in SystemContext
could not be used for DumpModuleImageInfo(), instead of, the next
IP of the IP triggering this page fault could be found from stack
by (E/R)SP in SystemContext.

IA32 SDM:
— I/D flag (bit 4).
This flag is 1 if the access causing the page-fault exception was
an instruction fetch. This flag describes the access causing the
page-fault exception, not the access rights specified by paging.

The idea comes from SmiPFHandler () in
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c and
UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c.

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>
3 years agoBaseTools: Add DevicePath support for PCD values
Yonghong Zhu [Wed, 27 Dec 2017 06:12:29 +0000 (14:12 +0800)]
BaseTools: Add DevicePath support for PCD values

Use C code parse device path to output hex string, and Python
run command when PCD Value need device path parse.

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Fix the bug for QuarkPlatformPkg build failure
Zhu, Yonghong [Fri, 29 Dec 2017 00:28:17 +0000 (08:28 +0800)]
BaseTools: Fix the bug for QuarkPlatformPkg build failure

The issue is that the string 'LPC' starts with the 'L' character and
this is being confused with L" or L' for a Unicode string or Unicode
character.

Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=831
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 a bug for different FV use same FILE statement Guid
Yonghong Zhu [Thu, 28 Dec 2017 17:40:54 +0000 (01:40 +0800)]
BaseTools: Fix a bug for different FV use same FILE statement Guid

We meet a case that different FV use same FILE statement Guid, but the
FILE content is different. current we use the Guid value as Ffs file
dir which cause the ffs file will be override. This patch use Guid
value and Fv name as ffs dir for FILE statement.

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/DxePrintLibPrint2Protocol: fix GCC5 build break
Wang, Jian J [Fri, 29 Dec 2017 01:40:28 +0000 (09:40 +0800)]
MdeModulePkg/DxePrintLibPrint2Protocol: fix GCC5 build break

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael Kinney <michael.d.kinney@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: Liming Gao <liming.gao@intel.com>
3 years agoUefiCpuPkg: Fix comment typo for MtrrLibApplyFixedMtrrs function
Song, BinX [Wed, 27 Dec 2017 07:53:44 +0000 (15:53 +0800)]
UefiCpuPkg: Fix comment typo for MtrrLibApplyFixedMtrrs function

Fix comment typo for MtrrLibApplyFixedMtrrs function

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>
3 years agoMdeModulePkg PeiCore: Update debug message to print FV handle correctly
Liming Gao [Thu, 28 Dec 2017 06:34:14 +0000 (14:34 +0800)]
MdeModulePkg PeiCore: Update debug message to print FV handle correctly

BfvHeader->FvLength is UINT64. Now, it prints with %x. It will cause the
late FvHandle to be as zero. So, its type is converted to UINT32.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg HiiDataBase: Fix the potential NULL pointer access
Liming Gao [Thu, 28 Dec 2017 02:55:04 +0000 (10:55 +0800)]
MdeModulePkg HiiDataBase: Fix the potential NULL pointer access

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoSourceLevelDebugPkg: Convert source file to DOS format
Liming Gao [Wed, 27 Dec 2017 15:23:19 +0000 (23:23 +0800)]
SourceLevelDebugPkg: Convert source file to DOS format

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Wu Hao A <hao.a.wu@intel.com>
Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
3 years agoNetworkPkg: Convert source file to DOS format
Liming Gao [Wed, 27 Dec 2017 15:23:18 +0000 (23:23 +0800)]
NetworkPkg: Convert source file to DOS format

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
3 years agoIntelFspWrapperPkg: Convert INF file to dos format
Liming Gao [Wed, 27 Dec 2017 15:23:17 +0000 (23:23 +0800)]
IntelFspWrapperPkg: Convert INF file to dos format

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoSecurityPkg: Convert source file to DOS format
Liming Gao [Thu, 28 Dec 2017 01:09:47 +0000 (09:09 +0800)]
SecurityPkg: Convert source file to DOS format

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Qin Long <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
3 years agoMdeModulePkg/DxePrintLibPrint2Protocol: Fix error in Precision position calculation
Jian J Wang [Thu, 28 Dec 2017 02:22:39 +0000 (10:22 +0800)]
MdeModulePkg/DxePrintLibPrint2Protocol: Fix error in Precision position calculation

Due to a potential hole in the stop condition of loop, the two continuous
access to ArgumentString (index, index+1) inside the loop might cause the
string ending character ('\0') and the byte after it to be read.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdePkg/BasePrintLib: Fix error in Precision position calculation
Jian J Wang [Mon, 25 Dec 2017 02:07:39 +0000 (10:07 +0800)]
MdePkg/BasePrintLib: Fix error in Precision position calculation

Due to a potential hole in the stop condition of loop, the two continuous
access to ArgumentString (index, index+1) inside the loop might cause the
string ending character ('\0') and the byte after it to be read.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoCryptoPkg/OpensslLib AARCH64: disable rather than demote format warning
Ard Biesheuvel [Wed, 27 Dec 2017 09:16:47 +0000 (09:16 +0000)]
CryptoPkg/OpensslLib AARCH64: disable rather than demote format warning

We recently added -Wno-error=format to the OpenSslLib build script to
work around an issue in the upstream OpenSSL code. This does not inhibit
the warning, but prevents it from breaking the build by not treating it
as a fatal error.

Unfortunately, this interacts poorly with the -Wno-unused-const-variable
option that we added to GCC49 and later. Those versions of GCC ignore
-Wno-xxxx options that they don't understand, unless warnings are emitted
for another reason, in which case the warning is emitted after all, and
in our case, this breaks the build when the non-fatal format warning is
emitted.

CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/x_int64.c: In function 'uint64_print':
CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/x_int64.c:105:32: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int64_t {aka long long int}' [-Wformat=]
         return BIO_printf(out, "%"BIO_PRI64"d\n", **(int64_t **)pval);
                                ^
CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/x_int64.c:106:28: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
     return BIO_printf(out, "%"BIO_PRI64"u\n", **(uint64_t **)pval);
                            ^
CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/x_int64.c: At top level:
cc1: error: unrecognized command line option '-Wno-unused-const-variable' [-Werror]
cc1: all warnings being treated as errors

So replace -Wno-error=format with -Wno-format to suppress the warning
entirely.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoUefiCpuPkg: Rollback field name changes
Jian J Wang [Wed, 27 Dec 2017 09:06:18 +0000 (17:06 +0800)]
UefiCpuPkg: Rollback field name changes

Roll back commit 56649f43013703e95f54c293d708152b765cc49b.
The original names follows the spec definition.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg/BaseLib.h: Rollback field name changes
Jian J Wang [Wed, 27 Dec 2017 09:00:45 +0000 (17:00 +0800)]
MdePkg/BaseLib.h: Rollback field name changes

Rollback commit 47595ac0b96aaa18246ac1be4a238893dd0aa0fe
The original names follows the spec definition.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg: Update PI spec version to 1.6 in MdePkg.dec
Liming Gao [Wed, 27 Dec 2017 08:56:00 +0000 (16:56 +0800)]
MdePkg: Update PI spec version to 1.6 in MdePkg.dec

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg HiiDataBase: Fix the potential NULL pointer reference
Liming Gao [Wed, 27 Dec 2017 02:31:19 +0000 (10:31 +0800)]
MdeModulePkg HiiDataBase: Fix the potential NULL pointer reference

This change is the additional fix of commit
14b351e2ed8586f144dd3cd2e0a25082c1a32837.

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>
3 years agoMdeModulePkg Variable: Use boolean type value instead of expression
Liming Gao [Wed, 27 Dec 2017 03:39:21 +0000 (11:39 +0800)]
MdeModulePkg Variable: Use boolean type value instead of expression

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTools: Remove 'COMMON' in PCD SkuInfoList
BobCF [Wed, 27 Dec 2017 06:03:35 +0000 (14:03 +0800)]
BaseTools: Remove 'COMMON' in PCD SkuInfoList

'COMMON' is an alias of 'DEFAULT' for internal code,
it should be removed before generating Pcd DataBase.

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>
3 years agoCryptoPkg/OpensslLib AARCH64: suppress format string warning
Ard Biesheuvel [Wed, 27 Dec 2017 07:52:39 +0000 (07:52 +0000)]
CryptoPkg/OpensslLib AARCH64: suppress format string warning

On GCC Build: openssl-1.1.0g introduced one additional build warning:
 ...\openssl\crypto\asn1\x_int64.c:105:32: error: format '%ld' expects
     argument of type 'long int', but argument 3 has type 'int64_t
     {aka long long int}' [-Werror=format=]
 return BIO_printf(out, "%"BIO_PRI64"d\n", **(int64_t **)pval);
                             ^
Add "-Wno-error=format" to GCC build flags to suppress this warning,
since we have no real printf usage in BaseCryptLib, and BIO_printf()
was already wrapped as a dummy implementation in CryptoPkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoNetworkPkg/IScsiDxe: Correct the DnsMode value according the target info.
Jiaxin Wu [Fri, 22 Dec 2017 02:15:36 +0000 (10:15 +0800)]
NetworkPkg/IScsiDxe: Correct the DnsMode value according the target info.

When the platform gets the target info from DHCP (option 17) and the ISCSI
server is expressed as IP address, the value of DnsMode should be false,
otherwise, the failure will happen in certain case.

please refer to https://bugzilla.tianocore.org/show_bug.chi?id=823 for
the detailed steps.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Karunakar P <karunakarp@amiindia.co.in>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Tested-by: Karunakar P <karunakarp@amiindia.co.in>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/HttpDxe: Remove the unnecessary ASSERT.
Jiaxin Wu [Tue, 26 Dec 2017 05:30:25 +0000 (13:30 +0800)]
NetworkPkg/HttpDxe: Remove the unnecessary ASSERT.

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>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/HttpDxe: Fix the memory leak issue in HttpRequest().
Jiaxin Wu [Tue, 26 Dec 2017 03:10:34 +0000 (11:10 +0800)]
NetworkPkg/HttpDxe: Fix the memory leak issue in HttpRequest().

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>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/DxeHttpLib: Refine some coding style.
Jiaxin Wu [Tue, 26 Dec 2017 01:31:06 +0000 (09:31 +0800)]
MdeModulePkg/DxeHttpLib: Refine some coding style.

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 agoMdeModulePkg/DxeHttpLib: Correct some return Status.
Jiaxin Wu [Mon, 25 Dec 2017 08:57:28 +0000 (16:57 +0800)]
MdeModulePkg/DxeHttpLib: Correct some return Status.

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 agoMdeModulePkg/DxeHttpLib: Check the input parameters for some APIs.
Jiaxin Wu [Mon, 25 Dec 2017 08:43:37 +0000 (16:43 +0800)]
MdeModulePkg/DxeHttpLib: Check the input parameters for some APIs.

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 agoMdeModulePkg/DxeHttpLib: Avoid the potential memory leak when error happen.
Jiaxin Wu [Thu, 21 Dec 2017 06:36:12 +0000 (14:36 +0800)]
MdeModulePkg/DxeHttpLib: Avoid the potential memory leak when error happen.

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 agoMdeModulePkg/DxeHttpLib: Add boundary condition check.
Jiaxin Wu [Mon, 25 Dec 2017 08:17:34 +0000 (16:17 +0800)]
MdeModulePkg/DxeHttpLib: Add boundary condition check.

v2:
* Fix GCC the build error.

This patch is to add the boundary condition check to make sure
the accessed buffer is valid.

Cc: Gary Lin <glin@suse.com>
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>
Tested-by: Gary Lin <glin@suse.com>
3 years agoNetworkPkg/TcpDxe: Check TCP payload for release version.
Jiaxin Wu [Fri, 22 Dec 2017 06:53:03 +0000 (14:53 +0800)]
NetworkPkg/TcpDxe: Check TCP payload for release version.

TCP payload check is implemented by TcpVerifySegment(), but all the function
calls of TcpVerifySegment() are placed in ASSERT(), which is only valid for
debug version:
  ASSERT (TcpVerifySegment (Nbuf) != 0);

This patch is to enable the check for release version.

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 agoUefiCpuPkg: Update AESNI support checking logic
Song, BinX [Mon, 25 Dec 2017 03:11:21 +0000 (11:11 +0800)]
UefiCpuPkg: Update AESNI support checking logic

With correct model CPU, current checking logic will
always execute AsmReadMsr64 operation and then check
ECX.AESNI[bit 25] = 1. Update checking logic to check
ECX.AESNI[bit 25] = 1 first and then do AsmReadMsr64
operation.

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>
3 years agoUefiCpuPkg: Delete redundant PcdGetSize PcdCpuFeaturesSupport
Song, BinX [Thu, 21 Dec 2017 12:01:18 +0000 (20:01 +0800)]
UefiCpuPkg: Delete redundant PcdGetSize PcdCpuFeaturesSupport

When CpuCommonFeaturesLib use RegisterCpuFeaturesLib to register
CPU features, the CpuFeaturesData->BitMaskSize has already been
initialized. So delete redundant PcdGetSize PcdCpuFeaturesSupport
in CpuInitDataInitialize.

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>
3 years agoRevert "UefiCpuPkg: Check invalid RegisterCpuFeature parameter"
Eric Dong [Thu, 21 Dec 2017 11:46:51 +0000 (19:46 +0800)]
Revert "UefiCpuPkg: Check invalid RegisterCpuFeature parameter"

This reverts commit 5c59537c1092a1372913274636a8d766fdd97e61.

Current code already has function IsCpuFeatureSupported to do
the feature validation, not need this check logic anymore.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoBaseTools: Support PCD flexible values format
Yonghong Zhu [Tue, 26 Dec 2017 08:17:13 +0000 (16:17 +0800)]
BaseTools: Support PCD flexible values format

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Add Platform Override Build Options for PcdValueInit
Yonghong Zhu [Tue, 26 Dec 2017 05:16:17 +0000 (13:16 +0800)]
BaseTools: Add Platform Override Build Options for PcdValueInit

Add Platform's CC_FLAGS /D option for PcdValueInit generation.

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: Update copyright year info of DSC/DEC/INF BuilData.py file
Yonghong Zhu [Tue, 26 Dec 2017 05:24:20 +0000 (13:24 +0800)]
BaseTools: Update copyright year info of DSC/DEC/INF BuilData.py file

The DecBuildData.py, DscBuildData.py and InfBuildData.py were separated
from WorkspaceDatabase.py, so we updated to use same copyright year
info.

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 agoEdk2: Update Maintainers.txt to remove PerformancePkg
Liming Gao [Wed, 27 Dec 2017 02:49:33 +0000 (10:49 +0800)]
Edk2: Update Maintainers.txt to remove PerformancePkg

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
3 years agoPerformancePkg: Remove it
Liming Gao [Wed, 27 Dec 2017 02:48:57 +0000 (10:48 +0800)]
PerformancePkg: Remove it

PerformancePkg contains following components:
1. TscTimerLib
2. Dp_App
3. Header files.

#1 has already been deprecated.
#2 can be removed because DpApp was added to ShellPkg.
#3 Header files are not used by DpApp and
   MdeModulePkg/PerformanceLib instances.

In summary, this package is no longer useful.

All related platforms have been updated to remove the references.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Daryl McDaniel <edk2-lists@mc2research.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
3 years agoBaseTools: Update Python Makefile to include the new added python files
Liming Gao [Tue, 26 Dec 2017 15:13:39 +0000 (23:13 +0800)]
BaseTools: Update Python Makefile to include the new added python files

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
3 years agoBaseTools: Update SkuId checker to make sure it be valid UINT64 value
Liming Gao [Tue, 26 Dec 2017 07:59:09 +0000 (15:59 +0800)]
BaseTools: Update SkuId checker to make sure it be valid UINT64 value

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoCryptoPkg: Remove Cryptest Application from CryptoPkg
Long Qin [Fri, 22 Dec 2017 07:01:06 +0000 (15:01 +0800)]
CryptoPkg: Remove Cryptest Application from CryptoPkg

BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=819
Remove Cryptest application from CryptoPkg, which was only for
unit test.

Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoSecurityPkg: Remove RngTest Application from SecurityPkg
Long Qin [Fri, 22 Dec 2017 06:52:04 +0000 (14:52 +0800)]
SecurityPkg: Remove RngTest Application from SecurityPkg

BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=820
Remove the RngTest application from SecurityPkg, which was only for
unit test.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
3 years agoCryptoPkg/OpensslLib: Update OpenSSL version to 1.1.0g
Long Qin [Fri, 22 Dec 2017 06:07:39 +0000 (14:07 +0800)]
CryptoPkg/OpensslLib: Update OpenSSL version to 1.1.0g

Update the supported OpenSSL version to the latest 1.1.0g (02-Nov-2017).
The changes includes:
 - Re-generate the OpensslLib[crypto].inf using process_files.pl script
   to reflect the openssl source changes.
 - Update OpenSSL-HOWTO.txt
 - On Visual Studio Build: adding "/wd4819" to disable one addition build
   warning issue, which was already fixed in OpenSSL-HEAD
   https://github.com/openssl/openssl/pull/4691.
 - On GCC Build: openssl-1.1.0g introduced one additional build warning:
    ...\openssl\crypto\asn1\x_int64.c:105:32: error: format '%ld' expects
        argument of type 'long int', but argument 3 has type 'int64_t
        {aka long long int}' [-Werror=format=]
    return BIO_printf(out, "%"BIO_PRI64"d\n", **(int64_t **)pval);
                                ^
    Adding "-Wno-error=format" to GCC build flag to suppress this warning,
    since we have no real printf usage in BaseCryptLib, and BIO_printf()
    was already wrappered as the dummy implementation in CryptoPkg.

Cc: Ye Ting <ting.ye@intel.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>
3 years agoMdeModulePkg/Core: Fix heap guard issues
Jian J Wang [Wed, 20 Dec 2017 08:47:15 +0000 (16:47 +0800)]
MdeModulePkg/Core: Fix heap guard issues

Three issues addressed here:

a. Make NX memory protection and heap guard to be compatible
The solution is to check PcdDxeNxMemoryProtectionPolicy in Heap Guard to
see if the free memory should be set to NX, and set the Guard page to NX
before it's freed back to memory pool. This can solve the issue which NX
setting would be overwritten by Heap Guard feature in certain
configuration.

b. Returned pool address was not 8-byte aligned sometimes
This happened only when BIT7 is not set in PcdHeapGuardPropertyMask. Since
8-byte alignment is UEFI spec required, letting allocated pool adjacent to
tail guard page cannot be guaranteed.

c. NULL address handling due to allocation failure
When allocation failure, normally a NULL will be returned. But Heap Guard
code will still try to adjust the starting address of it, which will cause
a non-NULL pointer returned.

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 agoMdeModulePkg HiiDataBaseDxe: Add the check for the memory allocation return
Liming Gao [Tue, 26 Dec 2017 08:36:11 +0000 (16:36 +0800)]
MdeModulePkg HiiDataBaseDxe: Add the check for the memory allocation return

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>
3 years agoMdeModulePkg Variable: Update Pointer Minus with UINTN type
Liming Gao [Tue, 26 Dec 2017 08:34:10 +0000 (16:34 +0800)]
MdeModulePkg Variable: Update Pointer Minus with UINTN type

In V2, reduce unnecessary () in the expression.

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>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoNetworkPkg/TcpDxe: Remove the redundant code.
Jiaxin Wu [Fri, 22 Dec 2017 03:32:33 +0000 (11:32 +0800)]
NetworkPkg/TcpDxe: Remove the redundant code.

The function SockGroup() is not used by any other code. So,
it can be deleted.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@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/TcpDxe: Check FragmentBuffer for NULL before use
Jiaxin Wu [Fri, 22 Dec 2017 03:28:42 +0000 (11:28 +0800)]
NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use

According the Spec, the FragmentBuffers in FragmentTable are allocated
by the application when calling Receive() function. This patch is to
check whether the FragmentBuffer is valid or not.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@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 agoBaseTools: Fix building FatPkg failed issue
Feng, Bob C [Tue, 26 Dec 2017 03:33:33 +0000 (11:33 +0800)]
BaseTools: Fix building FatPkg failed issue

Using property instead of vairable for DecPcds.

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>
3 years agoFix License Header.
zwei4 [Mon, 25 Dec 2017 08:30:50 +0000 (16:30 +0800)]
Fix License Header.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wei, David <david.wei@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Cc: Wu, Mike <mike.wu@intel.com>
3 years agoUefiCpuPkg: Update code to use new structure field names
Jian J Wang [Tue, 26 Dec 2017 00:43:59 +0000 (08:43 +0800)]
UefiCpuPkg: Update code to use new structure field names

Due to coding style fix of the structure definition in BaseLib.h, all
code referencing those structure must be updated accordingly.

Cc: Dandan Bi <dandan.bi@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: Dandan Bi <dandan.bi@intel.com>
3 years agoUefiCpuPkg/UefiCpuPkg.uni: Add missing string definition for new PCDs
Jian J Wang [Tue, 26 Dec 2017 00:43:44 +0000 (08:43 +0800)]
UefiCpuPkg/UefiCpuPkg.uni: Add missing string definition for new PCDs

Cc: Dandan Bi <dandan.bi@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: Dandan Bi <dandan.bi@intel.com>
3 years agoMdeModulePkg/Core: Coding style clean-up
Jian J Wang [Tue, 26 Dec 2017 00:43:30 +0000 (08:43 +0800)]
MdeModulePkg/Core: Coding style clean-up

Cc: Dandan Bi <dandan.bi@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 agoMdePkg/BaseLib.h: Coding style clean-up
Jian J Wang [Fri, 22 Dec 2017 12:47:41 +0000 (20:47 +0800)]
MdePkg/BaseLib.h: Coding style clean-up

Cc: Dandan Bi <dandan.bi@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: Dandan Bi <dandan.bi@intel.com>
3 years agoMdeModulePkg/NetLib: Refine coding style for API NetLibDetectMediaWaitTimeout
Wang Fan [Mon, 25 Dec 2017 02:41:18 +0000 (10:41 +0800)]
MdeModulePkg/NetLib: Refine coding style for API NetLibDetectMediaWaitTimeout

Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
3 years agoMdeModulePkg HiiDataBaseDxe: Initialize the local variable before reference
Liming Gao [Mon, 25 Dec 2017 10:24:19 +0000 (18:24 +0800)]
MdeModulePkg HiiDataBaseDxe: Initialize the local variable before reference

Make VS2012x86 and GCC48 pass build

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoMdeModulePkg: Update PCD driver to support the optimized PcdDataBase
Liming Gao [Fri, 22 Dec 2017 05:41:54 +0000 (13:41 +0800)]
MdeModulePkg: Update PCD driver to support the optimized PcdDataBase

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: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg PCD: Enable Firmware to retrieve the default setting
Liming Gao [Fri, 22 Dec 2017 04:42:00 +0000 (12:42 +0800)]
MdeModulePkg PCD: Enable Firmware to retrieve the default setting

https://bugzilla.tianocore.org/show_bug.cgi?id=611
Update PCD driver to retrieve the default setting and set the initial
EFI variable when PcdSetNvStoreDefaultId is set.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg HiiDataBase: Enable Firmware to retrieve the default setting
Liming Gao [Fri, 22 Dec 2017 03:51:45 +0000 (11:51 +0800)]
MdeModulePkg HiiDataBase: Enable Firmware to retrieve the default setting

https://bugzilla.tianocore.org/show_bug.cgi?id=611
Update HiiDataBase to retrieve the default setting and patch IFR data

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg: Enable Firmware to retrieve the default setting
Liming Gao [Fri, 22 Dec 2017 03:50:49 +0000 (11:50 +0800)]
MdeModulePkg: Enable Firmware to retrieve the default setting

https://bugzilla.tianocore.org/show_bug.cgi?id=611
Add two PCDs and new PCD DB format definition

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoMdeModulePkg VariableDxe: Update it supports normal format variable storage
Liming Gao [Fri, 22 Dec 2017 04:44:19 +0000 (12:44 +0800)]
MdeModulePkg VariableDxe: Update it supports normal format variable storage

PEI may report the normal format variable storage HOB for the default
EFI variable. VariableDxe needs to support it and set them into NV variable
region.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTools: Fixed the issue of structure pcd filed sku inherit override
Liming Gao [Fri, 22 Dec 2017 12:53:01 +0000 (20:53 +0800)]
BaseTools: Fixed the issue of structure pcd filed sku inherit override

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: Fix VPD data optimization issue
Liming Gao [Tue, 19 Dec 2017 08:26:16 +0000 (16:26 +0800)]
BaseTools: Fix VPD data optimization issue

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 nest field name in DSC/DEC
Liming Gao [Tue, 19 Dec 2017 08:01:38 +0000 (16:01 +0800)]
BaseTools: Support nest field name in DSC/DEC

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: Check PCD DataType and the maxsize.
BobCF [Fri, 1 Dec 2017 06:15:59 +0000 (14:15 +0800)]
BaseTools: Check PCD DataType and the maxsize.

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: Correct PCD generation logic to make sure DB is use
Liming Gao [Mon, 18 Dec 2017 04:42:41 +0000 (12:42 +0800)]
BaseTools: Correct PCD generation logic to make sure DB is use

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: Generate correct VPD PCD value to store the default setting
Liming Gao [Fri, 22 Dec 2017 12:23:21 +0000 (20:23 +0800)]
BaseTools: Generate correct VPD PCD value to store the 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: Add error message if Structure PCD value is wrong
Liming Gao [Fri, 15 Dec 2017 04:12:58 +0000 (12:12 +0800)]
BaseTools: Add error message if Structure PCD value is wrong

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: 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>