]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
8 years agoOvmfPkg: PciHostBridgeLib: implement PciHostBridgeFreeRootBridges()
Laszlo Ersek [Mon, 25 Jan 2016 22:17:22 +0000 (23:17 +0100)]
OvmfPkg: PciHostBridgeLib: implement PciHostBridgeFreeRootBridges()

This function has no counterpart in OvmfPkg/PciHostBridgeDxe/, but the
PciHostBridgeLib class requires it.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.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>
8 years agoOvmfPkg: PciHostBridgeLib: convert main loop from PciHostBridgeDxe
Laszlo Ersek [Mon, 25 Jan 2016 21:47:00 +0000 (22:47 +0100)]
OvmfPkg: PciHostBridgeLib: convert main loop from PciHostBridgeDxe

In this patch we import the scan for extra root buses from the
InitializePciHostBridge() function, in file
"OvmfPkg/PciHostBridgeDxe/PciHostBridge.c".

For the time being, the InitRootBridge() and UninitRootBridge() functions
are just placeholders.

The PciHostBridgeGetRootBridges() API expects us to return the
PCI_ROOT_BRIDGE structures in a contiguous array, instead of a linked
list. Therefore the following bits have to be converted manually:

(1) The array is allocated in advance, in a single step.

(2) The calculation of the array size depends on an explicit
    multiplication, which we must check against overflow. Since more than
    255 extra root bridges make no sense anyway, we use (1 + 255) as the
    limit on the main plus all extra root bridges. This also ensures that
    the UINTN multiplication doesn't overflow.

(3) The PciHostBridgeDxe code decrements "ExtraRootBridgesLeft" to
    terminate the scanning early. Here we need track the increasing count
    of used array elements as well, so we employ "ExtraRootBridges" as a
    constant limit, and increment the new local variable "Initialized".

(4) The prototypes of InitRootBridge() and UninitRootBridge() reflect that
    the PCI_ROOT_BRIDGE structure is allocated by the caller; only
    in-place initialization is necessary.

Additionally, macros are employed for standard PCI quantities, from
"MdePkg/Include/IndustryStandard/Pci22.h":

- MAX_PCI_DEVICE_NUMBER (31) is replaced with PCI_MAX_DEVICE (same),
- the constant 255 is replaced with PCI_MAX_BUS,
- the (RootBridgeNumber < 256) condition is replaced with
  (RootBridgeNumber <= PCI_MAX_BUS).

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.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>
8 years agoOvmfPkg: clone PciHostBridgeLib from MdeModulePkg's Null instance
Laszlo Ersek [Mon, 25 Jan 2016 19:33:32 +0000 (20:33 +0100)]
OvmfPkg: clone PciHostBridgeLib from MdeModulePkg's Null instance

In this patch we clone "MdeModulePkg/Library/PciHostBridgeLibNull" for
customization under OvmfPkg. Differences relative to a verbatim copy:

- the Null suffix is dropped from file names,
- the UNI file is dropped, together with the corresponding MODULE_UNI_FILE
  reference in the INF file,
- the INF file receives a new FILE_GUID,
- the top comments in the files mention OVMF, not a null instance.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.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>
8 years agoOvmfPkg: factor the MMIO aperture shared by all PCI root bridges into PCDs
Laszlo Ersek [Fri, 26 Feb 2016 15:29:19 +0000 (16:29 +0100)]
OvmfPkg: factor the MMIO aperture shared by all PCI root bridges into PCDs

Going forward, two modules will need to know about the aperture:
PlatformPei (as before), and OVMF's upcoming PciHostBridgeLib instance
(because the core PciHostBridgeDxe driver requires the library to state
the exact apertures for all root bridges).

On QEMU, all root bridges share the same MMIO aperture, hence one pair of
PCDs suffices.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.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>
8 years agoOvmfPkg: factor the IO aperture shared by all PCI root bridges into PCDs
Laszlo Ersek [Fri, 26 Feb 2016 15:29:19 +0000 (16:29 +0100)]
OvmfPkg: factor the IO aperture shared by all PCI root bridges into PCDs

At the moment we don't intend to customize this aperture at runtime, but
going forward, two modules will need to know about it: PlatformPei (as
before), and OVMF's upcoming PciHostBridgeLib instance (because the core
PciHostBridgeDxe driver requires the library to state the exact apertures
for all root bridges).

On QEMU, all root bridges share the same IO port aperture, hence one pair
of PCDs suffices.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.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>
8 years agoOvmfPkg: remove superfluous [PcdsFixedAtBuild] section header
Laszlo Ersek [Fri, 26 Feb 2016 15:24:35 +0000 (16:24 +0100)]
OvmfPkg: remove superfluous [PcdsFixedAtBuild] section header

At the location of this header an earlier [PcdsFixedAtBuild] section is in
effect already.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoMdeModulePkg: PciHostBridgeDxe: don't assume extended config space
Laszlo Ersek [Fri, 26 Feb 2016 22:09:46 +0000 (23:09 +0100)]
MdeModulePkg: PciHostBridgeDxe: don't assume extended config space

The "pc" ("pc-i440fx-*") machine types of QEMU don't support extended
config space. Accordingly, OVMF will use the following library instances
in connection with the core PciHostBridgeDxe driver:

  BasePciSegmentLibPci [class: PciSegmentLib]
    BasePciLibCf8      [class: PciLib]
      BasePciCf8Lib    [class: PciCf8Lib]

Add a new field to the PCI_ROOT_BRIDGE structure so that
RootBridgeIoCheckParameter() can catch config space offsets above 0xFF on
such old (emulated) platforms.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoMdeModulePkg: PciHostBridgeDxe: insert horizontal whitespace
Laszlo Ersek [Tue, 1 Mar 2016 10:04:59 +0000 (11:04 +0100)]
MdeModulePkg: PciHostBridgeDxe: insert horizontal whitespace

... in preparation for the next patch.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoMdeModulePkg/FvSimpleFs: don't open DevicePath with BY_DRIVER mode
Feng Tian [Wed, 2 Mar 2016 01:45:06 +0000 (09:45 +0800)]
MdeModulePkg/FvSimpleFs: don't open DevicePath with BY_DRIVER mode

The device path protocol doesn't get closed at FvSimpleFilesystem
driver stop() when it's opened at start() with BY_DRIVER mode.

We change it to open DevicePath with GET_PROTOCOL mode as FV2 protocol with BY_DRIVER is enough.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
8 years agoShellPkg: Update 'ifconfig -r' implementation
Jiaxin Wu [Wed, 2 Mar 2016 07:58:25 +0000 (15:58 +0800)]
ShellPkg: Update 'ifconfig -r' implementation

