]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoSecurityPkg: AuthVariableLib & SecureBootConfigDxe: Fix SecureBootEnable & PK inconsi...
Zhang, Chao B [Wed, 13 Apr 2016 07:27:04 +0000 (15:27 +0800)]
SecurityPkg: AuthVariableLib & SecureBootConfigDxe: Fix SecureBootEnable & PK inconsistency issue

Revert previous fix in AuthVariable driver init which breaks SecureBootEnable original behavior. Add more error handling logic in SecureBootConfigDxe to prevent wrong display info when SecureBootEnable & PK inconsistency happens.
Commit hash for the reverted patch in AuthVariable driver is
SHA-1: a6811666b0bef18871fa62b6c5abf18fb076fd0d

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
8 years agoBaseTools/Build: Consider only build-specified architectures
Thomas Palmer [Sat, 16 Apr 2016 01:45:02 +0000 (09:45 +0800)]
BaseTools/Build: Consider only build-specified architectures

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.

This fixes scenario whereby a build occurs in a source tree that was
been cleaned of non-essential directories.  For instance, X64 builds
do not require the ArmPkg directory to build a firmware image.  This
condition (build break when ArmPkg is absent) occurs when included
DSCs have sections for multiple architectures.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
8 years agoShellPkg: Update ping command options to sync with Spec
Jiaxin Wu [Tue, 12 Apr 2016 03:57:54 +0000 (11:57 +0800)]
ShellPkg: Update ping command options to sync with Spec

This patch is used to update ping command options to sync
with shell2.2 Spec.
Considering the backward compatible issue, the patch keeps
‘-_s’ command option unchanged, only add the new option '-s'
and make the old option '-_s' function same as new one.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Jaben Carsey <jaben.carsey@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>
8 years agoArmPlatformPkg/DS-5: fix 64-bit PE/COFF header parsing bug
Ard Biesheuvel [Thu, 31 Mar 2016 07:27:38 +0000 (09:27 +0200)]
ArmPlatformPkg/DS-5: fix 64-bit PE/COFF header parsing bug

The 64-bit version of the DS-5 debug script that retrieves the debug file
path from the PE/COFF image in memory assumes that the PE/COFF header is
packed, and that the debug directory entry in the optional header appears
at a fixed offset into the file. This is no longer true, now that we pad
between the file header and the PE header if the section alignment exceeds
the size of the header (which may be the case when the module contains a
vector table or small model code, which requires 2 KB or 4 KB section
alignment, respectively), to allow this padding to be emitted if the image
is subsequently converted to TE format.

So replace the fixed offset with a dereference of the appropriate header
field.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reported-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
8 years agoMdeModulePkg NvmExpressDxe: Ensure write-through for NVMe write command
Hao Wu [Fri, 25 Mar 2016 01:46:58 +0000 (09:46 +0800)]
MdeModulePkg NvmExpressDxe: Ensure write-through for NVMe write command

Set the Force Unit Access (FUA) bit in NVMe Write - Command Dword 12 to
ensure write-through behavior.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoEdkCompatibilityPkg: Fix a typo.
Marvin H?user [Thu, 14 Apr 2016 20:48:31 +0000 (04:48 +0800)]
EdkCompatibilityPkg: Fix a typo.

Fix a typo and a spacing mistake in EfiCommonLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoEdkCompatibilityPkg: Do not cast VA_LIST to a pointer for AARCH64.
Marvin H?user [Thu, 14 Apr 2016 20:48:24 +0000 (04:48 +0800)]
EdkCompatibilityPkg: Do not cast VA_LIST to a pointer for AARCH64.

Do not cast VA_LIST to a pointer for the AARCH64 architecture in
EfiCommonLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoPerformancePkg: Make Dp print help information with -? flag in Shell.
Qiu Shumin [Tue, 12 Apr 2016 07:06:07 +0000 (15:06 +0800)]
PerformancePkg: Make Dp print help information with -? flag in Shell.

Since Shell supports finding help information from resource section
of application image. We enhance the Dp to add help information
string. After the Dp are loaded in system the help string will
be stored in resource section of the application image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoShellPkg : Cache the environment variable into memory to enhance
Qiu Shumin [Fri, 1 Apr 2016 01:02:20 +0000 (09:02 +0800)]
ShellPkg : Cache the environment variable into memory to enhance
the performance.

