mirror_edk2.git
6 years agoSecurityPkg: Fix bug in TPM 1.2 SelfTest
Samer El-Haj-Mahmoud [Thu, 28 Apr 2016 20:29:27 +0000 (04:29 +0800)]
SecurityPkg: Fix bug in TPM 1.2 SelfTest

Fix uninitialized command Length variable in TPM1.2 Self Test command

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoSecurityPkg: Add DEBUG messages for TPM12Startup
Samer El-Haj-Mahmoud [Thu, 28 Apr 2016 20:32:55 +0000 (04:32 +0800)]
SecurityPkg: Add DEBUG messages for TPM12Startup

Add DEBUG messages for TPM12Startup to distinguish between TPM_SUCCESS
and
TPM_INVALID_POSTINIT. This helps debugging some hardware problems.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoSecurityPkg: Add DEBUG messages for TPM2Startup
Samer El-Haj-Mahmoud [Thu, 28 Apr 2016 20:04:20 +0000 (04:04 +0800)]
SecurityPkg: Add DEBUG messages for TPM2Startup

Add DEBUG messages for TPM2Startup to distinguish between TPM_RC_SUCCESS
and TPM_RC_INITIALIZE. This helps debugging some hardware problems.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
6 years agoCorebootModulePkg: Remove DuetPkg references
Leahy, Leroy P [Mon, 2 May 2016 19:59:17 +0000 (12:59 -0700)]
CorebootModulePkg: Remove DuetPkg references

Remove the references to DuetPkg.  Copy the files from revision
ffea0a2ce21e8e9878587de2419959a7bfea4021 of DuetPkg into
CorebootModulePkg.  The components include:
* PciBusNoEnumerationDxe
* PciRootBridgeNoEnumerationDxe
* SataControllerDxe

TEST=Build and run on Galileo Gen2

Change-Id: Id07185f7e226749e5f7c6b6cb427bcef7eac8496
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
6 years agoCorebootPayloadPkg: Remove trailing white space
Leahy, Leroy P [Mon, 2 May 2016 17:22:15 +0000 (10:22 -0700)]
CorebootPayloadPkg: Remove trailing white space

Remove trailing white space from existing .dsc and .fdf files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
6 years agoArmPlatformPkg/PrePi: allow unicore version to be used on MP hardware
Ard Biesheuvel [Tue, 19 Apr 2016 07:22:38 +0000 (09:22 +0200)]
ArmPlatformPkg/PrePi: allow unicore version to be used on MP hardware

When combining UEFI firmware built from Tianocore with ARM Trusted
Firmware running in EL3, it is the responsibility of ATF that only
a single core enters the UEFI firmware in EL2, and the remaining cores
are released directly to the OS via PSCI SMC calls.

In this case, we don't need the MpCore flavor of PrePi or PrePeiCore,
but the UniCore flavor currently checks the CPU identification registers
directly, and refuses to proceed if the boot CPU is part of a MpCore
system.

So drop the ASSERT()'s that implement this check.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPkg: implement CpuIo2 protocol driver specific for PCI
Ard Biesheuvel [Wed, 27 Apr 2016 12:52:05 +0000 (14:52 +0200)]
ArmPkg: implement CpuIo2 protocol driver specific for PCI

The CpuIo2 protocol is required by the generic PciHostBridgeDxe driver,
which relies on it to back its own I/O and MMIO operations.

Since ARM has no native I/O port equivalent, such accesses can only
originate from PCI drivers, and the PCI I/O space is translated to MMIO
in this case.

So we can implement this protocol using MMIO operations only, and take
the PCI I/O translation offset into account when performing I/O port
accesses.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoArmPlatformPkg: move PCI related PCD definitions to ArmPkg
Ard Biesheuvel [Fri, 29 Apr 2016 15:32:21 +0000 (17:32 +0200)]
ArmPlatformPkg: move PCI related PCD definitions to ArmPkg

The PCI related PCDs are not platform specific, and architectural
protocols such as CpuIo2 are based on PCI provided MMIO to IO
translation, so these PCDs belong in ArmPkg not ArmPlatformPkg.

NOTE: this *WILL* break some out-of-tree platforms, the fix is changing
all consumers of gArmPlatformTokenSpaceGuid.PcdPci* to
gArmTokenSpaceGuid.PcdPci*

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoMdeModulePkg/DxeCore: set ImageContext Handle and ImageRead() fields
Ard Biesheuvel [Fri, 29 Apr 2016 07:39:18 +0000 (09:39 +0200)]
MdeModulePkg/DxeCore: set ImageContext Handle and ImageRead() fields

Set the ImageContext.Handle and ImageContext.ImageRead() fields so that
PeCoffLoaderRelocateImageExtraAction() can invoke PeCoffLoaderGetImageInfo
or PeCoffLoaderGetPeHeader if desired to obtain additional metadata.

We will use this to create a PeCoffLoaderRelocateImageExtraAction()
implementation that applies boot time strict mapping permissions to
PE/COFF modules.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/PciBusDxe: don't create bogus descriptor if no resources needed
Ard Biesheuvel [Thu, 28 Apr 2016 15:51:28 +0000 (23:51 +0800)]
MdeModulePkg/PciBusDxe: don't create bogus descriptor if no resources needed

If the current PCI configuration requires no resources to be allocated at
all (i.e., unpopulated bus), the PCI enumeration code creates a single
ACPI_ADDRESS_SPACE_DESCRIPTOR memory descriptor with all fields cleared.
This is rejected by the SubmitResources() implementation of the generic
PciHostBridgeDxe in the following way:

  PciHostBridge: SubmitResources for PcieRoot(0x0)
   Mem: Granularity/SpecificFlag = 0 / 00
        Length/Alignment = 0x0 / 0x0
  PciBus: HostBridge->SubmitResources() - Invalid Parameter

  ASSERT_EFI_ERROR (Status = Invalid Parameter)
  ASSERT [PciBusDxe] .../PciBusDxe/PciLib.c(561): !EFI_ERROR (Status)

So instead, create the empty configuration as a single entry of type
EFI_ACPI_END_TAG_DESCRIPTOR.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoBaseTools/Build: Better DSC arch filtering
Thomas Palmer [Wed, 27 Apr 2016 22:32:17 +0000 (06:32 +0800)]
BaseTools/Build: Better DSC arch filtering

Description:
When building for any specific architecture, the build script today is loading
DSC sections for other architectures not in the build. The build process should
disregard DSC sections that are not relevant to the build.

