]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
9 years agoAdd UINT16/32/64 array and DSC include support.
Ma, Maurice [Wed, 4 Mar 2015 01:03:20 +0000 (01:03 +0000)]
Add UINT16/32/64 array and DSC include support.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Ma, Maurice" <maurice.ma@intel.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17003 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg: replace strict XenHypercallLib construction with explicit query
Laszlo Ersek [Tue, 3 Mar 2015 08:13:40 +0000 (08:13 +0000)]
OvmfPkg: replace strict XenHypercallLib construction with explicit query

XenHypercallLib has two clients at the moment: XenBusDxe and
XenConsoleSerialPortLib. Currently, when XenBusDxe starts on a non-Xen X86
platform (ie. as part of OVMF not running on Xen), the X86XenHypercallLib
instance built into it fails to initialize, which triggers an ASSERT() in
auto-generated code.

Instead, let's call XenHypercallIsAvailable() in the driver's entry point,
and exit cleanly when the driver is started on a non-Xen platform.

Modify the constructor of XenConsoleSerialPortLib similarly; we shouldn't
proceed if Xen is not available. In practice this check should never fail,
because XenConsoleSerialPortLib is only used on ARM, and
ArmXenHypercallLib is always available; but nonetheless we should be
pedantic.

Reported-by: Gabriel L. Somlo <gsomlo@gmail.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17001 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg: XenHypercallLib: introduce XenHypercallIsAvailable()
Laszlo Ersek [Tue, 3 Mar 2015 08:13:30 +0000 (08:13 +0000)]
OvmfPkg: XenHypercallLib: introduce XenHypercallIsAvailable()

Similarly to QemuFwCfgLib, we prefer mellow library construction code and
an explicit "are you available" query function in the XenHypercallLib
class. In this step we introduce that query function, but move no client
code to it yet.

Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17000 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg: XenHypercallLib: add empty constructor for ARM & AARCH64
Laszlo Ersek [Tue, 3 Mar 2015 08:13:19 +0000 (08:13 +0000)]
OvmfPkg: XenHypercallLib: add empty constructor for ARM & AARCH64

In the next patch we'll add a simple query function to the XenHypercallLib
library class that is supposed to be called by initialization code in
modules. Among those, in constructors of dependent libraries too.

Library construction ordering is ensured only between libraries with
constructors, plus we shouldn't allow a dependent library with a
constructor to call into any XenHypercallLib instances (the simple query
function) before XenHypercallLib is constructed itself. For this reason,
introduce an (empty) constructor for ARM & AARCH64 too.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16999 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg, ArmVirtualizationPkg: clean up XenHypercallLib names
Laszlo Ersek [Tue, 3 Mar 2015 08:13:09 +0000 (08:13 +0000)]
OvmfPkg, ArmVirtualizationPkg: clean up XenHypercallLib names

Perform the following renames in order to stick with edk2 tradition more
closely:

  XenHypercallLibArm, XenHypercallLibIntel  ->  XenHypercallLib
  XenHypercallIntel                         ->  X86XenHypercall

In addition, we unify the INF files.

This patch modifies ArmVirtualizationPkg and OvmfPkg at once, in order to
keep both bisectable (client code shouldn't break).

Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16998 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoShellPkg: Fixed EBC build error.
Elvin Li [Tue, 3 Mar 2015 02:38:26 +0000 (02:38 +0000)]
ShellPkg: Fixed EBC build error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16987 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: expose debug message bitmask on build command line
Laszlo Ersek [Mon, 2 Mar 2015 16:19:41 +0000 (16:19 +0000)]
ArmVirtualizationPkg: expose debug message bitmask on build command line

This enables -D DEBUG_PRINT_ERROR_LEVEL=0x8040004F style command line
options.

Since we're massaging the debug message bitmask anyway, let's update the
description of the individual bits too in the comments, so that they match
"MdePkg/Include/Library/DebugLib.h".

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@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16986 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: lack of QEMU kernel is no error
Laszlo Ersek [Mon, 2 Mar 2015 16:19:36 +0000 (16:19 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: lack of QEMU kernel is no error

When the user doesn't pass a kernel with QEMU's "-kernel" switch, the
firmware sees a zero-sized kernel blob via the QemuFwCfgItemKernelSize
key; there's no way to distinguish "no kernel" from "zero sized kernel".
In both cases TryRunningQemuKernel() proceeds as far as gBS->LoadImage(),
which then rejects the zero sized synthetic file with EFI_UNSUPPORTED.

This is known and works fully as expected; however we should rather catch
the much more frequent "no kernel" case earlier, in order to avoid the
EFI_D_ERROR message

  TryRunningQemuKernel: LoadImage(): Unsupported

which is arguably meaningless noise for the "no kernel" case.

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@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16985 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg: PEIM startup is not an error
Laszlo Ersek [Mon, 2 Mar 2015 16:19:32 +0000 (16:19 +0000)]
ArmPlatformPkg: PEIM startup is not an error

"MemoryInitPeim.c" and "PlatformPeim.c" log startup messages on the
EFI_D_ERROR level. This clutters a strictly EFI_D_ERROR level log
needlessly; change the log bitmask of these messages to EFI_D_LOAD |
EFI_D_INFO.

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@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16984 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPkg: DebugPeCoffExtraActionLib: debugger commands are not errors
Laszlo Ersek [Mon, 2 Mar 2015 16:19:26 +0000 (16:19 +0000)]
ArmPkg: DebugPeCoffExtraActionLib: debugger commands are not errors

PeCoffLoaderRelocateImageExtraAction() prints helpful debugger commands
for source level debugging. These messages should not be printed on the
EFI_D_ERROR level; they don't report errors. Change the debug level
(bitmask, actually) to EFI_D_LOAD | EFI_D_INFO, because the messages are
printed in relation to image loading, and they are informative.

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@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16983 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: add platform description for Xen guests
Ard Biesheuvel [Sat, 28 Feb 2015 20:34:36 +0000 (20:34 +0000)]
ArmVirtualizationPkg: add platform description for Xen guests

This adds the .dsc and .fdf descriptions to build a UEFI image that
is bootable by a Xen guest on 64-bit ARM (AArch64)

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16981 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/VirtFdtDxe: wire up XenBusDxe to "xen,xen" DT node
Ard Biesheuvel [Sat, 28 Feb 2015 20:34:26 +0000 (20:34 +0000)]
ArmVirtualizationPkg/VirtFdtDxe: wire up XenBusDxe to "xen,xen" DT node

This patchs adds support to VirtFdtDxe for the Xen DT node which
contains the base address of the Grant Table. This data is communicated
to XenBusDxe using a XENIO_PROTOCOL instance.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16980 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: add XenIoMmioLib
Ard Biesheuvel [Sat, 28 Feb 2015 20:34:16 +0000 (20:34 +0000)]
ArmVirtualizationPkg: add XenIoMmioLib

This adds a XenIoMmioLib declaration and implementation that can
be invoked to install the XENIO_PROTOCOL and a corresponding
grant table address on a EFI handle.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16979 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvfm/Xen: add a Vendor Hardware device path GUID for the XenBus root
Ard Biesheuvel [Sat, 28 Feb 2015 20:34:06 +0000 (20:34 +0000)]
Ovfm/Xen: add a Vendor Hardware device path GUID for the XenBus root

On non-PCI Xen guests (such as ARM), the XenBus root is not a PCI
device but an abstract 'platform' device. Add a dedicated Vendor
Hardware device path GUID to identify this node.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16978 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: implement dummy RealTimeClockLib for Xen
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:55 +0000 (20:33 +0000)]
ArmVirtualizationPkg: implement dummy RealTimeClockLib for Xen

This implements a dummy RealTimeClockLib for Xen, as there is no
guest interface to access the time kept by Xen that can be shared
between UEFI and the OS.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16977 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: add Xen PV console SerialPortLib driver
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:45 +0000 (20:33 +0000)]
Ovmf/Xen: add Xen PV console SerialPortLib driver

This implements a SerialPortLib instance that wires up to the
PV console ring used by domU guests. Also imports the required
upstream Xen io/console.h header.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16976 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: port XenBusDxe to other architectures
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:34 +0000 (20:33 +0000)]
Ovmf/Xen: port XenBusDxe to other architectures

