Commit Graph

69 Commits

Author SHA1 Message Date
Ard Biesheuvel f7de74afdd ArmVirtPkg/ArmVirtXen: add ARM support
This adds ARM support to the ArmVirtXen platform. As is the case for
AARCH64, the ARM port adheres to the ARM Linux boot protocol, i.e.,
it expects the address of a DTB describing the platform to be passed
in r2, and relocates itself at runtime to the actual load time memory
offset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19333 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-17 17:11:33 +00:00
Ard Biesheuvel 4008259841 ArmVirtPkg/ArmXenRelocatablePlatformLib: add ARM support
This is a port of the AARCH64 low level init routines to ARM. This
mainly covers the platform boot code that extracts the system base
and size from the DTB, copies it and updates the FD and FV base
addresses according to the load time offset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19332 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-17 17:11:25 +00:00
Ard Biesheuvel 809a639ee2 ArmVirtPkg/PrePiRelocatable: add ARM support
This adds support to the self relocating PrePi instance that is built
as a PIE ET_DYN executable. It primarily involves porting the relocation
routine to use ELF32 REL entries instead of ELF64 RELA entries which is
what AArch64 uses.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19331 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-17 17:11:16 +00:00
Ard Biesheuvel 03b6bed17e ArmVirtPkg/XenRelocatablePlatformLib: rewrite DTB memory node retrieval in C
Parsing the DTB early on using a handcoded assembly routine is a pointless
waste of brain cycles, since the UEFI firmware always executes from RAM
under Xen. So instead, set up a temporary stack in the memory region at the
beginning of the image, and use the libfdt C library.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19330 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-17 17:11:07 +00:00
Ard Biesheuvel cd625ae90e ArmVirtPkg RVCT: build DXE_RUNTIME_DRIVER modules with 4 KB alignment
This adds the RVCT armlink command line switches to build modules of type
DXE_RUNTIME_DRIVER with 4 KB PE/COFF section alignment, allowing the OS
to apply stricter permissions to the .text and .data sections.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19237 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-14 07:56:19 +00:00
Shannon Zhao 6831271061 ArmVirtPkg: HighMemDxe: add memory space for the high memory nodes
Here we add the memory space for the high memory nodes except the lowest
one in FDT. So these spaces will show up in the UEFI memory map.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: rewrap at 79 chars, use NULL, print Status]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19124 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-04 16:17:17 +00:00
Shannon Zhao 45f9bb91b0 ArmVirtPkg: ArmVirtPlatformLib: find the lowest memory node
While QEMU NUMA support on ARM will introduce more than one /memory node
in the device tree, it needs to find the lowest one and set
PcdSystemMemorySize with the actual size of this memory node.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19123 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-04 16:17:12 +00:00
Ard Biesheuvel e04671e81a ArmVirtPkg: use explicit KERNEL_BLOB_TYPE cast
The ARM RVCT compiler does not allow implicit casts between enumerated
types and integer types. In this particular case, the STUB_FILE::Position
member is overloaded as a KERNEL_BLOB_TYPE identifier, so it does not
hurt to make that cast explicit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19108 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-03 08:51:36 +00:00
Ard Biesheuvel 2c96024436 ArmVirtPkg: add secure boot support to 32-bit ARM targets
Building the 32-bit ARM targets with secure boot enabled requires
a library resolution for the ArmSoftfloatLib dependency of
OpenSslLib. So provide one.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19032 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-30 08:57:12 +00:00
Ard Biesheuvel 5eeba3b7f1 ArmVirtPkg/PrePi: remove global variable allocation from lowlevel init
Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to allocate and clear out the global
variable region in the PrePi init code. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18991 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-27 17:06:48 +00:00
Ard Biesheuvel 94904a8477 ArmVirtPkg: drop ArmPlatformGlobalVariableLib dependency
Now that all PeiServicesTablePointerLib and PrePiHobListPointerLib
library dependencies in both ArmVirtQemu and ArmVirtXen are satisfied
by implementations that do not depend on ArmPlatformGlobalVariableLib,
we can remove all mention of it from the various .dsc files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18986 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-27 17:05:47 +00:00
Ard Biesheuvel b761e8c2c5 ArmVirtPkg/ArmVirtQemu: move to ArmPkg version of PeiServicesTablePointerLib
As pointed out by Eugene, the ArmPlatformPkg implementation of
PeiServicesTablePointerLib violates the PI sec, since it uses
ArmPlatformGlobalVariableLib to store the PEI services table pointer
rather than the thread ID cpu registers as the spec requires.