My previous patch only fixed issue for one section type (Components). This
patch will handle all section types by updating the MetaFileParser class, which
now takes a Arch argument and will filter the DSC table results as they are
returned from the database.  The database still contains all information from
DSCs for when builds support multiple arch's

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoBaseTools: fix the bug for FMP to support use Macro as path description
Yonghong Zhu [Thu, 28 Apr 2016 06:42:26 +0000 (14:42 +0800)]
BaseTools: fix the bug for FMP to support use Macro as path description

Fix the bug for FMP image to support to use Macro as path description,
eg: FILE DATA = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/test.efi

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoShellPkg: Add NULL pointer check.
Qiu Shumin [Thu, 28 Apr 2016 05:28:53 +0000 (13:28 +0800)]
ShellPkg: Add NULL pointer check.

Add pointer check to avoid NULL pointer dereferenced.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Tapan Shah <tapandshah@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
6 years agoMdePkg-SmmMemLib: Enhance SmmIsBufferOutsideSmmValid() check for fixed comm buffer.
Jiewen Yao [Fri, 22 Apr 2016 07:49:28 +0000 (15:49 +0800)]
MdePkg-SmmMemLib: Enhance SmmIsBufferOutsideSmmValid() check for fixed comm buffer.

This patch adds more check in SmmIsBufferOutsideSmmValid(), to make sure that
SMM communication buffer is only EfiReservedMemoryType/EfiRuntimeServicesCode/
EfiRuntimeServicesData/EfiACPIMemoryNVS. So that the communication buffer will
not touch any OS memory.

The assumption is that a platform reports valid SMM communication buffer at
EndOfDxe, because EndOfDxe is last hook point that SMM code can call-out to
get memory map information.
A platform MUST finish SMM communication buffer allocation before EndOfDxe.
If a DXE or OS driver need do communication after EndOfDxe, it can either
allocate SMM communication buffer before EndOfDxe and save it, or consume
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE table to get general fixed comm buffer.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
6 years agoSecurityPkg-Opal(2): Enhance AHCI Bar MMIO region check.
Eric Dong [Fri, 22 Apr 2016 07:40:46 +0000 (15:40 +0800)]
SecurityPkg-Opal(2): Enhance AHCI Bar MMIO region check.

This patch enhance OPAL password SMM driver to check SMM bar is valid MMIO
besides outside of SMRAM.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoSecurityPkg-Opal(1): Use fixed SMM communication buffer in OPAL password lib.
Eric Dong [Fri, 22 Apr 2016 07:36:36 +0000 (15:36 +0800)]
SecurityPkg-Opal(1): Use fixed SMM communication buffer in OPAL password lib.

This patch enhance OPAL password lib SMM communication by using fixed
SMM communication buffer.

Update OPAL password lib to consume EDKII_PI_SMM_COMMUNICATION_REGION_TABLE
as fixed communication buffer for SMM communication.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-FPDT(4): Use fixed buffer for SMM_PERF_COMMUNICATE in PerfLib.
Liming Gao [Fri, 22 Apr 2016 07:32:30 +0000 (15:32 +0800)]
MdeModulePkg-FPDT(4): Use fixed buffer for SMM_PERF_COMMUNICATE in PerfLib.

This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update PerformanceLib to use fixed SMM communication buffer to get
performance data by SMM_PERF_COMMUNICATE API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-FPDT(3): Use SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtDxe.
Liming Gao [Fri, 22 Apr 2016 07:31:07 +0000 (15:31 +0800)]
MdeModulePkg-FPDT(3): Use SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtDxe.

This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update FpdtDxe to use fixed SMM communication buffer to get
performance data by SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-FPDT(2): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm...
Liming Gao [Fri, 22 Apr 2016 07:27:26 +0000 (15:27 +0800)]
MdeModulePkg-FPDT(2): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm Handler.

This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

Update FpdtSmm to handle SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET
request.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-FPDT(1): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET definition.
Liming Gao [Fri, 22 Apr 2016 07:22:43 +0000 (15:22 +0800)]
MdeModulePkg-FPDT(1): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET definition.

This patch enhance performance data SMM communication by using fixed
SMM communication buffer.

A new command SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET is added,
because we need to support get partial PerformanceData to fixed SMM communication
buffer. If performance data is bigger than fixed SMM communication buffer,
the DXE agent need to call SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET
multiple times to get all data out.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-MemoryProfile(3): Use SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET...
Star Zeng [Fri, 22 Apr 2016 07:18:35 +0000 (15:18 +0800)]
MdeModulePkg-MemoryProfile(3): Use SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in MemoryProfileInfo.

This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

Update MemoryProfileInfo APP to use fixed SMM communication buffer to get
profile data by SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET API.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg-MemoryProfile(2): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET...
Star Zeng [Fri, 22 Apr 2016 07:16:46 +0000 (15:16 +0800)]
MdeModulePkg-MemoryProfile(2): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET in PiSmmCore.

This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

Update PiSmmCore to handle SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET
request.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
6 years agoMdeModulePkg-MemoryProfile(1): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET...
Star Zeng [Fri, 22 Apr 2016 07:13:47 +0000 (15:13 +0800)]
MdeModulePkg-MemoryProfile(1): Add SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET definition.

This patch enhance SMM memory profile SMM communication by using fixed
SMM communication buffer.

A new command SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET is added,
because we need to support get partial ProfileData to fixed SMM communication
buffer. If profile data is bigger than fixed SMM communication buffer,
the DXE agent need to call SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET
multiple times to get all data out.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoMdeModulePkg: Add new driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.
Jiewen Yao [Fri, 22 Apr 2016 07:04:45 +0000 (15:04 +0800)]
MdeModulePkg: Add new driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.

Add a driver to publish EDKII_PI_SMM_COMMUNICATION_REGION_TABLE, so that
other DXE driver can consume this table directly. NOTE: This is sample driver.
A platform may uses its own way to define default SMM communication buffer
region and publish information in its own
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng, Tian <feng.tian@intel.com>
6 years agoMdeModulePkg: Add EDKII_PI_SMM_COMMUNICATION_REGION_TABLE definition.
Jiewen Yao [Fri, 22 Apr 2016 06:59:49 +0000 (14:59 +0800)]
MdeModulePkg: Add EDKII_PI_SMM_COMMUNICATION_REGION_TABLE definition.

This configuration table is used to describe platform pre-allocated memory
for SMM communication buffer. If DXE driver wants to communicate with SMM
agent, it can use this memory as SMM communication buffer instead of allocate
new memory region.