Currently UEFI Shell reads variable storage to get the environment
variables every time running a new command. And reading(writing)
UEFI variables is a high cost operation on most platforms. In order
to enhance the performance this patch read the variable storage once
and cache the environment variables in memory. Every further 'set'
command will save the variable not only to Shell cache, but also the
flash variable storage.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by:Ruiyu Ni <ruiyu.ni@intel.com>

8 years agoBaseTools: Fix PLATFORM_DIR variable value.
Marvin.Haeuser@outlook.com [Thu, 14 Apr 2016 16:28:19 +0000 (00:28 +0800)]
BaseTools: Fix PLATFORM_DIR variable value.

In commit 017fb1cd4c5e3c8b914eb217ac1760223687dad7, the PLATFORM_DIR
macro has been updated to resolve to the correct path. However, it is
incorrectly accessed via curved rather than curly braces by GenMake.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
8 years agoBaseTools/VolInfo: Update to handle PE image with .code section only
Yonghong Zhu [Thu, 14 Apr 2016 02:06:12 +0000 (10:06 +0800)]
BaseTools/VolInfo: Update to handle PE image with .code section only

rebase the image which only has .code section, but no other section, the
tool return error. this patch fix this bug to support it.

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>
8 years agoBaseTools/GenFw: Update to handle PE image with .code section only
Yonghong Zhu [Thu, 14 Apr 2016 02:04:55 +0000 (10:04 +0800)]
BaseTools/GenFw: Update to handle PE image with .code section only

current GenFw rebase the image which only has .code section, but no other
section, the tool return error. this patch fix this bug to support it.

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>
8 years agoBaseTools: Fix the bug to correctly handle the [BuildOptions]
Yonghong Zhu [Thu, 14 Apr 2016 15:03:45 +0000 (23:03 +0800)]
BaseTools: Fix the bug to correctly handle the [BuildOptions]

the last fix call os.path.normpath() function, which removes the
trailing slash character, it cause NASM failure for ResetVector
driver.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoArmPkg/AArch64Mmu: disable MMU during page table manipulations
Ard Biesheuvel [Mon, 11 Apr 2016 13:47:24 +0000 (15:47 +0200)]
ArmPkg/AArch64Mmu: disable MMU during page table manipulations

On ARM, manipulating live page tables is cumbersome since the architecture
mandates the use of break-before-make, i.e., replacing a block entry with
a table entry requires an intermediate step via an invalid entry, or TLB
conflicts may occur.

Since it is not generally feasible to decide in the page table manipulation
routines whether such an invalid entry will result in those routines
themselves to become unavailable, use a function that is callable with
the MMU off (i.e., a leaf function that does not access the stack) to
perform the change of a block entry into a table entry.

Note that the opposite should never occur, i.e., table entries are never
coalesced into block entries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
8 years agoEmbeddedPkg/AcpiLib: add GICD table init macro for ACPI 6.0
Heyi Guo [Wed, 6 Apr 2016 15:15:43 +0000 (23:15 +0800)]
EmbeddedPkg/AcpiLib: add GICD table init macro for ACPI 6.0

Add macro to help initialize GICD structure in MADT table according
to ACPI 6.0.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoArmPkg/AArch64Mmu: Fix XN attribute for device memory
Heyi Guo [Thu, 14 Apr 2016 09:24:47 +0000 (17:24 +0800)]
ArmPkg/AArch64Mmu: Fix XN attribute for device memory

Now XN attribute will be set automatically if the region is declared
as device memory. However, the function ArmMemoryAttributeToPageAttribute
is to get attribute for block and page descriptors, not for table
descriptors, so attribute TT_TABLE_*XN does not really take effect.

Need to use TT_*XN_MASK instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoNetworkPkg: Fix issue in Ip6Dxe SetData
Jiaxin Wu [Wed, 13 Apr 2016 03:07:07 +0000 (11:07 +0800)]
NetworkPkg: Fix issue in Ip6Dxe SetData

EFI_NOT_READY should not be treated as an error status
returned from SetData for Ip6ConfigDataTypeManualAddress
since there is an asynchronous operation for DAD process.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.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: Sriram Subramanian <sriram-s@hpe.com>
Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
8 years agoBaseTools: fix the bug for [BuildOptions] of multiple workspace support
Yonghong Zhu [Wed, 13 Apr 2016 08:27:05 +0000 (16:27 +0800)]
BaseTools: fix the bug for [BuildOptions] of multiple workspace support

