]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
6 years agoBaseTools: enhance error check for DatumType format
Yonghong Zhu [Fri, 2 Feb 2018 07:46:08 +0000 (15:46 +0800)]
BaseTools: enhance error check for DatumType format

Add a check for DatumType format, eg: VOID *, original Tool will crash
but no detail error message which cause confusion to user.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools GNUmakefile: Remove HOST_ARCH in every tool Makefile
Liming Gao [Wed, 31 Jan 2018 11:59:57 +0000 (19:59 +0800)]
BaseTools GNUmakefile: Remove HOST_ARCH in every tool Makefile

HOST_ARCH has been moved into the common header.makefile

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools GNUmakefile: Move HOST_ARCH detection into common makefile
Liming Gao [Wed, 31 Jan 2018 11:59:56 +0000 (19:59 +0800)]
BaseTools GNUmakefile: Move HOST_ARCH detection into common makefile

With this change, enter single tool directory, make can pass.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoPcAtChipsetPkg: Add PeiAcpiTimerLib to save Frequency in HOB
Liming Gao [Tue, 23 Jan 2018 02:24:04 +0000 (10:24 +0800)]
PcAtChipsetPkg: Add PeiAcpiTimerLib to save Frequency in HOB

In V2:
1) Update PeiAcpiTimerLib base name to PeiAcpiTimerLib
2) Update PeiAcpiTimerLib to add the missing constructor to enable ACPI IO space
3) Update DxeAcpiTimerLib to cache frequency in constructor.

PeiAcpiTimerLib caches PerformanceCounterFrequency in HOB, then Pei and Dxe
AcpiTimerLib can share the same PerformanceCounterFrequency.

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>
6 years agoSecurityPkg: Support PP version lower than 1.3
Zhang, Chao B [Fri, 2 Feb 2018 08:16:05 +0000 (16:16 +0800)]
SecurityPkg: Support PP version lower than 1.3

TCG PP 1.2 & PP 1.3 spec defined different Opcodes.
Update code to support both.

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <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>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoCorebootPayloadPkg/FbGop: Produces correct PixelsPerScanLine
Benjamin You [Tue, 30 Jan 2018 08:38:45 +0000 (16:38 +0800)]
CorebootPayloadPkg/FbGop: Produces correct PixelsPerScanLine

According to UEFI Spec, EFI_GRAPHICS_OUTPUT_PROTOCOL.Mode->Info->
PixelsPerScanLine may contain padding pixel elements outside the area
covered by HorizontalResolution for performance reasons or due to hardware
restrictions. CorebootPayloadPkg's FbGop driver doesn't follow this
requirement, and produces PixelsPerScanLine simply as
HorizontalResolution. This needs to be fixed to reflect the real length
of a framebuffer scanline.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoMdeModulePkg/PXE: Add warning message for PXE if failed to read system GUID from...
Fu Siyuan [Fri, 2 Feb 2018 03:25:05 +0000 (11:25 +0800)]
MdeModulePkg/PXE: Add warning message for PXE if failed to read system GUID from SMBIOS.

Current PXE driver uses zero GUID if failed to get the system GUID from smbios
table, and some OS PXE boot may fail in such case. This patch is to add a warning
message to inform user that smbios table is missed on the platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoNetworkPkg: Add warning message for PXE if failed to read system GUID from SMBIOS.
Fu Siyuan [Fri, 2 Feb 2018 03:23:52 +0000 (11:23 +0800)]
NetworkPkg: Add warning message for PXE if failed to read system GUID from SMBIOS.

Current PXE driver uses zero GUID if failed to get the system GUID from smbios
table, and some OS PXE boot may fail in such case. This patch is to add a warning
message to inform user that smbios table is missed on the platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoSecurityPkg: Add UNI string for 2 PCDs
Zhang, Chao B [Sat, 3 Feb 2018 03:08:54 +0000 (11:08 +0800)]
SecurityPkg: Add UNI string for 2 PCDs

Add prompt & help string for PcdTpm2CurrentIrqNum, PcdTpm2PossibleIrqNumBuf

Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
6 years agoBaseTools: Update Expression.py for VOID* to support L'a' and 'a'
Feng, YunhuaX [Fri, 2 Feb 2018 09:01:52 +0000 (17:01 +0800)]
BaseTools: Update Expression.py for VOID* to support L'a' and 'a'

Original VOID* type support L"string" and "string" format, now we also
add support for single quote string that without null terminator.
Type VOID* support L'a' and 'a', the value transfer to c style value.
L'a' --> {0x61, 0x00}
L'ab' --> {0x61, 0x00, 0x62, 0x00}
'a'  --> {0x61}
'ab' --> {0x61, 0x62}

when the value is L'' or '' that not include any character, tool will
report error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoBaseTools: StructurePcd array Value support flexible format
Feng, YunhuaX [Fri, 2 Feb 2018 06:49:24 +0000 (14:49 +0800)]
BaseTools: StructurePcd array Value support flexible format

if StructurePcd set item value is array, support flexible format
like as:
gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array | {flexible format}
{flexible format} = {L"ABC"} | {L'ABC'} | {"ABC"} | {UINT8(0x10)}
                  | {UINT16(0x10)} | {UINT32(0x10)} | {UINT64(0x10)}
                  | {DEVICE_PATH("PciRoot(0)/Pci(0,0)")}
                  | {GUID(gPcdPkgTokenSpaceGuid)}
                  | {L"ABC", L'ABC', UINT8(0x10)....}

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoMdeModulePkg/SmmCore: Fix hang due to already-freed memory deference
Ruiyu Ni [Thu, 1 Feb 2018 10:14:24 +0000 (18:14 +0800)]
MdeModulePkg/SmmCore: Fix hang due to already-freed memory deference

SmiHandlerUnRegister() validates the DispatchHandle by checking
whether the first 32bit matches to a certain signature
(SMI_HANDLER_SIGNATURE).
But if a caller calls *UnRegister() twice and the memory freed by
first call still contains the signature, the second call may hang.