This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS
requirement.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoShellPkg: Enhance ping6 to select the interface automatically
Jiaxin Wu [Fri, 22 Apr 2016 02:55:03 +0000 (10:55 +0800)]
ShellPkg: Enhance ping6 to select the interface automatically

v2:
* Refine the code to make it more readable.

This patch is used to support no source IP specified case while
multiple NICs existed in the platform. The command will select the
first both connected and configured interface automatically.
Note: Source address is always required when pinging a
link-local address.

Cc: Bhupesh Sharma <bhupesh.sharma@nxp.com>
Cc: Jaben Carsey <jaben.carsey@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: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoShellPkg: Enhance ping to select the interface automatically
Jiaxin Wu [Tue, 19 Apr 2016 01:49:01 +0000 (09:49 +0800)]
ShellPkg: Enhance ping to select the interface automatically

v2:
* A. Refine the code to make it more readable.
* B. Add hint message for link local address case.

This patch is used to support no source IP specified case
while multiple NICs existed in the platform. The command
will select the first both connected and configured interface
automatically.
Note: Source address is always required when pinging a
link-local address.

Cc: David Van Arnem <dvanarnem@cmlab.biz>
Cc: Bhupesh Sharma <bhupesh.sharma@nxp.com>
Cc: Jaben Carsey <jaben.carsey@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: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoMdeModulePkg/NvmExpressDxe: comments update to meet implementation
Feng Tian [Tue, 26 Apr 2016 06:49:53 +0000 (14:49 +0800)]
MdeModulePkg/NvmExpressDxe: comments update to meet implementation

Cc: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Wu, Hao A <hao.a.wu@intel.com>
Reviewed-by: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
6 years agoMdePkg: Add WSMT definition.
Jiewen Yao [Fri, 22 Apr 2016 02:23:19 +0000 (10:23 +0800)]
MdePkg: Add WSMT definition.

This patch adds Windows SMM Security Mitigation
Table @ http://download.microsoft.com/download/1/8/A/18A21244-EB67-4538-BAA2-1A54E0E490B6/WSMT.docx

Cc: "Gao, Liming" <liming.gao@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Gao, Liming" <liming.gao@intel.com>
6 years agoSecuritPkg: DxeImageVerificationLib: Fix wrong verification logic in DBX & DBT
Zhang, Chao B [Wed, 13 Apr 2016 08:25:50 +0000 (16:25 +0800)]
SecuritPkg: DxeImageVerificationLib: Fix wrong verification logic in DBX & DBT

In image verification, if image verified pass in DBT, still need to verify if it is blocked by any other cert/cert hash from DBX.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Dick Wilkins <dick_wilkins@phoenix.com>
6 years agoUefiCpuPkg/MtrrLib: Remove the loop of calculating Fixed-MTRR Mask
Jeff Fan [Thu, 21 Apr 2016 02:28:17 +0000 (10:28 +0800)]
UefiCpuPkg/MtrrLib: Remove the loop of calculating Fixed-MTRR Mask

Introduce the 32bit mask seeds to calculate Fixed-MTRR or&and mask values. It
could avoid the loop operation and 64bit shift operations.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoUefiCpuPkg/MtrrLib: Remove the loop of calculating byte offset in MSR
Jeff Fan [Wed, 20 Apr 2016 08:58:24 +0000 (16:58 +0800)]
UefiCpuPkg/MtrrLib: Remove the loop of calculating byte offset in MSR

Calculate byte offset in MSR directly and removing the loop.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoUefiCpuPkg/MtrrLib: Reduce the loop time to get fixed-MTRR MSR index
Jeff Fan [Wed, 20 Apr 2016 08:51:46 +0000 (16:51 +0800)]
UefiCpuPkg/MtrrLib: Reduce the loop time to get fixed-MTRR MSR index

Add input fixed-MTRR MSR index to be start MSR index to avoid finding fixed-MTRR
MSR index from 0 at each time.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoShellPkg: Update smbiosview for latest Type 17 devices
Samer El-Haj-Mahmoud [Wed, 27 Apr 2016 22:55:09 +0000 (15:55 -0700)]
ShellPkg: Update smbiosview for latest Type 17 devices

Update smbiosview to understand latest SMBIOS Type 17 devices from
SMBIOS 3.0.0 spec

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoOvmfPkg: PlatformBdsLib: lock down SMM regardless of S3
Laszlo Ersek [Wed, 27 Apr 2016 16:01:02 +0000 (18:01 +0200)]
OvmfPkg: PlatformBdsLib: lock down SMM regardless of S3

At the moment, the EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL is only installed if
S3 is enabled -- at the end of SaveS3BootScript().

While a runtime OS is never booted with SMM unlocked (because the SMM IPL
locks down SMM as a last resort:

> SMM IPL!  DXE SMM Ready To Lock Protocol not installed before Ready To
> Boot signal
> SmmInstallProtocolInterface: [EfiSmmReadyToLockProtocol] 0
> Patch page table start ...
> Patch page table done!
> SMM IPL locked SMRAM window

), we shouldn't allow UEFI drivers and applications either to mess with
SMM just because S3 is disabled. So install
EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL in PlatformBdsInit() unconditionally.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: PlatformBdsLib: lock down SMM in PlatformBdsInit()
Laszlo Ersek [Wed, 27 Apr 2016 15:37:42 +0000 (17:37 +0200)]
OvmfPkg: PlatformBdsLib: lock down SMM in PlatformBdsInit()

OVMF's PlatformBdsLib currently makes SMM vulnerable to the following
attack:

(1) a malicious guest OS copies a UEFI driver module to the EFI system
    partition,

(2) the OS adds the driver as a Driver#### option, and references it from
    DriverOrder,

(3) at next boot, the BdsEntry() function in
    "IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c" processes
    Driver#### and DriverOrder between the calls to PlatformBdsInit() and
    PlatformBdsPolicyBehavior(),

(4) OVMF locks down SMM only in PlatformBdsPolicyBehavior(), hence the
    driver runs with SMM unlocked.

The BdsEntry() function of the MdeModulePkg BDS driver (in file
"MdeModulePkg/Universal/BdsDxe/BdsEntry.c") recommends to "Signal
ReadyToLock event" in PlatformBootManagerBeforeConsole() -- which
corresponds to PlatformBdsInit() --, not in
PlatformBootManagerAfterConsole() -- which corresponds to
PlatformBdsPolicyBehavior().

Albeit an independent question, but it's worth mentioning: this patch also
brings OvmfPkg's PlatformBdsInit() closer to ArmVirtPkg's. Namely, the
latter signals End-of-Dxe in PlatformBdsInit() already.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoMdeModulePkg: PiDxeS3BootScriptLib: honor PcdAcpiS3Enable
Laszlo Ersek [Wed, 27 Apr 2016 17:28:44 +0000 (19:28 +0200)]
MdeModulePkg: PiDxeS3BootScriptLib: honor PcdAcpiS3Enable