when enable Multiple workspace and there have other option(eg: -I) before
$(WORKSPACE), handleWsMacro cannot return correct which cause the
ArmVirtPkg build failure.
example:
[BuildOptions]
  *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include

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>
8 years agoBaseTools: fix PLATFORM_DIR variable value for multiple workspace
Yonghong Zhu [Wed, 13 Apr 2016 05:09:17 +0000 (13:09 +0800)]
BaseTools: fix PLATFORM_DIR variable value for multiple workspace

when enable the multiple workspace, the PLATFORM_DIR still is
$(WORKSPACE)\AnyPkg, even though it is in a PACKAGES_PATH folder. this
patch fix this issue to use the real path.

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>
8 years agoMdeModulePkg S3SaveStateDxe: Add protocol usage for gEfiLockBoxProtocolGuid
Star Zeng [Wed, 13 Apr 2016 06:28:48 +0000 (14:28 +0800)]
MdeModulePkg S3SaveStateDxe: Add protocol usage for gEfiLockBoxProtocolGuid

Cc: Shumin Qiu <shumin.qiu@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: Shumin Qiu <shumin.qiu@intel.com>
8 years agoArmVirtPkg/VirtFdtDxe: remove Xenio handling and rename to VirtioFdtDxe
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:11 +0000 (11:45 +0200)]
ArmVirtPkg/VirtFdtDxe: remove Xenio handling and rename to VirtioFdtDxe

Now that we have moved the handling of the xen,xen DT node to XenioFdtDxe,
remove its handling from VirtFdtDxe. Since the only functionality that
remains is handling the virtio,mmio DT node, rename VirtFdtDxe to
VirtioFdtDxe to reflect that. Also update the platforms that use this
driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:10 +0000 (11:45 +0200)]
ArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver

Now that the only functionality that remains in VirtFdtDxe is enumerating
the respective virtual I/O buses, it no longer makes sense to have a driver
that is shared between Xen domU and QEMU. So move the Xen I/O DT node
handling to a new driver, and update ArmVirtXen to switch to it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoOvmfPkg/XenIoMmioLib: add missing MemoryAllocationLib dependency to INF
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:09 +0000 (11:45 +0200)]
OvmfPkg/XenIoMmioLib: add missing MemoryAllocationLib dependency to INF

XenIoMmioLib depends on MemoryAllocationLib, and uses its header, but
failed to declare the dependency in its INF.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: move FDT config table installation to FdtClientDxe
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:08 +0000 (11:45 +0200)]
ArmVirtPkg/VirtFdtDxe: move FDT config table installation to FdtClientDxe

Now that FdtClientDxe is the core driver that takes ownership of the host
supplied FDT, it makes sense to put it in charge of installing the FDT
configuration table as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: remove unused PL011 DT node type
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:07 +0000 (11:45 +0200)]
ArmVirtPkg/VirtFdtDxe: remove unused PL011 DT node type

This type is not used in the code, so drop the definitions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: get rid of A PRIORI DXE declarations for VirtFdtDxe
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:06 +0000 (11:45 +0200)]
ArmVirtPkg: get rid of A PRIORI DXE declarations for VirtFdtDxe

We no longer care when VirtFdtDxe executes, since
- the driver sets no dynamic PCDs any longer, and
- the only remaining functionality centers on VirtioMmioInstallDevice()
  and XenIoMmioInstall() function calls and FDT configuration table
  installation.

So drop the A PRIORI declaration.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: drop RTC handling
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:05 +0000 (11:45 +0200)]
ArmVirtPkg/VirtFdtDxe: drop RTC handling

The RTC driver no longer relies on VirtFdtDxe to set the pl031 RTC base
address in a dynamic PCD, so drop the handling altogether.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: move QEMU based platforms to ArmVirtPL031FdtClientLib
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:04 +0000 (11:45 +0200)]
ArmVirtPkg: move QEMU based platforms to ArmVirtPL031FdtClientLib

This moves QEMU based platforms to ArmVirtPL031FdtClientLib, so that we no
longer have to rely on VirtFdtDxe to execute first and set the PL031 base
address in a dynamic PCD.