The patch fixes this issue by locating the DispatchHandle
in all SMI handlers, instead of checking the signature.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoIntelSiliconPkg/MicrocodeUpdateDxe: Refine debug messages
Hao Wu [Thu, 25 Jan 2018 02:10:46 +0000 (10:10 +0800)]
IntelSiliconPkg/MicrocodeUpdateDxe: Refine debug messages

Refine the debug messages during the verification of microcode to make
them more clear.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools: Fix make PcdValueCommon.c failure on GCC
Feng, YunhuaX [Fri, 2 Feb 2018 02:34:24 +0000 (10:34 +0800)]
BaseTools: Fix make PcdValueCommon.c failure on GCC

error message:
PcdValueCommon.c: In function '__PcdGetPtr':
PcdValueCommon.c:315:11: error: variable 'Byte'
set but not used [-Werror=unused-but-set-variable]
   UINT8   Byte;
           ^
cc1: all warnings being treated as errors

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoMdeModulePkg/Core: fix feature conflict between NX and heap guard
Jian J Wang [Mon, 29 Jan 2018 12:03:33 +0000 (20:03 +0800)]
MdeModulePkg/Core: fix feature conflict between NX and heap guard

Considering following scenario (both NX memory protection and heap guard
are enabled):

   1. Allocate 3 pages. The attributes of adjacent memory pages will be

      |NOT-PRESENT|  present  |  present  |  present  |NOT-PRESENT|

   2. Free the middle page. The attributes of adjacent memory pages should be

      |NOT-PRESENT|  present  |NOT-PRESENT|  present  |NOT-PRESENT|

      But the NX feature will overwrite the attributes of middle page. So it
      looks still like below, which is wrong.

      |NOT-PRESENT|  present  |  PRESENT  |  present  |NOT-PRESENT|

The solution is checking the first and/or last page of a memory block to be
marked as NX, and skipping them if they are Guard pages.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoMdeModulePkg/Core: fix feature conflict between NX and NULL detection
Jian J Wang [Mon, 29 Jan 2018 11:07:29 +0000 (19:07 +0800)]
MdeModulePkg/Core: fix feature conflict between NX and NULL detection

If enabled, NX memory protection feature will mark all free memory as
NX (non-executable), including page 0. This will overwrite the attributes
of page 0 if NULL pointer detection feature is also enabled and then
compromise the functionality of it. The solution is skipping the NX
attributes setting to page 0 if NULL pointer detection feature is enabled.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoMdeModulePkg/Core: fix guard page missing issue
Jian J Wang [Fri, 26 Jan 2018 11:47:14 +0000 (19:47 +0800)]
MdeModulePkg/Core: fix guard page missing issue

This issue is a regression one caused by a patch at

    425d25699be83c35e12df8470b827d7fbcef3bce

That fix didn't take the 0 page to free into account, which still
needs to call UnsetGuardPage() even no memory needs to free.

The fix is just moving the calling of UnsetGuardPage() to the place
right after calling AdjustMemoryF().

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: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoIntelFrameworkModule/ThunkKb: ReadKeyStrokeEx always return key state
Ruiyu Ni [Fri, 19 Jan 2018 07:59:38 +0000 (15:59 +0800)]
IntelFrameworkModule/ThunkKb: ReadKeyStrokeEx always return key state

Today's implementation only return key state when there is a key.
But when user doesn't press any key, the key state cannot be
returned.

The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
6 years agoIntelFrameworkModule/Ps2Kb: ReadKeyStrokeEx always return key state
Ruiyu Ni [Fri, 19 Jan 2018 07:22:53 +0000 (15:22 +0800)]
IntelFrameworkModule/Ps2Kb: ReadKeyStrokeEx always return key state

Today's implementation only return key state when there is a key.
But when user doesn't press any key, the key state cannot be
returned.

The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
6 years agoMdeModulePkg/Ps2Kb: ReadKeyStrokeEx always return key state
Ruiyu Ni [Tue, 16 Jan 2018 08:21:42 +0000 (16:21 +0800)]
MdeModulePkg/Ps2Kb: ReadKeyStrokeEx always return key state

Today's implementation only return key state when there is key.
But when user doesn't press any key, the key state cannot be
returned.

The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
6 years agoMdeModulePkg/UsbKb: ReadKeyStrokeEx always return key state
Ruiyu Ni [Fri, 12 Jan 2018 11:29:32 +0000 (19:29 +0800)]
MdeModulePkg/UsbKb: ReadKeyStrokeEx always return key state

Today's implementation only return key state when there is key.
But when user doesn't press any key, the key state cannot be
returned.

The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
6 years agoMdeModulePkg/ConSplitter: ReadKeyStrokeEx always return key state
Ruiyu Ni [Fri, 12 Jan 2018 11:26:22 +0000 (19:26 +0800)]
MdeModulePkg/ConSplitter: ReadKeyStrokeEx always return key state

Today's implementation only return key state when there is key.
But when user doesn't press any key, the key state cannot be
returned.

The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
6 years agoMdePkg/SimpleTextInEx.h: Fix comments alignment
Ruiyu Ni [Mon, 15 Jan 2018 02:36:06 +0000 (10:36 +0800)]
MdePkg/SimpleTextInEx.h: Fix comments alignment

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools CommonLib: Remove the unnecessary print message in PcdValueCommon
Liming Gao [Wed, 31 Jan 2018 09:03:37 +0000 (17:03 +0800)]
BaseTools CommonLib: Remove the unnecessary print message in PcdValueCommon

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoUefiCpuPkg: Remove the unused file ResetVec.asm16
Liming Gao [Wed, 31 Jan 2018 09:45:34 +0000 (17:45 +0800)]
UefiCpuPkg: Remove the unused file ResetVec.asm16

ResetVec.nasmb is used. ResetVec.asm16 can be retired.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoMdePkg SafeIntLib: Update API definition to use the same output name
Liming Gao [Wed, 31 Jan 2018 12:27:10 +0000 (20:27 +0800)]
MdePkg SafeIntLib: Update API definition to use the same output name