In the edk2 tree, there are currently four drivers that consume
PcdAcpiS3Enable:

  IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
  MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.inf

From these, AcpiS3SaveDxe is the only one that isn't also a client of the
S3BootScriptLib class; all the others (BootScriptExecutorDxe,
S3SaveStateDxe, SmmS3SaveState) are clients of the S3BootScriptLib class.

In turn, the edk2 tree contains only one non-Null instance of the
S3BootScriptLib class:

  MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf

Therefore we can safely state that BootScriptExecutorDxe, S3SaveStateDxe,
and SmmS3SaveState are all linked against PiDxeS3BootScriptLib.

Now, if PcdAcpiS3Enable is FALSE when either of BootScriptExecutorDxe,
SmmS3SaveState, or SmmS3SaveState is dispatched, then the following
happens:

- The constructor of PiDxeS3BootScriptLib, function
  S3BootScriptLibInitialize(), registers a protocol installation callback
  for gEfiDxeSmmReadyToLockProtocolGuid. Namely, the function
  S3BootScriptEventCallBack().

- The driver immediately exits with EFI_UNSUPPORTED from its entry point
  function, upon seeing PcdAcpiS3Enable == FALSE. (See commits
  800c02fbe2da6125e093876414, and d2d38610603f6.)

- This leaves a dangling callback pointer in the DXE core.

- When Platform BDS installs gEfiDxeSmmReadyToLockProtocolGuid (which is a
  valid thing to do for locking down SMM, even in the absence of S3
  support!), things blow up.

Fix this issue by returning immediately from S3BootScriptLibInitialize()
if PcdAcpiS3Enable is FALSE -- it is useless to initialize the library
instance if the containing driver module exits first thing in its entry
point.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoNetworkPkg: Fix incorrect buffer free in HttpDxe
Jiaxin Wu [Wed, 27 Apr 2016 06:29:29 +0000 (14:29 +0800)]
NetworkPkg: Fix incorrect buffer free in HttpDxe

FragmentBuffer of each TcpWrap in HttpDxe should not be
freed in HttpTcpTokenCleanup(). This buffer points to
HttpMsg body actually, which is the responsibility of the
caller to allocate a buffer for Body.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoNetworkPkg: Avoid the indefinite wait case in HttpDxe
Jiaxin Wu [Tue, 26 Apr 2016 08:46:33 +0000 (16:46 +0800)]
NetworkPkg: Avoid the indefinite wait case in HttpDxe

Need the timer check to avoid the indefinite wait case
in HttpDxe driver
A.HTTP receive Header process in HttpTcpReceiveHeader();
B.HTTP receive Body process in HttpTcpReceiveBody();

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoMdeModulePkg: DxeCore MemoryPool Algorithm Update
Liming Gao [Fri, 8 Apr 2016 06:34:03 +0000 (14:34 +0800)]
MdeModulePkg: DxeCore MemoryPool Algorithm Update

Use 128 bytes as the start size region to be same to previous one.

64 bytes is small as the first range. On X64 arch, POOL_OVERHEAD
takes 40 bytes, the pool data less than 24 bytes can be fit into
it. But, the real allocation is few that can't reduce its free pool
link list. And, the second range (64~128) has more allocation
that also increases the free pool link list of the first range.
Then, the link list will become longer and longer. When LinkList
check enable in DEBUG tip, the long link list will bring the
additional overhead and bad performance. Here is the performance
data collected in our X64 platform with DEBUG enable.
64  byte: 22 seconds in BDS phase
128 byte: 19.6 seconds in BDS phase

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
6 years agoShellPkg: Fix typos and EDK2 coding style issues
Tapan Shah [Wed, 27 Apr 2016 14:55:39 +0000 (07:55 -0700)]
ShellPkg: Fix typos and EDK2 coding style issues

Fixing typos and EDK2 coding style issues found from previous submit

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoShellPkg: Fix pci command for '_e' option
Abdul Lateef Attar [Thu, 21 Apr 2016 11:24:14 +0000 (04:24 -0700)]
ShellPkg: Fix pci command for '_e' option

    ShellPkg: Fix pci command for '_e' option

    Processing of '_e' argument was missing.
    Added fix, to process the '_e' option
    for printing additional AER information.

    Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Abdul Lateef Attar <abdul-lateef.attar@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
6 years agoMdeModulePkg: Export ConfigResp only for form Package after ReadyToBoot
Dandan Bi [Wed, 20 Apr 2016 04:59:47 +0000 (12:59 +0800)]
MdeModulePkg: Export ConfigResp only for form Package after ReadyToBoot

The Hii runtime support feature will export the content of
HiiDatabase and the ConfigResp string to runtime buffer
after ReadyToBoot event is triggered. If some drivers
add/update/remove packages from Hiidatabase after ReadyToBoot:
Originally we will both export the content of HiiDatabase and
the ConfigResp string for all packages.
But now after investigation, we found only for form packages need
to export the content of HiiDatabase and the ConfigResp string,
for other packages just need to export the content of HiiDatabase.
Now to enhance this logic.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
6 years agoMdeModulePkg: BOOLEAN type needn't to compare to TRUE/FALSE explicitly
Dandan Bi [Tue, 26 Apr 2016 08:17:11 +0000 (16:17 +0800)]
MdeModulePkg: BOOLEAN type needn't to compare to TRUE/FALSE explicitly

Fix this issue to follow the coding style.

Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
6 years agoMdeModulePkg: Add description to MdeModulePkg AcpiTable driver.
Liming Gao [Mon, 18 Apr 2016 01:39:19 +0000 (09:39 +0800)]
MdeModulePkg: Add description to MdeModulePkg AcpiTable driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoNetworkPkg:HttpDxe:Consume DxeHttpLib API changes
Nagaraj Hegde [Mon, 4 Apr 2016 10:09:28 +0000 (18:09 +0800)]
NetworkPkg:HttpDxe:Consume DxeHttpLib API changes

HttpGenRequestString is updated to HttpGenRequestMessage,
with an additional argument. This patch updates the caller
of the DxeHttpLib API. Also, we will avoid adding any '\0'
to the string, which was added to make AsciiStrLen to
work on the string.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde <nagaraj-p.hegde@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
6 years agoMdeModulePkg:DxeHttpLib: Update to DxeHttpLib API
Nagaraj Hegde [Mon, 4 Apr 2016 10:09:27 +0000 (18:09 +0800)]
MdeModulePkg:DxeHttpLib: Update to DxeHttpLib API