So instead, move to the ArmPkg version of this library, which does
adhere to the PI spec.

Reported-by: Eugene Cohen <eugene@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18985 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-27 17:05:36 +00:00
Star Zeng ad7f6bc2e1 ArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
Beyond just changing the directly related lines in the FDF and DSC files,
we have to adapt the EarlyFdtPL011SerialPortLib and FdtPL011SerialPortLib
instances as well, in the same patch. This is because the EmbeddedPkg
driver expects the SerialPortSetAttributes(),
SerialPortSetControl() and SerialPortGetControl() functions from
SerialPortExtLib, while the MdeModulePkg driver expects them from
SerialPortLib itself.

We cannot implement these functions in ArmVirtPkg's SerialPortLib
instances *before* flipping the driver, because it would cause double
function definitions in the EmbeddedPkg driver. We also can't implement
the functions *after* flipping the driver, because it would cause
unresolved function references in the MdeModulePkg driver. Therefore
we have to implement the functions simultaneously with the driver
replacement.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18973 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-26 08:52:12 +00:00
Ard Biesheuvel 1dc3f34f61 ArmVirtPkg/ArmVirtPlatformLib: reduce ID map size to GCD region size
The ID mapping routines on virtual platforms simply map the entire
hardware supported physical address space as device memory, and then
punch some holes for regions that need to be mapped cacheable.
On virtual platforms hosted on CPUs that support a large physical
address range, this may result in a lot of overhead, i.e., 4 KB of page
tables for each 512 GB of address space, which quickly adds up (i.e.,
2 MB for the architectural maximum of 48 bits).

Since there may be a platform specific limit to the size of the (I)PA
space that is not reflected by CPU id registers, restrict the range of
the ID mapping to gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize bits.
This makes sense by itself, since we cannot manipulate mappings above
that limit anwyay (because they are not covered by GCD), and it allows
the PCD be set to a lower value by platforms whose (I)PA space is
smaller than the hardware supported maximum.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Wei Huang <wei@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18929 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-24 07:44:41 +00:00
Ard Biesheuvel 7416fd46e3 ArmVirtPkg/ArmVirtQemu: limit the (I)PA space to 40 bits
KVM uses a fixed size of 40 bits for its intermediate physical address
space, so there is no need to support anything beyond that even if the
host hardware does.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Wei Huang <wei@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18928 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-24 07:44:28 +00:00
Ard Biesheuvel dca7f96fd2 ArmVirtPkg/ArmVirtPlatformLib: map executable NOR region as normal memory
The ARM architecture version 7 and later mandates that device mappings
have the XN (non-executable) bit set, to prevent speculative instruction
fetches from read-sensitive regions. This implies that we should not map
regions as device if we want to execute from them, so the NOR region that
contains our FD image should be mapped as normal memory instead.

The MMU code deals correctly with overlapping ARM_MEMORY_REGION_DESCRIPTOR
entries, and later entries in the array take precedence over earlier ones.
So simply add an entry to the end of the array that overrides the mapping
attributes of the FD image, wherever it resides.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18889 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-18 11:50:33 +00:00
Ard Biesheuvel 8c5ac451d5 ArmVirtPkg/PrePi: do not invalidate the entire data cache at startup
Drop the call to ArmInvalidateDataCache () from the PrePi startup
sequence. This kind of data cache maintenance should not be performed
when running under virtualization.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18757 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-09 13:27:56 +00:00
Mark Rutland f813662589 ArmVirtPkg: include BaseStackCheckLib also for AARCH64
Some AArch64 toolchains also invoke the software stack checker
functions on certain code - so include BaseStackCheckLib for
AARCH64 as well as for ARM. Since this was the only difference
between [LibraryClasses.ARM] and [LibraryClasses.AARCH64],
merge the two into the existing [LibraryClasses.common].