In SafeUintnToChar8(), update its output parameter name.
Update pui8Result --> Result to match its library implementation

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoBaseTools: Structure Pcd in CommandLine.
Feng, Bob C [Wed, 31 Jan 2018 08:49:14 +0000 (16:49 +0800)]
BaseTools: Structure Pcd in CommandLine.

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>
6 years agoBaseTools: Support multiple .h file
Feng, Bob C [Mon, 29 Jan 2018 06:09:36 +0000 (14:09 +0800)]
BaseTools: Support multiple .h file

for structure Pcd declaration in DEC file.

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>
6 years agoBaseTool: Enhance error handling.
BobCF [Wed, 31 Jan 2018 09:32:01 +0000 (17:32 +0800)]
BaseTool: Enhance error handling.

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>
6 years agoBaseTool: Add comments in PcdValueInit.c.
Feng, Bob C [Wed, 31 Jan 2018 09:45:02 +0000 (17:45 +0800)]
BaseTool: Add comments in PcdValueInit.c.

Add Comments for __FLEXIBLE_SIZE () statement.

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>
6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: eliminate conditional jump in IA32 SmmStartup()
Laszlo Ersek [Tue, 30 Jan 2018 14:34:08 +0000 (15:34 +0100)]
UefiCpuPkg/PiSmmCpuDxeSmm: eliminate conditional jump in IA32 SmmStartup()