Rename and update the logic of HttpGenRequestString API provided
by DxeHttpLib. The RequestString size is returned as an argument.
The user is not expected to do a AsciiStrLen anymore, and is not
logical too, since request string can contain message body and
using AsciiStrLen on such a string can provide truncated lengths.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde <nagaraj-p.hegde@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
6 years agoNetworkPkg: Allow user to create a HTTP corporate boot option in setup page.
Fu Siyuan [Mon, 25 Apr 2016 07:29:26 +0000 (15:29 +0800)]
NetworkPkg: Allow user to create a HTTP corporate boot option in setup page.

This patch updates the HTTP Boot Configuration page to allow the user to create
a corporate mode HTTP boot option, by leaving the URI string empty.
The patch also fix a bug that the L"https://" should use StrnCmp() with Length 8.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdePkg:Http11.h: Add defines for "Expect" header
Nagaraj Hegde [Tue, 26 Apr 2016 03:46:45 +0000 (11:46 +0800)]
MdePkg:Http11.h: Add defines for "Expect" header

Add #defines for "Expect" header, which is a part of RFC 2616
and used for HTTP PUT/POST operations.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde, Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoBaseTools: Fix the bug for .aml to use ASL binary type in Asbuilt inf
Yonghong Zhu [Fri, 22 Apr 2016 07:08:47 +0000 (15:08 +0800)]
BaseTools: Fix the bug for .aml to use ASL binary type in Asbuilt inf

Per build spec, the .aml file should use ASL binary type in the Asbuilt
inf file. the original bug is .aml file may use BIN as binary type when
the module type is not BASE or USER_DEFINED. This patch 1) fix this bug.
2) fix some indent coding style issue.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Update FMP Capsule support to follow FDF spec
Yonghong Zhu [Thu, 21 Apr 2016 06:50:30 +0000 (14:50 +0800)]
BaseTools: Update FMP Capsule support to follow FDF spec

Current the FMP Capsule feature is supported, but its format has a little
different with FDF spec. so this patch 1) Align the FMP Capsule with FDF
spec. 2) fix some style issue, eg: Tab. 3) Add a SectionParser function to
check the section header info since this method is used in 7 places.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoOvmfPkg: SataControllerDxe: SataControllerStop: fix use after free
Laszlo Ersek [Tue, 26 Apr 2016 11:57:32 +0000 (13:57 +0200)]
OvmfPkg: SataControllerDxe: SataControllerStop: fix use after free

It would be possible to remove the UAF without local variables, by calling
SataPrivateData->PciIo->Attributes() before releasing SataPrivateData.

However, by keeping the location of the call (for which temporary
variables are necessary), we continue to match the error path logic in
SataControllerStart(), which is always recommended.

Reported-by: wang xiaofeng <winggundum82@163.com>
Fixes: bcab71413407e61c144994925556725dd65eede9
Cc: wang xiaofeng <winggundum82@163.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoOvmfPkg: SataControllerDxe: SataControllerStop: remove useless null check
Laszlo Ersek [Tue, 26 Apr 2016 11:51:55 +0000 (13:51 +0200)]
OvmfPkg: SataControllerDxe: SataControllerStop: remove useless null check

"ASSERT (SataPrivateData != NULL)" is just a few lines higher up.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoMdeModulePkg DxeCore: Check free memory type by CoreUpdateProfile()
Star Zeng [Fri, 22 Apr 2016 06:31:10 +0000 (14:31 +0800)]
MdeModulePkg DxeCore: Check free memory type by CoreUpdateProfile()

It can improve profile performance, especially when
PcdMemoryProfileMemoryType configured without EfiBootServicesData.
CoreUpdateProfile() can return quickly, but not depend on the further
code to find the buffer not recorded and then return.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg/NvmExpress: Clean Phase/CqHdbl/SqTdbl fields to restart HC
Tian Feng [Tue, 24 Nov 2015 08:45:44 +0000 (16:45 +0800)]
MdeModulePkg/NvmExpress: Clean Phase/CqHdbl/SqTdbl fields to restart HC

Phase Tag, SqTdbl/CqHdbl and SqBuffer/CqBuffer should be cleared in
NvmeControllerInit() to make HC functionality work when user invokes
NvmeBlockIoReset().

Cc: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
6 years agoMdeModulePkg/NvmExpress: Fix bug of handling not null-terminated strings
Feng Tian [Tue, 26 Apr 2016 07:16:26 +0000 (15:16 +0800)]
MdeModulePkg/NvmExpress: Fix bug of handling not null-terminated strings

In EnumerateNvmeDevNamespace(), when Private->ControllerData->Sn and/or
Private->ControllerData->Mn are NOT null-terminated strings,
UnicodeSPrintAsciiFormat(…) may generate unexpected (garbage) output
string.

Cc: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/NvmExpress: Fix mem leak in error handling of Start()
Tian Feng [Tue, 24 Nov 2015 06:35:28 +0000 (14:35 +0800)]
MdeModulePkg/NvmExpress: Fix mem leak in error handling of Start()

Memory pointed to by Private->ControllerData has not been freed up
correctly at error handling path.

Cc: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Simon (Xiang) Lian-SSI <simon.lian@ssi.samsung.com>
6 years agoMdeModulePkg/EmmcDxe: Fix wrong coding style on close brace
Feng Tian [Fri, 15 Apr 2016 07:48:22 +0000 (15:48 +0800)]
MdeModulePkg/EmmcDxe: Fix wrong coding style on close brace

The close brace of EmmcDxeComponentNameGetControllerName should be
at the beginning of a line.

Cc: Qiu Shumin <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
6 years agoMdeModulePkg/EmmcDxe: Fix wrong typo on function comments
Feng Tian [Fri, 15 Apr 2016 07:45:20 +0000 (15:45 +0800)]
MdeModulePkg/EmmcDxe: Fix wrong typo on function comments

Cc: Qiu Shumin <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
6 years agoMdeModulePkg/Sd: Not explicitly compare BOOLEAN type with TRUE/FALSE
Feng Tian [Fri, 15 Apr 2016 07:43:31 +0000 (15:43 +0800)]
MdeModulePkg/Sd: Not explicitly compare BOOLEAN type with TRUE/FALSE

It's coding style update to follow EDKII coding style doc.

Cc: Qiu Shumin <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
6 years agoMdeModulePkg/MdeModulePkg.uni: Add SD related PCD description
Feng Tian [Fri, 1 Apr 2016 08:37:53 +0000 (16:37 +0800)]
MdeModulePkg/MdeModulePkg.uni: Add SD related PCD description