The only driver which [transitively] depends on this PcdPL031RtcBase PCD is
EmbeddedPkg/RealTimeClockRuntimeDxe, so this conversion cannot affect any
other users and is thus safe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: implement ArmVirtPL031FdtClientLib
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:03 +0000 (11:45 +0200)]
ArmVirtPkg: implement ArmVirtPL031FdtClientLib

This implements a library ArmVirtPL031FdtClientLib which is intended to
be incorporated into RealTimeClockRuntimeDxe via NULL library class
resolution. This allows us to make RealTimeClockRuntimeDxe depend on the
FDT client protocol, and discover the PL031 base address from the device tree
directly rather than relying on VirtFdtDxe to set the dynamic PCDs.

The NULL library class resolution approach to strictly order production and
consumption of dynamic PCDs is not generally safe in cases such as this one,
where the producer and the consumer of the PCD are both libraries. However,
since the PCD is produced in this library's constructor, and the consumer
library's constructor 'LibRtcInitialize' is not a 'true' constructor (it is
invoked explicitly by RealTimeClockRuntimeDxe), this case is guaranteed to
be safe after all.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/RelocatableVirtHelper: use correct FindMemNode argument order
Ard Biesheuvel [Wed, 13 Apr 2016 11:47:46 +0000 (13:47 +0200)]
ArmVirtPkg/RelocatableVirtHelper: use correct FindMemNode argument order

Commit 03b6bed17ea6 ArmVirtPkg/XenRelocatablePlatformLib: rewrite DTB
memory node retrieval in C") introduced a FindMemNode () C function
that takes pointers to system memory base and size as arguments, but the
calling code passes them in the wrong order.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
8 years agoIntelFrameworkModulePkg: Remove unused PCD/Protocol
Ruiyu Ni [Mon, 11 Apr 2016 07:38:18 +0000 (15:38 +0800)]
IntelFrameworkModulePkg: Remove unused PCD/Protocol

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoVlv2TbltDevicePkg: Reference the PCD defined in MdeModulePkg
Ruiyu Ni [Mon, 11 Apr 2016 07:43:13 +0000 (15:43 +0800)]
Vlv2TbltDevicePkg: Reference the PCD defined in MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
8 years agoIntelFrameworkModulePkg/KeyboardDxe: Use PCD defined in MdeModulePkg
Ruiyu Ni [Mon, 11 Apr 2016 07:37:31 +0000 (15:37 +0800)]
IntelFrameworkModulePkg/KeyboardDxe: Use PCD defined in MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoIntelFrameworkModulePkg/Ps2Mouse: Use PCD defined in MdeModulePkg
Ruiyu Ni [Mon, 11 Apr 2016 07:36:52 +0000 (15:36 +0800)]
IntelFrameworkModulePkg/Ps2Mouse: Use PCD defined in MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoIntelFrameworkModulePkg/Ps2AbsPointer: Use PCD defined in MdeModulePkg
Ruiyu Ni [Mon, 11 Apr 2016 07:34:58 +0000 (15:34 +0800)]
IntelFrameworkModulePkg/Ps2AbsPointer: Use PCD defined in MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoIntelFrameworkModulePkg/Ps2Kbd: use PCD/Protocol in MdeModulePkg
Ruiyu Ni [Mon, 11 Apr 2016 07:34:20 +0000 (15:34 +0800)]
IntelFrameworkModulePkg/Ps2Kbd: use PCD/Protocol in MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoMdeModulePkg/MdeModulePkg.uni: Add PS2 related PCD description
Ruiyu Ni [Wed, 13 Apr 2016 06:33:31 +0000 (14:33 +0800)]
MdeModulePkg/MdeModulePkg.uni: Add PS2 related PCD description

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
8 years agoMdeModulePkg/Ps2MouseDxe: Use a different FILE_GUID
Ruiyu Ni [Wed, 13 Apr 2016 06:31:47 +0000 (14:31 +0800)]
MdeModulePkg/Ps2MouseDxe: Use a different FILE_GUID

Change to use a different FILE_GUID to avoid using the
same GUID as the module in IntelFrameworkModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
8 years agoMdeModulePkg/Ps2KeyboardDxe: Use a different FILE_GUID
Ruiyu Ni [Wed, 13 Apr 2016 06:31:30 +0000 (14:31 +0800)]
MdeModulePkg/Ps2KeyboardDxe: Use a different FILE_GUID