At the same time, fix the grammar for the related comments.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18617 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-16 15:23:46 +00:00
Ard Biesheuvel 64df44b7e5 ArmVirtPkg/ArmVirtQemu: enable non-exec DXE stack for AARCH64
Enable the non-exec DXE stack feature when building for AARCH64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18589 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-08 18:52:33 +00:00
Ard Biesheuvel 955b4946f9 ArmVirtPkg: use 4 KB section alignment for ARM DXE_RUNTIME_DRIVER modules
In order to support the Properties Table memory protection feature
on 32-bit ARM, build DXE_RUNTIME_DRIVER type binaries with 4 KB section
alignment by setting the common-page-size linker command line option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Zimmermann <sigmaepsilon92@gmail.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18566 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-01 14:01:16 +00:00
Laszlo Ersek 5236e09cde ArmVirtPkg: build the TFTP command into the UEFI shell
The TFTP command is easy to use, it has very nice documentation
(accessible with "HELP TFTP" in the shell), and it's a very versatile
tool for downloading files from the host to the guest, via virtual
network, while the guest is in the UEFI shell.

Even better, enabling this command in the shell increases the
uncompressed FVMAIN size only by 8192 bytes, in my AARCH64 build of
VirtArmQemu.dsc, and the final size increase (after LZMA compression)
that is visible in the FVMAIN_COMPACT volume is merely 1976 bytes.

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: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18555 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-25 17:23:03 +00:00
Laszlo Ersek 953bcbcce4 ArmVirtPkg: QemuFwCfgLib: read bytes from fw-cfg with DMA when available
The protocol is documented in "docs/specs/fw_cfg.txt" in the QEMU tree.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18545 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-24 21:40:41 +00:00
Laszlo Ersek 50b91449a3 ArmVirtPkg: VirtFdtDxe: detect fw-cfg DMA interface from the DTB
A DMA-like transfer interface has recently been implemented in QEMU for
fw-cfg. For ARM and AARCH64 virtual machines, the binding prescribes a new
8-byte wide register at offset 0x10 in the register block. Make VirtFdtDxe
expose this register if it is present.