Cc: Shumin Qiu <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
6 years agoShellPkg: Fix Shell treats every .EFI file as an executable application.
Qiu Shumin [Mon, 25 Apr 2016 02:08:30 +0000 (10:08 +0800)]
ShellPkg: Fix Shell treats every .EFI file as an executable application.

UEFI Shell 2.x cannot recognize whether a .EFI file is an application or
a driver. This means when we typed in a driver image in Shell command
line, Shell will load the driver image and try to run the entry point
function of the driver.
This patch check the ImageCodeType to fix the issue.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
6 years agoBaseTools/UPT: UPT to Support UTF-8
Hess Chen [Fri, 22 Apr 2016 05:23:38 +0000 (13:23 +0800)]
BaseTools/UPT: UPT to Support UTF-8

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoBaseTools/ECC: Remove UNI checkpoint from ECC
Hess Chen [Fri, 22 Apr 2016 05:18:42 +0000 (13:18 +0800)]
BaseTools/ECC: Remove UNI checkpoint from ECC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoUpdate ECC to support more doxygen keywords
Hess Chen [Fri, 22 Apr 2016 04:50:23 +0000 (12:50 +0800)]
Update ECC to support more doxygen keywords

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
6 years agoShellPkg: Enahance 'dh' command to add more protocols decoding support
Tapan Shah [Fri, 22 Apr 2016 16:32:26 +0000 (09:32 -0700)]
ShellPkg: Enahance 'dh' command to add more protocols decoding support

Adding EdidDiscovered, EdidActive protocol decode support a in 'dh' command.
Extending GraphicsOutput protocol decoding to list all supported GOP resolutions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoArmPkg/Gic: Fix boundary checking bug
Heyi Guo [Sat, 23 Apr 2016 14:39:59 +0000 (22:39 +0800)]
ArmPkg/Gic: Fix boundary checking bug

mGicNumInterrupts is the total number of interrupts, so the interrupt
ID equal to mGicNumInterrupts is also invalid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
6 years agoMdeModulePkg/SetupBrowserDxe: Remove the useless check
Dandan Bi [Fri, 22 Apr 2016 03:29:12 +0000 (11:29 +0800)]
MdeModulePkg/SetupBrowserDxe: Remove the useless check

When the type of HiiValue is BUFFER Type, the BufferValue
of the related question can not be NULL, so can remove the
check.

Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoMdeModulePkg/DxeCore: Avoid assertion in CoreLocateProtocol
Ruiyu Ni [Fri, 22 Apr 2016 09:08:49 +0000 (17:08 +0800)]
MdeModulePkg/DxeCore: Avoid assertion in CoreLocateProtocol

The patch uses CoreAcquireLockOrFail() instead of
CoreAcquireProtocolLock() in CoreLocateProtocol() to avoid
assertion when CoreLocateProtocol() is called with the
protocol database locked.

The issue was found when changing PcdDebugPrintErrorLevel to
enable page/pool allocation debug message.
Nt32 platform hangs immediately after DxeCore is loaded.
Investigation shows the following calling stacks:

DxeCore entry point (Install a certain protocol)
0 DxeCore::CoreInstallProtocolInterface  // Protocol DB is locked
1 DxeCore::AllocatePool
2 PeiDxeDebugLibReportStatusCode::DebugPrint
3 DxeReportStatusCodeLib::ReportStatusCodeEx // <-------------------|
4 DxeReportStatusCodeLib::InternalGetReportStatusCode               |
5 DxeCore::LocateProtocol(StatusCodeRuntimeProtocol)                |
                     // Assertion when locking Protocol DB 2nd time |
6 DxeCore::CoreAcquireProtocolLock                                  |
7 PeiDxeDebugLibReportStatusCode::DebugAssert                       |
8 DxeReportStatusCodeLib::ReportSatusCodeEx  // loop begins ---------

In frame #6 the assertion is triggered due to the protocol database
is already locked. #8 calls #4 and the loop begins.
After changing #6 to CoreAcquireLockOrFail(), the assertion is
avoided and the loop is broken.

With the fix, NT32 can boot to Shell even setting
PcdDebugPrintErrorLevel to 0xFFFFFFFF, with all error levels turned
on.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg: Correct PlatformHookLibSerialPortPpi module type.
Liming Gao [Fri, 15 Apr 2016 03:50:25 +0000 (11:50 +0800)]
MdeModulePkg: Correct PlatformHookLibSerialPortPpi module type.

This library instance is PEIM type, not BASE type. It has the PPI
dependency for PEIM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
6 years agoNetworkPkg: Fix GCC code build error of iSCSI driver.
Zhang Lubo [Fri, 22 Apr 2016 08:54:50 +0000 (16:54 +0800)]
NetworkPkg: Fix GCC code build error of iSCSI driver.

Fix GCC build error when refine the codes of iSCSI driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: Fix GCC code build error of iSCSI driver.
Zhang Lubo [Fri, 22 Apr 2016 08:52:29 +0000 (16:52 +0800)]
MdeModulePkg: Fix GCC code build error of iSCSI driver.

Fix GCC build error when refine the codes of iSCSI driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoVlv2TbltDevicePkg: Convert to build FatPkg from source
Jordan Justen [Wed, 6 Apr 2016 07:09:57 +0000 (00:09 -0700)]
Vlv2TbltDevicePkg: Convert to build FatPkg from source

Now that FatPkg is open source (and therefore in the EDK II tree) we
can build and use it directly.

Note: Not build tested

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tim He <tim.he@intel.com>
6 years agoFatBinPkg: Change to 2-clause BSD license
Jordan Justen [Wed, 6 Apr 2016 06:11:26 +0000 (23:11 -0700)]
FatBinPkg: Change to 2-clause BSD license

The FatPkg is now open source. Update FatBinPkg license to match
FatPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoFatPkg: Add Contributions.txt
Jordan Justen [Wed, 6 Apr 2016 06:07:19 +0000 (23:07 -0700)]
FatPkg: Add Contributions.txt

This is copied from MdePkg/Contributions.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoFatPkg: Update License.txt to have the full license text
Jordan Justen [Wed, 6 Apr 2016 06:03:10 +0000 (23:03 -0700)]
FatPkg: Update License.txt to have the full license text

A script was used to convert the license text for the entire FatPkg.
It used the shorter BSD text that we use in most files:

  This program and the accompanying materials are licensed and made
  available under the terms and conditions of the BSD License which
  accompanies this distribution. The full text of the license may be
  found at http://opensource.org/licenses/bsd-license.php