SMM emulation under both KVM and QEMU (TCG) crashes the guest when the
"jz" branch, added in commit d4d87596c11d ("UefiCpuPkg/PiSmmCpuDxeSmm:
Enable NXE if it's supported", 2018-01-18), is taken.

Rework the propagation of CPUID.80000001H:EDX.NX [bit 20] to IA32_EFER.NXE
[bit 11] so that no code is executed conditionally.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: http://mid.mail-archive.com/d6fff558-6c4f-9ca6-74a7-e7cd9d007276@redhat.com
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[lersek@redhat.com: XD -> NX code comment updates from Ray]
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
[lersek@redhat.com: mark QEMU/TCG as well in the commit message]

6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: remove unneeded DBs from IA32 SmmStartup()
Laszlo Ersek [Tue, 30 Jan 2018 13:43:28 +0000 (14:43 +0100)]
UefiCpuPkg/PiSmmCpuDxeSmm: remove unneeded DBs from IA32 SmmStartup()

The SmmStartup() executes in SMM, which is very similar to real mode. Add
"BITS 16" before it and "BITS 32" after it (just before the @32bit label).

Remove the manual 0x66 operand-size override prefixes, for selecting
32-bit operands -- the sizes of our operands trigger NASM to insert the
prefixes automatically in almost every spot. The one place where we have
to add it back manually is the LGDT instruction. (The 0x67 address-size
override prefix is also auto-generated.)

This patch causes NASM to generate byte-identical object code (determined
by disassembling both the pre-patch and post-patch versions, and comparing
the listings), except:

> @@ -158,7 +158,7 @@
>  00000142  6689D3            mov ebx,edx
>  00000145  66B800000000      mov eax,0x0
>  0000014B  0F22D8            mov cr3,eax
> -0000014E  67662E0F0155F6    o32 lgdt [cs:ebp-0xa]
> +0000014E  2E66670F0155F6    o32 lgdt [cs:ebp-0xa]
>  00000155  66B800000000      mov eax,0x0
>  0000015B  0F22E0            mov cr4,eax
>  0000015E  66B9800000C0      mov ecx,0xc0000080

The only difference is the prefix list order, it changes from:

- 0x67, 0x66, 0x2E

to

- 0x2E, 0x66, 0x67

(0x2E is "CS segment override").

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=866
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoUefiCpuPkg/PiSmmCpuDxeSmm: update comments in IA32 SmmStartup()
Laszlo Ersek [Tue, 30 Jan 2018 13:31:23 +0000 (14:31 +0100)]
UefiCpuPkg/PiSmmCpuDxeSmm: update comments in IA32 SmmStartup()

The gSmmCr3, gSmmCr4, gSmmCr0 and gSmmJmpAddr global variables are used
for patching assembly instructions, thus we can't yet remove the DB
encodings for those instructions. At least we should add the intended
meanings in comments.

This patch only changes comments.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
[lersek@redhat.com: adapt commit msg to ongoing PatchAssembly discussion]

6 years agoBaseTools: Update BPDG to support L'' and '' format as VPD Pcd Value
Yonghong Zhu [Tue, 30 Jan 2018 15:01:31 +0000 (23:01 +0800)]
BaseTools: Update BPDG to support L'' and '' format as VPD Pcd Value

Current Pcd value support flexible format, this patch add support for
BPDG Tool to support L'' and '' format.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Fix the bug to align VPD PCD based on value type
Yonghong Zhu [Mon, 29 Jan 2018 07:49:56 +0000 (15:49 +0800)]
BaseTools: Fix the bug to align VPD PCD based on value type

Spec required for VOID* VPD Pcd, Ascii string use byte alignment, byte
array use 8-byte alignment, unicode string use 2-byte alignment.
while when the VPD pcd offset use *, the offset generated in the .map
file not follow this rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg PiSmmCore: Set ForwardLink to NULL in RemoveOldEntry()
Star Zeng [Thu, 25 Jan 2018 03:20:04 +0000 (11:20 +0800)]
MdeModulePkg PiSmmCore: Set ForwardLink to NULL in RemoveOldEntry()

"Entry->Link.ForwardLink = NULL;" is present in RemoveMemoryMapEntry()
for DxeCore, that is correct.
"Entry->Link.ForwardLink = NULL;" is absent in RemoveOldEntry()
for PiSmmCore, that is incorrect.

Without this fix, when FromStack in Entry is TRUE,
the "InsertTailList (&mMapStack[mMapDepth].Link, &Entry->Link);" in
following calling to CoreFreeMemoryMapStack() will fail as the entry
at mMapStack[mMapDepth] actually has been removed from the list.

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>
6 years agoMdePkg ACPI: Correct processor struct of PPTT
Ming Huang [Tue, 30 Jan 2018 05:51:55 +0000 (13:51 +0800)]
MdePkg ACPI: Correct processor struct of PPTT

The Type field of EFI_ACPI_6_2_PPTT_STRUCTURE_PROCESSOR should
be UINT8 as ACPI version 6.2 specification.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <huangming23@huawei.com>
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Enhance parse performance by optimize ValueExpressionEx
Yunhua Feng [Fri, 26 Jan 2018 16:28:05 +0000 (00:28 +0800)]
BaseTools: Enhance parse performance by optimize ValueExpressionEx

Optimize ValueExpressionEx function to enhance meta-data file parse
performance.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden
Ard Biesheuvel [Thu, 7 Dec 2017 22:43:22 +0000 (22:43 +0000)]
MdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden

Invoke the newly introduced SD/MMC override protocol to override
the capabilities register after reading it from the device registers,
and to call the pre/post host init and reset hooks at the appropriate
times.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg: introduce SD/MMC override protocol
Ard Biesheuvel [Thu, 7 Dec 2017 22:43:21 +0000 (22:43 +0000)]
MdeModulePkg: introduce SD/MMC override protocol

Many ARM based SoCs have integrated SDHCI controllers, and often,
these implementations deviate in subtle ways from the pertinent
specifications. On the one hand, these deviations are quite easy
to work around, but on the other hand, having a collection of SoC
specific workarounds in the generic driver stack is undesirable.

So let's introduce an optional SD/MMC override protocol that we
can invoke at the appropriate moments in the device initialization.
That way, the workaround itself remains platform specific, but we
can still use the generic driver stack on such platforms.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
​Reviewed-by: Star Zeng <star.zeng@intel.com>

6 years agoCorebootPayloadPkg: Use correct BytesPerScanLine
Arthur Heymans [Wed, 24 Jan 2018 10:57:36 +0000 (18:57 +0800)]
CorebootPayloadPkg: Use correct BytesPerScanLine

Fetch BytesPerScanLine from coreboot table to reflect how the actual
framebuffer is set up instead of guessing it from the horizontal
resolution.

This fixes a garbled display when HorizontalResolution * (BitsPerPixel
/ 8) and pFbInfo->BytesPerScanLine don't match.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
6 years agoBaseTools: Fix indentation in CParser.py file
Gary Lin [Wed, 17 Jan 2018 04:05:43 +0000 (12:05 +0800)]
BaseTools: Fix indentation in CParser.py file

Mixing usage of spaces and tabs may confuse the python
compiler/interpreter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin <glin@suse.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoSecurityPkg: Disable TPM interrupt in DEC
Zhang, Chao B [Mon, 29 Jan 2018 08:31:17 +0000 (16:31 +0800)]
SecurityPkg: Disable TPM interrupt in DEC

Disable TPM interrupt support in DEC by default to keep compatibility

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
6 years agoSecurityPkg: Tcg2Smm: Enable TPM2.0 interrupt support
Zhang, Chao B [Mon, 8 Jan 2018 02:13:54 +0000 (10:13 +0800)]
SecurityPkg: Tcg2Smm: Enable TPM2.0 interrupt support

1. Expose _CRS, _SRS, _PRS control method to support TPM interrupt
2. Provide 2 PCDs to configure _CRS and _PRS returned data

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Ronald Aigner <Ronald.Aigner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoShellPkg/Level2Command: Use UnicodeCollation in StrinCmp
Ruiyu Ni [Fri, 26 Jan 2018 08:43:22 +0000 (22:36 -3407)]
ShellPkg/Level2Command: Use UnicodeCollation in StrinCmp

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg/CommandLib: Locate proper UnicodeCollation instance
Ruiyu Ni [Fri, 26 Jan 2018 08:41:37 +0000 (16:41 +0800)]
ShellPkg/CommandLib: Locate proper UnicodeCollation instance

Original code locates the first UnicodeCollation instance in
DXE Core protocol database.
It's not correct considering multiple UnicodeCollation instances
exist in system.
The patch changes logic to find the one that matches the current
system language.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com.
6 years agoUefiCpuPkg/CpuDxe: remove all code to flush TLB for APs
Jian J Wang [Mon, 29 Jan 2018 01:26:31 +0000 (09:26 +0800)]
UefiCpuPkg/CpuDxe: remove all code to flush TLB for APs

The reason doing this is that we found that calling StartupAllAps() to
flush TLB for all APs in CpuDxe driver after changing page attributes
will spend a lot of time to complete. If there are many page attributes
update requests, the whole system performance will be slowed down
explicitly, including any shell command and UI operation.

The solution is removing the flush operation for AP in CpuDxe driver
and let AP flush TLB after woken up.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
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: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoUefiCpuPkg/MpInitLib: force flushing TLB for AP in mwait loop mode
Jian J Wang [Fri, 26 Jan 2018 08:30:40 +0000 (16:30 +0800)]
UefiCpuPkg/MpInitLib: force flushing TLB for AP in mwait loop mode

The reason doing this is that we found that calling StartupAllAps() to
flush TLB for all APs in CpuDxe driver after changing page attributes
will spend a lot of time to complete. If there are many page attributes
update requests, the whole system performance will be slowed down
explicitly, including any shell command and UI operation.

The solution is removing the flush operation for AP in CpuDxe driver.
Since TLB is always flushed in HLT loop mode, we just need to enforce
a TLB flush for mwait loop mode.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
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: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoUefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI
Jian J Wang [Wed, 24 Jan 2018 12:09:02 +0000 (20:09 +0800)]
UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI

This issue is introduced by a patch at

   f32bfe6d061420a15bac6083063d227c567e6388

The above patch miss the case of 64-bit PEI, which will link
X64/MpFuncs.nasm instead of Ia32/MpFuncs.nasm. For X64/MpFuncs.nasm,
ExchangeInfo->ModeHighMemory should be always initialized no matter
if separate wakeup buffer is allocated or not. Ia32/MpFuncs.nasm will
not need ModeHighMemory during AP init. So the changes made in this
patch should not affect the functionality of it.

Cc: Ruiyu Ni <ruiyu.ni@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: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoBeagleBoardPkg: reroute Firmware Vendor Pcd to MdeModulePkg
Leif Lindholm [Fri, 26 Jan 2018 17:25:56 +0000 (17:25 +0000)]
BeagleBoardPkg: reroute Firmware Vendor Pcd to MdeModulePkg

Commit f9669f09fb53 ("ArmPlatformPkg: retire obsolete PCDs") got rid of
the unfortunate ARM-specific variant of PcdFirmwareVendor.

However, BeagleBoard was still using it, so the change broke the build.
Fix this by moving BeagleBoard to use the MdeModulePkg one instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoUefiCpuPkg/MpInitLib: Make sure AP uses correct StartupApSignal
Star Zeng [Thu, 28 Dec 2017 02:24:29 +0000 (10:24 +0800)]
UefiCpuPkg/MpInitLib: Make sure AP uses correct StartupApSignal

Every processor's StartupApSignal is initialized in
MpInitLibInitialize() before calling CollectProcessorCount().
When SortApicId() is called from CollectProcessorCount(), AP Index
is re-assigned by APIC ID. But SortApicId() forgets to set the
correct StartupApSignal when sorting the AP.

The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
6 years agoUefiCpuPkg/CpuExceptionHandler: Init serial port before context dump
Ruiyu Ni [Thu, 25 Jan 2018 05:09:57 +0000 (13:09 +0800)]
UefiCpuPkg/CpuExceptionHandler: Init serial port before context dump

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg/Partition: Fix media probe
Ruiyu Ni [Thu, 25 Jan 2018 09:44:16 +0000 (17:44 +0800)]
MdeModulePkg/Partition: Fix media probe

The call in ProbeMediaStatusEx() to the ReadDisk() function of the
EFI_DISK_IO_PROTOCOL interface implemented in DiskIoDxe/DiskIo.c
crashed in DiskIo2ReadWriteDisk() because of the NULL value of
the destination buffer pointer.

Pass the address of a buffer in the stack instead of a NULL
pointer.

The similar fix was applied to ProbeMediaStatus in commit
df473cc1fc9acd1a623ec7e05276f2f0635c19d2
* MdeModulePkg/PartitionDxe: Fix media probe

Somehow ProbeMediaStatusEx() wasn't changed together.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Tested-by: Jian J Wang <jian.j.wang@intel.com>
6 years agoIntelSiliconPkg MicrocodeUpdateDxe: TotalSize must be multiples of 1KB
Star Zeng [Thu, 21 Dec 2017 02:57:04 +0000 (10:57 +0800)]
IntelSiliconPkg MicrocodeUpdateDxe: TotalSize must be multiples of 1KB

TotalSize must be multiples of 1024 bytes (1 KBytes) according to SDM.

Also enhance the debug message for DataSize that must be
multiples of DWORDs.

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>
6 years agoShellPkg: Update package version from 1.01 to 1.02
Ruiyu Ni [Wed, 24 Jan 2018 05:51:10 +0000 (13:51 +0800)]
ShellPkg: Update package version from 1.01 to 1.02

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoMdePkg/BaseSafeIntLib: Add SafeIntLib class and instance
Sean Brogan [Mon, 24 Apr 2017 23:37:20 +0000 (16:37 -0700)]
MdePkg/BaseSafeIntLib: Add SafeIntLib class and instance

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

SafeIntLib provides helper functions to prevent integer overflow
during type conversion, addition, subtraction, and multiplication.

Conversion Functions
====================
* Converting from a signed type to an unsigned type of the same
  size, or vice-versa.
* Converting to a smaller type that could possibly overflow.
* Converting from a signed type to a larger unsigned type.

Unsigned Addition, Subtraction, Multiplication
===============================================
* Unsigned integer math functions protect from overflow and
  underflow (in case of subtraction).

Signed Addition, Subtraction, Multiplication
============================================
* Strongly consider using unsigned numbers.
* Signed numbers are often used where unsigned numbers should
  be used. For example file sizes and array indices should always
  be unsigned. Subtracting a larger positive signed number from a
  smaller positive signed number with SafeInt32Sub() will succeed,
  producing a negative number, that then must not be used as an
  array index (but can occasionally be used as a pointer index.)
  Similarly for adding a larger magnitude negative number to a
  smaller magnitude positive number.
* SafeIntLib does not protect you from such errors. It tells you
  if your integer operations overflowed, not if you are doing the
  right thing with your non-overflowed integers.
* Likewise you can overflow a buffer with a non-overflowed
  unsigned index.

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/21ef3a321c907b40fa93797619c9f6c686dd92e0
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoSecurityPkg:Tpm2DeviceLibDTpm: Support TPM command cancel
Zhang, Chao B [Tue, 23 Jan 2018 07:18:16 +0000 (15:18 +0800)]
SecurityPkg:Tpm2DeviceLibDTpm: Support TPM command cancel

Support TPM Command cancel if executing command timeouts. Cancel could
happen in long running command case

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Chinnusamy Rajkumar K <rajkumar.k.chinnusamy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoBaseTools: Fixed incorrect VPD size.
BobCF [Tue, 23 Jan 2018 08:00:59 +0000 (16:00 +0800)]
BaseTools: Fixed incorrect VPD size.

The VPD size is incorrect if that VPD is not used in Module.

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>
6 years agoBaseTool: Fixed the StructurePcd incorrect value.
Feng, Bob C [Thu, 25 Jan 2018 07:42:25 +0000 (15:42 +0800)]
BaseTool: Fixed the StructurePcd incorrect value.

If user not set Structure overall value in Dsc,
Structure Pcd value would be incorrect.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Fixed some small issues
Feng, Bob C [Tue, 23 Jan 2018 03:34:45 +0000 (11:34 +0800)]
BaseTools: Fixed some small issues
1. The structure pcd default value should use the default value under sku.
2. Incorrect VpdOffset value for those un-used in module Vpd
3. Add a checkpoint for Structure Pcd Name

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>
6 years agoBaseTools: Fixed build failure for the PCD value initialization.
Feng, Bob C [Tue, 23 Jan 2018 01:38:36 +0000 (09:38 +0800)]
BaseTools: Fixed build failure for the PCD value initialization.

A pcd is initialized under one SKU but is uninitialized under another SKU.

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>
6 years agoBaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file
Feng, Bob C [Tue, 23 Jan 2018 03:03:05 +0000 (11:03 +0800)]
BaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file

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>
6 years agoBaseTool: Combine the HiiPcd value if they link to same Variable
Feng, Bob C [Tue, 23 Jan 2018 02:18:53 +0000 (10:18 +0800)]
BaseTool: Combine the HiiPcd value if they link to same Variable

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>
6 years agoNetworkPkg/HttpBootDxe: Avoid to corrupt HttpBootDxe setup screen.
Jiaxin Wu [Wed, 17 Jan 2018 03:25:41 +0000 (11:25 +0800)]
NetworkPkg/HttpBootDxe: Avoid to corrupt HttpBootDxe setup screen.

When giving an invalid URI in Boot URI field within HTTP Boot
configuration page, the AsciiPrint will corrupt the setup screen.

This patch is to resolve the 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: Karunakar P <karunakarp@amiindia.co.in>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdeModulePkg/UefiBootManagerLib: Skip the DNS device path node check.
Jiaxin Wu [Tue, 23 Jan 2018 07:06:52 +0000 (15:06 +0800)]
MdeModulePkg/UefiBootManagerLib: Skip the DNS device path node check.

After HTTP boot successfully in home mode, the HTTP device path will be
updated accordingly. So, the new device path may be appended with a DNS
device path node. When executing home mode boot again, the original HTTP
device path will mismatch with the new updated one, which will cause the
HTTP boot failure. So, we need update the current match algorithm to match
the correct FilePath. Since the DNS device path is an optional, we can skip
it check.

This patch is to fix above issue.

Cc: Ruiyu Ni <ruiyu.ni@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: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoBaseTools: CommonLib Fix Crash to write the last byte
Liming Gao [Wed, 24 Jan 2018 15:24:28 +0000 (23:24 +0800)]
BaseTools: CommonLib Fix Crash to write the last byte

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoUefiCpuPkg/MpInitLib: fix issue in wakeup buffer initialization
Jian J Wang [Wed, 24 Jan 2018 01:36:01 +0000 (09:36 +0800)]
UefiCpuPkg/MpInitLib: fix issue in wakeup buffer initialization

To fix an issue in which enabling NX feature will mark the AP wakeup
buffer as non-executable and fail the AP init, the buffer was split
into two part: the lower part in memory within 1MB and the higher part
within allocated executable memory (EfiBootServicesCode). But the
address of higher part memory was stored in lower part memory, which
is actually shared with legacy components and will be overwritten by
LegacyBiosDxe driver if CSM is enabled.

This patch fixes this issue by storing the address of higher part
memory in CpuMpData instead of ExchangeInfo.

Cc: Ruiyu Ni <ruiyu.ni@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: Laszlo Ersek <lersek@redhat.com>
6 years agoShellPkg/UefiShellLevel3CommandsLib: fix string over-read
Jian J Wang [Mon, 22 Jan 2018 05:06:08 +0000 (13:06 +0800)]
ShellPkg/UefiShellLevel3CommandsLib: fix string over-read

In the for-loop condition of original code, the expression

  *CurrentCommand != CHAR_NULL

is put before expression

  CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16)