This patch is used to update ifconfig -r implementation
to sync with UEFI Shell 2.2.

option -r means to reconfigure all or specified interface,
and set DHCP policy. If specified interface is already set
to DHCP, then refresh the IPv4 configuration.

If the interface name is specified
with '-r', DHCP DORA process will be triggered by the policy
transition (static -> dhcp).

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Carsey Jaben <jaben.carsey@intel.com>
Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
8 years agoShellPkg: Increase reallocation size for temp memory files
Jim_Dailey@Dell.com [Thu, 18 Feb 2016 15:51:33 +0000 (23:51 +0800)]
ShellPkg: Increase reallocation size for temp memory files

If data of any real size were to be piped from one command to another,
an inordinate amount of time could be taken up by reallocating memory
that is only 10 bytes bigger than what is currently needed. Also, this
could cause unwelcome memory fragmentation.

Added a define to control how much memory is reallocated beyond that
which is currently needed. Set it to 1K vs. the original 10 bytes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
8 years agoShellPkg: Do not write the UNICODE BOM on ConOut.
Jim_Dailey@Dell.com [Thu, 18 Feb 2016 14:47:07 +0000 (22:47 +0800)]
ShellPkg: Do not write the UNICODE BOM on ConOut.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
8 years agoShellPkg: Add FileSize member to shell memory file structure.
Jim_Dailey@Dell.com [Thu, 18 Feb 2016 14:40:46 +0000 (22:40 +0800)]
ShellPkg: Add FileSize member to shell memory file structure.

The shell uses the memory file structure to manage temporary files in
memory that support piping of output from one command into the the
input of another command.  The BufferSize member is the size of the
internal buffer, not the size of the data that was written to the
file. So, it was possible to read beyond the EOF of these files as
reads used BufferSize. Now FileSize tracks the actual size of these
files (the number of bytes written, not the number of bytes available
in the buffer), and the reads use this member.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
8 years agoBaseTools/LZMA: fix the format issue for last patch
Yonghong Zhu [Tue, 1 Mar 2016 04:41:30 +0000 (12:41 +0800)]
BaseTools/LZMA: fix the format issue for last patch

There are no functional changes in this patch. fixing the format base on
last commit.
The only change is 1) add back the blank line, which can help we better
compare with the original LZMA source code. 2) remove the indent of
#ifndef and #endif.

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 agoUefiCpuPkg/Application/Cpuid: Change DisplayFamily/DisplayModel type
Jeff Fan [Wed, 2 Mar 2016 02:05:44 +0000 (10:05 +0800)]
UefiCpuPkg/Application/Cpuid: Change DisplayFamily/DisplayModel type

Change DisplayFamily/DisplayModel type to UINT32 to avoid different size in
bitwise operation.

Cc: Qiu Shumin <shumin.qiu@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: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoUefiCpuPkg/Application/Cpuid: Remove unnecessary code check
Jeff Fan [Wed, 2 Mar 2016 02:00:31 +0000 (10:00 +0800)]
UefiCpuPkg/Application/Cpuid: Remove unnecessary code check

gMaximumBasicFunction is set to CPUID_SIGNATURE as below, so removed the compare
code.
UINT32  gMaximumBasicFunction = CPUID_SIGNATURE;

Cc: Qiu Shumin <shumin.qiu@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: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoUefiCpuPkg/CpuMpPei: Load microcode if found newer revision
Jeff Fan [Wed, 2 Mar 2016 01:45:14 +0000 (09:45 +0800)]
UefiCpuPkg/CpuMpPei: Load microcode if found newer revision

Current implementation only loads the latest revision if there is no microcode
loaded. Per IA32 User Manual, we should load the newer revision by comparing
the existing microcode loaded with the updating revision.

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>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoEmulatorPkg: Use UEFI Shell by default
Jordan Justen [Tue, 1 Mar 2016 23:39:43 +0000 (15:39 -0800)]
EmulatorPkg: Use UEFI Shell by default

Now we will build the UEFI shell from source and include it in the
EmulatorPkg build.

USE_OLD_SHELL can be defined on the command line to force using the
old shell.

Fixes: https://github.com/tianocore/edk2/issues/60
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoShellPkg: Revert git 'd6cf1af9' fix
Jiaxin Wu [Thu, 25 Feb 2016 03:09:17 +0000 (11:09 +0800)]
ShellPkg: Revert git 'd6cf1af9' fix

'd6cf1af9' is associated with '3d0a49ad' commit. So, this patch is
used to respond the revert for '3d0a49ad' to adapt the Ipv4 config
policy update.

Cc: Subramanian Sriram <sriram-s@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>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
8 years agoNetworkPkg: Revert git 'eb213f2f' fix
Jiaxin Wu [Thu, 25 Feb 2016 03:06:14 +0000 (11:06 +0800)]
NetworkPkg: Revert git 'eb213f2f' fix

'eb213f2f' is associated with '3d0a49ad' commit. So, this patch is
used to respond the revert for '3d0a49ad' to adapt the Ipv4 config
policy update.

Cc: Subramanian Sriram <sriram-s@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>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
8 years agoNetworkPkg: Change the default IPv6 config policy
Jiaxin Wu [Thu, 25 Feb 2016 02:52:13 +0000 (10:52 +0800)]
NetworkPkg: Change the default IPv6 config policy

The default policy for Ip6Config is Ip6ConfigPolicyAutomatic,
which results in all NIC ports starting SARR process when it
receives RA message with M flag from IPv6 router. So, this
patch is used to changes the the default IPv6 config policy to
Ip6ConfigPolicyManualand also defer the SetData operation after
Ip6ConfigProtocol installed. This update let the other platform
drivers have chance to change the default config data by consume
Ip6ConfigProtocol.

Cc: Subramanian Sriram <sriram-s@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>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Subramanian Sriram <sriram-s@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
8 years agoMdeModulePkg: Change the default IPv4 config policy
Jiaxin Wu [Thu, 25 Feb 2016 02:48:58 +0000 (10:48 +0800)]
MdeModulePkg: Change the default IPv4 config policy

Git version '3d0a49ad' commit provided a scenario to resolve the
performance issue for IPv4, but it's not workable for IPv6. To
avoid IPv4 and IPv6 inconsistency, we decided to revert that version
fix.

If so, the default policy for Ip4Config2 is Ip4Config2PolicyDhcp,
which results in all NIC ports attempting DHCP. So, this patch is
used to changes the the default IPv4 config policy to
Ip4Config2PolicyStatic and also defer the SetData operation after
Ip4Config2Protocol installed. This update let the other platform
drivers have chance to change the default config data by consume
Ip4Config2Protocol.