Change to use a different FILE_GUID to avoid using the
same GUID as the module in IntelFrameworkModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
8 years agoMdeModulePkg/Ps2Mouse: Fix potential buffer overflow issue.
Ruiyu Ni [Wed, 13 Apr 2016 06:11:38 +0000 (14:11 +0800)]
MdeModulePkg/Ps2Mouse: Fix potential buffer overflow issue.

Count is initially 1 but is assigned to 2 in case PS2_READ_DATA_BYTE.
Though the state machine doesn't go back from PS2_READ_DATA_BYTE to
PS2_READ_BYTE_ONE (not a true bug), force assign Count to 1 to avoid
potential buffer overflow issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
8 years agoMdeModulePkg: Update Guid/Protocol usages in INF files.
Liming Gao [Fri, 25 Mar 2016 09:24:37 +0000 (17:24 +0800)]
MdeModulePkg: Update Guid/Protocol usages in INF files.

V2: Update VariableSmm inf to align the change in VariableRuntimeDxe.inf.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoShellPkg: Update Guid/Protocol usages in INF files.
Liming Gao [Fri, 25 Mar 2016 09:21:35 +0000 (17:21 +0800)]
ShellPkg: Update Guid/Protocol usages in INF files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
8 years agoSecurityPkg: Update protocol usage in module INF files.
Liming Gao [Fri, 25 Mar 2016 09:14:13 +0000 (17:14 +0800)]
SecurityPkg: Update protocol usage in module INF files.

Update TCG and Library module uses gEdkiiVariableLockProtocolGuid
as SOMETIMES_CONSUMES instead of CONSUMES to follow the code logic.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
8 years agoMdePkg: Add EFI Erase Block Protocol definitions
Hao Wu [Tue, 2 Feb 2016 05:09:42 +0000 (13:09 +0800)]
MdePkg: Add EFI Erase Block Protocol definitions

This protocol is newly introduced in UEFI 2.6 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoQuarkSocPkg: Add /Oi option to let MemoryInit pass build.
Liming Gao [Mon, 11 Apr 2016 03:52:25 +0000 (11:52 +0800)]
QuarkSocPkg: Add /Oi option to let MemoryInit pass build.

MemoryInit uses the intrinsic memset function. To keep it pass build in VS
tool chain without source code change, /Oi option will be added.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoMdeModulePkg/Ps2MouseDxe: Fix build failure of GCC tool chain
Qiu, Shumin [Sun, 10 Apr 2016 12:55:27 +0000 (20:55 +0800)]
MdeModulePkg/Ps2MouseDxe: Fix build failure of GCC tool chain

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoArmVirtPkg/VirtFdtDxe: drop PCI host bridge handling
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:02 +0000 (11:45 +0200)]
ArmVirtPkg/VirtFdtDxe: drop PCI host bridge handling

Now that the PCI host bridge driver parses the DT node that describes
the PCI host bridge directly via the FDT client protocol, we can drop the
handling from VirtFdtDxe completely.

This means some PCI related PCDs are no longer set, such as PcdPciBusMin,
PcdPciBusMax, PcdPciIoBase, PcdPciIoSize, PcdPciIoTranslation,
PcdPciMmio32Base and PcdPciMmio32Size. Since these PCDs are specific to
ARM (and declared in ArmPlatformPkg), and not used anywhere else by the
ArmVirtPkg platforms, we can simply stop populating them, and drop all
references to them.

It also means that we can no longer rely on PcdPciDisableBusEnumeration
to be set before it is consumed by PciBusDxe and QemuFwCfgAcpiPlatformDxe,
so make those depend on FdtPciPcdProducerLib explicitly via NULL library
class resolution.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:01 +0000 (11:45 +0200)]
ArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol

Instead of relying on VirtFdtDxe to populate various dynamic PCDs with
information retrieved from the host-provided device tree, perform the
PCI ECAM related DT node parsing directly in PciHostBridgeDxe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/BaseCachingPciExpressLib: depend on PciPcdProducerLib
Ard Biesheuvel [Fri, 8 Apr 2016 09:45:00 +0000 (11:45 +0200)]
ArmVirtPkg/BaseCachingPciExpressLib: depend on PciPcdProducerLib