When CurrentCommand walks to the end of string buffer, one more character
over the end of string buffer will be read and then stop.

To fix this issue, just move the last expression to the first one. Because
of short-circuit evaludation of and-expression, the following one

  *CurrentCommand != CHAR_NULL

will not be evaluated if the expression before it is evaludated as FALSE.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoIntelSiliconPkg IntelVTdDxe: Fix flush cache issue
Star Zeng [Wed, 17 Jan 2018 10:31:29 +0000 (18:31 +0800)]
IntelSiliconPkg IntelVTdDxe: Fix flush cache issue

The patch fixes flush cache issue in
CreateSecondLevelPagingEntryTable().

We found some video cards still not work even they have
been added to the exception list.

In CreateSecondLevelPagingEntryTable(), the check
"(BaseAddress >= MemoryLimit)" may be TRUE and "goto Done"
will be executed, then the FlushPageTableMemory operations
at the end of the function will be skipped.

Instead of "goto Done", this patch uses "break" to break
the for loops, then the FlushPageTableMemory operations
at the end of the function could have opportunity to be
executed.

The patch also fixes a miscalculation for Lvl3End.

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>
6 years agoMdeModulePkg/NvmExpressDxe: Fix data buffer not mapped for Write cmd
Hao Wu [Tue, 23 Jan 2018 04:47:44 +0000 (12:47 +0800)]
MdeModulePkg/NvmExpressDxe: Fix data buffer not mapped for Write cmd