Cc: Subramanian Sriram <sriram-s@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>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Subramanian Sriram <sriram-s@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
8 years agoMdeModulePkg: Add ASSERT to make sure pointers are not NULL
Dandan Bi [Mon, 29 Feb 2016 07:08:56 +0000 (15:08 +0800)]
MdeModulePkg: Add ASSERT to make sure pointers are not NULL

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: FileExplorerLib: Modify the EFI_FILE_EXPLORE_FORMSET_GUID
Dandan Bi [Tue, 1 Mar 2016 06:36:46 +0000 (14:36 +0800)]
MdeModulePkg: FileExplorerLib: Modify the EFI_FILE_EXPLORE_FORMSET_GUID

Currently the EFI_FILE_EXPLORE_FORMSET_GUID value in BdsDxe in
IntelFrameworkModulePkg is same with the GUID VALUE in FileExplorerLib.
This patch is to modify the EFI_FILE_EXPLORE_FORMSET_GUID in
FileExplorerLib to avoid potential issue.

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 agoOvmfPkg: copy log level comments from DebugLib.h
Laszlo Ersek [Tue, 1 Mar 2016 09:39:49 +0000 (10:39 +0100)]
OvmfPkg: copy log level comments from DebugLib.h

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: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoOmap35xxPkg: sync log level comments to DebugLib.h
Laszlo Ersek [Tue, 1 Mar 2016 09:28:50 +0000 (10:28 +0100)]
Omap35xxPkg: sync log level comments to DebugLib.h

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoBeagleBoardPkg: sync log level comments to DebugLib.h
Laszlo Ersek [Tue, 1 Mar 2016 09:28:50 +0000 (10:28 +0100)]
BeagleBoardPkg: sync log level comments to DebugLib.h

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoArmVirtPkg: sync log level comments to DebugLib.h
Laszlo Ersek [Tue, 1 Mar 2016 09:28:50 +0000 (10:28 +0100)]
ArmVirtPkg: sync log level comments to DebugLib.h

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoMdePkg: DebugLib: more cleanup for log level comments in lib class header
Laszlo Ersek [Tue, 1 Mar 2016 09:07:31 +0000 (10:07 +0100)]
MdePkg: DebugLib: more cleanup for log level comments in lib class header

The DEBUG_POOL and DEBUG_PAGE clarifications were suggested by Leif
Lindholm.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoMdeModulePkg: FileExplorerLib: Add check when to call FreePool function
Dandan Bi [Mon, 29 Feb 2016 02:08:47 +0000 (10:08 +0800)]
MdeModulePkg: FileExplorerLib: Add check when to call FreePool function

when free up resource allocated for a MenuEntry, there exists
the case that the DevicePath and DisplayString are NULL,
so before calling FreePool function, need to check.

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 agoShellPkg: Don't strip BOM when piping UCS2 data to a UEFI app
Jim_Dailey@Dell.com [Tue, 1 Mar 2016 21:02:19 +0000 (13:02 -0800)]
ShellPkg: Don't strip BOM when piping UCS2 data to a UEFI app

If the BOM is stripped from StdIn, then an app that duplicates StdIn
will not be able to duplicate, say, a UCS2 file that was piped into
it (the output file it creates would not start with a BOM).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>
8 years agoArmPlatformPkg/PL180MciDxe: don't check ID_REG3
Ryan Harkin [Tue, 1 Mar 2016 08:23:20 +0000 (08:23 +0000)]
ArmPlatformPkg/PL180MciDxe: don't check ID_REG3

TC2 reads 0x02 for the PL180 ID3 register instead of 0x00 as defined in
the spec.

However, the spec [1] states that the contents of ID3 register represent
the "configuration option of the peripheral" and thus not part of the
Prime Cell identification.

For this patch, we drop checking the value in MCI_PERIPH_ID_REG3.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0172a/index.html

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
8 years agoArmPlatformPkg/PL180MciDxe: warn on probe fail
Ryan Harkin [Tue, 1 Mar 2016 08:20:40 +0000 (08:20 +0000)]
ArmPlatformPkg/PL180MciDxe: warn on probe fail

If the PL180 fails to probe, issue a warning on debug builds.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
8 years agoArmPlatformPkg/PL180MciDxe: fix Depex for TC2
Ryan Harkin [Tue, 1 Mar 2016 07:44:39 +0000 (07:44 +0000)]
ArmPlatformPkg/PL180MciDxe: fix Depex for TC2

PL180 on TC2 has a dependency on gEfiCpuArchProtocolGuid.  Without
adding the dependency, TC2 will crash in the PL180 driver.

This problem has been present since d340ef7 when TC2 stopped booting.
However, it was masked by 300fc77 which prevented PL180 from running on
TC2 due to TC2 using a version on PL180 newer than that documented
publicly.

[1] https://github.com/tianocore/edk2/commit/d340ef7
2014-08-26
ArmPkg/ArmArchTimerLib: Remove non required [depex] and IoLib
[2] https://github.com/tianocore/edk2/commit/300fc77
2015-08-25
ArmPlatformPkg/PL180MciDxe: check PrimeCell ID before initializing

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
8 years agoArmPlatformPkg: delete orphaned ArmVExpress.dsc.inc
Leif Lindholm [Tue, 1 Mar 2016 10:13:06 +0000 (10:13 +0000)]
ArmPlatformPkg: delete orphaned ArmVExpress.dsc.inc

In the recent migration of the ARM Ltd. platforms to
https://git.linaro.org/uefi/OpenPlatformPkg.git, this file unfortunately
got left behind. Delete it to reduce confusion and (further) risk of
duplication of effort.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoMdeModulePkg: DxeCore: fully initialize image context before passing it on
Ard Biesheuvel [Mon, 29 Feb 2016 16:08:45 +0000 (17:08 +0100)]
MdeModulePkg: DxeCore: fully initialize image context before passing it on

When the DXE core is loaded, it invokes the PeCoffExtraActionLib library
function 'PeCoffLoaderRelocateImageExtraAction' explicitly, which may be
in addition to the same function having been called by the DxeIpl PE/COFF
loader instance.

The ImageContext that DXE core presents to this function is only partially
initialized, which may result in the following output on AArch64 systems:

add-symbol-file ..MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll 0x5F226240
<some intermediate output>
add-symbol-file ..MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll 0x5F226000