The script also used the short version in FatPkg/License.txt. In each
package's License.txt, we normally include the full BSD license text.
This change copies the longer version of License.txt from MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
6 years agoNetworkPkg: refine codes of iSCSI driver.
Zhang Lubo [Fri, 22 Apr 2016 07:18:56 +0000 (15:18 +0800)]
NetworkPkg: refine codes of iSCSI driver.

Add error handling logic in DriverBingingStop function,
it may return error status when invoking the
UninstallProtocolInterface.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: refine codes of iSCSI driver.
Zhang Lubo [Fri, 22 Apr 2016 07:18:40 +0000 (15:18 +0800)]
MdeModulePkg: refine codes of iSCSI driver.

Add error handling logic in DriverBingingStop function,
it may return error status when invoking the
UninstallProtocolInterface.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdeModulePkg DxeCore: Enhance MemoryAttributesTable installation
Star Zeng [Wed, 20 Apr 2016 09:27:40 +0000 (17:27 +0800)]
MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation

Current MemoryAttributesTable will be installed on ReadyToBoot event
at TPL_NOTIFY level, it maybe incorrect when PcdHiiOsRuntimeSupport
= TRUE as HiiDatabaseDxe will have runtime memory allocation for HII
OS runtime support on and after ReadyToBoot. The issue was exposed at
http://article.gmane.org/gmane.comp.bios.edk2.devel/10125.

To make sure the correctness of MemoryAttributesTable, this patch is
to enhance MemoryAttributesTable installation to install
MemoryAttributesTable on ReadyToBoot event at TPL_CALLBACK - 1 level
to make sure it is at the last of ReadyToBoot event, and also hook
runtime memory allocation after ReadyToBoot.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg DxeCore: Return memory type from internal free pool/pages
Star Zeng [Mon, 11 Apr 2016 03:00:47 +0000 (11:00 +0800)]
MdeModulePkg DxeCore: Return memory type from internal free pool/pages

The following patch for MemoryAttributesTable will need the memory type.
And CoreUpdateProfile() can also use the memory type for check.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg DxeCore: Fix a memory leak in InstallMemoryAttributesTable()
Star Zeng [Wed, 20 Apr 2016 08:19:01 +0000 (16:19 +0800)]
MdeModulePkg DxeCore: Fix a memory leak in InstallMemoryAttributesTable()

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg/HiiDatabaseDxe: Fix the VS2010/VS2012 build fail
Dandan Bi [Thu, 21 Apr 2016 01:05:47 +0000 (09:05 +0800)]
MdeModulePkg/HiiDatabaseDxe: Fix the VS2010/VS2012 build fail

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoMdeModulePkg DxeCore: Call PeCoffExtraActionLib member after Constructor
Star Zeng [Thu, 21 Apr 2016 01:47:00 +0000 (09:47 +0800)]
MdeModulePkg DxeCore: Call PeCoffExtraActionLib member after Constructor

Originally, the code block for "Report DXE Core image information to the PE/COFF
Extra Action Library" was after ProcessLibraryConstructorList(). To fix an issue,
ProcessLibraryConstructorList() was moved to be right after CoreInitializeGcdServices()
at c5d5379937629f3061d08b8d9a3386a40152ca2c, but the code block was left.

As there maybe PeCoffExtraActionLib implementation need Constructor executed first,
the patch is to move the code block for "Report DXE Core image information to the PE/COFF
Extra Action Library" to be after ProcessLibraryConstructorList.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
6 years agoMdeModulePkg/Sd: wait 1ms before check DATA line in voltage switch proc
Feng Tian [Tue, 12 Apr 2016 06:08:49 +0000 (14:08 +0800)]
MdeModulePkg/Sd: wait 1ms before check DATA line in voltage switch proc

According to SD Host Controller 3.0 spec figure 3-10, we have to wait
1ms before checking DAT[3:0] in voltage switch proc

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
6 years agoMdeModulePkg/SdMmcPciHc: Reset the slot when sd device is connected
Feng Tian [Tue, 12 Apr 2016 05:57:48 +0000 (13:57 +0800)]
MdeModulePkg/SdMmcPciHc: Reset the slot when sd device is connected

The original code doesn't reset the slot when there is device change.
It may bring issue on device identification procedure of some SD cards.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
6 years agoMdeModulePkg/Sd: Fix wrong response type of SD Deselect cmd
Feng Tian [Wed, 6 Apr 2016 01:52:08 +0000 (09:52 +0800)]
MdeModulePkg/Sd: Fix wrong response type of SD Deselect cmd

The SD CMD7 deselect cmd have no response according to SD
physical layer simplified spec.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
6 years agoMdeModulePkg/Sd: update the sd detection logic
Feng Tian [Thu, 7 Apr 2016 08:28:56 +0000 (16:28 +0800)]
MdeModulePkg/Sd: update the sd detection logic

If there is no card presented before power on, there would
have no card change interrupt generated. This is a corner
case which can't be handled by old logic.

The patch is used to move card present detection in the front
of card change interrupt detection.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
6 years agoMdeModulePkg/Usb: Fix wrong condition judgment to support usb3.1 dev
Feng Tian [Fri, 8 Apr 2016 05:43:49 +0000 (13:43 +0800)]
MdeModulePkg/Usb: Fix wrong condition judgment to support usb3.1 dev

The bcdUSB value of usb3.1 is 0x0310, we update the condition judgment
to get correct max packet size for usb3.1 dev.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/UsbKbDxe: don't assert when the key read is invalid
Feng Tian [Fri, 1 Apr 2016 08:37:53 +0000 (16:37 +0800)]
MdeModulePkg/UsbKbDxe: don't assert when the key read is invalid

The GetKeyDescriptor() may return NULL when the KeyData is invalid.
For such case, we should go to error handling path rather than assert

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoShellPkg: Support connect a device handle recursively with '-r'.
Qiu Shumin [Mon, 18 Apr 2016 07:59:58 +0000 (15:59 +0800)]
ShellPkg: Support connect a device handle recursively with '-r'.

This patch make Shell 'connect' a device handle recursively with
'-r' option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoBaseTools: add the support for --pcd feature to patch the binary efi
Yonghong Zhu [Wed, 20 Apr 2016 01:32:52 +0000 (09:32 +0800)]
BaseTools: add the support for --pcd feature to patch the binary efi

the original --pcd feature can override the Pcd value when build the
source driver, while it missed the binary driver. this patch add the
support to patch the binary efi for --pcd feature.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Add mixed PCD support feature
Yonghong Zhu [Tue, 12 Apr 2016 02:31:55 +0000 (10:31 +0800)]
BaseTools: Add mixed PCD support feature