Make BaseCachingPciExpressLib depend on PciPcdProducerLib, so that we
have a chance to populate PcdPciExpressBaseAddress based on the contents
of the device tree.

Also update the platforms under ArmVirtPkg that support PCI to use the
special MAX_UINT64 value as the build time default for
PcdPciExpressBaseAddress.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: implement FdtPciPcdProducerLib
Ard Biesheuvel [Tue, 12 Apr 2016 12:21:03 +0000 (14:21 +0200)]
ArmVirtPkg: implement FdtPciPcdProducerLib

This implements a library FdtPciPcdProducerLib which is intended to
be incorporated into modules that consume the PCI related dynamic PCDs
PcdPciExpressBaseAddress and PcdPciDisableBusEnumeration, either via NULL
library class resolution or via a direct dependency (for other libraries
or modules in ArmVirtPkg). This allows us to make them depend on the FDT
client protocol, and populate these PCDs based on the presence and the
contents of a 'pci-host-ecam-generic' DT node.

This also overloads the meaning of PcdPciExpressBaseAddress, which we will
set to MAX_UINT64 to signify that the actual values of these two PCDs have
not been assigned yet.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:59 +0000 (11:44 +0200)]
ArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node

Remove the handling of the fw_cfg DT node from VirtFdtDxe now that the
fw_cfg client library has been moved to the FDT client protocol, and no
longer relies on VirtFdtDxe to pass this information via dynamic PCDs.
Since the PCDs in question are now no longer used, remove them from the
various DEC and DSC files as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/QemuFwCfgLib: move to FDT client protocol
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:58 +0000 (11:44 +0200)]
ArmVirtPkg/QemuFwCfgLib: move to FDT client protocol

Make this library depend on the FDT client protocol to access the
host supplied device tree directly rather than depending on VirtFdtDxe
to set them using dynamic PCDs.

Since this library is used by several drivers (BdsDxe, SmbiosPlatformDxe,
SmbiosDxe and QemuFwCfgAcpiPlatformDxe), we will end up parsing the device
tree and the fwcfg node at least four times. However, no dynamic PCDs are
involved anymore, and will even be removed completely in a subsequent
patch. So the conversion is not optimal, but guaranteed to be safe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoBaseTools: use unsigned chars on ARM architectures
Leif Lindholm [Thu, 17 Mar 2016 13:22:52 +0000 (21:22 +0800)]
BaseTools: use unsigned chars on ARM architectures

By default, the ARM architectures have unsigned chars, whereas the other
architectures supported by EDK2 by default have signed chars.
However, EDK2 uses -funsigned-chars on those architectures to change the
default behaviour.

Unfortunately, the ARM architectures explicitly break their default
behaviour by specifying -fsigned-chars (I presume in a pre-emptive
attempt at avoiding incompatibility).

Since this situation is already confusing enough, switch the ARM
architectures to also specify -funsigned-chars explicitly rather than
just dropping the current parameter.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoBaseTools: generate hash value in build report for each output EFI image
Yonghong Zhu [Thu, 7 Apr 2016 05:57:14 +0000 (13:57 +0800)]
BaseTools: generate hash value in build report for each output EFI image

Build report add new report type 'HASH' to include the hash value for
each output EFI image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoBaseTools/VolInfo: generate HASH value for each PE image
Yonghong Zhu [Thu, 7 Apr 2016 05:56:44 +0000 (13:56 +0800)]
BaseTools/VolInfo: generate HASH value for each PE image

VolInfo Tool add new option --hash to use openssl to generate hash value
for each PE image. If the image base address is not zero, we will rebase
its base address to zero before generate hash value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoArmVirtPkg/VirtFdtDxe: remove timer DT node handling
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:57 +0000 (11:44 +0200)]
ArmVirtPkg/VirtFdtDxe: remove timer DT node handling

The timer code no longer relies on VirtFdtDxe to set the PCDs, so remove
the handling of the timer node and the references to those PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: move TimerDxe to FDT client library
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:56 +0000 (11:44 +0200)]
ArmVirtPkg: move TimerDxe to FDT client library