This is caused by incorrect data in the ImageContext structure, which means
the start of the .text section is calculated incorrectly. In general, it is
the duty of the caller to present a valid ImageContext structure, so let's
add the missing values before invoking PeCoffLoaderRelocateImageExtraAction().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoMdePkg: fix comment typo in DebugLib.h
Leif Lindholm [Mon, 29 Feb 2016 19:42:41 +0000 (19:42 +0000)]
MdePkg: fix comment typo in DebugLib.h

The definition of DEBUG_LOADFILE was incorrectly described as "UNDI
Driver". Correct this to align with MdePkg.dec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoMdeModulePkg/NvmExpress: Fix uninitialized field used in NVMe DiskInfo
Tian, Feng [Mon, 29 Feb 2016 05:12:38 +0000 (13:12 +0800)]
MdeModulePkg/NvmExpress: Fix uninitialized field used in NVMe DiskInfo

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: Add new API HttpUrlGetPath() to HttpLib.h
Fu Siyuan [Mon, 29 Feb 2016 05:51:02 +0000 (13:51 +0800)]
MdeModulePkg: Add new API HttpUrlGetPath() to HttpLib.h

This patch is to add a new interface to get the "Path" component according to
the URI parse result, it would be helpful for the library user to extract the
file path value in a URI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
8 years agoEmbeddedPkg/AndroidFastboot: fix size with 64bit
Haojian Zhuang [Mon, 29 Feb 2016 14:51:50 +0000 (22:51 +0800)]
EmbeddedPkg/AndroidFastboot: fix size with 64bit

Since there's percentage calcution, multiply on 32bit variable
will cause overflow. So fix the variables as 64bit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
8 years agoMdeModulePkg/HiiDatabaseDxe: Fix a variable is uninitialized.
Cinnamon Shia [Mon, 22 Feb 2016 02:53:14 +0000 (10:53 +0800)]
MdeModulePkg/HiiDatabaseDxe: Fix a variable is uninitialized.

The StringSize variable in the FindStringBlock function is a IN OUT
parameter of the GetUnicodeStringTextOrSize function.
Thought the GetUnicodeStringTextOrSize function changes the value of
the StringSize variable, it is better to initialize the StringSize
variable before passing it to the GetUnicodeStringTextOrSize function.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
8 years agoMdeModulePkg: PciHostBridgeLibNull: rewrap source to 79 characters
Laszlo Ersek [Mon, 25 Jan 2016 19:47:35 +0000 (20:47 +0100)]
MdeModulePkg: PciHostBridgeLibNull: rewrap source to 79 characters

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoBaseTools: fix LzmaCompress VS2013 make failure
Yonghong Zhu [Mon, 29 Feb 2016 03:18:12 +0000 (11:18 +0800)]
BaseTools: fix LzmaCompress VS2013 make failure

when make BaseTools by VS2013, LzmaEnc.c report warning C4127:
conditional expression is constant, so this patch fix this issue.

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: Update PeiCore dispatcher to handle PEIM and PEI_CORE only
Liming Gao [Sat, 6 Feb 2016 01:02:57 +0000 (09:02 +0800)]
MdeModulePkg: Update PeiCore dispatcher to handle PEIM and PEI_CORE only

When PcdShadowPeimOnBoot is FALSE, they are not copied to memory and
execute from their original locations. Here, this policy should only
apply for PEIM and PEI_CORE, not for other file type, such as DXE_CORE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Tested-by: Eugene Cohen <eugene@hp.com>
8 years agoMdeModulePkg RamDiskDxe: Install Block I/O 2 Protocol on RAM disk devices
Hao Wu [Wed, 17 Feb 2016 03:25:14 +0000 (11:25 +0800)]
MdeModulePkg RamDiskDxe: Install Block I/O 2 Protocol on RAM disk devices

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoMdeModulePkg: Add RamDiskDxe driver implementation
Hao Wu [Wed, 3 Feb 2016 06:14:47 +0000 (14:14 +0800)]
MdeModulePkg: Add RamDiskDxe driver implementation

The RamDiskDxe driver will:
1. Produce the EFI RAM Disk Protocol
2. Install RAM disk device path and block I/O related protocols on the
   RAM disk device handle.
3. Install RAM disk configuration form to HII database

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
8 years agoMdeModuelPkg/PciBus: Return AddrTranslationOffset in GetBarAttributes
Ruiyu Ni [Wed, 17 Feb 2016 10:06:36 +0000 (18:06 +0800)]
MdeModuelPkg/PciBus: Return AddrTranslationOffset in GetBarAttributes

Some platform doesn't use CPU(HOST)/Device 1:1 mapping for PCI Bus.
But PCI IO doesn't have interface to tell caller (device driver)
whether the address returned by GetBarAttributes() is HOST address
or device address.
UEFI Spec 2.6 addresses this issue by clarifying the address returned
is HOST address and caller can use AddrTranslationOffset to calculate
the device address.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoMdeModulePkg/PciBus: reorganize case-statement to reduce code lines
Ruiyu Ni [Wed, 24 Feb 2016 08:02:18 +0000 (16:02 +0800)]
MdeModulePkg/PciBus: reorganize case-statement to reduce code lines

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoMdeModulePkg/PciBus: Change local variable AddressSpace to Descriptor
Ruiyu Ni [Mon, 15 Feb 2016 06:53:05 +0000 (14:53 +0800)]
MdeModulePkg/PciBus: Change local variable AddressSpace to Descriptor

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8 years agoMdeModulePkg: Add missing PCD usage information string.
Qiu Shumin [Fri, 26 Feb 2016 08:37:20 +0000 (16:37 +0800)]
MdeModulePkg: Add missing PCD usage information string.

For new PCDs add their usage information strings in UNI file.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoSecurityPkg: Tcg2Smm: Change TPM2.0 MMIO range attribute
Zhang, Chao B [Mon, 29 Feb 2016 01:17:03 +0000 (09:17 +0800)]
SecurityPkg: Tcg2Smm: Change TPM2.0 MMIO range attribute

Change TPM2.0 MMIO resource attribute to ReadWrite according to TCG PC Client Platform Firmware Profile Spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anbazhagan Baraneedharan <anbazhagan@hp.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
8 years agoMdeModulePkg:Fix a robustness issue of Mnp Driver
Zhang Lubo [Wed, 24 Feb 2016 03:54:53 +0000 (11:54 +0800)]
MdeModulePkg:Fix a robustness issue of Mnp Driver

v3:
*
When there exists duplicate items in VLAN variable , save the correct
variable content back to the variable storage after duplicate items are removed

