summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/start.c
Commit message (Collapse)AuthorAgeFilesLines
* ARM: start: Allow to pass machine type as boarddataSascha Hauer2019-10-021-1/+13
| | | | | | | | Allow to pass a machine type number as directly as boarddata. This makes it easy for non device tree boards to pass a machine type and to identify themselves during runtime. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add CONFIG_PBL_BREAK optionOleksij Rempel2019-06-271-0/+2
| | | | | | | | With this option barebox will be build with breakpoint instruction in early pbl stage. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Initial OP-TEE supportSascha Hauer2019-06-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This adds initial support for OP-TEE, see https://www.op-tee.org/ barebox starts in secure mode as usual. When booting a kernel the bootm code also loads the optee_os binary. Instead of jumping into the kernel barebox jumps into the optee_os binary and puts the kernel execution address into the lr register. OP-TEE then jumps into the kernel in nonsecure mode. The optee_os binary is passed with the -t option to bootm or with global.bootm.tee. Optionally OP-TEE can be compiled into barebox using the builtin firmware feature. Enable the Kconfig option and place or link your tee binary as optee.bin into the firmware directory. The amount of SDRAM which is kept free for OP-TEE is configurable. This patch was tested on a i.MX6 Nitrogen6x board. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: save end of memory passed to start.Tomaz Solc2019-03-041-0/+8
| | | | | | | | Knowing the address of the end of the memory area used by Barebox is useful if PBL stores some extra data after it, so that board init code can later retrieve it from there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Add missing prototypeSascha Hauer2018-11-191-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Add missing prototypeSascha Hauer2018-11-121-0/+2
| | | | | | | start() has no prototype, add it. Since it is not called from anywhere in the barebox binary just add the prototype to the C file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Add missing includeSascha Hauer2018-11-121-0/+2
| | | | | | entry.h provides prototypes for some functions, so include it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: install HYP vectors at PBL and Barebox entryLucas Stach2018-11-051-0/+5
| | | | | | | | | | | | | | | | If the CPU was already in HYP mode when entering the PBL, install a simple trap handler to allow to get back from SVC to HYP before switching to HYP mode. As the vectors are part of the currently running binary, we need to do the same setup when starting the real Barebox binary, as the PBL setup vectors might get overwritten. To do this we trap into HYP mode just before jumping to Barebox and then re-do the vector setup and SVC switch as the first thing in Barebox proper. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Avoid calling arm_mem_barebox_image() twiceAndrey Smirnov2018-04-111-8/+5
| | | | | | | | Avoid calling arm_mem_barebox_image() twice by making barebox_base function-wide in scope Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: change mmu_early_enable() prototypeSascha Hauer2018-04-041-1/+1
| | | | | | | Change the arguements to type unsigned long which is suitable for both arm32 and arm64. While at it move the prototype to arch/arm/include/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: aarch64: Add dummy naked attributeSascha Hauer2018-03-211-2/+2
| | | | | | | The naked attribute is not supported on aarch64. To silence the compiler warning add a dummy naked attribute. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Fix boarddata allocationSascha Hauer2017-02-061-1/+1
| | | | | | | | | It's essential that we always pass the same size value to arm_mem_barebox_image(), otherwise the result will be inconsistent. Pass arm_barebox_size instead of barebox_image_size as the latter does not contain the max bss segment size. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Fix a bug in stack's "top" initializationAndrey Smirnov2017-01-091-1/+1
| | | | | | | | | | | | | | | | | | | Code-paths responsible for initializing CPU's stack pointer and variable used in stack memory resource reservation got out of sync which resulted in actual stack being 64K off from what "stack" struct resource registered by arm_request_stack() thought it was. At least one issue resulting from that can be easily triggered by running: memtest -t This commit unifies the aforementioned code to a certain degree which solves the problem and hopefuly makes it less likely to become an issue again. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Fix calling of arm_mem_barebox_image()Sascha Hauer2016-09-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | arm_mem_barebox_image() is used to pick a suitable place where to put the final image to. This is called from both the PBL uncompression code and also from the final image. To make it work properly it is crucial that it's called with the same arguments both times. Currently it is called with the wrong image size from the PBL uncompression code. The size passed to arm_mem_barebox_image() has to be the size of the whole uncompressed image including the BSS segment size. The PBL code calls it with the compressed image size instead and without the BSS segment. This patch fixes this by reading the uncompressed image size from the compressed binary (the uncompressed size is appended to the end of the compressed binary by our compression wrappers). The size of the BSS segment is unknown though by the PBL uncompression code, so we introduce a maximum BSS size which is used instead. The code before this patch worked by accident because the base address of the final image was aligned down to a 1MiB boundary. The alignment was sufficient already to make enough space. This breaks though when the uncompressed image including BSS becomes bigger than 1MiB while the compressed image is smaller. Fixes: 65071bd0: arm: Clarify memory layout calculation Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: drop unnecessary variableSascha Hauer2016-06-201-5/+2
| | | | | | | | No need anymore to store arm_head_bottom globally as it's only used in barebox_non_pbl_start(). Also rename the variable to malloc_end which is more meaningful. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: simplify board_data sdram allocationSascha Hauer2016-06-201-5/+5
| | | | | | | | We already have a pointer for barebox_boarddata, so use it to request the corresponding SDRAM region instead of calculating it again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: do not change barebox_boarddataSascha Hauer2016-06-201-2/+6
| | | | | | | | barebox_boarddata should stay the original boarddata and not be modified. Keep a local pointer in barebox_arm_boot_dtb() instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: start: Fix wrong format specifierSascha Hauer2016-04-011-1/+1
| | | | | | Print a hex number after 0x, not a decimal number. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: Add RAMOOPS memory areaMarkus Pargmann2015-12-101-0/+6
| | | | | | | | | | | | | | RAMOOPS is a driver that uses a reserved static memory region to store the data from the last panic or boot. This helps to debug crashes at the next boot while preserving the boot messages. To guarantee a memory area that is not altered by barebox or the kernel, this area is located at the end of the RAM right after barebox and before the STACK. This ensures that changing barebox sizes do not interfere with RAMOOPS. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: start: Add visible sdram region for barebox board dataMarkus Pargmann2015-12-101-1/+18
| | | | | | | | | This helps to understand and find problems with the memory layout of barebox. It adds another entry for the board data that barebox allocated. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: Clarify memory layout calculationMarkus Pargmann2015-12-101-21/+27
| | | | | | | | | | | | | | The memory calculations used are all hardcoded into three different files, start-pbl.c, uncompress.c and start.c. To make this more readable and reliable, this patch gathers these information in barebox-arm.h with static inline functions for the calculation of the memory offsets. This patch also adds proper handling of different barebox/board data sizes. Currently only 1MB+Alignment of RAM is reserved for Barebox and board data. This could be too small for bigger devicetrees and barebox. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: calculate compressed dtb len correctlySascha Hauer2015-11-111-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2015-11-061-2/+46
|\
| * ARM: Allow compressed dtb binariesSascha Hauer2015-10-271-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current multi image build process the DTBs end up uncompressed in the PBL. This can be annoying because the PBL is often very size constrained. This patch allows to put the DTBs in as lzo compressed binary into the PBL. Since lzo offers quite good compression ratios for DTBs no other compression algorithm has been implemented for now. Boards which want to use the compressed DTBs only have to change the __dtb_ prefix in the DTB name to __dtb_z_. Also they should select ARM_USE_COMPRESSED_DTB to make sure barebox supports uncompressing the DTB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | arm/cpu: Avoid multiple definitions of barebox_arm_entryAndrey Smirnov2015-11-021-27/+2
| | | | | | | | | | | | | | | | | | | | All versions of barebox_arm_entry (in uncompress.c, start.c and start-pbl.c) appear to be doing exacty the same thing. So move the definition into a separate file and use IS_ENABLED macro to avoid re-definition. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | arm/cpu/start.c: Distil some common code in __start().Andrey Smirnov2015-11-021-24/+36
|/ | | | | | | | | | | Both barebox_boarddata and barebox_boot_dtb perform essentially the same function -- hold a pointer to a chunk of private data. Since only one variable is ever used at any given time we may as well merge those two variable into one. This also allows us to share more code between two boot paths (board data vs. device tree) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/omap'Sascha Hauer2015-07-031-16/+27
|\ | | | | | | | | Conflicts: arch/arm/boards/beagle/board.c
| * ARM: add a machine number mechanism for boarddataSascha Hauer2015-07-021-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Multi machine barebox builds have to pass information on which board we are running on via boarddata. Usually this will be a pointer to a device tree. Some boards might not have a device tree available though because they are either not ported over to device tree yet, or are running in some limited first state environment which does not offer enough space for a device tree. For these cases this patch adds a mechanism to embed a machine number into a struct type along with a magic number. This makes it possible to check for a specific machine later during regular runtime. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: start: Fix code reordering problemSascha Hauer2015-07-021-0/+2
|/ | | | | | | | | | | This adds a barrier after setup_c(). This is necessary because otherwise some global variable assignments may be reordered by the compiler to be executed before setup_c which cannot work. This was observed when doing other unrelated changes to the start function, it seems in current mainline state the compiler does not actually reorder the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: delete useless and wrong commentsMasahiro Yamada2015-01-301-2/+0
| | | | | | | | These comments are wrong. Anyway, they do not carry useful information. Delete. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mxs'Sascha Hauer2015-01-091-0/+11
|\
| * ARM: start.c: Add some debugging messagesSascha Hauer2015-01-051-0/+11
| | | | | | | | | | | | | | | | pr_debug can now be used right after setup_c(), so add some debug messages to the early startup code to make it a bit more clear what is happening there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | sizes.h: move include/sizes.h to include/linux/sizes.hMasahiro Yamada2015-01-081-1/+1
|/ | | | | | | | | | | | | | This file originates in Linux. Linux has it under include/linux/ directory since commit dccd2304cc90. Let's move it to the same place as well in barebox. This commit was generated by the following commands: find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:' git mv include/sizes.h include/linux/ Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Increase automatic malloc area spaceSascha Hauer2014-07-211-3/+3
| | | | | | | | | This increases the malloc to half of the available memory in a bank. This helps with some usecases requiring a lot of memory. The other half is still available as scratch area and for putting the kernel binary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: change signature of barebox_arm_entryLucas Stach2014-05-051-12/+11
| | | | | | | | | | | Mostly to make it clear that boarddata needs to be something we can dereference. As this is a pretty invasive change, use the opportunity to make the signature 64bit safe. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-12-061-0/+1
|\ | | | | | | | | Conflicts: scripts/Makefile
| * treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | | | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: start: fix fdt inside valid memory checkSascha Hauer2013-11-261-1/+1
|/ | | | | | | We want to check whether boarddata contains a valid dtb if it's inside valid memory. This includes the base of SDRAM, so use '>=' instead of '>'. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: cache: restore cache functions from the PBLAndre Heider2013-10-221-1/+3
| | | | | | | | | | | When using CONFIG_MMU_EARLY combined with CONFIG_PBL_IMAGE, the barebox setup reuses the MMU setup from the PBL, but doesn't setup the cache functions. Set these up to guarantee proper early cache handing before mmu_initcall(). Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: invalidate caches thoroughlySascha Hauer2013-09-211-1/+3
| | | | | | | | | | | | The data caches should be invalided once during startup. This should also be done when we do not have the MMU enabled in barebox because the Kernel does not invalidate the caches during start. To make this sure this patch enables the arm_early_mmu_cache_invalidate function even if MMU support is disabled. Additionally this patch adds calls to arm_early_mmu_cache_invalidate in start.c and uncompress.c. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Allow to pass a devicetree via boarddataSascha Hauer2013-06-261-0/+20
| | | | | | | Addionally to having a builtin DTB provide the possibility for the board to provide a dtb via boarddata. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: invalidate data caches during early initSascha Hauer2013-05-231-0/+2
| | | | | | | | | | Some SoCs come up with invalid entries in the data cache. This can lead to memory corruption when we enable them later, so invalidate the caches early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Lucas Stach <l.stach@pengutronix.de>
* Merge branch 'for-next/relocate'Sascha Hauer2013-04-041-0/+5
|\ | | | | | | | | Conflicts: arch/arm/lib/barebox.lds.S
| * ARM: Add relocatable binary supportSascha Hauer2013-03-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For making the same binary executable on different SoCs which have different DRAM addresses we have to be independent of the compile time link address. This patch adds relocatable binary support for the ARM architecture. With this two new functions are available. relocate_to_current_adr will fixup the binary to continue executing from the current position. relocate_to_adr will copy the binary to a given address, fixup the binary and continue executing from there. For the PBL and the real image relocatable support can be enabled independently. This is done to (hopefully) better cope with setups where the PBL runs from SRAM or ROM and the real binary does not. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: Add missing barebox_arm_boarddata functionSascha Hauer2013-03-101-0/+10
|/ | | | | | | | The comment above barebox_arm_entry promises to preserve the boarddata variable passed to it which can then later get back with barebox_arm_boarddata(). This function was missing so far, add it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Automatically determine malloc sizeSascha Hauer2013-02-041-0/+28
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Enable mmu earlySascha Hauer2013-02-041-0/+12
| | | | | | | | | This optionally enabled the MMU in the PBL or during early startup for the non PBL case. The regular MMU init code will pickup the already enabled MMU later. This might complicate debugging early code, so this has been made optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Setup stack at end of SDRAMSascha Hauer2013-02-041-1/+17
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM start: pickup parameters from pblSascha Hauer2013-02-041-21/+23
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INITSascha Hauer2013-02-041-12/+0
| | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>