Move to the new dedicated ArmVirtTimerFdtClientLib to populate the
various timer related PCDs at driver load time rather than relying on
VirtFdtDxe to do it. Since ArmPkg/TimerDxe is the only consumer of these
PCDs, which is the DXE driver ArmVirtTimerFdtClientLib is intended to
complement, this conversion is guaranteed to be safe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: implement ArmVirtTimerFdtClientLib
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:55 +0000 (11:44 +0200)]
ArmVirtPkg: implement ArmVirtTimerFdtClientLib

This implements a library ArmVirtTimerFdtClientLib which is intended to
be incorporated into TimerDxe via NULL library class resolution. This
allows us to make TimerDxe depend on the FDT client protocol, and
discover the timer interrupts from the device tree directly rather than
relying on VirtFdtDxe to set the dynamic PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: drop detection of PSCI method
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:54 +0000 (11:44 +0200)]
ArmVirtPkg/VirtFdtDxe: drop detection of PSCI method

The detection of the PSCI method has been moved to the EfiResetSystemLib
implementation, so drop the handling from VirtFdtDxe. Since no users
remain of gArmVirtTokenSpaceGuid.PcdArmPsciMethod, remove that as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:53 +0000 (11:44 +0200)]
ArmVirtPkg/ArmVirtPsciResetSystemLib: move to FDT client protocol

Instead of relying on VirtFdtDxe to detect the PSCI method, move our
EfiResetSystemLib to the FDT client protocol to interrogate the device
tree directly.

Since this library is only consumed by EmbeddedPkg/ResetRuntimeDxe, and
considering that the PCD is no longer set, and even removed completely in a
subsequent patch, this conversion is guaranteed to be safe.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/VirtFdtDxe: remove GIC discovery
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:52 +0000 (11:44 +0200)]
ArmVirtPkg/VirtFdtDxe: remove GIC discovery

Now that we moved the GIC discovery to our ArmGicArchLib implementation,
we can remove it from VirtFdtDxe, since it is no longer used. Remove the
PcdArmGicRevision declaration and definitions as well: VirtFdtDxe no longer
sets it, and no other drivers consume its value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/ArmGicArchLib: move to FdtClient protocol
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:51 +0000 (11:44 +0200)]
ArmVirtPkg/ArmGicArchLib: move to FdtClient protocol

Instead of relying on VirtFdtDxe to populate the GIC related PCDs, move
this handling to our implementation of ArmGicArchLib, and retrieve the
required DT info using the new FDT client protocol.

This removes one of the reasons we need to load VirtFdtDxe first using
an 'A PRIORI' declaration in the platform FDF.

As Laszlo kindly confirms:

  So, ultimately, the only user of this library instance is
  "ArmPkg/Drivers/ArmGic/ArmGicDxe.inf". ... Indeed, checking the build
  report file for ArmVirtQemu (AARCH64), I find ArmVirtGicArchLib (and
  ArmGicLib too) only under "ArmPkg/Drivers/ArmGic/ArmGicDxe.inf".

which means that the constructor is only invoked once, and so the dynamic
PCDs are set in time for ArmGicDxe to consume them, and never afterwards.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: add FdtClientDxe to the ArmVirtPkg platforms
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:50 +0000 (11:44 +0200)]
ArmVirtPkg: add FdtClientDxe to the ArmVirtPkg platforms

Add FdtClientDxe to the various platforms under ArmVirtPkg, so that the
drivers we will update to depend on the FDT client protocol in subsequent
patches will remain in working order.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg/FdtClientDxe: implement new driver
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:49 +0000 (11:44 +0200)]
ArmVirtPkg/FdtClientDxe: implement new driver

This implements a new DXE driver FdtClientDxe to produce the FDT client
protocol based on a device tree image supplied by the virt host.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoArmVirtPkg: introduce FdtClientProtocol
Ard Biesheuvel [Fri, 8 Apr 2016 09:44:48 +0000 (11:44 +0200)]
ArmVirtPkg: introduce FdtClientProtocol

This introduces the FdtClientProtocol, which will be used to expose the
device tree provided by the host to other DXE drivers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoUefiCpuPkg: CpuIo2Dxe: optimize FIFO reads and writes of IO ports
Laszlo Ersek [Thu, 7 Apr 2016 20:28:38 +0000 (22:28 +0200)]
UefiCpuPkg: CpuIo2Dxe: optimize FIFO reads and writes of IO ports

