aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/lib
AgeCommit message (Collapse)AuthorFilesLines
2018-07-26ARM: PSCI: Enable the PSCI nodeStephen Warren1-0/+4
When fixing up the DT to report PSCI support, explicitly enable the node. DTs may ship with the node disabled in case a PSCI implementation is not present, and expect any PSCI implementation to enable the node if they are actually present. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
2018-07-26ARM: PSCI: Support PSCI v0.2Stephen Warren1-0/+2
Enhance the PSCI DT editing code to allow setting a PSCI v0.2 compatible value in the DT. The CONFIG_ option is added to the whitelist to match the existing PSCI_1_0 option. While not adding new options to Kconfig isn't ideal, I figure it's better to keep related options together. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
2018-07-19arm: Remove unused _relocate argumentsIvan Gorinov4-8/+2
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
2018-06-19ARM: image: Add option for ignoring ep bit 3Marek Vasut1-2/+3
Add option to the booti_setup() which indicates to it that the caller requires the image to be relocated to the beginning of the RAM and that the information whether the image can be located anywhere in RAM at 2 MiB aligned boundary or not is to be ignored. This is useful ie. in case the Image is wrapped in another envelope, ie. fitImage and not relocating it but moving it would corrupt the envelope. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bin Chen <bin.chen@linaro.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-By: Bin Chen <bin.chen@linaro.org>
2018-06-18arm: Do not clear LR on exception in SPLAndrew F. Davis1-1/+1
When an exception or interrupt occurs the link register (LR) may contain the source of the exception, although we do not print the value it may still be extracted with a debugger. When in SPL we loop on getting and exception, but use a linking branch, which over-writes the LR value, use a regular branch instruction here. Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-05-23arm: print instructions pointed to by pcHeinrich Schuchardt1-0/+25
If an exception occurs in a loaded image and the relocation offset is unknown, it is helful to know the instructions pointed to by the program counter. This patch adds the missing output. A possible output is: Code: e1c560d0 e12fff1e e120077b e12fff1e (e7f7defb) The parentheses indicate the instruction causing the exception. The output can be disassembled using the decodecode script provided by the Linux kernel project. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-05-10bootm: fix 'memory-fixup' for vxWorks bootHannes Schmelzer1-1/+1
The check for having a memory node within the fdt blob is made wrong, we fix this here. Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
2018-05-07arm: v7R: Add support for enabling cachesLokesh Vutla1-1/+11
Cache maintenance procedure is same for v7A and v7R processors. So re-use cache-cp15.c file except for mmu parts. Tested-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-07arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15Lokesh Vutla1-5/+1
Certain ARM architectures like ARMv7-A, ARMv7-R has support for enabling caches using CP15 registers. To have a common support for all these architectures, introduce a Kconfig symbol SYS_ARM_CACHE_CP15 that selects cache-cp15.c Tested-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-05-07arm: v7: Kconfig: Rename CPU_V7 as CPU_V7ALokesh Vutla1-1/+1
Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under armv7 folder. This led to a misconception of creating separate folders for armv7m and armv7r. There is no reason to create separate folder for other armv7 based architectures when it can co-exist with few Kconfig symbols. As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and can co exist in the same folder. Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Michal Simek <michal.simek@xilinx.com> Suggested-by: Alexander Graf <agraf@suse.de> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-05-07SPDX: Convert all of our multiple license tags to Linux Kernel styleTom Rini2-3/+2
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have multiple licenses (in these cases, dual license) declared in the SPDX-License-Identifier tag. In this case we change from listing "LICENSE-A LICENSE-B" or "LICENSE-A or LICENSE-B" or "(LICENSE-A OR LICENSE-B)" to "LICENSE-A OR LICENSE-B" as per the Linux Kernel style document. Note that parenthesis are allowed so when they were used before we continue to use them. Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini44-96/+46
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-27Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini1-2/+0
We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-13vxworks: fixed cpu enable using PSCI on armv8Vasyl Vavrychuk1-0/+5
Without armv8_setup_psci register VBAR_EL3 is not set up property which makes SMC calls jump to invalid location. smp_kick_all_cpus is required to make slave cpus leave gic_wait_for_interrupt. Without this they will never pursue booting process. Fix was applied to the two ways of booting VxWorks: bootvx and bootm commands. This implementation is very similar to what is done in boot_jump_linux in arch/arm/lib/bootm.c file. Tested on VxWorks 7 release SR0520 2017-12-08 Intel Stratix 10 SX SoC Development Kit board. Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2018-04-11ARM: Fix Makefile during SPL and TPL buildMarek Vasut1-2/+2
The tiny variants of memset and memcpy implementations can be built for TPL as well, check whether a TPL build is in progress and avoid including the default variants. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
2018-04-05arm: print information about loaded UEFI imagesHeinrich Schuchardt1-0/+13
If an exception occurs in a UEFI loaded image we need the start address of the image to determine the relocation offset. This patch adds the necessary lines after the registers in the crash dump. A possible output would be: UEFI image [0xbffe6000:0xbffe631f] pc=0x138 '/\snp.efi' With the offset 0x138 we can now find the relevant instruction in the disassembled 'snp.efi' binary. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-03-05libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>Masahiro Yamada2-2/+2
Thomas reported U-Boot failed to build host tools if libfdt-devel package is installed because tools include libfdt headers from /usr/include/ instead of using internal ones. This commit moves the header code: include/libfdt.h -> include/linux/libfdt.h include/libfdt_env.h -> include/linux/libfdt_env.h and replaces include directives: #include <libfdt.h> -> #include <linux/libfdt.h> #include <libfdt_env.h> -> #include <linux/libfdt_env.h> Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-23arm64: show_regs: Dump the LRs HW valuesKarl Beldan1-7/+6
These were dropped in [1], after relocation, for their values offset by reloc_off. Unconditionally show the HW values and add a '(reloc)' hint for the offset values showed after relocation. Also, the LRs' dumps are now formatted the same way the other regs' are. [1] Commit 082693f4 ("arm64 :show_regs: show the address before relocation") Signed-off-by: Karl Beldan <karl.beldan+oss@gmail.com>
2018-02-14arm/PSCI: support PSCI versions greater than 1.0Andre Heider1-7/+9
ATF recently began announcing PSCI v1.1. Since that version is unknown to u-boot, the PSCI device nodes were not updated. Switch from the case statement to a greater/less-than comparison so that v1.1, as well as future versions, get at least the compatible nodes of known versions. PSCI v1.1 doesn't seem to have introduced a new corresponding compatible. Signed-off-by: Andre Heider <a.heider@gmail.com>
2018-02-13ARM: image: indent with tab instead of 4 spacesMasahiro Yamada1-46/+46
Commit 6808ef9ac2a6 ("move booti_setup to arch/arm/lig/image.c") not only moved the code, but also replaced a tab with 4 spaces to break the Linux coding style. Restore tab indentation. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Bin Chen <bin.chen@linaro.org>
2018-02-10efi_loader: fix building crt0 on armHeinrich Schuchardt2-2/+6
Before the patch an undefined constant EFI_SUBSYSTEM was used in the crt0 code. The current version of binutils does not swallow the error. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888403 The necessary constant IMAGE_SUBSYSTEM_EFI_APPLICATION is already defined in pe.h. So let's factor out asm-generic/pe.h for the image subsystem constants and use it in our assembler code. IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER does not exist in the specification let's use IMAGE_SUBSYSTEM_EFI_ROM instead. The include pe.h is only used in code maintained by Alex so let him be the maintainer here too. Reported-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Vagrant Cascadian <vagrant@debian.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-02-07move booti_setup to arch/arm/lig/image.cBin Chen2-1/+78
Follow bootz's pattern by moving the booti_setup to arch/arm/lib. This allows to use booti_setup in other paths, e.g booting an Android image containing Image format. Note that kernel relocation is move out of booti_setup and it is the caller's responsibility to do it and allows them do it differently. say, cmd/booti.c just do a manually, while in the bootm path, we can use bootm_load_os(with some changes). Signed-off-by: Bin Chen <bin.chen@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-01-28arm: bootm-fdt.c: fix compiler warningHeiko Schocher1-1/+1
compiling U-Boot with bosch_mpcxxxxd_sd_defconfig drops warning: arch/arm/lib/bootm-fdt.c: In function ‘arch_fixup_fdt’: arch/arm/lib/bootm-fdt.c:37:6: warning: unused variable ‘ret’ [-Wunused-variable] int ret = 0; ^~~ Fix it. Signed-off-by: Heiko Schocher <hs@denx.de>
2018-01-22efi_selftest: test start imageHeinrich Schuchardt1-0/+1
This pair of tests checks the StartImage boot service. Each test loads an EFI application into memory and starts it. One returns by calling the Exit boot service. The other returns directly. The tests are not built on x86_64 because the relocation code for the efi binary cannot be created. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-12ARM: bootm: don't assume sp is in DRAM bank 0Stephen Warren1-3/+12
arch_lmb_reserve() currently assumes that the stack pointer is within DRAM bank 0. This is not necessarily true. Enhance the code to search through DRAM banks until the bank that does contain SP is found, and then reserve the tail of that bank. Fixes: 2d1916e48bd8 ("ARM: add flat device tree support") Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2018-01-12ARMv8: Allow dynamic early stack pointerStephen Warren1-0/+3
U-Boot typically uses a hard-coded value for the stack pointer before relocation. Implement option SYS_INIT_SP_BSS_OFFSET to instead calculate the initial SP at run-time. This is useful to avoid hard-coding addresses into U-Boot, so that can be loaded and executed at arbitrary addresses and thus avoid using arbitrary addresses at runtime. This option's value is the offset added to &_bss_start in order to calculate the stack pointer. This offset should be large enough so that the early malloc region, global data (gd), and early stack usage do not overlap any appended DTB. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
2017-12-24arm: Add support of updating dts before fix-upPrabhakar Kushwaha1-0/+12
"ethernet" node fix-up for device tree happens before Linux boot. There can be requirement of updating "ethernet" node even before fix-up. So, add support of updating "ethernet" node. Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
2017-12-16efi_loader: helloworld.c: Reduce file sizeAlexander Graf1-7/+4
The efi linker script includes sections needed for the dynamic linker. However, in our EFI application environment we don't have a dynamic linker. So let's remove them. That way we save on 4k padding and reduce the file size of the hello world efi binary from ~4k to ~1k. Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-07armv8: fix gd after relocationYork Sun1-2/+3
Commit 21f4486faa5d ("armv8: update gd after relocate") sets x18 without checking the return value of spl_relocate_stack_gd(). Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: York Sun <york.sun@nxp.com> CC: Kever Yang <kever.yang@rock-chips.com> CC: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-12-04arm64 :show_regs: show the address before relocationPeng Fan1-2/+8
After relocation, when error happends, it is hard to track ELR and LR with asm file objdumped from elf file. So subtract the gd->reloc_off the reflect the compliation address. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-21arm: provide a PCS-compliant setjmp implementationPhilipp Tomsich3-0/+85
The previous setjmp-implementation (as a static inline function that contained an 'asm volatile' sequence) was extremely fragile: (some versions of) GCC optimised the set of registers. One critical example was the removal of 'r9' from the clobber list, if -ffixed-reg9 was supplied. To increase robustness and ensure PCS-compliant behaviour, the setjmp and longjmp implementation are now in assembly and closely match what one would expect to find in a libc implementation. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-21arm: boot0 hook: move boot0 hook before '_start'Philipp Tomsich1-19/+35
The boot0 hook on ARM does not insert its payload before the vector table. This is both a mismatch with thec comment above it and contradict usage of the boot0 hook on ARM64. To fix this (and unify the semantics for ARM and ARM64), we change the boot0-hook semantics on ARM to match those on ARM64: (1) if a boot0-hook is present it is inserted at the start of the image (2) if a boot0-hook is present, emitting the ARM vector table (and the _start) symbol are suppressed in vectors.S and the boot0-hook has full control over where and when it wants to emit these Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-11-17armv8: update gd after relocateKever Yang1-0/+2
We need to update gd in assamble code after relocate, this is a fix to: adc421e arm: move gd handling outside of C code Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-11-17arm64: support running at addr other than linked toStephen Warren2-5/+26
This is required in the case where U-Boot is typically loaded and run at a particular address, but for some reason the RAM at that location is not available, e.g. due to memory fragmentation loading other boot binaries or firmware, splitting an SMP complex between various different OSs without using e.g. the EL2 second-stage page tables to hide the memory asignments, or due to known ECC failures. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-10-12Merge git://git.denx.de/u-boot-fsl-qoriqTom Rini1-0/+11
2017-10-09armv8: layerscape: Enable falcon bootYork Sun1-0/+11
Add jump_to_image_linux() for arm64. Add "noreturn" flag to armv8_switch_to_el2(). Add hooks to fsl-layerscape to enable falcon boot. Signed-off-by: York Sun <york.sun@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Łukasz Majewski <lukma@denx.de> Tested-by: Łukasz Majewski <lukma@denx.de>
2017-10-08ARMv8: fix error in freeing stack framezijun_hu1-1/+1
relocate_code() allocates 32 bytes stack frame but only 16 bytes are freed before return. it will cause errors to possible previous frames and doesn't make relocate_code() look like a function. fix by freeing 32 bytes stack space Signed-off-by: zijun_hu <zijun_hu@htc.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-08ARMv8: get new GD address from gd->new_gd directlyzijun_hu1-2/+1
the new GD address is calculated via board data BD currently it require the new GD area locates below BD tightly, so a strict constraint is imposed on memory layout which maybe make special platform unpleasant. fix it by getting new GD address from gd->new_gd directly. Signed-off-by: zijun_hu <zijun_hu@htc.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename getenv/_f() to env_get()Simon Glass1-3/+3
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename setenv() to env_set()Simon Glass1-1/+1
We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-13armv8: TPL_STACK will always be defined, so test CONFIG_TPL_NEEDS_SEPARATE_STACKPhilipp Tomsich1-1/+1
Now that TPL_STACK has been moved off the whitelist (ok, I'm lying: the 'moving off the whitelist' part comes in once moveconfig runs... which will be a few commits down the line) and added to Kconfig, we need to test CONFIG_TPL_NEEDS_SEPARATE_STACK to see whether the value from TPL_STACK should be used or whether we try to inherit whatever SPL uses. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-13armv8: spl: Support separate stack for TPLPhilipp Tomsich1-1/+3
To allow a TPL and SPL to run from different addresses/memories, we need to split setup of the TPL and SPL stacks. To do so, we introduce CONFIG_TPL_STACK (not listed in Kconfig) which can be used to override the initial stack pointer for TPL. To provide backward compatibility for existing boards, this is added as an optional configuration item and the normal search order (i.e. SPL_STACK, then SYS_STACK) apply if not defined. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-06-29Revert "armv7m: Disable D-cache when booting nommu(ARMv7M) Linux kernel"Tom Rini1-1/+0
The author of the commit discovered later on that this was already being done in cleanup_before_linux() on arch/arm/cpu/armv7m/cpu.c. This reverts commit 8f079cccb369995e46a2ab530d5d60b88c1e70bb. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-06-12ARM: provide a valid exception stack address for startup codeLothar Waßmann1-1/+4
Create exception stack in IRAM if available to facilitate debugging of pre-relocation code by catching exceptions rather than stopping dead. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
2017-06-12arm: adjust PC displayed in exception handlers to point to the failing ↵Lothar Waßmann1-0/+14
instruction Adjust the program counter register to point to the failing instruction depending on the exeption type. This makes it easier to localize the offending instruction leading to a fatal exception. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
2017-06-12ARM: remove bogus cp_delay() functionLothar Waßmann1-14/+1
The cp_delay() function was introduced because of a missing 'volatile' attribute to the 'asm' statement in get_cr() which led to the 'mrc' instruction in get_cr() being optimised out eventually. This has been fixed in commit 53fd4b8c22bb ("arm: mmu: Add missing volatile for reading SCTLR register") but the bogus cp_delay() function which was introduced as a workaround for the malfunctioning get_cr() was never removed. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
2017-06-10Merge git://git.denx.de/u-boot-dmTom Rini1-2/+11
2017-06-09armv7m: Disable D-cache when booting nommu(ARMv7M) Linux kerneltnishinaga.dev@gmail.com1-0/+1
Disable D-Cache is required when booting nommu Linux kernel. (please see Linux kernel source "arch/arm/kernel/head-nommu.S") U-Boot is enabled D-cache and I-Cache at startup. However, it does not disable D-Cache before booting nommu Linux kernel. Therefore, I call dcache_disable() when the CPU is ARMv7M to fix this problem. Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
2017-06-09arm: Disable LPAE if not enabledSimon Glass1-0/+9
If CONFIG_ARMV7_LPAE is not defined we should make sure that the feature is disabled. This can happen if U-Boot is chain-loaded from another boot loader which does enable LPAE. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-09arm: Don't try to support CONFIG_ARMV7_LPAE on ARMv4TSimon Glass1-1/+1
At present if CONFIG_ARMV7_LPAE is defined then mmu_setup() will use instructions which are invalid on ARMv4T. This happens on Tegra since it has an ARMv4T boot CPU. Add a check for the architecture version to allow the code to be built. It will not actually be executed by the boot CPU, but needs to compile. Signed-off-by: Simon Glass <sjg@chromium.org>