Duplicate items in VLAN variable will cause MNP driver binding
start function fall into infinite loop,so we should check it's
content before using it.

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: Wu Jiaxin <jiaxin.wu@intel.com>
8 years agoUefiCpuPkg/Cpuid: Fix GCC build error
Hao Wu [Fri, 26 Feb 2016 08:43:02 +0000 (16:43 +0800)]
UefiCpuPkg/Cpuid: Fix GCC build error

define PRINT_BIT_FIELD(Variable, FieldName) \
  Print (L"%5a%42a: %x\n", #Variable, #FieldName, \
  ##Variable.Bits.##FieldName);

The above definition in UefiCpuPkg/Application/Cpuid/Cpuid.c
will cause GCC build error.

Fix it with:

define PRINT_BIT_FIELD(Variable, FieldName) \
  Print (L"%5a%42a: %x\n", #Variable, #FieldName, \
  Variable.Bits.FieldName);

The '.' has its origin meaning as a member operator in the define
statement. Thus, the token-pasting operator '##' is not necessary here.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
8 years agoShellPkg: Fix unexpected behavior of mouse cursor in Editor.
Qiu Shumin [Fri, 26 Feb 2016 06:52:18 +0000 (14:52 +0800)]
ShellPkg: Fix unexpected behavior of mouse cursor in Editor.

USB mouse cursor cannot move unless the left button is down. The patch
refresh the FileBuffer of Editor every time when the 'MainEditorRefresh'
is called to fix this bug.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
8 years agoCorebootModulePkg-CbParseLib: Fix bad reference in CbParseLib
Leahy, Leroy P [Thu, 25 Feb 2016 02:55:51 +0000 (18:55 -0800)]
CorebootModulePkg-CbParseLib: Fix bad reference in CbParseLib

Dereferencing pMemTableSize in debug statement displays bad values when
it is set to NULL.  Display the actual table size value instead.

TEST=Build and run on Galileo Gen2

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
8 years agoCorebootModulePkg-CbParseLib: Add ACPI table verification
Leahy, Leroy P [Thu, 25 Feb 2016 02:53:31 +0000 (18:53 -0800)]
CorebootModulePkg-CbParseLib: Add ACPI table verification

Verify the register address in the FADT.

TEST=Build and run on Galileo Gen2 when the FADT was not present.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
8 years agoMdeModulePkg: RegularExpressionDxe: support free(NULL)
Laszlo Ersek [Wed, 24 Feb 2016 20:00:04 +0000 (21:00 +0100)]
MdeModulePkg: RegularExpressionDxe: support free(NULL)

The ISO C standard says about free(),

  If ptr is a null pointer, no action occurs.

This is not true of the FreePool() interface of the MemoryAllocationLib
class:

  Buffer must have been allocated on a previous call to the pool
  allocation services of the Memory Allocation Library. [...] If Buffer
  was not allocated with a pool allocation function in the Memory
  Allocation Library, then ASSERT().

Therefore we must not forward the argument of free() to FreePool() without
checking.

Cc: Cecil Sheng <cecil.sheng@hpe.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Cc: Yao Jiewen <Jiewen.Yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-By: Cinnamon Shia <cinnamon.shia@hpe.com>
8 years agoArmPlatformPkg: PL061 - rewrite the hardware interaction
Leif Lindholm [Wed, 28 Oct 2015 18:11:49 +0000 (18:11 +0000)]
ArmPlatformPkg: PL061 - rewrite the hardware interaction

The PL061 GPIO controller is a bit of an anachronism, and the existing
driver does nothing to hide this - leading to it being very tricky to
read.

Rewrite it to document (in comments and code) what is actually
happening, and fix some bugs in the process.

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: Ryan Harkin <ryan.harkin@linaro.org>
8 years agoArmPlatformPkg: PL061 - drop pointless initialize function
Leif Lindholm [Wed, 10 Feb 2016 16:38:26 +0000 (16:38 +0000)]
ArmPlatformPkg: PL061 - drop pointless initialize function

PL061Initialize() did not actually do anything other than call
PL061Identify() - so cut out the middle man.

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: Ryan Harkin <ryan.harkin@linaro.org>
8 years agoArmPlatformPkg: PL061 - only initialize on protocol load
Leif Lindholm [Wed, 28 Oct 2015 18:08:53 +0000 (18:08 +0000)]
ArmPlatformPkg: PL061 - only initialize on protocol load

For whatever reason, every single operation on the PL061 looked for an
"Initialized" flag, and manually called the initialization function if
not set. Move this to a single call on protocol installation.

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: Ryan Harkin <ryan.harkin@linaro.org>
8 years agoArmPlatformPkg: PL061 - reformat copyright statement.
Leif Lindholm [Wed, 28 Oct 2015 18:00:16 +0000 (18:00 +0000)]
ArmPlatformPkg: PL061 - reformat copyright statement.

The copyright statement in PL061Gpio.c would not fit on a normal terminal
screen. Break lines at <= 80 characters.

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: Ryan Harkin <ryan.harkin@linaro.org>
8 years agoMdeModulePkg: AcpiTableDxe: fix VS2008 build by merging adjacent if blocks
Ard Biesheuvel [Thu, 25 Feb 2016 16:20:21 +0000 (17:20 +0100)]
MdeModulePkg: AcpiTableDxe: fix VS2008 build by merging adjacent if blocks

The assignment of CurrentRsdtEntry and its subsequent dereference are
subject to the same condition, but for some reason, VS2008 does not see
that and warns about the dereference possibly involving an uninitialized
pointer. Since the single statememt between the blocks is unrelated, we
can just move it and merge the two conditional blocks together.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoMdeModulePkg/PciHostBridge: Don't assume resources are fully NonExistent
Ruiyu Ni [Thu, 25 Feb 2016 09:13:31 +0000 (17:13 +0800)]
MdeModulePkg/PciHostBridge: Don't assume resources are fully NonExistent

The patch removes the assumption that the resources claimed by root
bridges should not exist. Because resources might have been added:
1. by platform modules either in PEI through resource HOB, or in DXE,
   before the PCI host bridge driver runs.
2. Resources claimed by different root bridges may overlap so that
   resource adding operation for latter root bridges may fail if
   we assume the resource should not exist.

In real world, this patch is to fit OVMF platform needs because
different root bridges in OVMF platform shares the same resources.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
[lersek@redhat.com: intersection-based implementation]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoMdeModulePkg/PciHostBridge: Refine function header comments.
Ruiyu Ni [Thu, 25 Feb 2016 01:14:29 +0000 (09:14 +0800)]
MdeModulePkg/PciHostBridge: Refine function header comments.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
8 years agoSecurityPkg: Use FileExplorerLib in SecureBootConfigDxe
Dandan Bi [Thu, 28 Jan 2016 01:36:43 +0000 (09:36 +0800)]
SecurityPkg: Use FileExplorerLib in SecureBootConfigDxe

Using existing library FileExplorerLib to replace the same
logic in SecureBootConfigDxe to make the code clear. After using
FileExplorerLib, the UI behavior for enroll PK will change,
previously when select one PK file, commit/discard changes will
return to Device Manager,press ESC will return to FileExplorer.
Now using FileExplorerLib the behavior will keep same with
enroll KEK/DB/..., commit/discard changes will return to Custom
Secure Boot Options form and ESC will return to PK options form.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
8 years agoSecurityPkg: Add FileExplorerLib.inf to the dsc file
Dandan Bi [Wed, 24 Feb 2016 12:21:28 +0000 (20:21 +0800)]
SecurityPkg: Add FileExplorerLib.inf to the dsc file

Add FileExplorerLib to SecurePkg DSC to pass build,
as SecureBootConfigDxe requires this library now.

Cc: Chao Zhang <chao.b.zhang@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: Chao Zhang <chao.b.zhang@intel.com>
8 years agoVlv2TbltDevicePkg: Add FileExplorerLib.inf to the dsc file
Dandan Bi [Wed, 24 Feb 2016 12:20:24 +0000 (20:20 +0800)]
Vlv2TbltDevicePkg: Add FileExplorerLib.inf to the dsc file

Because SecureBootConfigDxe use FileExplorerLib now, but
FileExplorerLib is not in the dsc file of the package
that use SecureBootConfigDxe. Now add it to pass build.

Cc: David Wei <david.wei@intel.com>
Cc: Tim He <tim.he@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: David Wei <david.wei@intel.com>
8 years agoOvmfPkg: Add FileExplorerLib.inf to the dsc file
Dandan Bi [Wed, 24 Feb 2016 12:18:53 +0000 (20:18 +0800)]
OvmfPkg: Add FileExplorerLib.inf to the dsc file

Because SecureBootConfigDxe use FileExplorerLib now, but
FileExplorerLib is not in the dsc file of the package
that use SecureBootConfigDxe. Now add it to pass build.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.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: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoArmVirtPkg: Add FileExplorerLib.inf to the QEMU dsc files
Dandan Bi [Wed, 24 Feb 2016 12:15:52 +0000 (20:15 +0800)]
ArmVirtPkg: Add FileExplorerLib.inf to the QEMU dsc files

Because SecureBootConfigDxe use FileExplorerLib now, but
FileExplorerLib is not in the dsc files of the package
that use SecureBootConfigDxe. Now add it to pass build.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
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: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
8 years agoMdeModulePkg: Add ASSERT to make sure pointer 'OptionalData' not be NULL
Dandan Bi [Thu, 25 Feb 2016 07:09:39 +0000 (15:09 +0800)]
MdeModulePkg: Add ASSERT to make sure pointer 'OptionalData' not be NULL

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: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
8 years agoMdeModulePkg: Add ASSERT to make sure pointer 'MemoryMap' is not NULL.
Qiu Shumin [Thu, 25 Feb 2016 05:00:28 +0000 (13:00 +0800)]
MdeModulePkg: Add ASSERT to make sure pointer 'MemoryMap' is not NULL.

If 'CoreGetMemoryMap' return success the 'MemoryMap' shouldn't be NULL.
Add code to make sure this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Yao Jiewen <Jiewen.Yao@intel.com>
8 years agoDuetPkg-PciBusNoEnumerationDxe: Fix stack overflow
Lee Leahy [Fri, 26 Feb 2016 02:07:51 +0000 (10:07 +0800)]
DuetPkg-PciBusNoEnumerationDxe: Fix stack overflow

When a PCI bridge is not enabled, the secondary bus may still be zero.
This causes an infinite recursive call to enumerate bus 0 which results
in a stack overflow.  The easy fix is to skip the recursive bus
enumeration for bridges which do not have the secondary bus initialized.

TEST=Build and run CorebootPayloadPkg on Quark/Galileo Gen2

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoCryptoPkg: RuntimeCryptLib: support realloc(NULL, size)
Laszlo Ersek [Wed, 24 Feb 2016 20:00:04 +0000 (21:00 +0100)]
CryptoPkg: RuntimeCryptLib: support realloc(NULL, size)

The ISO C standard says about realloc(),

  If ptr is a null pointer, the realloc function behaves like the malloc
  function for the specified size.

The realloc() implementation doesn't conform to this currently, so add a
check and call malloc() if appropriate.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>
8 years agoCryptoPkg: RuntimeCryptLib: support free(NULL)
Laszlo Ersek [Wed, 24 Feb 2016 20:00:04 +0000 (21:00 +0100)]
CryptoPkg: RuntimeCryptLib: support free(NULL)

The ISO C standard says about free(),

  If ptr is a null pointer, no action occurs.

This is not true of the RuntimeFreeMem() internal function. Therefore we
must not forward the argument of free() to RuntimeFreeMem() without
checking.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>
8 years agoCryptoPkg: BaseCryptLib: support free(NULL)
Laszlo Ersek [Wed, 24 Feb 2016 20:00:04 +0000 (21:00 +0100)]
CryptoPkg: BaseCryptLib: support free(NULL)

The ISO C standard says about free(),

  If ptr is a null pointer, no action occurs.

This is not true of the FreePool() interface of the MemoryAllocationLib
class:

  Buffer must have been allocated on a previous call to the pool
  allocation services of the Memory Allocation Library. [...] If Buffer
  was not allocated with a pool allocation function in the Memory
  Allocation Library, then ASSERT().

Therefore we must not forward the argument of free() to FreePool() without
checking.

This bug can be triggered by upstream OpenSSL commit 8e704858f219
("RT3955: Reduce some stack usage"), for example.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>
8 years agoMdePkg: Add EFI RAM Disk Protocol definitions
Hao Wu [Wed, 3 Feb 2016 04:58:01 +0000 (12:58 +0800)]
MdePkg: Add EFI RAM Disk Protocol definitions

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: M1cha <sigmaepsilon92@gmail.com>
8 years agoMdePkg: Update Http11 with additional useful definitions
Samer El-Haj-Mahmoud [Thu, 18 Feb 2016 22:47:07 +0000 (06:47 +0800)]
MdePkg: Update Http11 with additional useful definitions

Add additional HTTP 1.1 definitions that are useful in HTTP
applications, such as User-Agent, Location, and x-Auth-Token

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
8 years agoNetworkPkg: Use Http11 definitions in HttpDxe and HttpBootDxe
Samer El-Haj-Mahmoud [Thu, 18 Feb 2016 22:47:36 +0000 (06:47 +0800)]
NetworkPkg: Use Http11 definitions in HttpDxe and HttpBootDxe

Change HttpDxe and HttpBootDxe to use the standard definitions from
Http11.h instead of private duplicate definitions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
8 years agoMdeModulePkg: Add submitted callback test case in DriverSample
Dandan Bi [Tue, 23 Feb 2016 03:04:20 +0000 (11:04 +0800)]
MdeModulePkg: Add submitted callback test case in DriverSample

Now we add new HII action type EFI_BROWSER_ACTION_SUBMITTED in
EFI HII Configuration Access Protocol, so add the test case in
DriverSample to show how to use it and whether it works.

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: Add new HII action type EFI_BROWSER_ACTION_SUBMITTED
Dandan Bi [Tue, 23 Feb 2016 02:59:10 +0000 (10:59 +0800)]
MdeModulePkg: Add new HII action type EFI_BROWSER_ACTION_SUBMITTED

Add new HII action type EFI_BROWSER_ACTION_SUBMITTED
to notify HII driver when its question values are submitted.

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 agoMdePkg: Add new HII action type EFI_BROWSER_ACTION_SUBMITTED
Dandan Bi [Tue, 23 Feb 2016 02:46:44 +0000 (10:46 +0800)]
MdePkg: Add new HII action type EFI_BROWSER_ACTION_SUBMITTED

Base on the UEFI2.6, Add the new HII action type
EFI_BROWSER_ACTION_SUBMITTED to notify HII driver
when its question values are submitted.

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 agoUefiCpuPkg/Cpuid: Add UEFI CPUID application
Michael Kinney [Fri, 19 Feb 2016 07:16:02 +0000 (23:16 -0800)]
UefiCpuPkg/Cpuid: Add UEFI CPUID application

Add UEFI application to UefiCpuPkg to display all supported CPUID
leafs and sub-leafs described by UefiCpuPkg/Include/Register/Cpuid.h
that is based on information from Intel(R) 64 and IA-32
Architectures Software Developer's Manual, Volume 2A, December
2015, CPUID instruction.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
8 years agoUefiCpuPkg/Cpuid.h: Add CPUID leaf/sub-leaf defines and structures
Michael Kinney [Fri, 19 Feb 2016 07:15:48 +0000 (23:15 -0800)]
UefiCpuPkg/Cpuid.h: Add CPUID leaf/sub-leaf defines and structures

Add CPUID leaf and sub-leaf indexes and structures as described by
Intel(R) 64 and IA-32 Architectures Software Developer's Manual,
Volume 2A, December 2015, CPUID instruction.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
8 years agoBaseTools/tools_def.txt: Add -march=i586 for IA32 GCC targets
Michael Kinney [Tue, 23 Feb 2016 00:46:06 +0000 (16:46 -0800)]
BaseTools/tools_def.txt: Add -march=i586 for IA32 GCC targets

Newer GCC compilers use a default of march higher than i586
for -m32 (IA32 configuration) and this is causing generation of
instructions that are not compatible with all IA32 targets.
Specically Galileo platform support in the QuarkPlatformPkg does
not boot if GCC48 or higher is used.

This is similar to the following checkin that was done to address
this same issue for VS2012 and higher tool chains:

SHA-1: 71028ba2c4c398d70475504e671d048d9003d90f

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leroy Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoMdeModulePkg: Fix Memory Attributes table type issue
Jiewen Yao [Tue, 23 Feb 2016 04:43:57 +0000 (12:43 +0800)]
MdeModulePkg: Fix Memory Attributes table type issue

According to the spec, each entry in the Memory
Attributes table shall have the same type as
the region it was carved out of in the UEFI memory map.
The current attribute uses RTData for PE Data, but
it should be RTCode.

This patch fixed the issue. It is validated with or
without PropertiesTable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoMdeModulePkg: Fix the build fail issue on VS2008\VS2010\GCC
Dandan Bi [Wed, 24 Feb 2016 01:03:22 +0000 (09:03 +0800)]
MdeModulePkg: Fix the build fail issue on VS2008\VS2010\GCC

This is caused by my last commit,the LoadOption may
not initialize when call FreePool, and after investigation,
find that we can delete the LoadOption variable, this patch
is to fix this issue.

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 agoMdePkg: Add definition for new warning code EFI_WARN_FILE_SYSTEM.
Fu Siyuan [Mon, 15 Feb 2016 05:57:41 +0000 (13:57 +0800)]
MdePkg: Add definition for new warning code EFI_WARN_FILE_SYSTEM.

Add the definition for the new return status code defined in UEFI 2.6.

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: Liming Gao <liming.gao@intel.com>
8 years agoOvmfPkg: add driver for Virtio-RNG device
Ard Biesheuvel [Wed, 24 Feb 2016 08:27:30 +0000 (09:27 +0100)]
OvmfPkg: add driver for Virtio-RNG device

This adds the new Virtio-RNG DXE module to all three builds of
OvmfPkg. Note that QEMU needs to be invoked with the 'device
virtio-rng-pci' option in order for this device to be exposed to
the guest.

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: ArmVirtQemu: add driver for Virtio-RNG device
Ard Biesheuvel [Mon, 22 Feb 2016 07:52:15 +0000 (08:52 +0100)]
ArmVirtPkg: ArmVirtQemu: add driver for Virtio-RNG device

This adds the new Virtio-RNG DXE module to the default build of
ArmVirtQemu. Note that QEMU needs to be invoked with the 'device
virtio-rng-pci' option in order for this device to be exposed to
the guest.

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: implement UEFI driver for Virtio RNG devices
Ard Biesheuvel [Fri, 19 Feb 2016 10:43:12 +0000 (11:43 +0100)]
OvmfPkg: implement UEFI driver for Virtio RNG devices

This implements a UEFI driver model driver for Virtio devices of type
VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and exposes them via instances of
the EFI_RNG_PROTOCOL protocol, supporting the EFI_RNG_ALGORITHM_RAW
algorithm only.

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: VirtioFlush(): return the number of bytes written by the host
Laszlo Ersek [Fri, 19 Feb 2016 17:15:07 +0000 (18:15 +0100)]
OvmfPkg: VirtioFlush(): return the number of bytes written by the host

VirtioLib provides an API for simple, synchronous (request/response-style)
virtio communication. The guest driver builds one descriptor chain, link
for link, with VirtioPrepare() and VirtioAppendDesc(), then submits the
chain, and awaits the processing, with VirtioFlush().

The descriptor chain is always built at the beginning of the descriptor
area, with the head descriptor having descriptor index 0.

In order to submit the descriptor chain to the host, the guest always
pushes a new "available element" to the Available Ring, in genuine
queue-like fashion, with the new element referencing the head descriptor
(which always has index 0, see above).

In turn, after processing, the host always pushes a new "used element" to
the Used Ring, in genuine queue-like fashion, with the new element
referencing the head descriptor of the chain that was just processed. The
same element also reports the number of bytes that the host wrote,
consecutively across the host-writeable buffers that were linked by the
descriptors.

(See "OvmfPkg/VirtioNetDxe/TechNotes.txt" for a diagram about the
descriptor area and the rings.)

Because at most one descriptor chain can be in flight with VirtioLib at
any time,

- the Available Ring and the Used Ring proceed in lock-step,

- and the head descriptor that the new "available" and "used" elements can
  ever reference has index 0.

Based on the above, we can modify VirtioFlush() to return the number of
bytes written by the host across the descriptor chain. The virtio-block
and virtio-scsi drivers don't care (they have other ways to parse the data
produced by the host), while the virtio-net driver doesn't use
VirtioFlush() at all (it employs VirtioLib only to set up its rings).