This patch updates XenBusDxe to use the 16-bit compare and exchange
function that was introduced for this purpose to the
BaseSynchronizationLib. It also provides a new generic implementation
of TestAndClearBit () using the same 16-bit compare and exchange, making
this module fully architecture agnostic.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16975 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: implement XenHypercallLib for ARM
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:22 +0000 (20:33 +0000)]
Ovmf/Xen: implement XenHypercallLib for ARM

This patch adds an implementation of XenHypercallLib for both
AArch64 and AArch32 execution modes on ARM systems.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16974 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: move XenBusDxe to abstract XENIO_PROTOCOL
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:11 +0000 (20:33 +0000)]
Ovmf/Xen: move XenBusDxe to abstract XENIO_PROTOCOL

While Xen on Intel uses a virtual PCI device to communicate the
base address of the grant table, the ARM implementation uses a DT
node, which is fundamentally incompatible with the way XenBusDxe is
implemented, i.e., as a UEFI Driver Model implementation for a PCI
device.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16973 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: add separate driver for Xen PCI device
Ard Biesheuvel [Sat, 28 Feb 2015 20:33:00 +0000 (20:33 +0000)]
Ovmf/Xen: add separate driver for Xen PCI device

Prepare for making XenBusDxe suitable for use with non-PCI devices
(such as the DT node exposed by Xen on ARM) by introducing a separate
DXE driver that binds to the Xen virtual PCI device and exposes the
abstract XENIO_PROTOCOL for XenBusDxe to bind against.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16972 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: introduce XENIO_PROTOCOL
Ard Biesheuvel [Sat, 28 Feb 2015 20:32:50 +0000 (20:32 +0000)]
Ovmf/Xen: introduce XENIO_PROTOCOL

This introduces the abstract XENIO_PROTOCOL that will be used to
communicate the Xen grant table address to drivers supporting this
protocol. Primary purpose is allowing us to change the XenBusDxe
implementation so that it can support non-PCI Xen implementations
such as Xen on ARM.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16971 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: move XenBusDxe hypercall code to separate library
Ard Biesheuvel [Sat, 28 Feb 2015 20:32:39 +0000 (20:32 +0000)]
Ovmf/Xen: move XenBusDxe hypercall code to separate library

This moves all of the Xen hypercall code that was private to XenBusDxe
to a new library class XenHypercallLib. This will allow us to reimplement
it for ARM, and to export the Xen hypercall functionality to other parts
of the code, such as a Xen console SerialPortLib driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16970 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: refactor XenBusDxe hypercall implementation
Ard Biesheuvel [Sat, 28 Feb 2015 20:32:27 +0000 (20:32 +0000)]
Ovmf/Xen: refactor XenBusDxe hypercall implementation

This refactors the Xen hypercall implementation that is part of the
XenBusDxe driver, in preparation of splitting it off entirely into
a XenHypercallLib library. This involves:
- removing the dependency on XENBUS_DEVICE* pointers in the XenHypercall()
  prototypes