Within function NvmExpressPassThru():

The data buffer for the below 2 Admin command:
Create I/O Completion Queue command (Opcode 01h)
Create I/O Submission Queue command (Opcode 05h)

are not mapped to the PCI controller specific addresses.

But the current code logic also prevents the below NVM command:
Write (Opcode 01h)

from mapping its data buffer.

Hence, this commit refine the logic to resolve this issue.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools: Barf on unknown HOST_ARCH in C Makefile
Chema Gonzalez [Thu, 28 Dec 2017 00:23:56 +0000 (16:23 -0800)]
BaseTools: Barf on unknown HOST_ARCH in C Makefile

I was getting `HOST_ARCH` set using the linux arch name ("x86_64"), which
is different from the MS one ("X64").

It is not clear anyway we can proceed without valid build variables
(`ARCH_INCLUDE`, `BIN_PATH`, `LIB_PATH`, `SYS_BIN_PATH`, and
`SYS_LIB_PATH`).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chema Gonzalez <chemag@gmail.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/PciBusDxe: Install PciEnumerationComplete after PciIo
Ruiyu Ni [Mon, 22 Jan 2018 06:23:00 +0000 (14:23 +0800)]
MdeModulePkg/PciBusDxe: Install PciEnumerationComplete after PciIo

Per PI spec, the PciEnumerationComplete protocol installation
should be after PciIo installation.
Today's implementation installs the PciEnumerationComplete
after hardware enumeration is completed, but before PciIo
installation.
The change corrects the spec/implementation gap.
The change also benefits certain implementation that depends on
the PciIo handle in PciEnumerationComplete callback.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/PciBusDxe: reference gFullEnumeration in one file
Ruiyu Ni [Mon, 22 Jan 2018 06:16:10 +0000 (14:16 +0800)]
MdeModulePkg/PciBusDxe: reference gFullEnumeration in one file