However, the virtio entropy device,  to be covered in the upcoming
patches, reports the amount of randomness produced by the host only
through this quantity.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoArmPlatformPkg/IntelBds: call BdsLibConnectAll()
Leif Lindholm [Wed, 25 Nov 2015 17:24:29 +0000 (17:24 +0000)]
ArmPlatformPkg/IntelBds: call BdsLibConnectAll()

Currently, we don't pick up removable media (USB drives) or storage
devices connected via plug-in cards. Take the sledge hammer approach
for now.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoArmVirtPkg/ArmVirtQemu: limit ACPI support to v5.0 and higher
Ard Biesheuvel [Thu, 18 Feb 2016 19:51:08 +0000 (20:51 +0100)]
ArmVirtPkg/ArmVirtQemu: limit ACPI support to v5.0 and higher

The ACPI spec predates the AARCH64 architecture by 5 versions, so there
is no point in supporting anything below v5.0. So set the PCD that
controls the ACPI table generation to the appropriate value.

Note that the current consumers of this PCD only check whether bit 1
is set or not (i.e., ACPI v1.0b), but this may change in the future,
so let's choose a meaningful value right away.

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 agoMdeModulePkg: AcpiTableDxe: make 4 GB table allocation limit optional
Ard Biesheuvel [Wed, 17 Feb 2016 14:37:58 +0000 (15:37 +0100)]
MdeModulePkg: AcpiTableDxe: make 4 GB table allocation limit optional