- moving the discovered hyperpage address to a global variable
- moving XenGetSharedInfoPage() to its only user XenBusDxe.c (the shared info
  page is not strictly part of the Xen hypercall interface, and is not used
  by other expected users of XenHypercallLib such as the Xen console version
  of SerialPortLib
- reimplement XenHypercall2() in C and move the indexing of the hyperpage
  there; the existing asm implementations are renamed to __XenHypercall2() and
  invoked from the new C implementation.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16969 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: fix pointer to int cast in XenBusDxe
Ard Biesheuvel [Sat, 28 Feb 2015 20:32:16 +0000 (20:32 +0000)]
Ovmf/Xen: fix pointer to int cast in XenBusDxe

On ARM, xen_pfn_t is 64 bits but the size of a pointer is only
32 bits, so casting between them needs to go via (UINTN). Also
move the xen_pfn_t cast outside the shift so that we can avoid
shifting 64-bit quantities on 32-bit architectures, which may
require runtime library support.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16968 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmf/Xen: move Xen interface version to <xen.h>
Ard Biesheuvel [Sat, 28 Feb 2015 20:32:06 +0000 (20:32 +0000)]
Ovmf/Xen: move Xen interface version to <xen.h>

Tiancore has its private copy of the Xen headers, and all drivers
that depend on it should use the same Xen interface version, so
let's move the #define to xen.h itself.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16967 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdePkg/BaseSynchronizationLib: Add InterlockedCompareExchange16
Ard Biesheuvel [Sat, 28 Feb 2015 20:31:54 +0000 (20:31 +0000)]
MdePkg/BaseSynchronizationLib: Add InterlockedCompareExchange16

This implements the function InterlockedCompareExchange16 () for all
architectures, using architecture and toolchain specific intrinsics
or primitive assembler instructions.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16966 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdePkg/BaseSynchronizationLib: Added proper support for ARM architecture
Olivier Martin [Sat, 28 Feb 2015 20:31:40 +0000 (20:31 +0000)]
MdePkg/BaseSynchronizationLib: Added proper support for ARM architecture

This implements the following synchronization primitives for AArch64 (GCC)
and ARM (GCC & RVCT):

InternalSyncCompareExchange32
InternalSyncCompareExchange64
InternalSyncIncrement
InternalSyncDecrement

Note: these functions are implemented using the exclusive monitor,
which implies that they can only be used after the caches (and hence
the MMU) have been enabled.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16965 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: Xen/PV relocatable platformlib instance
Ard Biesheuvel [Sat, 28 Feb 2015 20:31:28 +0000 (20:31 +0000)]
ArmVirtualizationPkg: Xen/PV relocatable platformlib instance

Add a ArmPlatformLib instance that can deal with the self relocation
and truly dynamic discovery of system RAM base and size.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16964 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: allow patchable PCD for FV and DT base addresses
Ard Biesheuvel [Sat, 28 Feb 2015 20:31:18 +0000 (20:31 +0000)]
ArmVirtualizationPkg: allow patchable PCD for FV and DT base addresses

Allow the use of patchable PCDs for gArmTokenSpaceGuid.PcdFvBaseAddress
and gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
by moving them from the [FixedPcd] to the [Pcd] section in the INF file of
PlatformPeiLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16963 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: implement custom MemoryInitPeiLib
Ard Biesheuvel [Sat, 28 Feb 2015 20:31:08 +0000 (20:31 +0000)]
ArmVirtualizationPkg: implement custom MemoryInitPeiLib

This implements a MemoryInitPeiLib instance that differs from the
stock ArmPlatformPkg version only in the fact that it does not remove
the memory used by the flash device (FD). The reason is that, when using
PrePi, the DXE core is started immediately and never returns so there is
no reason to preserve any of the memory that the flash device occupied
originally, and it is preferable to release is so that the OS loader
can reuse it. This is especially important for the relocatable PrePi
configuration, which is aimed at being launched from a boot loader that
itself adheres to the Linux arm64 boot protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martn@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16962 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: add a relocatable version of PrePi
Ard Biesheuvel [Sat, 28 Feb 2015 20:26:20 +0000 (20:26 +0000)]
ArmVirtualizationPkg: add a relocatable version of PrePi

This patch introduces a relocatable PrePi, which can execute
from arbitrary offsets in RAM. This is intendend to be run
from a boot loader which passes a description of the actual
platform in a device tree, for instance.

This module is based on the PrePi implementations residing under
ArmPlatformPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16961 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: add padding to FDT allocation
Ard Biesheuvel [Sat, 28 Feb 2015 20:26:10 +0000 (20:26 +0000)]
ArmVirtualizationPkg: add padding to FDT allocation

Our primary user QEMU/mach-virt presents us with a FDT blob padded
to 64 KB with plenty of room to set additional properties. However,
in the general case, we should only add properties after making sure
there is enough room available.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16960 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: use a HOB to store device tree blob
Ard Biesheuvel [Sat, 28 Feb 2015 20:26:00 +0000 (20:26 +0000)]
ArmVirtualizationPkg: use a HOB to store device tree blob

Instead of using a dynamic PCD, store the device tree address in a HOB
so that we can also run under a configuration that does not support
dynamic PCDs.

This also adds MemoryAllocationLib to the [LibraryClasses] section of
ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf, as this
dependency was formerly satisfied transitively through one of the
library dependencies that were dropped.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16959 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: move early UART discovery to PlatformPeim
Ard Biesheuvel [Sat, 28 Feb 2015 20:25:48 +0000 (20:25 +0000)]
ArmVirtualizationPkg: move early UART discovery to PlatformPeim

This is partially motivated by the desire to use PrePi in a virt
environment, and in that configuration, ArmPlatformInitializeSystemMemory()
is never called. But actually, this is a more suitable place anyway.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16958 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: allow patchable PCD for device tree base address
Ard Biesheuvel [Sat, 28 Feb 2015 20:25:38 +0000 (20:25 +0000)]
ArmVirtualizationPkg: allow patchable PCD for device tree base address

To allow a runtime self relocating PrePi instance to discover the base
address of the device tree at runtime, allow the use of a patchable PCD
for gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress.
We will not be using the build time patch tool in this case, but using
a patchable PCD will make the build system aware that its value is not
a compile time constant.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16957 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: add GICv3 detection to VirtFdtDxe
Ard Biesheuvel [Sat, 28 Feb 2015 20:25:26 +0000 (20:25 +0000)]
ArmVirtualizationPkg: add GICv3 detection to VirtFdtDxe

This adds support for detecting the presence of a GICv3 interrupt
controller from the device tree, and recording its distributor and
redistributor base addresses in their respective PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16956 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg: allow patchable PCD for FD base address
Ard Biesheuvel [Sat, 28 Feb 2015 20:25:17 +0000 (20:25 +0000)]
ArmPlatformPkg: allow patchable PCD for FD base address

This moves the reference to gArmTokenSpaceGuid.PcdFdBaseAddress
from the [FixedPcd] to the [Pcd] section in the INF file of
PrePiArmPlatformGlobalVariableLib so that its users may choose
to use a patchable PCD instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16955 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPkg: allow patchable PCDs for memory, FD and FV addresses
Ard Biesheuvel [Sat, 28 Feb 2015 20:25:07 +0000 (20:25 +0000)]
ArmPkg: allow patchable PCDs for memory, FD and FV addresses

In order to allow a runtime self relocating PrePi instance, change the
allowable PCD types for the following PCDs:

  gArmTokenSpaceGuid.PcdSystemMemoryBase
  gArmTokenSpaceGuid.PcdSystemMemorySize
  gArmTokenSpaceGuid.PcdFdBaseAddress
  gArmTokenSpaceGuid.PcdFvBaseAddress

to include PcdsPatchableInModule. This makes the build system correctly
distinguish fixed PCDs from PCDs whose value may be different from the
assigned value at compile time.

Note that this only affects platforms that explicitly mark these PCDs as
PatchableInModule in the DSC. All existing platforms that use FixedPcd
will not be affected by this change.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16954 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPkg: allow HYP timer interrupt to be omitted
Ard Biesheuvel [Sat, 28 Feb 2015 20:24:57 +0000 (20:24 +0000)]
ArmPkg: allow HYP timer interrupt to be omitted

The DT binding for the ARM generic timer describes the secure,
non-secure, virtual and hypervisor timer interrupts, respectively.
However, under virtualization, only the virtual timer is usable, and
the device tree may omit the hypervisor timer interrupt. (Other timer
interrupts cannot be omitted simply due to the fact that the virtual
timer is listed third)

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16953 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoPcAtChipsetPkg: Update BaseAcpiTimerLib
Liming Gao [Sat, 28 Feb 2015 05:34:38 +0000 (05:34 +0000)]
PcAtChipsetPkg: Update BaseAcpiTimerLib

Introduce new PcdAcpiIoPortBaseAddressMask to mask BITS ACPI IO Port Base Address.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16952 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoNT32Pkg: Bind NT32 process to a single core to avoid NT32 crash issue in some multi...
Qiu Shumin [Sat, 28 Feb 2015 02:36:06 +0000 (02:36 +0000)]
NT32Pkg: Bind NT32 process to a single core to avoid NT32 crash issue in some multi-core processors.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ni Ruiyu <ni.ruiyu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16951 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoShellBinPkg: Arm/AArch64 Shell binary update.
Olivier Martin [Fri, 27 Feb 2015 17:54:29 +0000 (17:54 +0000)]
ShellBinPkg: Arm/AArch64 Shell binary update.

The binaries of ShellBinPkg are generated with ShellPkg project 16948.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16950 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoFatBinPkg: Update ARM and AArch64 binaries
Olivier Martin [Fri, 27 Feb 2015 17:27:42 +0000 (17:27 +0000)]
FatBinPkg: Update ARM and AArch64 binaries

Based on MdePkg and BaseTools (r16948), FatPkg (r93)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16949 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoShellPkg: Update Intel copyright to 2015.
Elvin Li [Fri, 27 Feb 2015 03:32:59 +0000 (03:32 +0000)]
ShellPkg: Update Intel copyright to 2015.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16944 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoShellPkg: Parse new SMBIOS 3.0 fields.
Elvin Li [Fri, 27 Feb 2015 02:10:57 +0000 (02:10 +0000)]
ShellPkg: Parse new SMBIOS 3.0 fields.

Parse new SMBIOS 3.0 fields in Type 4: Core Count 2, Core Enabled 2, Thread Count 2.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16943 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmJunoPkg: Create two default boot entries on first boot on Juno R1
Olivier Martin [Thu, 26 Feb 2015 11:04:52 +0000 (11:04 +0000)]
ArmPlatformPkg/ArmJunoPkg: Create two default boot entries on first boot on Juno R1

Juno R1 can run in two configurations:
- A57x2
- A57x2-A53x4

The Device Tree tell Linux which configuration has been selected.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16942 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmJunoPkg: Update with Juno R1 device tree names
Olivier Martin [Thu, 26 Feb 2015 11:03:41 +0000 (11:03 +0000)]
ArmPlatformPkg/ArmJunoPkg: Update with Juno R1 device tree names

Juno R1 support two configurations:
- A57x2
- A57x2-A53x4

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16941 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/Bds: Remove any use of the "Fdt" UEFI variable
Ronald Cron [Thu, 26 Feb 2015 11:02:39 +0000 (11:02 +0000)]
ArmPlatformPkg/Bds: Remove any use of the "Fdt" UEFI variable

Remove the option to update the "Fdt" UEFI variable in the ARM BDS as
the "setfdt" EFI Shell command provides this service from now.

Remove the use of this variable in the legacy kernel boot loader and
use the FDT installed in the configuration table instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16940 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmJunoDxe: Set the platform dependent FDT device path
Ronald Cron [Thu, 26 Feb 2015 10:57:27 +0000 (10:57 +0000)]
ArmPlatformPkg/ArmJunoDxe: Set the platform dependent FDT device path

The MIDR register of the CPU on which the UEFI firmware is running on
is used to infer if the platform is a Juno r0 or a Juno r1. The right
device path to the platform FDT is then stored in the
"gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths" dynamic PCD.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16939 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmJunoPkg : Use FdtPlatformDxe driver to install the FDT
Ronald Cron [Thu, 26 Feb 2015 10:56:20 +0000 (10:56 +0000)]
ArmPlatformPkg/ArmJunoPkg : Use FdtPlatformDxe driver to install the FDT

Remove the installation of the FDT for Juno into the UEFI Configuration
Table from the Juno specific DXE driver. Use the FdtPlatformDxe driver to
do it instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16938 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmVExpressDxe: Load FDT into the EFI Configuration Table
Ronald Cron [Thu, 26 Feb 2015 10:54:39 +0000 (10:54 +0000)]
ArmPlatformPkg/ArmVExpressDxe: Load FDT into the EFI Configuration Table

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16937 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoClean up GCC build.
Bruce Cran [Thu, 26 Feb 2015 06:49:31 +0000 (06:49 +0000)]
Clean up GCC build.

Make the Unix Vlv2TbltDevicePkg scripts executable, add shebangs and skip the requirement to press a key when displaying usage text from Build_IFWI.sh.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bruce Cran <bruce.cran@gmail.com>
Reviewed-by: David Wei <david.wei@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16936 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoEmbeddedPkg/FdtPlatformDxe: Add 'setfdt' EFI Shell command
Ronald Cron [Wed, 25 Feb 2015 19:34:07 +0000 (19:34 +0000)]
EmbeddedPkg/FdtPlatformDxe: Add 'setfdt' EFI Shell command

The 'setfdt' EFI Shell command allows to define a new FDT
as the prefered one for development purposes. It allows to
trigger the run of the FDT installation process as well.

Please refer to the README.txt file for more comprehensive
description.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16934 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoEmbeddedPkg : Add FdtPlatformDxe driver
Ronald Cron [Wed, 25 Feb 2015 19:20:57 +0000 (19:20 +0000)]
EmbeddedPkg : Add FdtPlatformDxe driver

The FdtPlatformDxe driver installs the FDT of the platform it
is running on into the UEFI Configuration table at the end of
the DXE phase.

Please refer to the README.txt file for a global overview of
the driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16933 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmVExpressPkg: Added support to differentiate ARMv8 FVP variants
Olivier Martin [Wed, 25 Feb 2015 19:15:39 +0000 (19:15 +0000)]
ArmPlatformPkg/ArmVExpressPkg: Added support to differentiate ARMv8 FVP variants

There are three FVP variants for the Base and Foundation models:
- model with GICv2 legacy memory map (same location as the Versatile Express model)
- model with GICv2 and Base model memory map
- model with GICv3 and Base model memory map

The new code detects the variants to load the appropriate device tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16932 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmVExpressDxe: Identify the current platform
Olivier Martin [Wed, 25 Feb 2015 19:14:26 +0000 (19:14 +0000)]
ArmPlatformPkg/ArmVExpressDxe: Identify the current platform

Add a function to ArmVExpressDxe to identify the current platform we
are running on. This includes ARM32 and AArch64 models and hardware.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16931 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPkg/BdsLib: Added support to change the given DevicePath of a Boot Entry
Olivier Martin [Wed, 25 Feb 2015 19:04:59 +0000 (19:04 +0000)]
ArmPkg/BdsLib: Added support to change the given DevicePath of a Boot Entry

Some boot entries might not have a EFI Device Path FilePath
attached to it (eg: EFI device Path for removable device path).
This patch allows a support loader to edit the EFI Device Path
and for instance add \EFI\BOOT\BOOT(ARM|AA64).EFI

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16930 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmVExpress-FVP-AArch64.dsc: Switch to Linux kernel with EFI stub...
Olivier Martin [Wed, 25 Feb 2015 18:50:37 +0000 (18:50 +0000)]
ArmPlatformPkg/ArmVExpress-FVP-AArch64.dsc: Switch to Linux kernel with EFI stub by default

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16929 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg/ArmJuno: Use EFI Stub and updated the command line
Olivier Martin [Wed, 25 Feb 2015 18:49:51 +0000 (18:49 +0000)]
ArmPlatformPkg/ArmJuno: Use EFI Stub and updated the command line

- 'earlycon' is the new name for 'earlyprintk'
- Support Linux EFI stub by default
- The command line is expected to be in unicode when
  booting an EFI application.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16928 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/QemuFwCfgLib: Fixed build error
Olivier Martin [Wed, 25 Feb 2015 18:47:12 +0000 (18:47 +0000)]
ArmVirtualizationPkg/QemuFwCfgLib: Fixed build error

ARM toolchain raises the build error:
Error #188-D: enumerated type mixed with another type

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16927 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPkg/ArmGic: Fix GICv3 in GICv2 legacy mode
Olivier Martin [Wed, 25 Feb 2015 18:42:36 +0000 (18:42 +0000)]
ArmPkg/ArmGic: Fix GICv3 in GICv2 legacy mode

- GIC distributor needs to be programmed to target interrupts
on the boot CPU using the Interrupt Processor Targets Registers
- Enabling the GIC Distributor is different following the value
of GICD_CTLR.ARE_NS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16926 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: display TianoCore logo
Laszlo Ersek [Wed, 25 Feb 2015 17:54:15 +0000 (17:54 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: display TianoCore logo

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16925 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: detect consoles dynamically
Laszlo Ersek [Wed, 25 Feb 2015 17:54:05 +0000 (17:54 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: detect consoles dynamically

Detect the video displays dynamically, and add them to the console and
error output variables.

Add a short-form, "wild card" USB_CLASS_DEVICE_PATH to the console input
variable, which causes the USB keyboard to be handled automatically.

Add the fixed location serial console to all of the console input, console
output, and error output variables.

This patch enables QEMU users to drop "addr=..." PCI address
specifications from the -device options (or to use whatever addresses they
like). For example, the following works:

  -device VGA \
  \
  -device ich9-usb-ehci1,multifunction=on,id=ehci \
  -device ich9-usb-uhci1,multifunction=on,masterbus=ehci.0,firstport=0 \
  -device ich9-usb-uhci2,multifunction=on,masterbus=ehci.0,firstport=2 \
  -device ich9-usb-uhci3,multifunction=on,masterbus=ehci.0,firstport=4 \
  -device usb-kbd,bus=ehci.0

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16924 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: remove ties to ARM BDS
Laszlo Ersek [Wed, 25 Feb 2015 17:53:55 +0000 (17:53 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: remove ties to ARM BDS

In this patch we remove all dependencies on ARM BDS libraries. We also
remove empty and/or unneeded functions, includes, etc.

PlatformIntelBdsLib "goes back to basics" temporarily -- there are no
consoles configured, and it's practically not possible to interact with
the user interface. Bisection remains available in the sense that
"ArmVirtualizationQemu.dsc" continues to build and should boot preexistent
boot options, but user interaction does regress temporarily.

The reason for this is that it's preferable to keep this patch and the
next one separate for readability's sake -- they amount to a rewrite from
scratch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16923 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: beautify source
Laszlo Ersek [Wed, 25 Feb 2015 17:53:44 +0000 (17:53 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: beautify source

This patch introduces no functional changes. It sorts #include directives,
sorts INF file sections, and reformats license blocks.

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: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16922 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoFix typo.
Yao, Jiewen [Wed, 25 Feb 2015 03:11:05 +0000 (03:11 +0000)]
Fix typo.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Fan, Jeff" <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16919 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdeModulePkg/FvSimpleFileSystemDxe: Fixed ARM compiler error
Olivier Martin [Wed, 25 Feb 2015 02:24:04 +0000 (02:24 +0000)]
MdeModulePkg/FvSimpleFileSystemDxe: Fixed ARM compiler error

Some compilers requires an empty line at the end of the file.
ARM compiler version 5 is one of these compilers:
error  #1-D: last line of file ends without a newline

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16918 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdePkg: Fixed wrong definition in smbios.h.
Elvin Li [Wed, 25 Feb 2015 01:02:41 +0000 (01:02 +0000)]
MdePkg: Fixed wrong definition in smbios.h.

SlotTypeAgp8X should be used per SMBIOS spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16917 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdeModulePkg: list ARM and AARCH64 as valid architectures for some modules
Laszlo Ersek [Mon, 23 Feb 2015 16:05:50 +0000 (16:05 +0000)]
MdeModulePkg: list ARM and AARCH64 as valid architectures for some modules

"ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc" references
these drivers:
- Pci/PciBusDxe
- Pci/EhciDxe
- Pci/UhciDxe
- Usb/UsbBusDxe
- Usb/UsbKbDxe

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16916 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoMdePkg: BasePciLibPciExpress: list ARM and AARCH64 as valid architectures
Laszlo Ersek [Mon, 23 Feb 2015 16:04:35 +0000 (16:04 +0000)]
MdePkg: BasePciLibPciExpress: list ARM and AARCH64 as valid architectures

"ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc" references
this PciLib instance.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16915 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/ArmVirtualizationQemu: add USB keyboard input
Laszlo Ersek [Mon, 23 Feb 2015 16:04:30 +0000 (16:04 +0000)]
ArmVirtualizationPkg/ArmVirtualizationQemu: add USB keyboard input

Similarly to the previous patch, we can now multiplex input from the USB
keyboard.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16914 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/ArmVirtualizationQemu: add VGA console output
Laszlo Ersek [Mon, 23 Feb 2015 16:04:25 +0000 (16:04 +0000)]
ArmVirtualizationPkg/ArmVirtualizationQemu: add VGA console output

Alex Graf's QEMU patchset enables "-device VGA" for the virt machtype as
well. We can now include OvmfPkg/QemuVideoDxe in the firmware, and set
PcdDefaultConOutPaths such that the console output is multiplexed to the
video window as well. (Our platform BDS lib doesn't (yet) locate the VGA
device automatically.)

OvmfPkg/PlatformDxe is included too; it allows users to select a video
resolution. (Note that PcdSetupVideoHorizontalResolution and
PcdSetupVideoVerticalResolution are independent; see git commit 848834cb
(SVN r16311) for explanation.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16913 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: fix multiconsole setup
Laszlo Ersek [Mon, 23 Feb 2015 16:04:21 +0000 (16:04 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: fix multiconsole setup

In the following call chain:

PlatformBdsPolicyBehavior()
  PlatformBdsConnectConsole()
    InitializeConsolePipe() x 3
      BdsConnectDevicePath() [ArmPkg/Library/BdsLib/BdsFilePath.c]

the three InitializeConsolePipe() function calls pass through
- (&gST->ConsoleOutHandle, &gST->ConOut),
- (&gST->ConsoleInHandle, &gST->ConIn),
- (&gST->StandardErrorHandle, &gST->StdErr)

to BdsConnectDevicePath(), in ArmPkg's BdsLib.

At least when more than one console device paths are specified in the
ConIn / ConOut / ErrOut variables, the above resuls in:
- unchanged protocol interfaces (ConOut, ConIn, StdErr) in the system
  table (because ConSplitterDxe installs its non-NULL interfaces first),
- but, changed handles in the system table.

This effectively separates the handle fields in the system table from the
protocol interfaces in the same that should always be associated with the
handles. The end result is that clients using the handles break (splitting
/ multiplexing doesn't work for them), while clients directly using the
protocol interfaces work.

Therefore, do not attempt to connect consoles separately. ConSplitterDxe
is dispatched before PlatformBdsPolicyBehavior() is called (the latter
happens in the BDS phase), and ConSplitterDxe installs virtual handles and
protocol interfaces for input / output / error.

BdsLibConnectAll() covers all devices, including consoles; as those
consoles are connected, ConPlatformDxe and ConSplitterDxe pick them up
nicely as "slaves". We just need to make sure that the variables are set
first, for the variables -> ConPlatformDxe -> ConSplitterDxe dependency
chain.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16912 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: PlatformIntelBdsLib: kernel boot should provide ACPI
Laszlo Ersek [Mon, 23 Feb 2015 16:04:16 +0000 (16:04 +0000)]
ArmVirtualizationPkg: PlatformIntelBdsLib: kernel boot should provide ACPI

If there is a PCI host, then PCI enumeration (which happens inside
BdsLibConnectAll()) blocks ACPI table installation (correctly). Make sure
we install ACPI tables before trying to direct-boot a QEMU kernel.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16911 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/ArmVirtualizationQemu: enable PCI support
Laszlo Ersek [Mon, 23 Feb 2015 16:04:11 +0000 (16:04 +0000)]
ArmVirtualizationPkg/ArmVirtualizationQemu: enable PCI support

Beyond including the foundational drivers in the DSC and FDF files, we
enable virtio-over-PCI, and turn on QemuBootOrderLib's OFW-to-UEFI device
path translation for PCI devices.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16910 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: clone BasePciExpressLib, cache PCIe config base
Laszlo Ersek [Mon, 23 Feb 2015 16:04:07 +0000 (16:04 +0000)]
ArmVirtualizationPkg: clone BasePciExpressLib, cache PCIe config base

The BarExisted() function in
"MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c" raises the TPL to
TPL_HIGH_LEVEL before accessing PCI config space.

The PciExpressLib instance under "MdePkg/Library/BasePciExpressLib" --
serving the PCI config space access -- calls
PcdGet64(PcdPciExpressBaseAddress) in turn, for each such call.

The PcdGet64() function, when issued at TPL_HIGH_LEVEL, triggers an
ASSERT(). PcdGet64() is based on a protocol in this UEFI phase, and
protocol handler services are not allowed above TPL_NOTIFY (see Table 23
"TPL Restrictions" in the UEFI spec).

Clone the library, and in a new constructor, cache the PCD in a global
variable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16909 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: handle 0 in GetProposedResources()
Laszlo Ersek [Mon, 23 Feb 2015 16:04:00 +0000 (16:04 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: handle 0 in GetProposedResources()

When there are no devices connected to the root bridge, no resources are
needed. GetProposedResources() currently considers this an invalid
condition (the PI spec doesn't regulate it).

Emitting an empty set of EFI_ACPI_ADDRESS_SPACE_DESCRIPTORs, followed by
the required EFI_ACPI_END_TAG_DESCRIPTOR, allows
PciHostBridgeResourceAllocator() [MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c]
to advance.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16908 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: skip 0 AddrLen in SubmitResources()
Laszlo Ersek [Mon, 23 Feb 2015 16:03:56 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: skip 0 AddrLen in SubmitResources()

According to Volume 5 of the PI spec, 10.8.2 PCI Host Bridge Resource
Allocation Protocol, SubmitResources(),

  It is considered an error if no resource requests are submitted for a
  PCI root bridge. If a PCI root bridge does not require any resources, a
  zero-length resource request must explicitly be submitted.

Under MdeModulePkg/Bus/Pci/PciBusDxe/, we have:

  PciHostBridgeResourceAllocator()                   [PciLib.c]
    ConstructAcpiResourceRequestor(..., &AcpiConfig) [PciEnumerator.c]
    PciResAlloc->SubmitResources(..., &AcpiConfig)
    ASSERT_EFI_ERROR ()

If ConstructAcpiResourceRequestor() finds no resources to request (for
example because no PCI devices are on the root bridge), it places a
zero-length EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR followed by an
EFI_ACPI_END_TAG_DESCRIPTOR in "AcpiConfig"; satisfying the PI spec.

However, PciHostBridgeDxe's SubmitResources() function does not expect
such input; the following part of the code rejects it:

        switch (Ptr->ResType) {

        case 0:

          //
          // Check invalid Address Sapce Granularity
          //
          if (Ptr->AddrSpaceGranularity != 32) {
            return EFI_INVALID_PARAMETER;
          }

Skip EFI_ACPI_ADDRESS_SPACE_DESCRIPTORs with zero AddrLen early. Also,
allow PciHostBridgeResourceAllocator() to proceed to the AllocateResources
phase by setting "ResourceSubmited" to TRUE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16907 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: get MMIO BARs from our own aperture
Laszlo Ersek [Mon, 23 Feb 2015 16:03:51 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: get MMIO BARs from our own aperture

This is our MMIO space map:

> GCD:AddMemorySpace(Base=0000000010000000,Length=000000002EFF0000)
>   GcdMemoryType   = MMIO
>   Capabilities    = 0000000000000001
>   Status = Success
> GCDMemType Range                             Capabilities     Attributes
> ========== ================================= ================ ================
> NonExist   0000000000000000-0000000003FFFFFF 0000000000000000 0000000000000000
> MMIO       0000000004000000-0000000007FFFFFF C000000000000001 8000000000000001

NorFlashDxe adds this, but does not allocate it.

> NonExist   0000000008000000-000000000900FFFF 0000000000000000 0000000000000000
> MMIO       0000000009010000-0000000009010FFF C000000000000001 8000000000000001

Added by RealTimeClockRuntimeDxe, but also not allocated.

> NonExist   0000000009011000-000000000FFFFFFF 0000000000000000 0000000000000000
> MMIO       0000000010000000-000000003EFEFFFF C000000000000001 0000000000000000

Added by ourselves.

> NonExist   000000003EFF0000-000000003FFFFFFF 0000000000000000 0000000000000000
> SystemMem  0000000040000000-00000000BFFFFFFF 800000000000000F 0000000000000008*
> NonExist   00000000C0000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000000

In the EfiPciHostBridgeAllocateResources phase, we allocate memory BARs
bottom up, from whichever MMIO range comes first and has room left.
Unfortunately, this places memory BARs into MMIO ranges that belong to
other devices. (Arguably, their respective drivers should not just add,
but immediately allocate those ranges as well.)

(

  This problem is not seen in OVMF / PcAtChipsetPkg, because there we
  allocate bottom-up from the range

    [max(2GB, top-of-low-RAM), 0xFC000000).

  (See the MMIO resource descriptor HOB created in MemMapInitialization()
  [OvmfPkg/PlatformPei/Platform.c].)

  That MMIO range fits in the static [2GB, 4GB) aperture given in
  "mResAperture" in PcAtChipsetPkg/PciHostBridgeDxe; plus other MMIO
  ranges (IO-APIC, HPET, LAPIC, flash chip) are higher than 0xFC000000.
  Hence the bottom-up BAR allocation in OvmfPkg always finds the right
  MMIO range first.

)

In ArmVirtualizationPkg/PciHostBridgeDxe we can solve the problem by
working our way downwards from the top of our own aperture.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16906 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: allocate IO BARs top-down
Laszlo Ersek [Mon, 23 Feb 2015 16:03:46 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: allocate IO BARs top-down

Currently we allocate IO BARs bottom-up in the
EfiPciHostBridgeAllocateResources phase of the enumeration.

> GCD:AddIoSpace(Base=0000000000000000,Length=0000000000010000)
>   GcdIoType    = I/O
>   Status = Success
> GCDIoType  Range
> ========== =================================
> I/O        0000000000000000-000000000000FFFF

Because the IO aperture is based at zero, the first allocation happens to
get the zero address. However, a zero address for a PCI BAR is considered
unmapped; see eg.:

- <http://www.pcisig.com/reflector/msg00459.html>,

- the (new_addr == 0) part in QEMU, pci_bar_address() [hw/pci/pci.c]:

    new_addr = pci_get_long(d->config + bar) & ~(size - 1);
    last_addr = new_addr + size - 1;
    /* Check if 32 bit BAR wraps around explicitly.
     * TODO: make priorities correct and remove this work around.
     */
    if (last_addr <= new_addr || new_addr == 0 || last_addr >= UINT32_MAX)
    {
        return PCI_BAR_UNMAPPED;
    }

We can avoid this problem by allocating top-down in the IO aperture.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16905 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: MMIO aperture must not be uncached
Laszlo Ersek [Mon, 23 Feb 2015 16:03:42 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: MMIO aperture must not be uncached

Quite non-intuitively, we must allow guest-side writes to emulated PCI
MMIO regions to go through the CPU cache, otherwise QEMU, whose accesses
always go through the cache, may see stale data in the region.

This change makes no difference for QEMU/TCG, but it is important for
QEMU/KVM, at the moment.

Because gDS->SetMemorySpaceAttributes() is ultimately implemented by
EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes() -- see
"MdeModulePkg/Core/Dxe/Gcd/Gcd.c" and "ArmPkg/Drivers/CpuDxe/" -- we add
the CPU architectural protocol to the module's DepEx.

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: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16904 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: add room for PCI resource allocation
Laszlo Ersek [Mon, 23 Feb 2015 16:03:37 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: add room for PCI resource allocation

VirtFdtDxe parses the following address space properties from the DTB (and
saves them in PCDs) :

  ProcessPciHost: Config[0x3F000000+0x1000000)
                  Bus[0x0..0xF]
                  Io[0x0+0x10000)@0x3EFF0000
                  Mem[0x10000000+0x2EFF0000)@0x0

In order to allow PCI enumeration to allocate IO and MMIO resources from
the above ranges for devices, we must add the ranges to the Global
Coherency Domain.

There are two ways for that:
- building resource descriptor HOBs in the HOB producer phase (basically,
  PEI), and letting the DXE core process them,
- calling gDS->AddIoSpace() and gDS->AddMemorySpace() during DXE.

We opt for the second method for simplicity.

In the address space maps, the corresponding ranges change from
"nonexistent" to "IO" and "MMIO", from which the gDS->AllocateIoSpace()
and gDS->AllocateMemorySpace() services can later allocate PCI BARs.

   GCD:AddIoSpace(Base=0000000000000000,Length=0000000000010000)
     GcdIoType    = I/O
     Status = Success
   GCDIoType  Range
   ========== =================================
-> I/O        0000000000000000-000000000000FFFF

   GCD:AddMemorySpace(Base=0000000010000000,Length=000000002EFF0000)
     GcdMemoryType   = MMIO
     Capabilities    = 0000000000000001
     Status = Success
   GCDMemType Range                             Capabilities     Attributes
   ========== ================================= ================ ================
   NonExist   0000000000000000-0000000003FFFFFF 0000000000000000 0000000000000000
   MMIO       0000000004000000-0000000007FFFFFF C000000000000001 8000000000000001
   NonExist   0000000008000000-000000000900FFFF 0000000000000000 0000000000000000
   MMIO       0000000009010000-0000000009010FFF C000000000000001 8000000000000001
   NonExist   0000000009011000-000000000FFFFFFF 0000000000000000 0000000000000000
-> MMIO       0000000010000000-000000003EFEFFFF C000000000000001 0000000000000000
   NonExist   000000003EFF0000-000000003FFFFFFF 0000000000000000 0000000000000000
   SystemMem  0000000040000000-00000000BFFFFFFF 800000000000000F 0000000000000008*
   NonExist   00000000C0000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000000

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16903 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/ArmVirtualizationQemu: enable IO addressing
Laszlo Ersek [Mon, 23 Feb 2015 16:03:32 +0000 (16:03 +0000)]
ArmVirtualizationPkg/ArmVirtualizationQemu: enable IO addressing

Set gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize to 16, which determines the
maximum "I/O address width".

This ensures, through the BuildCpuHob() call in
"ArmPkg/Drivers/CpuPei/CpuPei.c", that the inital I/O Space Map will
consist of a 16-bit wide "splittable" entry, when the DXE core starts (see
CoreInitializeGcdServices() in "MdeModulePkg/Core/Dxe/Gcd/Gcd.c"):

  GCD:Initial GCD I/O Space Map
  GCDIoType  Range
  ========== =================================
  NonExist   0000000000000000-000000000000FFFF

Otherwise this range would have size 0, and (since it could not be split)
any gDS->AddIoSpace() calls would fail.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16902 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: accommodate general address spaces
Laszlo Ersek [Mon, 23 Feb 2015 16:03:28 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: accommodate general address spaces

The RootBridgeIoCheckParameter() function currently relies on the range
limit being of the form (2^n - 1). This assumption is not necessarily
true; handle the general case.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16901 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: IO space is emulated with MMIO
Laszlo Ersek [Mon, 23 Feb 2015 16:03:21 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: IO space is emulated with MMIO

There is no IO space on ARM, and there are no special instructions that
access it. QEMU emulates the IO space for PCI devices with a special MMIO
range. We're ready to use it at this point, we just have to switch the
Io(Read|Write)(8|16|32) primitives to their MMIO counterparts, because in
"MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c", the IO primitives
correctly ASSERT (FALSE).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16900 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: translate addresses for IO
Laszlo Ersek [Mon, 23 Feb 2015 16:03:16 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: translate addresses for IO

Unlike the one in PcAtChipsetPkg, our PciHostBridgeDxe module must handle
address space translation. IO addresses expressed in the respective
aperture are mapped to a different base in CPU address space.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16899 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: abort if there's no PCI host bridge
Laszlo Ersek [Mon, 23 Feb 2015 16:03:11 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: abort if there's no PCI host bridge

If VirtFdtDxe found no PCI host in the DTB, then the config space base
address will be left at zero -- the default is set in the DSC --, and we
should exit PciHostBridgeDxe immediately.

This causes gEfiPciRootBridgeIoProtocolGuid not to be installed, which in
turn prevents MdeModulePkg/Bus/Pci/PciBusDxe from binding (see
PciBusDriverBindingSupported()).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16898 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: set Root Bridge apertures from PCDs
Laszlo Ersek [Mon, 23 Feb 2015 16:03:06 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: set Root Bridge apertures from PCDs

Our PciHostBridgeDxe module creates one root bridge on the one and only
host bridge. The resource apertures of the root bridge (bus range, IO
space, MMIO space) are configured with the "mResAperture" array, which at
the moment carries static values inherited from PcAtChipsetPkg.

Set the array as first thing from the PCDs that we parsed from the device
tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16897 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: ECAM enables 4KB config space
Laszlo Ersek [Mon, 23 Feb 2015 16:03:02 +0000 (16:03 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: ECAM enables 4KB config space

The Enhanced Configuration Access Mechanism provides access to 4096
register bytes per PCIe B/D/F. The MAX_PCI_REG_ADDRESS macro that we're
changing here is used by RootBridgeIoCheckParameter() for verifying config
space boundaries in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Read() and
.Write().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.Martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16896 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/PciHostBridgeDxe: clone from PcAtChipsetPkg
Laszlo Ersek [Mon, 23 Feb 2015 16:02:55 +0000 (16:02 +0000)]
ArmVirtualizationPkg/PciHostBridgeDxe: clone from PcAtChipsetPkg

MdeModulePkg/Bus/Pci/PciBusDxe depends on
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL and
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. Here we clone the driver that produces
these from PcAtChipsetPkg, with the following immediate changes:

- a new FILE_GUID is generated;

- the assembly-language Ia32 / X64 specific IoFifo "accelerators" are not
  copied, and their client code (which would be dead code anyway) is
  removed;

- UNI files are not copied: they are used in conjunction with the UEFI
  Packaging Tool (UPT), but the driver under ArmVirtualizationPkg will not
  be part of UDK.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16895 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg/VirtFdtDxe: parse "pci-host-ecam-generic" properties
Laszlo Ersek [Mon, 23 Feb 2015 16:02:50 +0000 (16:02 +0000)]
ArmVirtualizationPkg/VirtFdtDxe: parse "pci-host-ecam-generic" properties

In the Linux kernel tree,
"Documentation/devicetree/bindings/pci/host-generic-pci.txt" describes the
device tree bindings of a Generic PCI host controller.

Recent QEMU patches from Alexander Graf implement such a controller on the
"virt" machine type of qemu-system-(aarch64|arm):

  pcie@10000000 {
    //
    //                    (devfn<<8, 0, 0)  PCI irq
    //                    ----------------  -------
    interrupt-map-mask = <0x1800 0x0 0x0    0x7>;

    //                                        gic      irq
    //               (devfn<<8, 0, 0)  pin+1  phandle  (type, nr, level)
    //               ----------------  -----  -------- -----------------
    interrupt-map = <   0x0 0x0 0x0    0x1    0x8001   0x0 0x3 0x4
                        0x0 0x0 0x0    0x2    0x8001   0x0 0x4 0x4
                        0x0 0x0 0x0    0x3    0x8001   0x0 0x5 0x4
                        0x0 0x0 0x0    0x4    0x8001   0x0 0x6 0x4
                      0x800 0x0 0x0    0x1    0x8001   0x0 0x4 0x4
                      0x800 0x0 0x0    0x2    0x8001   0x0 0x5 0x4
                      0x800 0x0 0x0    0x3    0x8001   0x0 0x6 0x4
                      0x800 0x0 0x0    0x4    0x8001   0x0 0x3 0x4
                     0x1000 0x0 0x0    0x1    0x8001   0x0 0x5 0x4
                     0x1000 0x0 0x0    0x2    0x8001   0x0 0x6 0x4
                     0x1000 0x0 0x0    0x3    0x8001   0x0 0x3 0x4
                     0x1000 0x0 0x0    0x4    0x8001   0x0 0x4 0x4
                     0x1800 0x0 0x0    0x1    0x8001   0x0 0x6 0x4
                     0x1800 0x0 0x0    0x2    0x8001   0x0 0x3 0x4
                     0x1800 0x0 0x0    0x3    0x8001   0x0 0x4 0x4
                     0x1800 0x0 0x0    0x4    0x8001   0x0 0x5 0x4>;

    #interrupt-cells = <0x1>;

    //
    //                   child base      cpu base
    //        type       address         address         size
    //        ---------  --------------  --------------  --------------
    ranges = <0x1000000  0x0        0x0  0x0 0x3eff0000  0x0    0x10000
              0x2000000  0x0 0x10000000  0x0 0x10000000  0x0 0x2eff0000>;

    //
    //     PCIe config     PCIe config
    //     space base      space size
    //     --------------  -------------
    reg = <0x0 0x3f000000  0x0 0x1000000>;

    //
    // allowed bus numbers; inclusive range
    //
    bus-range = <0x0 0xf>;

    #size-cells = <0x2>;
    #address-cells = <0x3>;
    device_type = "pci";
    compatible = "pci-host-ecam-generic";
  };

Parse those properties of the compatible="pci-host-ecam-generic" node into
PCDs that are relevant for PCI enumeration in edk2:

- gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress controls
  MdePkg/Library/BasePciExpressLib,

- gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration controls
  OvmfPkg/AcpiPlatformDxe at this point,

- the rest have been introduced earlier in this patchset, and will control
  PCI range checks and translation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16894 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmPlatformPkg: introduce PCDs for describing PCI address spaces
Laszlo Ersek [Mon, 23 Feb 2015 16:02:44 +0000 (16:02 +0000)]
ArmPlatformPkg: introduce PCDs for describing PCI address spaces

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16893 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoPcAtChipsetPkg/PciHostBridgeDxe: drop PciAddress, PciData
Laszlo Ersek [Mon, 23 Feb 2015 16:02:39 +0000 (16:02 +0000)]
PcAtChipsetPkg/PciHostBridgeDxe: drop PciAddress, PciData

The PciAddress and PciData members of PCI_ROOT_BRIDGE_INSTANCE are never
read; drop them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16892 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoPcAtChipsetPkg/PciHostBridgeDxe: fix typo in "aperture"
Laszlo Ersek [Mon, 23 Feb 2015 16:02:34 +0000 (16:02 +0000)]
PcAtChipsetPkg/PciHostBridgeDxe: fix typo in "aperture"

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Olivier Martin <Olivier.martin@arm.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16891 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg/QemuVideoDxe: enable ARM builds
Laszlo Ersek [Mon, 23 Feb 2015 16:02:29 +0000 (16:02 +0000)]
OvmfPkg/QemuVideoDxe: enable ARM builds

The only feature not portable to ArmVirtualizationQemu is the VBE shim;
make that dependent on Ia32 / X64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Olivier Martin <Olivier.martin@arm.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16890 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOptionRomPkg: FrameBufferBltLib: drop set but not used variable
Laszlo Ersek [Mon, 23 Feb 2015 16:02:21 +0000 (16:02 +0000)]
OptionRomPkg: FrameBufferBltLib: drop set but not used variable

BltMemSrc is set in BltLibVideoFill(), but never read.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16889 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoShellPkg/UefiShellLib: Fixed ARM compiler error
Olivier Martin [Mon, 23 Feb 2015 11:13:58 +0000 (11:13 +0000)]
ShellPkg/UefiShellLib: Fixed ARM compiler error

ARM Compiler version 5 raises the warning/error (warning treated as error):
#191-D: type qualifier is meaningless on cast type

The compiler team said the warning is valid because from the C90 standard,
section 6.5.3 it is specified that "The properties associated with
qualified types are meaningful only for expressions that are lvalues."

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16888 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg: AcpiPlatformDxe: make dependency on PCI enumeration dynamic
Laszlo Ersek [Thu, 19 Feb 2015 23:46:27 +0000 (23:46 +0000)]
OvmfPkg: AcpiPlatformDxe: make dependency on PCI enumeration dynamic

SVN r16411 delayed ACPI table installation until PCI enumeration was
complete, because on QEMU the ACPI-related fw_cfg files should have been
downloaded only after PCI enumeration. Said commit implemented the
dependency by tightening the module's depex.

This patch replaces the EFI_PCI_ENUMERATION_COMPLETE_PROTOCOL depex with a
matching protocol registration callback. The depex was static, and it
could not handle dynamically discovered situations when the dependency
would turn out invalid.

Namely:

- At the moment, the depex in "QemuFwCfgAcpiPlatformDxe.inf" assumes
  that "ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc"
  lacks PCI support. However, PCI support is about to become run-time
  discoverable on that platform. If PCI support is missing, then
  ArmVirtualizationPkg will set PcdPciDisableBusEnumeration to TRUE.

  Hence, when PcdPciDisableBusEnumeration is TRUE, we invalidate the
  dependency by not registering the callback and installing the ACPI
  tables right away.

- InitializeXen() in "OvmfPkg/PlatformPei/Xen.c" sets
  PcdPciDisableBusEnumeration to TRUE. This causes
  PciBusDriverBindingStart() in "MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c"
  to set gFullEnumeration to FALSE, which in turn makes PciEnumerator() in
  "MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c" branch to
  PciEnumeratorLight(). The installation of
  EFI_PCI_ENUMERATION_COMPLETE_PROTOCOL at the end of PciEnumerator() is
  not reached.

  Which means that starting with SVN r16411, AcpiPlatformDxe is never
  dispatched on Xen.

  Hence, when PcdPciDisableBusEnumeration is TRUE, we invalidate the
  dependency by not registering the callback and installing the ACPI
  tables right away.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: Removed PcdOvmfPciEnabled]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16887 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoArmVirtualizationPkg: Set PcdPciDisableBusEnumeration to TRUE
Jordan Justen [Thu, 19 Feb 2015 23:46:13 +0000 (23:46 +0000)]
ArmVirtualizationPkg: Set PcdPciDisableBusEnumeration to TRUE

This setting makes OvmfPkg/AcpiPlatformDxe not wait for PCI
enumeration to complete before installing ACPI tables.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16886 6f19259b-4bc3-4df7-8a09-765794883524

9 years agoOvmfPkg: AcpiPlatformDxe: extract common entry point
Laszlo Ersek [Thu, 19 Feb 2015 23:45:57 +0000 (23:45 +0000)]
OvmfPkg: AcpiPlatformDxe: extract common entry point

Currently the entry point functions of both driver builds
(AcpiPlatformDxe.inf and QemuFwCfgAcpiPlatformDxe.inf) directly contain
the logic that is different between the two builds.

Because we're going to restructure the entry point logic soon, we'd have
to duplicate the same new code between both entry point functions.

Push down the logic in which they differ to a new function:
- InstallAcpiTables() [AcpiPlatform.c]
- InstallAcpiTables() [QemuFwCfgAcpiPlatform.c]

and extract a common entry point function:
- AcpiPlatformEntryPoint() [EntryPoint.c]

which we can soon modify without code duplication.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16885 6f19259b-4bc3-4df7-8a09-765794883524