* Short description:

  The CpuIoServiceRead() and CpuIoServiceWrite() functions transfer data
  between memory and IO ports with individual Io(Read|Write)(8|16|32)
  function calls, each in an appropriately set up loop.

  On the Ia32 and X64 platforms however, FIFO reads and writes can be
  optimized, by coding them in assembly, and delegating the loop to the
  CPU, with the REP prefix.

  On KVM virtualization hosts, this difference has a huge performance
  impact: if the loop is open-coded, then the virtual machine traps to the
  hypervisor on every single UINT8 / UINT16 / UINT32 transfer, whereas
  with the REP prefix, KVM can transfer up to a page of data per VM trap.
  This is especially noticeable with IDE PIO transfers, where all the data
  are squeezed through IO ports.

* Long description:

  The RootBridgeIoIoRW() function in

    PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c

  used to have the exact same IO port acces optimization, dating back
  verbatim to commit 1fd376d9792:

    PcAtChipsetPkg/PciHostBridgeDxe: Improve KVM FIFO I/O read/write
      performance

  OvmfPkg cloned the "PcAtChipsetPkg/PciHostBridgeDxe" driver (for
  unrelated reasons), and inherited the optimization from PcAtChipsetPkg.

  The "PcAtChipsetPkg/PciHostBridgeDxe" driver was ultimately removed in
  commit 111d79db47:

    PcAtChipsetPkg/PciHostBridge: Remove PciHostBridge driver

  and OvmfPkg too was rebased to the new core Pci Host Bridge Driver, in
  commit 4014885ffd:

    OvmfPkg: switch to MdeModulePkg/Bus/Pci/PciHostBridgeDxe

  This caused the optimization to go lost. Namely, the
  RootBridgeIoIoRead() and RootBridgeIoIoWrite() functions in the new core
  Pci Host Bridge Driver delegate IO port accesses to
  EFI_CPU_IO2_PROTOCOL. And, in OvmfPkg (and likely most other Ia32 / X64
  edk2 platforms), this protocol is provided by "UefiCpuPkg/CpuIo2Dxe",
  which lacks the optimization.

  Therefore, this patch ports the C source code logic from commit
  1fd376d9792 (see above) to "UefiCpuPkg/CpuIo2Dxe", plus it ports the
  NASM-converted assembly helper functions from OvmfPkg commits
  6026bf460037 and ace1d0517b65:

    OvmfPkg PciHostBridgeDxe: Convert Ia32/IoFifo.asm to NASM

    OvmfPkg PciHostBridgeDxe: Convert X64/IoFifo.asm to NASM

  In order to support the MSFT and INTEL toolchains as well, the *.asm
  files are ported from OvmfPkg as well, immediately from before the above
  conversion (that is, at 6026bf460037^).

* Notes about the port:

  - The write and read branches from commit 1fd376d9792 are split to the
    separate functions CpuIoServiceWrite() and CpuIoServiceRead().

  - The EfiPciWidthUintXX constants are replaced with EfiCpuIoWidthUintXX.

  - The cast expression "(UINTN) Address" is replaced with
    "(UINTN)Address" (i.e., no space), because that's how the receiving
    functions spell it as well.

  - The labels in the switch statements are unindented by one level, to
    match the edk2 coding style (and the rest of UefiCpuPkg) better.

* The first signoff belongs to Jordan, because he authored all of
  1fd376d97926026bf460037 and ace1d0517b65.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Ref: https://www.redhat.com/archives/vfio-users/2016-April/msg00029.html
Reported-by: Mark <kram321@gmail.com>
Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/10424/focus=10432
Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Mark <kram321@gmail.com>
Tested-by: Mark <kram321@gmail.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
8 years agoMdeModulePkg: Update PerformanceLib instances not to check Identifier.
Liming Gao [Fri, 8 Apr 2016 09:35:18 +0000 (17:35 +0800)]
MdeModulePkg: Update PerformanceLib instances not to check Identifier.

In PerformanceLib, Identifier is for single PERF, not the pair of PERF.
When find the matched START and END pair, the identifier will not be checked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoMdePkg: Update PerformanceLib comments not to check Identifier.
Liming Gao [Fri, 8 Apr 2016 09:34:58 +0000 (17:34 +0800)]
MdePkg: Update PerformanceLib comments not to check Identifier.

In PerformanceLib, Identifier is for single PERF, not the pair of PERF.
When find the matched START and END pair, the identifier will not be checked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>