AARCH64 systems never require compatibility with legacy ACPI OSes, and
may not have any 32-bit addressable system RAM. To support ACPI on these
systems, we need to be able to relax the 4 GB allocation restriction.

So add a PCD PcdAcpiExposedTableVersions containing a bitmask describing
which ACPI versions are targeted, and wire it up it up to the memory
allocation calls in AcpiTableDxe/AcpiTableProtocol.c. I.e., if ACPI v1.0b
is not among the supported versions, the memory allocations are not limited
to 4 GB, and only table types that carry 64-bit addresses are emitted.

Note that this will inhibit the publishing of any tables that carry only
32-bit addresses, i.e., RSDPv1, RSDTv1 and RSDTv3.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoMdeModulePkg: Add sample help information for HelloWorld application.
Qiu Shumin [Sun, 21 Feb 2016 07:55:14 +0000 (15:55 +0800)]
MdeModulePkg: Add sample help information for HelloWorld application.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
8 years agoShellPkg: Support finding help message embedded in resource section.
Qiu Shumin [Sun, 21 Feb 2016 07:52:53 +0000 (15:52 +0800)]
ShellPkg: Support finding help message embedded in resource section.

UEFI Shell scandalizes the help message in spec level so that a standalone
UEFI shell application can never get "-?" switch, instead the Shell core
(interpreter) detects the "-?" and finds .MAN file for that shell
application in certain spec defined paths, then show the help extracted
from that .MAN file.