The patch is just a code cleanup with no functionality impact.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoUefiCpuPkg/MtrrLib: Add comments to recommend to use batch-set API
Ruiyu Ni [Thu, 18 Jan 2018 06:13:32 +0000 (14:13 +0800)]
UefiCpuPkg/MtrrLib: Add comments to recommend to use batch-set API

MtrrSetMemoryAttributesInMtrrSettings() is a batch-set API.
When setting multiple ranges of memory attributes, the single-set
API (MtrrSetMemoryAttributeInMtrrSettings and MtrrSetMemoryAttribute)
may fail, but batch-set API may succeed.
Add comments to recommend caller to use batch-set API when setting
multiple ranges.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ming Shao <ming.shao@intel.com>
6 years agoUefiCpuPkg/MtrrLib: Update the comments for RETURN_BUFFER_TOO_SMALL
Ruiyu Ni [Thu, 18 Jan 2018 05:59:09 +0000 (13:59 +0800)]
UefiCpuPkg/MtrrLib: Update the comments for RETURN_BUFFER_TOO_SMALL

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ming Shao <ming.shao@intel.com>
6 years agoUefiCpuPkg/PeiMpLib: Fix a system hang-in-pei issue.
Ruiyu Ni [Mon, 22 Jan 2018 09:16:33 +0000 (17:16 +0800)]
UefiCpuPkg/PeiMpLib: Fix a system hang-in-pei issue.

GetWakeupBuffer() tries to find a below-1M free memory, it checks
whether the memory is allocated already in
CheckOverlapWithAllocatedBuffer(). When there is a memory allocation
hob (base = 0xff_00000000, size = 0x10000000),
CheckOverlapWithAllocateBuffer() truncates the base to 0 which causes
it always returns TRUE so GetWakeupBuffer() fails to find a below-1MB
memory.

The patch fixes this issue by using UINT64 type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
6 years agoEdk2: Retire Edk2Setup.bat
Liming Gao [Thu, 11 Jan 2018 08:21:29 +0000 (16:21 +0800)]
Edk2: Retire Edk2Setup.bat

Edk2Setup.bat is out of maintain. It is a draft version batch file, and not
implement all features listed in its header file. To avoid the confuse,
drop it from edk2 project, and keep edksetup.bat only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6 years agoBaseTools: Add DefaultStore section format Check
Yonghong Zhu [Mon, 22 Jan 2018 05:46:52 +0000 (13:46 +0800)]
BaseTools: Add DefaultStore section format Check

This patch add DefaultStore section format Check and it use same logic
with SKUID section.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: update SKUID value to support both integer and Hex number
Yonghong Zhu [Mon, 22 Jan 2018 05:38:39 +0000 (13:38 +0800)]
BaseTools: update SKUID value to support both integer and Hex number

This patch updated Skuid value to support both integer and hex value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Enhance binary file in [Binaries] section use relative path
Yonghong Zhu [Mon, 22 Jan 2018 09:55:17 +0000 (17:55 +0800)]
BaseTools: Enhance binary file in [Binaries] section use relative path

Enhance the binary file in Asbuilt inf file [Binaries] section use
relative path.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Add "processing meta-data" string back
Yonghong Zhu [Mon, 22 Jan 2018 03:17:09 +0000 (11:17 +0800)]
BaseTools: Add "processing meta-data" string back

Previous build tool will display "processing meta-data ..." to let user
know the progress. this Patch add this string back.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoNetworkPkg: Update package version to 0.98
Fu Siyuan [Tue, 23 Jan 2018 05:27:08 +0000 (13:27 +0800)]
NetworkPkg: Update package version to 0.98

Update package version of NetworkPkg to 0.98.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoCryptoPkg: Update package version to 0.98
Long Qin [Mon, 22 Jan 2018 06:59:21 +0000 (14:59 +0800)]
CryptoPkg: Update package version to 0.98

Update package version of CryptoPkg to 0.98.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
6 years agoSecurityPkg: Update package version to 0.98
Zhang, Chao B [Mon, 22 Jan 2018 08:52:29 +0000 (16:52 +0800)]
SecurityPkg: Update package version to 0.98

Update package version of SecurityPkg to 0.98.

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
6 years agoMdePkg Smbios.h: Update spec version info to 3.1.1
Star Zeng [Mon, 22 Jan 2018 02:44:02 +0000 (10:44 +0800)]
MdePkg Smbios.h: Update spec version info to 3.1.1

It was missed to be updated at
SHA-1: 043026ac12c29703bb7e3c19b9ae5e8177bb554b.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoUefiCpuPkg: Update package version.
Eric Dong [Mon, 22 Jan 2018 02:00:08 +0000 (10:00 +0800)]
UefiCpuPkg: Update package version.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools/tools_def CLANG3x: ignore unknown warning options
Ard Biesheuvel [Fri, 19 Jan 2018 16:19:30 +0000 (16:19 +0000)]
BaseTools/tools_def CLANG3x: ignore unknown warning options

Ironically, disabling warnings in the OpensslLib library build is
causing breakage when using the CLANG35 toolchain to build for ARM:

error: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Werror,-Wunknown-warning-option]

So let's add -Wno-unknown-warning-option to the list of warnings to
ignore when using Clang 3.5, and move the same option from the x86
specific list to the shared list for Clang 3.8.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg: Update package version to 0.98
Star Zeng [Mon, 22 Jan 2018 01:09:45 +0000 (09:09 +0800)]
MdeModulePkg: Update package version to 0.98

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoMdePkg: Update DEC and DSC version from 1.07 to 1.08
Liming Gao [Thu, 18 Jan 2018 07:48:29 +0000 (15:48 +0800)]
MdePkg: Update DEC and DSC version from 1.07 to 1.08