Problem statement:
The current build system requires that a PCD must use the same access
method for all modules. A Binary Module may use a different PCD access
method than: 1.A source tree build it is integrated into. 2.Other Binary
Modules in platform build that use the same PCD.

Solution:
1. Source build:
No change. PCDs must use the same access method for building all Source
Modules.
2. Mixed Source & Binary Builds or Binary Only Builds:
1) Source Modules - No changes
2) Module that is interpreted as a Binary Module
a.DSC file may optionally override default value of PatchableInModule
PCDs in scope of Binary Module.
b.DSC file must declare DynamicEx PCD subtype for all DynamicEx PCDs
from Binary Modules.
c.FDF file must list Binary Module INF

Build update:
1. PCDs in a binary module are permitted to use the PatchableInModule
or DynamicEx access methods (the Binary INF clearly identifies the PCD
access method for each PCD). The build must support binary modules that
use the same or different PCD access method than the Source INFs or
other Binary INFs.
2. Build report list PCDs that have mixed PCD access methods.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoOvmfPkg: AcpiPlatformDxe: Don't enable unsupported PCI attributes
Volker Rümelin [Mon, 18 Apr 2016 19:51:30 +0000 (21:51 +0200)]
OvmfPkg: AcpiPlatformDxe: Don't enable unsupported PCI attributes

Current code in PciEnableDecoding tries to unconditionally enable
EFI_PCI_IO_ATTRIBUTE_IO and EFI_PCI_IO_ATTRIBUTE_MEMORY even if they
are unsupported attributes. This fails on devices which don't
support both attributes.

This patch masks out unsupported attributes.

Information to reproduce the bug.

Host lspci -s 0000:04:00.0 -vnn:
04:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB
3.0 Host Controller [1912:0014] (rev 03) (prog-if 30 [XHCI])
Flags: fast devsel, IRQ 19
Memory at ef900000 (64-bit, non-prefetchable) [size=8K]
Capabilities: [50] Power Management version 3
Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+
Capabilities: [90] MSI-X: Enable- Count=8 Masked-
Capabilities: [a0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [150] Latency Tolerance Reporting
Kernel driver in use: pci-stub
Kernel modules: xhci_pci

libvirt xml:
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x11'
       function='0'/>
    </hostdev>

OVMF debug log with additional DEBUG statement:
OnRootBridgesConnected: root bridges have been connected, installing
ACPI tables
Select Item: 0x19
EnablePciDecoding: GetLocation: D=0000:00:00.0
    OrigAttr=0000000000004000 SuppAttr=000000000000E700
EnablePciDecoding: GetLocation: D=0000:00:10.0
    OrigAttr=0000000000004000 SuppAttr=000000000000E700
EnablePciDecoding: GetLocation: D=0000:00:11.0
    OrigAttr=0000000000004000 SuppAttr=000000000000E600
EnablePciDecoding: EfiPciIoAttributeOperationEnable: Unsupported
Select Item: 0x28
Select Item: 0x19
Select Item: 0x2A
Select Item: 0x19
Select Item: 0x27
InstallQemuFwCfgTables: installed 6 tables

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
6 years agoBaseTools: fix a bug for PEI VPD Pcd collection
Yonghong Zhu [Tue, 19 Apr 2016 02:43:57 +0000 (10:43 +0800)]
BaseTools: fix a bug for PEI VPD Pcd collection

When a PEI phase VPD PCD only list in the DSC IA32 arch, then build X64
arch image, it missed to collect this PEI VPD pcd into VPD Pcd map file.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools/GenFds: remove the old logic since ActivePlatform is abs. path
Yonghong Zhu [Mon, 18 Apr 2016 07:38:15 +0000 (15:38 +0800)]
BaseTools/GenFds: remove the old logic since ActivePlatform is abs. path

We can support the DSC file out of workspace. this old logic first make
the absolute path to relative path and strips the leading slash off,
then append it to workspace. it cause GenFds failure on Linux when the
DSC file is out of workspace. Since we make sure the ActivePlatform is
abs. path, so we don't need this old logic to change the abs. path to
relative.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Marvin Haeuser <marvin.haeuser@outlook.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: enhance error handling for DSC file
Yonghong Zhu [Fri, 15 Apr 2016 08:46:48 +0000 (16:46 +0800)]
BaseTools: enhance error handling for DSC file

Add logic for DSC file validation for Prebuild init. Add logic to detect
error for DSC parser when '{' is missing.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/HiiDatabaseDxe: Support EfiVarStore to get AltCfg from Driver
Dandan Bi [Wed, 13 Apr 2016 08:47:25 +0000 (16:47 +0800)]
MdeModulePkg/HiiDatabaseDxe: Support EfiVarStore to get AltCfg from Driver

Allow EfiVarStore to get <AltResp> from Hii Driver, and enhance code logic
in MergeDefaultString function to get a full AltCfgResp.
The logic in function MergeDefaultString after enhancement:
(1) If there are no <AltResp> in AltCfgResp, merge the <AltResp> in
DefaultAltCfgResp to AltCfgResp.
(2) If there are <AltResp> in AltCfgResp, for the same <AltConfigHdr>, if
the <ConfigElement> already in AltCfgResp, don't need to merge from
DefaultAltCfgResp, else merge the <ConfigElement> in the DefaultAltCfgResp
to the related <AltResp> in AltCfgResp.
AltCfgResp: Generated by Driver.
DefaultAltCfgResp: Generated by HiiDatabase.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/HiiDatabaseDxe: Correct the ReallocatePool size
Dandan Bi [Tue, 12 Apr 2016 02:53:42 +0000 (10:53 +0800)]
MdeModulePkg/HiiDatabaseDxe: Correct the ReallocatePool size

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/DriverSampleDxe: Add a sample case
Dandan Bi [Fri, 15 Apr 2016 05:25:55 +0000 (13:25 +0800)]
MdeModulePkg/DriverSampleDxe: Add a sample case

Add the sample case for orderedlist to get standard
default value from Callback function.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoMdeModulePkg/SetupBrowserDxe: Get default from callback for orderedList
Dandan Bi [Fri, 15 Apr 2016 05:18:41 +0000 (13:18 +0800)]
MdeModulePkg/SetupBrowserDxe: Get default from callback for orderedList

For orderedlist question, the value is stored in a buffer,
not in HiiValue. So when need to get default value from callback
function for orderedlist, need to pass the buffer.
This patch is to enhance this logic.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>