summaryrefslogtreecommitdiff
path: root/ArmPkg
AgeCommit message (Collapse)Author
2016-08-11ArmPkg/SemihostLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Note that in some cases, various entry points refer to different parts of the same routine, so in those cases, the files have been left untouched. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/BaseMemoryLibVstm: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/BaseMemoryLibSm: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmSmcLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmMmuLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmHvcLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmGicV3: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmCpuLib: switch to ASM_FUNC() asm macroArd Biesheuvel
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/ArmSmcLibNull: move to generic C implementationArd Biesheuvel
The C language is powerful enough to implement a function that does absolutely nothing, so there is no need to resort to implementations in assembler for various toolchains/architectures. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macrosArd Biesheuvel
This introduces the ASM_FUNC() macro to annotate function entry points in assembler files. This allows us to add additional metadata that marks a function entry point as a function, and allows us to emit a .section directive for each function, which makes it possible for the linker to drop unreferenced code. In addition, introduce a couple of utility macros that we can use to clean up the code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Eugene Cohen <eugene@hp.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macrosArd Biesheuvel
This removes the various Mmio ASM macros that are not used anywhere in the code, and removes some variants of LoadConstant... () that are not used anywhere either. Note that these MmioXxx() implementations are unrelated to the C versions defined in MdePkg. These are strictly intended for use in assembler, and no such uses remain. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmPkg: add missing ArmMmuLib resolution to ArmPkg.dscArd Biesheuvel
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-11ArmLib: remove ArmReplaceLiveTranslationEntry() implementationArd Biesheuvel
The function ArmReplaceLiveTranslationEntry() has been moved to ArmMmuLib, so remove the old implementation from ArmLib. Note that the new implementation was not exported from the object file, and so references to it were satisfied by the old version residing in ArmLib. Since we are removing that one, we need to export the new one at the same time to prevent the linker from bailing with undefined reference errors. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-08ArmPkg/ArmGicDxe: Fix double GIC EIOR write per interruptAlexei Fedorov
This commit fixes a bug in the GIC v2 and v3 drivers where the GICC_EOIR (End Of Interrupt Register) is written twice for a single interrupt. GicV(2|3)IrqInterruptHandler() calls the Interrupt Handler and then GicV(2|3)EndOfInterrupt() on exit: InterruptHandler = gRegisteredInterruptHandlers[GicInterrupt]; if (InterruptHandler != NULL) { // Call the registered interrupt handler. InterruptHandler (GicInterrupt, SystemContext); } else { DEBUG ((EFI_D_ERROR, "Spurious GIC interrupt: 0x%x\n", GicInterrupt)); } GicV2EndOfInterrupt (&gHardwareInterruptV2Protocol, GicInterrupt); although gInterrupt->EndOfInterrupt() can be expected to have already been called by InterruptHandler() [which is the case for the primary in-tree handler in TimerDxe] The fix moves the EndOfInterrupt() call inside the else case for unregistered/spurious interrupts. This removes a potential race condition that might have lost interrupts. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Alexei Fedorov <alexei.fedorov@arm.com> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-08-05ArmPkg/CompilerIntrinsicsLib: make the default memset() weakArd Biesheuvel
The ARM compiler intrinsics library defines __aeabi_memset() and memset() in the same object, which means that both will be pulled in if either is referenced. The IntrinsicLib in CryptoPkg defines its own, preferred memset(), which may clash with our memset(). So make our version weak. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-05ArmPkg/ArmSoftFloatLib: disable LTO build for GCCArd Biesheuvel
Building ArmSoftFloatLib with LTO results in errors like .../bin/ld: softfloat.obj: plugin needed to handle lto object .../bin/ld: __aeabi_dcmpge.obj: plugin needed to handle lto object .../bin/ld: __aeabi_dcmplt.obj: plugin needed to handle lto object .../bin/ld: internal error ../../ld/ldlang.c 6299 This library is only linked by OpensslLib at the moment, and only marginally used at runtime, so just disable LTO for it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-02ArmPkg: add prebuilt glue binaries for GCC5 LTO supportArd Biesheuvel
GCC in LTO mode interoperates poorly with non-standard libraries that provide implementations of compiler intrinsics such as memcpy/memset or the stack protector entry points. Such libraries need to be built in non-LTO mode, and then referenced explicitly on the linker command line using a -plugin-opt=-pass-through=-lxxx linker option. However, if these intrinsics are also referenced directly, the LTO version of the code will be pulled in, and will happily satisfy all other references to the same symbol. So add a pair of glue libraries, for ARM and AARCH64, that reference the known intrinsics. Since the binaries live under ArmPkg directly, we can reference them in tools_def.txt. Under LD garbage collection, the object itself will be pruned, and so will the intrinsics that end up unused by the module. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-01ArmPkg/Library: Add ArmReadSctlr for AArch64Supreeth Venkatesh
ArmLib defines a prototype for the ArmReadSctlr() function, but the AArch64 implementation is missing. So add it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: John Powell <john.powell@arm.com> Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com> [ardb: update commit log] Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-07-28ArmPkg: Add Cortex-A72 CPU typeJeremy Linton
Add the Cortex-A72 CPU type which is used in JunoR2. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-13ArmPkg/ArmGicLib: manage GICv3 SPI state at the distributorArd Biesheuvel
Unlike SGIs and PPIs, which are private to the CPU and are managed at the redistributor level (which is also a per-CPU construct), shared interrupts (SPIs) are shared between all CPUs, and therefore managed at the distributor level (just as on GICv2). Reported-by: Narinder Dhillon <ndhillonv2@gmail.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-13ArmPkg/ArmMmuLib: avoid type promotion in TCR_EL1 assignmentArd Biesheuvel
Commit fafb7e9c110e ("ArmPkg: correct TTBR1_EL1 settings in TCR_EL1") introduced a symbolic constant TCR_TG1_4KB which resolves to (2 << 30), and ORs it into the value to be written into TCR_EL1 (if executing at EL1). Since the constant is implicitly typed as signed int, and has the sign bit set, the promotion that occurs when casting to UINT64 results in a TCR value that has bits [63:32] all set, which includes mostly RES0 bits but also the TBIn, AS and IPS fields. So explicitly redefine all TCR related constants as 'unsigned long' types, using the UL suffix. To avoid confusion in the future, the inappropriately named VTCR_EL23_xxx constants have the leading V removed, and the actual VTCR_EL2 related constants are dropped, given that we never configure stage 2 translation in UEFI. Reported-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com>
2016-07-11ArmPkg: Fix typos in commentsGiri P Mudusuru
EFI_UNSUPPORTEDT to EFI_UNSUPPORTED Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-07-07ArmPkg/ArmMmuLib: add PEI specific version of ArmMmuLibArd Biesheuvel
This introduces a special version of ArmMmuLib for PEIMs that takes care only to perform cache maintenance on the live entry replacement routine if the module is not executing in place. Not only is such cache maintenance unnecessary in that case, it may be actively harmful on some systems that fail to tolerate cache maintenance operations on NOR flash regions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-07ArmPkg ArmVirtPkg MdeModulePkg: switch to separate ArmMmuLibArd Biesheuvel
Switch all users of ArmLib that depend on the MMU routines to the new, separate ArmMmuLib. This needs to occur in one go, since the MMU routines are removed from ArmLib build at the same time, to prevent conflicting symbols. 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: Star Zeng <star.zeng@intel.com>
2016-07-07ArmPkg: introduce base ArmMmuLib implementationArd Biesheuvel
This base library encapsulates the MMU manipulation routines that have been factored out of ArmLib. The functionality covers initial creation of the 1:1 mapping in the page tables, and remapping regions to change permissions or cacheability attributes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-07ArmPkg: introduce ArmMmuLib library classArd Biesheuvel
Introduce the library class ArmMmuLib, which encapsulates the functionality to set up and modify page table entries. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-01ArmPkg/CpuDxe: unmask SErrors in DEBUG buildsArd Biesheuvel
SErrors (formerly called asynchronous aborts) are a distinct class of exceptions that are not closely tied to the currently executing instruction. Since execution may be able to proceed in such a condition, this class of exception is masked by default, and software needs to unmask it explicitly if it is prepared to handle such exceptions. On DEBUG builds, we are well equipped to report the CPU context to the user and it makes sense to report an SError as soon as it occurs rather than to wait for the OS to take it when it unmasks them, especially since the current arm64/Linux implementation simply panics in that case. So unmask them when ArmCpuDxe loads. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-07-01ArmPkg/DefaultExceptionHandlerLib: put ASSERT (FALSE) lastArd Biesheuvel
Putting DEBUG () code after an ASSERT (FALSE) statement is not very useful, since the code will be unreachable on DEBUG builds and compiled out on RELEASE builds. So move the ASSERT () statement after it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-06-23ArmPkg/ArmGicV3Dxe: configure all interrupts as non-secure Group-1Ard Biesheuvel
Reassign all interrupts to non-secure Group-1 if the GIC has its DS (Disable Security) bit set. In this case, it is safe to assume that we own the GIC, and that no other firmware has performed any configuration yet, which means it is up to us to reconfigure the interrupts so they can be taken by the non-secure firmware. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-06-15ArmPkg/ArmLib: avoid cache maintenance in PEIMs when executing in placeArd Biesheuvel
On some platforms, performing cache maintenance on regions that are backed by NOR flash result in SErrors. Since cache maintenance is unnecessary in that case, create a PEIM specific version that only performs said cache maintenance in its constructor if the module is shadowed in RAM. To avoid performing the cache maintenance if the MMU code is not used to begin with, check that explicitly in the constructor. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-12ArmPkg/PlatformBootManagerLib: implement new generic versionArd Biesheuvel
This implements the platform glue for the new generic BDS implementation. It is based on the ArmVirtQemu version, with the QEMU references removed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-12ArmPkg/ArmLib: don't invalidate entire I-cache on range operationArd Biesheuvel
Instead of cleaning the data cache to the PoU by virtual address and subsequently invalidating the entire I-cache, invalidate only the range that we just cleaned. This way, we don't invalidate other cachelines unnecessarily. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/AArch64Mmu: don't let table entries inherit XN permission bitsArd Biesheuvel
When we split a block entry into a table entry, the UXN/PXN/XN permission attributes are inherited both by the new table entry and by the new block entries at the next level down. Unlike the NS bit, which only affects the next level of lookup, the XN table bits supersede the permissions of the final translation, and setting the permissions at multiple levels is not only redundant, it also prevents us from lifting XN restrictions on a subregion of the original block entry by simply clearing the appropriate bits at the lowest level. So drop the code that sets the UXN/PXN/XN bits on the table entries. Reported-by: "Oliyil Kunnil, Vishal" <vishalo@qti.qualcomm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: assert that consistent mappings are uncachedArd Biesheuvel
DmaMap () only allows uncached mappings to be used for creating consistent mappings with operation type MapOperationBusMasterCommonBuffer. However, if the buffer passed to DmaMap () happens to be aligned to the CWG, there is no need for a bounce buffer, and we perform the cache maintenance directly without ever checking if the memory attributes of the buffer adhere to the API. So add some debug code that asserts that the operation type and the memory attributes are consistent. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: do not remap arbitrary memory regions as uncachedArd Biesheuvel
In the DmaMap () operation, if the region to be mapped happens to be aligned to the Cache Writeback Granule (CWG) (whose value is typically 64 or 128 bytes and 2 KB maximum), we remap the memory as uncached. Since remapping memory occurs at page granularity, while the buffer and the CWG may be much smaller, there is no telling what other memory we affect by doing this, especially since the operation is not reverted in DmaUnmap(). So remove the remapping call. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: reject consistent DMA mappings of cached memoryArd Biesheuvel
DmaMap () operations of type MapOperationBusMasterCommonBuffer should return a mapping that is coherent between the CPU and the device. For this reason, the API only allows DmaMap () to be called with this operation type if the memory to be mapped was allocated by DmaAllocateBuffer (), which in this implementation guarantees the coherency by using uncached mappings on the CPU side. This means that, if we encounter a cached mapping in DmaMap () with this operation type, the code is either broken, or someone is violating the API, but simply proceeding with a double buffer makes no sense at all, and can only cause problems. So instead, actively reject this operation type for cached memory mappings. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: interpret GCD attributes as a bit fieldArd Biesheuvel
Comparing a GCD attribute field directly against EFI_MEMORY_UC and EFI_MEMORY_WT is incorrect, since it may have other bits set as well which are not related to the cacheability of the region. So instead, test explicitly against the flags EFI_MEMORY_WB and EFI_MEMORY_WT, which must be set if the region may be mapped with cacheable attributes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: consistently use 'gCacheAlignment - 1' as alignment maskArd Biesheuvel
We manage to use both an AND operation with 'gCacheAlignment - 1' and a modulo operation with 'gCacheAlignment' in the same compound if statement. Since gCacheAlignment is a global of which the compiler cannot guarantee that it is a power of two, simply use the AND version in both cases. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-10ArmPkg/ArmDmaLib: deal with NULL return value of UncachedAllocatePages ()Ard Biesheuvel
The allocation function UncachedAllocatePages () may return NULL, in which case our implementation of DmaAllocateBuffer () should return EFI_OUT_OF_RESOURCES rather than silently ignoring the NULL value and returning EFI_SUCCESS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-09ArmPkg/DefaultExceptionHandlerLib: fix typoArd Biesheuvel
Replace : with ; which was changes accidentally. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-05-09ArmPkg/DefaultExceptionHandlerLib: add stack dump to exception handling codeArd Biesheuvel
This adds a partial stack dump (256 bytes at either side of the stack pointer) to the CPU state dumping routine that is invoked when taking an unexpected exception. Since dereferencing the stack pointer may itself fault, ensure that we don't enter the dumping routine recursively. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-05-09ArmPkg/DefaultExceptionHandlerLib: use deadloop rather than ASSERTArd Biesheuvel
The default exception handler, which is essentially the one that is invoked for unexpected exceptions, ends with an ASSERT (FALSE), to ensure that execution halts after dumping the CPU state. However, ASSERTs are compiled out in RELEASE builds, and since we simply return to wherever the ELR is pointing, we will not make any progress in case of synchronous aborts, and the same exception will be taken again immediately, resulting in the string 'Exception at 0x....' to be printed over and over again. So use an explicit deadloop instead. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-04-29ArmPkg: implement CpuIo2 protocol driver specific for PCIArd Biesheuvel
The CpuIo2 protocol is required by the generic PciHostBridgeDxe driver, which relies on it to back its own I/O and MMIO operations. Since ARM has no native I/O port equivalent, such accesses can only originate from PCI drivers, and the PCI I/O space is translated to MMIO in this case. So we can implement this protocol using MMIO operations only, and take the PCI I/O translation offset into account when performing I/O port accesses. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-04-29ArmPlatformPkg: move PCI related PCD definitions to ArmPkgArd Biesheuvel
The PCI related PCDs are not platform specific, and architectural protocols such as CpuIo2 are based on PCI provided MMIO to IO translation, so these PCDs belong in ArmPkg not ArmPlatformPkg. NOTE: this *WILL* break some out-of-tree platforms, the fix is changing all consumers of gArmPlatformTokenSpaceGuid.PcdPci* to gArmTokenSpaceGuid.PcdPci* Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-04-25ArmPkg/Gic: Fix boundary checking bugHeyi Guo
mGicNumInterrupts is the total number of interrupts, so the interrupt ID equal to mGicNumInterrupts is also invalid. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-04-14ArmPkg/AArch64Mmu: disable MMU during page table manipulationsArd Biesheuvel
On ARM, manipulating live page tables is cumbersome since the architecture mandates the use of break-before-make, i.e., replacing a block entry with a table entry requires an intermediate step via an invalid entry, or TLB conflicts may occur. Since it is not generally feasible to decide in the page table manipulation routines whether such an invalid entry will result in those routines themselves to become unavailable, use a function that is callable with the MMU off (i.e., a leaf function that does not access the stack) to perform the change of a block entry into a table entry. Note that the opposite should never occur, i.e., table entries are never coalesced into block entries. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com>
2016-04-14ArmPkg/AArch64Mmu: Fix XN attribute for device memoryHeyi Guo
Now XN attribute will be set automatically if the region is declared as device memory. However, the function ArmMemoryAttributeToPageAttribute is to get attribute for block and page descriptors, not for table descriptors, so attribute TT_TABLE_*XN does not really take effect. Need to use TT_*XN_MASK instead. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-04-01ArmPkg/ArmArchTimerLib: correct typosEvan Lloyd
Some minor typographical problems were noticed during previous commits. This change corrects those, and contains no functional modifications. The changes are in comments, and one diagnostic message. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>