UEFI2.7/PI1.6 have been added in MdePkg. Update DEC and DSC version to
reflect those changes in MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
6 years agoCryptoPkg/BaseCryptLib: Add error handling for time() wrapper
Long Qin [Mon, 22 Jan 2018 06:27:53 +0000 (14:27 +0800)]
CryptoPkg/BaseCryptLib: Add error handling for time() wrapper

In time() wrapper implementation, the gRT->GetTime() call may be not
available. This patch adds the extra error handling to avoid the
potential dead loop.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/UsbStorage: Fix "map -r" cannot detect media change
Ruiyu Ni [Fri, 19 Jan 2018 07:04:24 +0000 (15:04 +0800)]
MdeModulePkg/UsbStorage: Fix "map -r" cannot detect media change

When system boots to Shell without CDROM in the USB CDROM drive,
and then user inserts one CDROM with Eltorito file system,
"map -r" cannot show the the new Eltorito file system.

The root cause is when "map" command probes the media change
by calling dummy ReadBlockIo(), UsbMassStorage ReadBlockIo()
contains a bug that ignores the media change status:
UsbBootDetectMedia() ignores the EFI_MEDIA_CHANGED status
returned from UsbBootIsUnitReady(), in consequence, the
BlockIo protocol re-installation logic doesn't run.

By checking the code change history, below commit
SHA-1: 19bc85276559ae01996fa0918ec3f6495e7aaa69
* remove unnecessary retry logic from usb mass storage driver.
adds the code to skip EFI_MEDIA_CHANGED status.

Talking with the original committer Tian Feng, he said the
change was just a code cleanup, not for a special bug fix.
So I revert part of the patch, only keep the change that
removes unnecessary retry logic. It can fix this bug.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoBaseTools: Optimizing DscDefaultValue process in BuildReport
From: Yunhua Feng [Sat, 20 Jan 2018 06:22:43 +0000 (14:22 +0800)]
BaseTools: Optimizing DscDefaultValue process in BuildReport

DscDefaultValue from Dsc file has been parsed by ValueExpressionEx
when Dsc file parse, so only DscDefaultValue from FDF file need
ValueExpressionEx parse

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoBaseTools: Fix GenFds increment build bug that missing cover command option's change
Yunhua Feng [Fri, 19 Jan 2018 03:21:15 +0000 (11:21 +0800)]
BaseTools: Fix GenFds increment build bug that missing cover command option's change

Issue decription:
step 1, build platform X64
step 2, build platform IA32
step 3, build platform X64
step 4, check all ffs files for X64, the content still has IA32 in it

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoUefiCpuPkg/CpuDxe: fix bad boot performance
Jian J Wang [Thu, 18 Jan 2018 07:29:01 +0000 (15:29 +0800)]
UefiCpuPkg/CpuDxe: fix bad boot performance

If features like memory profile, protection and heap guard are enabled,
a lot of more memory page attributes update actions will happen than
usual. An unnecessary sync of CR0.WP setting among APs will then cause
worse performance in memory allocation action. Removing the calling of
SyncMemoryPageAttributesAp() in function DisableReadOnlyPageWriteProtect
and EnableReadOnlyPageWriteProtect can fix this problem. In DEBUG build
case, the boot performance can be boosted from 11 minute to 6 minute.

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: Eric Dong <eric.dong@intel.com>
6 years agoMdeModulePkg/Core: fix a logic hole in page free
Jian J Wang [Wed, 17 Jan 2018 10:36:55 +0000 (18:36 +0800)]
MdeModulePkg/Core: fix a logic hole in page free

This hole will cause page fault randomly. The root cause is that Guard
page, which is just freed back to page pool but not yet cleared not-
present attribute, will be allocated right away by internal function
CoreFreeMemoryMapStack(). The solution to this issue is to clear the
not-present attribute for freed Guard page before doing any free
operation, instead of after those operation.

The reason we didn't do this before is due to the fact that manipulating
page attributes might cause memory allocation action which would cause a
dead lock inside a memory allocation/free operation. So we always set or
unset Guard page outside the memory lock. After a thorough analysis, we
believe clearing a Guard page will not cause memory allocation because
memory we're to manipulate was already manipulated before for sure.
Therefore there should be no memory allocation occurring in this
situation.

Since we cleared Guard page not-present attribute before freeing instead
of after freeing, the debug code to clear freed memory can now be restored
to its original way (aka no checking and bypassing Guard page).

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoMdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress()
Liming Gao [Wed, 10 Jan 2018 05:45:58 +0000 (13:45 +0800)]
MdeModulePkg DxeIpl: remove the hard code alignment adjustment in Decompress()

Section data alignment should be made in the build generation.

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>
6 years agoMdeModulePkg DxeIpl: remove the hard code alignment adjustment.
Liming Gao [Wed, 10 Jan 2018 05:33:29 +0000 (13:33 +0800)]
MdeModulePkg DxeIpl: remove the hard code alignment adjustment.

Section data alignment should be made in the build generation.

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>
6 years agoMdeModulePkg SectionExtractionPei: remove the hard code alignment adjustment
Liming Gao [Wed, 10 Jan 2018 05:33:30 +0000 (13:33 +0800)]
MdeModulePkg SectionExtractionPei: remove the hard code alignment adjustment

Section data alignment should be made in the build generation.

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>
6 years agoBaseTools: enhance error handling for option --binary-source
Yonghong Zhu [Thu, 18 Jan 2018 03:13:06 +0000 (11:13 +0800)]
BaseTools: enhance error handling for option --binary-source

Enhance error handling for option --binary-source to report invalid
option value. --binary-destination use same rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdePkg/DMAR: Add the definition for DMA_CTRL_PLATFORM_OPT_IN_FLAG bit
Hao Wu [Thu, 18 Jan 2018 01:58:22 +0000 (09:58 +0800)]
MdePkg/DMAR: Add the definition for DMA_CTRL_PLATFORM_OPT_IN_FLAG bit

For the support of VTd 2.5, add the BIT definition of
DMA_CTRL_PLATFORM_OPT_IN_FLAG

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>