summaryrefslogtreecommitdiff
path: root/ArmVirtPkg
AgeCommit message (Collapse)AuthorFilesLines
2017-03-01ArmVirtPkg AARCH64: enable NX memory protection for all platformsArd Biesheuvel1-0/+7
This sets the recently introduced PCD PcdDxeNxMemoryProtectionPolicy to a value that protects all memory regions except code regions against inadvertent execution. Note that this does not [yet] protect EfiLoaderData regions, due to compatibility issues with shim and GRUB. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
2017-03-01ArmVirtPkg: move UefiBootManagerLib resolution to ArmVirt.dsc.incArd Biesheuvel3-2/+1
Recent changes to ShellPkg require a resolution for UefiBootManagerLib for all platforms in ArmVirtPkg. So move the resolution to the shared include ArmVirt.dsc.inc. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-03-01ArmVirtPkg/HighMemDxe: preserve non-exec permissions on newly added regionsArd Biesheuvel2-2/+17
Using DxeServices::SetMemorySpaceAttributes to set cacheability attributes has the side effect of stripping permission attributes, given that those are bits in the same bitfield, and so setting the Attributes argument to EFI_MEMORY_WB implies not setting EFI_MEMORY_XP or EFI_MEMORY_RO attributes. In fact, the situation is even worse, given that the descriptor returned by DxeServices::GetMemorySpaceDescriptor does not reflect the permission attributes that may have been set by the preceding call to DxeServices::AddMemorySpace if PcdDxeNxMemoryProtectionPolicy has been configured to map EfiConventionalMemory with non-executable permissions. Note that this applies equally to the non-executable stack and to PE/COFF sections that may have been mapped with R-X or RW- permissions. This is due to the ambiguity in the meaning of the EFI_MEMORY_RO/EFI_MEMORY_XP attributes when used in the GCD memory map, i.e., between signifying that an underlying RAM region has the controls to be configured as read-only or non-executable, and signifying that the contents of a certain UEFI memory region allow them to be mapped with certain restricted permissions. So let's check the policy in PcdDxeNxMemoryProtectionPolicy directly, and set the EFI_MEMORY_XP attribute if appropriate for EfiConventionalMemory regions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-02-27ArmPkg: remove unused PcdArmUncachedMemoryMask PCDArd Biesheuvel3-15/+0
This removes the PCD PcdArmUncachedMemoryMask from ArmPkg, along with any remaining references to it in various platform .DSC files. It is no longer used now that we removed the virtual uncached pages protocol and the associated DebugUncachedMemoryAllocationLib library instance. 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>
2017-02-27ArmVirtPkg: clear PcdPerformanceLibraryPropertyMask PCDArd Biesheuvel1-1/+0
The only observeable effect of having PcdPerformanceLibraryPropertyMask set to 1 is that a EfiReservedMemory region of 4 pages is allocated right below the 4 GB mark. This region is out of bounds for the OS, which means it is not even allowed to map it, to avoid speculative loads from it. On Linux, this may prevent the kernel from using a 1 GB block mapping for this region, and instead it has to carve up the block as follows: 0xffffffff80000000-0xffffffffbe000000 992M PMD CON BLK 0xffffffffbe000000-0xffffffffbfe00000 30M PMD BLK 0xffffffffbfe00000-0xffffffffbfff0000 1984K PTE CON 0xffffffffbfff0000-0xffffffffbfffc000 48K PTE where it would otherwise use a single 1 GB mapping (*), i.e., 0xffffffff80000000-0xffffffffc0000000 1G PGD To clarify, the latter is a single 8 byte entry in the top level page table, whereas in the former case, we have two additional levels of paging, requiring two extra 4 KB pages (on a 4 KB pagesize kernel). The real cost, however, is the TLB footprint, which goes up from a single entry to a number between 90 and 1020, depending on whether contiguous hints are honoured by the hardware. So let's remove PcdPerformanceLibraryPropertyMask until we find a reason why we need it. (*) provided that no other allocations were deliberately located right below the 4 GB mark, and that we are running with more than 3 GB of memory, in which case most allocations will be over 4 GB, given EDK2's default top-down allocation policy. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-02-25ArmVirtPkg: resolve OpensslLib to OpensslLibCryptoLaszlo Ersek1-1/+1
The OpensslLibCrypto library instance (which does not contain libssl functions) is sufficient for the Secure Boot feature. It would not be sufficient for HTTPS booting (which requires TLS), but in ArmVirtPkg, we don't even enable plaintext HTTP booting for the time being. Ease security analysis by excluding libssl functionality from the OpensslLib instance we use. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Tomas Hoger <thoger@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>
2017-02-24ArmVirtPkg/ArmVirt.dsc.inc: AARCH64: enable DXE image protection featureArd Biesheuvel1-0/+10
Enable the new DXE image protection for all image, i.e., FV images but also external images that originate from disk or the network, such as OS loaders. This complements work that is underway on the arm64/Linux kernel side, to emit the OS loader with 4 KB section alignment, and a suitable split between code and data. http://marc.info/?l=linux-arm-kernel&m=148655557227819 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-02-23ArmPkg: remove DebugUncachedMemoryAllocationLibArd Biesheuvel1-2/+0
The debug implementation of the UncachedMemoryAllocationLib library class relies on the creation of an uncached alias of a memory range, while keeping the original cached mapping, but with read-only attributes to trap inadvertent write accesses. This is not a terribly good idea, given that the ARM architecture does not allow mismatched attributes, and so creating them deliberately is not something we should encourage by doing it in reference code. So remove the library, and replace all references to it with a reference to the non-debug version (unless the platform does not require a resolution for it in the first place, in which case all UncachedMemoryAllocationLib references can be removed altogether). 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>
2017-01-31ArmVirtPkg/QemuFwCfgLib: implement QemuFwCfgSkipBytes() APILaszlo Ersek1-0/+78
We are now sufficiently equipped to implement the new QemuFwCfgSkipBytes() API. The previous patch and this one enable ArmVirtPkg/QemuFwCfgLib to overwrite part of a writeable fw_cfg file, which will be particularly useful for the upcoming QEMU_LOADER_WRITE_POINTER command in OvmfPkg/AcpiPlatformDxe. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359 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>
2017-01-31ArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if availableLaszlo Ersek1-6/+54
We use the "InternalQemuFwCfgReadBytes" static function pointer to dispatch the reading of fw_cfg bytes between MMIO and DMA. This pointer is initialized to MMIO, and we set it to DMA in the library constructor if DMA is available. Unlike the above, we write fw_cfg bytes only with MMIO at the moment. Extend the write functionality so that it follows the read pattern: - introduce the new function typedef WRITE_BYTES_FUNCTION, - extract the current (MMIO-only) write internals from QemuFwCfgWriteBytes() to MmioWriteBytes(), - provide a DMA-based implementation in DmaWriteBytes() -- a thin wrapper around DmaTransferBytes(), - set the new static function pointer "InternalQemuFwCfgWriteBytes" according to the DMA feature provided by QEMU, - In QemuFwCfgWriteBytes(), call the best available method through "InternalQemuFwCfgWriteBytes". Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359 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>
2017-01-31ArmVirtPkg/QemuFwCfgLib: extract generic DmaTransferBytes() functionLaszlo Ersek1-6/+36
The DmaReadBytes() function that we currently use only for reading -- through the InternalQemuFwCfgReadBytes function pointer, in case the DMA interface is available -- is suitable with minimal changes for two more operations provided by the DMA interface, WRITE and SKIP. Expose the Control parameter in the function prototype, rename the function to DmaTransferBytes(), and rebase DmaReadBytes() to it. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359 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>
2017-01-16ArmVirtPkg/ArmVirtQemu: Install BGRT ACPI tableBhupesh Sharma3-0/+3
While debugging OS for ACPI BGRT support (especially on VMs), it is very useful to have the EFI firmware to export the ACPI BGRT table. This patch tries to add this support in ArmVirtPkg. Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-12-05ArmVirtPkg/QemuFwCfgLib: rebase lib instance to updated lib class headerLaszlo Ersek1-1/+1
Put the FW_CFG_F_DMA constant, introduced in the last patch, to use. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-12-05ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib classLaszlo Ersek1-20/+0
Move the type and macro definitions related to QEMU's DMA-like fw_cfg access method to the library class header. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-12-05ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable()Laszlo Ersek1-25/+6
InternalQemuFwCfgIsAvailable() is an API that is incorrectly exposed by the "OvmfPkg/Include/Library/QemuFwCfgLib.h" library class header; the API is meant to be used internally to library instances (if it's needed at all). ArmVirtPkg's instance has no use for it actually, so simplify the code and remove the function definition. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> 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: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-11-17ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob()Star Zeng1-1/+3
Update the function header description of BuildFv(2)Hob() to match with HobLib.h in MdePkg. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@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: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2016-11-10ArmVirPkg/PlatformBds: Dispatch deferred images after EndOfDxeRuiyu Ni1-0/+5
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Sunny Wang <sunnywang@hpe.com>
2016-10-27ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE()Laszlo Ersek1-1/+1
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>
2016-10-25ArmVirtPkg: disable deprecated interfacesLaszlo Ersek1-0/+6
At this point no code in ArmVirtPkg (and apparently no code outside of ArmVirtPkg that the ArmVirt binaries depend on) uses the deprecated APIs, so we can disable them in the common platform DSC include file: BaseLib: - StrCpy - StrnCpy - StrCat - StrnCat - UnicodeStrToAsciiStr - AsciiStrCpy - AsciiStrnCpy - AsciiStrCat - AsciiStrnCat - AsciiStrToUnicodeStr PcdLib: - PcdSet8 - PcdSet16 - PcdSet32 - PcdSet64 - PcdSetPtr - PcdSetBool - PcdSetEx8 - PcdSetEx16 - PcdSetEx32 - PcdSetEx64 - PcdSetExPtr - PcdSetExBool UefiLib: - GetVariable - GetEfiGlobalVariable 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> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/PlatformBootManagerLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-1/+5
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/FdtPciPcdProducerLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-3/+7
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/ArmVirtTimerFdtClientLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-4/+9
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/ArmVirtPlatformLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-8/+10
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/ArmVirtPL031FdtClientLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-1/+3
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-25ArmVirtPkg/ArmVirtGicArchLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek1-4/+9
These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 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> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-10-24ArmVirtPkg/PrePi: remove mSystemMemoryEndArd Biesheuvel3-15/+1
Recording the top of SEC visible system memory in a global variable is not necessary, and violates the constraints of the SEC/PEI environment, given that it may execute from NOR flash. 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>
2016-10-21ArmVirtPkg/ArmVirtGicArchLib: adapt ASSERT()s to 64-bit base addressesDennis Chen1-4/+4
Since All the GIC base address variables has been aligned to 64-bit, it doesn't make sense to continue use MAX_UINT32 in ASSERT() statement, so this patch uses MAX_UINTN to adapt to this kind of change. Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Dennis Chen <dennis.chen@arm.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-10-15ArmVirtPkg: undo bogus component name and driver diagnostics disablementLaszlo Ersek1-4/+0
The entry point function of any UEFI_DRIVER that conforms to the UEFI driver model must install an instance of the EFI_DRIVER_BINDING_PROTOCOL on the image handle. Beyond that, the following protocols are optional: - EFI_COMPONENT_NAME_PROTOCOL - EFI_COMPONENT_NAME2_PROTOCOL - EFI_DRIVER_CONFIGURATION_PROTOCOL - EFI_DRIVER_CONFIGURATION2_PROTOCOL - EFI_DRIVER_DIAGNOSTICS_PROTOCOL - EFI_DRIVER_DIAGNOSTICS2_PROTOCOL The UefiLib functions - EfiLibInstallAllDriverProtocols() - EfiLibInstallAllDriverProtocols2() - EfiLibInstallDriverBindingComponentName2() are convenience helpers for such UEFI_DRIVERs. They simplify the installation of the above protocols. The UefiLib instance in "MdePkg/Library/UefiLib/UefiDriverModel.c" allows platforms to control these functions through the MdePkg feature PCDs - PcdComponentNameDisable - PcdComponentName2Disable - PcdDriverDiagnosticsDisable - PcdDriverDiagnostics2Disable If any of these PCDs are set to TRUE, then the helper functions will not install the corresponding protocol interfaces on the image handle, even if the driver passes in non-NULL protocol interfaces. In other words, at build time, a platform can forcibly prevent all drivers that employ UefiLib from producing these protocols. In ArmVirtPkg, that's what we've been doing forever, for no reason at all. This is why we haven't been seeing component and driver names from the DH, DEVICES, DRIVERS and DEVTREE shell commands, unlike in OvmfPkg. The default value for all these PCDs is FALSE, in "MdePkg/MdePkg.dec". Revert ArmVirtPkg to the sane defaults. This bug dates back to the inception of ArmVirtPkg (called ArmPlatformPkg/ArmVirtualizationPkg at the time). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Fixes: 6f5872b1f4013f58c6d2f446d885edd6c8ea6d21 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-10-12ArmVirtPkg: Remove unused BltLib referenceRuiyu Ni2-8/+2
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek at redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-10-12ArmVirtPkg: Include MdeModulePkg/FrameBufferLib in ArmVirtPkgRuiyu Ni2-0/+2
One of the following patches will change QemuVideoDxe driver to use the new FrameBufferLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek at redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-09-28ArmVirtPkg: Use the new LogoDxe driverRuiyu Ni4-20/+6
Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-09-28ArmVirtPkg/PlatformBds: Do not call BootLogoEnableLogoRuiyu Ni2-8/+7
Prototype of BootLogoEnableLogo will change in following patches, so do not call BootLogoEnableLogo to avoid build failure. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-09-21ArmVirtPkg: move all platforms to MdePkg/ BaseMemoryLib implementationsArd Biesheuvel1-3/+5
The BaseMemoryLibStm implementation under ArmPkg/ is being deprecated, in favor of the generic versions under MdePkg, now that ARM and AARCH64 support has been added to both the generic C version (BaseMemoryLib) and the accelerated version (BaseMemoryLibOptDxe). The latter uses unaligned accesses and special cache maintenance instructions, and can therefore not be used when the MMU is off. So move to BaseMemoryLibOptDxe for the DXE phase and later, and to the generic BaseMemoryLib before that. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-15ArmVirtPkg/HighMemDxe: move to FDT client protocolArd Biesheuvel2-75/+61
Use the FDT client protocol rather than parsing the DT directly using fdtlib. While we're at it, update the code so it deals correctly with memory nodes that describe multiple disjoint regions in their "reg" properties, and make the code work with #address-cells/#size-cells properties of <1> as well as <2>. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-15ArmVirtPkg/FdtClientDxe: add methods to iterate over memory nodesArd Biesheuvel2-0/+101
Add high level methods to iterate over all 'reg' properties of all DT nodes whose device_type properties have the value "memory". Since we are modifying the FdtClient protocol, update the protocol and the only existing implementation at the same time. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-15ArmVirtPkg/FdtClientDxe: report address and size cell count directlyArd Biesheuvel6-14/+31
The FDT client protocol methods dealing with "reg" properties return the size of a "reg" element. Currently, we have hardcoded this as '8', since #address-cells == #size-cells == 2 in most cases. However, for different values, have a single 'reg' element size is not unambiguous, since - however unlikely - if #address-cells != #size-cells, we do not know which is which. So before adding more methods to the protocol, fix up this oversight. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-15ArmVirtPkg/FdtClientDxe: fix check for size of "reg" propertiesArd Biesheuvel1-1/+1
Currently, the code in FdtClientDxe assumes #address-cells/#size-cells values of <2>. Since DT "reg" properties always consist of <base, size> tuples, this means the size of the entire property should always be a multiple of 16 bytes (i.e, 4 * sizeof(UINT32), not 8. So fix this. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-13ArmVirtPkg/FdtParser: avoid unaligned accesses with the MMU offArd Biesheuvel2-16/+12
When parsing the device tree to find the memory node, we are still running with the MMU off, which means unaligned memory accesses are not allowed. Since the FDT only mandates 32-bit alignment, 64-bit quantities are not guaranteed to appear naturally aligned, and so should be accessed using 32-bit accesses instead. Reported-by: Julien Grall <julien.grall@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>
2016-09-08ArmVirtPkg: restrict mapping attributes of normal memory to EFI_MEMORY_WBArd Biesheuvel2-5/+1
In general, on an ARM system, mapping normal memory as device memory may have unintended side effects, given that unaligned accesses or loads and stores with special semantics (e.g., load/store exclusive) may fault or may not work as expected. Under KVM, the situation is even worse, since the host may not expect the guest to perform uncached accesses, and so writes to such an uncached region may get lost completely. Since the only safe mapping type under KVM is EFI_MEMORY_WB, remove all other memory type attributes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-08ArmVirtPkg: replace all ArmLib resolutions with ArmBaseLibArd Biesheuvel3-24/+3
The various ArmLib flavors are identical in practice, and a new ArmBaseLib has been introduced that can replace all of them. So replace all occurrences with ArmBaseLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-08ArmPkg ArmPlatformPkg ArmVirtPkg: ARM GICv2/v3 Base Address width fix-upDennis Chen1-4/+4
According to the ACPI 6.0/6.1 spec, the physical base address of GICC, GICD, GICR and GIC ITS is 64-bit. So change the type of the various GIC base address PCDs to 64-bit, and fix up all users. Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Dennis Chen <dennis.chen@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-09-06ArmVirtPkg/FdtPciHostBridgeLib: enable 64-bit PCI DMAArd Biesheuvel1-1/+1
Now that the PCI root bridge driver and various host controller drivers have been fixed, remove the 4 GB limit on PCI DMA allocation for QEMU's ECAM PCI host bridge. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-05ArmVirtPkg/FdtPciPcdProducerLib: zero init local var to please GCC 4.8Ard Biesheuvel1-0/+1
GCC 4.8 in RELEASE mode complains about GetPciIoTranslation () potentially not assigning IoTranslation, but does not notice that it returns failure in this case, which means IoTranslation is never referenced *unless* it has been assigned. So simply set IoTranslation to zero to help the compiler. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-09-02ArmVirtPkg: remove now unused PciHostBridgeDxeArd Biesheuvel4-4165/+0
This code is now no longer used, 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> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-02ArmVirtPkg/FdtPciHostBridgeLib: add MMIO64 supportArd Biesheuvel2-22/+59
If the pci-host-ecam-generic DT node describes a 64-bit MMIO region, account for it in the PCI_ROOT_BRIDGE description that we return to the generic PciHostBridgeDxe implementation, which will be able to allocate BARs from it without any further changes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-02ArmVirtPkg/ArmVirtQemu: switch to generic PciHostBridgeDxeArd Biesheuvel3-3/+20
Wire up the FdtPciHostBridgeLib introduced in the previous patch to the generic PciHostBridgeDxe implementation, and drop the special ArmVirtPkg version. The former's dependency on gEfiCpuIo2ProtocolGuid is satisfied by adding ArmPciCpuIo2Dxe.inf as well, and adding the PCD gArmTokenSpaceGuid.PcdPciIoTranslation as a dynamic PCD. In terms of functionality, no changes are intended. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-02ArmVirtPkg: implement FdtPciHostBridgeLibArd Biesheuvel2-0/+456
Implement PciHostBridgeLib for DT platforms that expose a PCI root bridge via a pci-host-ecam-generic DT node. The DT parsing logic is copied from the PciHostBridgeDxe implementation in ArmVirtPkg, with the one notable difference that we don't set some of the legacy PCI attributes for IDE and VGA I/O ranges. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-02ArmVirtPkg/FdtPciPcdProducerLib: add handling of PcdPciIoTranslationArd Biesheuvel2-10/+100
Add handling of the PcdPciIoTranslation PCD, so that modules that include this library via NULL resolution are guaranteed that it will be set before they reference it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-02ArmVirtPkg/PciHostBridgeDxe: don't set linux,pci-probe-only DT propertyArd Biesheuvel1-38/+0
Setting the linux,pci-probe-only was intended to align OSes booting via DT with OSes booting via ACPI in the way they honor the PCI configuration performed by the firmware. However, ACPI on arm64 does not currently honor the firmware's PCI configuration, and the linux,pci-probe-only completely prevents any PCI reconfiguration from occurring under the OS, including what is needed to support PCI hotplug. Since the primary use case was OS access to the GOP framebuffer (which breaks when the framebuffer BAR is moved when the OS reconfigures the PCI), we can undo this change now that ArmVirtQemu has moved to a GOP implementation that does not expose a raw framebuffer in the first place. This effectively reverts commit 8b816c624dd4 ("ArmVirtPkg/VirtFdtDxe: set /chosen/linux,pci-probe-only to 1 in DTB") Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=65
2016-09-01ArmVirtPkg: remove PcdKludgeMapPciMmioAsCachedLaszlo Ersek5-33/+1
In ARM/AARCH64 guests that run on KVM, we can now use virtio-gpu-pci, so PcdKludgeMapPciMmioAsCached is no longer necessary. Standard VGA continues to work on TCG without the kludge. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=66 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>