But it means distributing a UEFI shell application not only means
distributing a .EFI file but also distributing a .MAN file. If the text
formatted .MAN file is corrupted (edited by user by mistake), or is
missing (deleted by user by mistake), no help will be shown to user.

So this patch enhance the Shell to make it support finding help message
imbedded in resource section of application image.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
8 years agoMdeModulePkg/UsbBusDxe: Fix memory leak
Alcantara, Paulo [Mon, 8 Feb 2016 20:53:34 +0000 (04:53 +0800)]
MdeModulePkg/UsbBusDxe: Fix memory leak

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paulo Alcantara <paulo.alc.cavalcanti@hp.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
8 years agoMdePkg: BaseLib: fix AArch64 DAIF interrupt mask definitions
Cohen, Eugene [Mon, 22 Feb 2016 21:59:52 +0000 (21:59 +0000)]
MdePkg: BaseLib: fix AArch64 DAIF interrupt mask definitions

The AArch64 DAIF bits are different for reading (mrs) versus writing (msr).
The bitmask definitions assumed they were the same causing incorrect
results when trying to determine the current interrupt state through
GetInterruptState.

The logic for interpreting the DAIF read data using the csel instruction
was also incorrect and is fixed.

Replaced the magic numbers in DisableInterrupts.S and EnableInterrupts.S
with definitions for the DAIF write (daifset/daifclr) IRQ field.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoArmPkg: CpuDxe: don't track interrupt state in a global variable
Cohen, Eugene [Mon, 22 Feb 2016 23:08:27 +0000 (23:08 +0000)]
ArmPkg: CpuDxe: don't track interrupt state in a global variable

Update the CpuDxe driver to remove an assumption that it is the only
component modifying interrupt state since this can be done through BaseLib
as well. Instead of using a global variable for last interrupt state we
now check the current PSTATE value directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
8 years agoArmPkg: CpuDxe: fix AArch64 interrupt read masks
Cohen, Eugene [Mon, 22 Feb 2016 23:08:27 +0000 (23:08 +0000)]
ArmPkg: CpuDxe: fix AArch64 interrupt read masks

The AArch64 DAIF bits are different for reading (mrs) versus writing
(msr). The bitmask definitions assumed they were the same causing
incorrect results when trying to determine the current interrupt
state through ArmGetInterruptState.

The logic for interpreting the DAIF read data using the csel instruction
was also incorrect and is fixed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>