Please see "docs/specs/fw_cfg.txt" in the QEMU tree for more information.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18544 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-24 21:40:36 +00:00
Ard Biesheuvel 2f71ad11d6 ArmVirtPkg: reduce preallocation of boot services data pages
Commit SVN r18503 ("MdeModulePkg DxeCore: Take the range in resource
HOB for PHIT as higher priority") changed the GCD init logic to take
the sum of the region sizes in gMemoryTypeInformation[] into account
when estimating the minimal amount of memory needed to boot the system.

Unfortunately, as an unintended side effect, this change results in boot
failures of ArmVirtQemu when running with QEMU's default memory size of
128 MB. The reason is that the sum of the gMemoryTypeInformation region
sizes plus the size of the inital PEI region exceeds 128 MB. Since we do
not actually need to preallocate 20,000 pages' worth of BootServicesData
memory, reduce this figure to the more reasonable 12,000.

Reported-by: Mark Rutland <mark.rutland@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18533 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-22 15:50:30 +00:00
Laszlo Ersek 9a470dae60 ArmVirtPkg: PlatformIntelBdsLib: signal ReadyToBoot on direct kernel boot
According to the UEFI spec, EFI_EVENT_GROUP_READY_TO_BOOT "is notified by
the system when the Boot Manager is about to load and execute a boot
option". ArmVirtPkg doesn't do this currently when launching a kernel from
the QEMU command line. OvmfPkg does (see git commit 28a34033ee).

At least two edk2-wide callbacks are worth mentioning:

- OnReadyToBoot() in
  "MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c" performs
  variable reclaim and (optionally) installs variable usage statistics as
  a vendor config table;

- OnReadyToBoot() in
  "SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c"
  installs the image execution info table if it doesn't exist yet, in
  SecureBoot-enabled builds.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18513 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-18 13:58:35 +00:00
Ard Biesheuvel 5f6ed4681f ArmVirtPkg: set max physical address width to 40 bits
When executing on a LPAE capable 32-bit ARM platform, we support
up to 40 bits of physical address space so set PcdPrePiCpuMemorySize
accordingly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18428 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-09 14:48:41 +00:00
Ard Biesheuvel 72daeed8cf ArmVirtPkg/ArmVirtMemoryInitPeiLib: handle memory above 4 GB on 32-bit ARM
On 32-bit ARM, split system memory into a region below (and up to) 4 GB
and a region above 4 GB. This is necessary to get the DXE core to consider
the former as the resource descriptor that describes the primary memory
region that also covers the PHIT region.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18427 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-09 14:48:33 +00:00
Ard Biesheuvel 218ea6c164 ArmVirtPkg: revert unintended change to ArmVirt.dsc.inc
The recent changes to ArmVExpress-FVP-AArch64 in SVN r18309
contained a hunk to ArmVirt.dsc.inc which was included in
error. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18321 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-26 12:09:39 +00:00
Ard Biesheuvel 0ad3e6d4a6 ArmPlatformPkg/FVP: unify support for Foundation and Base models
Now that the PL180 and PL111 drivers know how to behave when executed
on the Foundation model (which does not emulate the hardware), we can
remove the ARM_FOUNDATION_FVP ifdefs and produce a single build that
runs on both the Foundation model and the Base model.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18309 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-25 13:11:25 +00:00
Star Zeng 7a9f5b202c ArmVirtPkg: Link separated VarCheckUefiLib NULL class library instance
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18290 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-25 03:03:23 +00:00
Star Zeng 0bdbaadee1 ArmVirtPkg: Add VarCheckLib library mapping
Since Variable driver has been updated to consume the separated VarCheckLib.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18283 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-25 03:00:20 +00:00
Ard Biesheuvel b1e3967b16 ArmVirtPkg: use global section alignment in custom linker script
The ArmVirtPrePiUniCoreRelocatable module comes with its own GNU
linker script to create a PIE executable that can relocate itself
at runtime. In order to be able to build this module using CLANG,
we need to adhere to the section alignment passed via to the linker
using -z commmon-page-size, so add this to the linker script.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18203 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-11 12:32:45 +00:00
Ard Biesheuvel 5bf512d380 ArmVirtPkg: avoid relocated immediates in AARCH64 asm
The relocated immediate notation supported by GNU as (e.g., #:lo12:foo)
is not supported by clang. Since we are loading a constant value, they
were not entirely appropriate here anyway, so simply replace them with
assembler arithmetic expressions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18202 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-11 12:32:38 +00:00
Laszlo Ersek 9b1c5be026 ArmVirtPkg: set default for PcdSmbiosDocRev
When MdeModulePkg/Universal/SmbiosDxe is instructed to compose & install
an SMBIOS 3.0 entry point, it keys the Docrev (specification document
revision) field of that structure off of PcdSmbiosDocRev. An upcoming
OvmfPkg patch will have OvmfPkg/Library/SmbiosVersionLib set this PCD
dynamically. Because we use that driver in the ArmVirtQemu.dsc platform,
we must provide a default for the dynamic PCD.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Wei Huang <wei@redhat.com>
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: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18181 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-06 10:14:07 +00:00
Laszlo Ersek f52af4899f ArmVirtPkg/ArmVirtQemu.dsc: set default for PcdQemuSmbiosValidated
The upcoming OvmfPkg patches will implicitly affect the ArmVirtQemu.dsc
build, necessitating a default value for the new dynamic
PcdQemuSmbiosValidated. Add it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Wei Huang <wei@redhat.com>
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: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18179 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-06 10:13:59 +00:00
Laszlo Ersek 59e0efa7b3 ArmVirtPkg: revert "ArmVirtPkg: add QemuFwCfgToPcdDxe"
This reverts git commit d2733aa9 (SVN r18042), because it is empty now.
The original problem:

  Many universal DXE drivers in edk2 can be controlled by setting dynamic
  PCDs. Such a PCD must be set before the consumer DXE driver is
  dispatched.

should be hereafter solved similarly to how
OvmfPkg/Library/SmbiosVersionLib is plugged into
MdeModulePkg/Universal/SmbiosDxe now (originally suggested by Jordan
Justen <jordan.l.justen@intel.com>).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Wei Huang <wei@redhat.com>
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: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18177 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-06 10:13:50 +00:00
Laszlo Ersek 34eeb6763b ArmVirtPkg: set SMBIOS version in DetectSmbiosVersionLib instead of QemuFwCfgToPcdDxe
This patch de-duplicates the logic added in commit

  ArmVirtPkg: QemuFwCfgToPcdDxe: set SMBIOS entry point version
  dynamically

(git c98da334, SVN r18043) by hooking DetectSmbiosVersionLib into
SmbiosDxe.

Although said commit was supposed to work with SMBIOS 3.0 payloads from
QEMU, in practice that never worked, because the size / signature checks
in SmbiosVersionInitialization() would always fail, due to the SMBIOS 3.0
entry point being structurally different. Therefore this patch doesn't
regress ArmVirtPkg.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Wei Huang <wei@redhat.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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18176 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-06 10:13:46 +00:00
Ard Biesheuvel 7ed84968e8 ArmVirtPkg/ArmVirtXen: add missing BdsLib instance
Now that the ARM BDS has been removed, there is a remaining BdsLib
dependency in ArmVirtXen that has now become unresolved. So re-add
the BdsLib resolution that we removed from ArmVirt.dsc.inc to
ArmVirtXen.dsc

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18156 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-04 19:44:25 +00:00
Ard Biesheuvel 9038538b3c ArmVirtPkg/ArmVirtQemu: add LinuxLoader UEFI app to ARM build
The ARM build still needs an intermediate loader to boot Linux,
since ARM/Linux has no builtin UEFI boot stub (yet).

So add the LinuxLoader UEFI application to the FV, and enable
the FvSimpleFileSystemDxe driver so that we can invoke the
Linux loader from the shell, e.g.,

  Shell> linuxloader fs2:zImage -c console=ttyAMA0

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18155 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-04 18:41:45 +00:00
Ard Biesheuvel a20f683a69 ArmVirtPkg/ArmVirtXen: remove unused PcdFirmwareVendor PCD
The PcdFirmwareVendor PCD was never used on this platform, since
it has never supported the ARM BDS. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18154 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-04 18:41:33 +00:00
Ard Biesheuvel 1c51e601a0 ArmVirtPkg/ArmVirtQemu: drop ARM BDS and make Intel BDS the default
ARM BDS support in ArmVirtQemu has been broken since SVN r17969
("ArmPkg/BdsLib: Remove Linux loader from BdsLib") dated July 14th.

Instead of fixing this, let's get rid of the ARM BDS and LinuxLoader
altogether: they violate both the UEFI spec and the arm64 Linux boot
protocol, and lack the level of integration with the QEMU command
line that the Intel BDS has when running under ArmVirtPkg or OvmfPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18153 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-04 18:41:19 +00:00
Ard Biesheuvel 5670dd5e99 ArmVirtPkg: move to unified GCC linker script
Move to the parametrised generic GCC linker script and set 64 KB
alignment, instead of using the AARCH64 specific incremental linker
script for 64 KB alignment which is about to be removed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-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@18140 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-03 08:23:26 +00:00
Ard Biesheuvel 7669f73498 ArmVirtPkg: use 'auto' alignment and FIXED placement for XIP modules
Now that GenFw correctly propagates the minimum alignment of the ELF
input sections to the PE/COFF binary, we can simply select 'auto'
alignment in the FDF Rule section instead of tweaking it by hand.

Also add the FIXED FFS attribute to the module types that may execute
in place. This enables a newly added optimization in GenFfs that strips
redundant padding, preventing excessive waste of FV space if the section
alignment is considerable (i.e., 2 KB or 4 KB)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18122 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-31 08:24:18 +00:00
Ard Biesheuvel 15c9b25e5d ArmVirtPkg: implement DT-based ArmGicArchLib
Since it is arguably incorrect to infer the GIC revision from CPU
ID and GIC feature registers on platforms that describe the GIC in
the device tree, this implements the library class ArmGicArchLib
tailored for such platforms.

The supported GIC revision is retrieved from the dynamic PCD that
is set based on the GIC DT node.

This means this library can only execute post DXE core, but this is
not a problem for any of the virt platforms.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18102 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-28 20:45:36 +00:00
Ard Biesheuvel ae26410e28 ArmVirtPkg: record GIC revision in dynamic PCD
In order to allow a ArmGicArchLib to be implemented that returns
the supported GIC revision based on the device tree, add handling
to VirtFdtDxe to record the GIC revision at DT parsing time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18101 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-28 20:45:25 +00:00
Ard Biesheuvel 8d13298b80 ArmPkg: split off ArmGicArchLib from ArmGicLib
The current implementation of ArmGicGetSupportedArchRevision ()
that is used by all ARM platforms is entirely stateless (in order
to support being executed from flash) so it needs to interrogate
the hardware for the supported GIC revision upon each invocation.

However, this statelessness is only needed for SEC type modules;
in all other cases, we could easily determine the GIC revision once,
and store the result in a global variable.

In preparation of having separate early and normal versions, this patch
introduces the ArmGicArchLib library class and default implementation,
and moves the existing ArmGicGetSupportedArchRevision () into it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18098 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-28 20:44:44 +00:00
Laszlo Ersek ceb0574006 ArmVirtPkg/ArmVirtQemu: support SMBIOS
The "MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf" driver is generic, it
provides EFI_SMBIOS_PROTOCOL.

The "OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf" driver downloads the
SMBIOS payload from QEMU via fw_cfg.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18044 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:03:00 +00:00
Laszlo Ersek c98da3345a ArmVirtPkg: QemuFwCfgToPcdDxe: set SMBIOS entry point version dynamically
(This patch parallels OvmfPkg commit 37baf06b (SVN r17676).)

PcdSmbiosVersion controls the version number of the SMBIOS entry point
table (and other, related things) that the universal
"MdeModulePkg/Universal/SmbiosDxe" driver, providing EFI_SMBIOS_PROTOCOL,
installs.

The "virt" machine type of QEMU generates SMBIOS payload for the firmware
to install. The payload includes the entry point table ("anchor" table).
OvmfPkg/SmbiosPlatformDxe cannot install the anchor table (because that is
the jurisdiction of the generic "MdeModulePkg/Universal/SmbiosDxe"
driver); however, we can parse the entry point version from QEMU's anchor
table, and instruct "MdeModulePkg/Universal/SmbiosDxe" to adhere to that
version.

As default for PcdSmbiosVersion we should keep the current 0x0300 value
(ie. SMBIOS 3.0) from "MdeModulePkg/MdeModulePkg.dec"; that spec version
was specifically created for ARM / AARCH64 needs.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18043 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:02:55 +00:00
Laszlo Ersek d2733aa95a ArmVirtPkg: add QemuFwCfgToPcdDxe
Many universal DXE drivers in edk2 can be controlled by setting dynamic
PCDs. Such a PCD must be set before the consumer DXE driver is dispatched.

(In general we assume that the DXE driver will consume the PCD in its
entry point, or in the constructor of a library instance it links against.
In special cases this requirement can be relaxed a bit, if we know that
the DXE driver accesses the PCD only in a protocol member function that it
exports.)

On the QEMU platform, the PCD values to be set for the universal drivers
are frequently derived from fw_cfg files that QEMU exports.

In OvmfPkg we tend to handle this in the following way:

- For IA32 and X64, OvmfPkg provides a QemuFwCfgLib instance that is
  usable in PEI.

- In PlatformPei, fw_cfg files can be loaded and transformed to PCD
  values.

- Any DXE driver is bound to be dispatched after the PEI phase is done.

(In specific cases other ordering solutions might be possible, via Depex
or protocol notify, etc.)

In ArmVirtPkg/ArmVirtQemu, things differ a bit:

- We don't have an ArmVirtPkg-specific ("Platform") PEIM. This is actually
  a good thing for now, so let's not introduce one just for this purpose.

- Even if we had such a PEIM, it could not easily access fw_cfg: the MMIO
  addresses of the fw_cfg device are available only in the DTB that QEMU
  exports.

  (Accordingly, our QemuFwCfgLib instance is restricted to DXE_DRIVER
  modules: VirtFdtDxe parses the DTB, stores the fw_cfg addresses in PCDs,
  and then QemuFwCfgLib's constructor fetches those PCDs.)

  There are some examples in ArmVirtPkg where early code is forced to
  parse the DTB manually, but those examples are all painful, and our goal
  here (controlling universal DXE drivers) doesn't justify more of that
  pain.

Therefore, introduce a separate, minimal DXE driver that is dispatched
strictly after VirtFdtDxe (so that it can use QemuFwCfgLib), and strictly
before other DXE drivers (so that it can set dynamic PCDs for them).
Because VirtFdtDxe is already ordered with the APRIORI DXE file, it is
simplest to do the same for the new driver.

Actual fw_cfg files and PCDs shall be accessed in future patches.

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>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18042 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:02:50 +00:00
Heyi Guo a5955fa352 ArmVirtPkg: Make terminal type consistent
Change default terminal type to be consistent with default
ConIn/ConOut device path, which is now determined by TTY_TERMINAL
flag, TTYTERM or VT100.

I can't say this is a bug, as we can pass the whole console device
path to ConnectController, and TerminalDxe driver will pick up the
terminal in the remaining device path. However, in rare circumstances,
the console devices may be disconnected with the driver, and they will
be ignored by ConPlatformDxe until we pass the device path explicitly
just as BDS.

Changing default terminal type to be the same with console device
path could help serial terminal be reconnected with normal connect
controller operation.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18025 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-16 08:50:24 +00:00