summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/barebox-arm.h
Commit message (Collapse)AuthorAgeFilesLines
* ARM: start: Fix image size calculationSascha Hauer2017-02-081-0/+2
| | | | | | | | | | In barebox_non_pbl_start() we do not run at the address we are linked at, so we must read linker variables using ld_var(). Since ld_var() current is not available on arm64 we create two zero sized arrays, one at the begin of the image and one at the end. The difference between both is the image size we are looking for. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Fix a bug in stack's "top" initializationAndrey Smirnov2017-01-091-1/+7
| | | | | | | | | | | | | | | | | | | 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-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Fix arm_mem_barebox_image for !CONFIG_RELOCATABLESascha Hauer2016-06-201-2/+6
| | | | | | | | | | | | | | Fixes: 65071bd arm: Clarify memory layout calculation arm_mem_barebox_image() shall return the beginning of the barebox image (and thus the end of the malloc region). For relocatable images we can return a suitable location, but for non relocatable images we do not have a choice: We must return TEXT_BASE. If TEXT_BASE happens to be outside the memory region between membase and endmem we can return the base of the ramoops area. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Markus Pargmann <mpa@pengutronix.de>
* ARM: Do not use last 64KiB of address space for bareboxSascha Hauer2016-04-011-1/+1
| | | | | | | | The last 64KiB of address space may be used for the vector table at 0xffff0000, so we cannot use it for barebox. The easiest way to archieve this is to never use the last 64KiB of memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: Add RAMOOPS memory areaMarkus Pargmann2015-12-101-1/+13
| | | | | | | | | | | | | | 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: Clarify memory layout calculationMarkus Pargmann2015-12-101-18/+37
| | | | | | | | | | | | | | 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: Allow compressed dtb binariesSascha Hauer2015-10-271-0/+9
| | | | | | | | | | | | | | | 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: add a machine number mechanism for boarddataSascha Hauer2015-07-021-1/+26
| | | | | | | | | | | | | | | 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: include some headers from barebox-arm.hMasahiro Yamada2015-01-141-0/+2
| | | | | | | | | | | | ENTRY_FUNCTION() references __barebox_arm_head(), so <asm/barebox-arm-head.h> should be included from barebox-arm.h to avoid implicit declaration warning/error. ENTRY_FUNCTION() uses __naked, so <linux/compiler.h> should also be included. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> 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: include relevant headers in barebox-armLucas Stach2014-12-171-0/+2
| | | | | | | Provide the necessary types and defines used in this header. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: change signature of barebox_arm_entryLucas Stach2014-05-051-2/+2
| | | | | | | | | | | 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>
* ARM: Make ENTRY_FUNCTION more robustSascha Hauer2013-12-101-3/+13
| | | | | | | | | | An entry function should begin with a exception header. For this to work properly the entry function should not contain any code which gcc might put before the header. To make this sure change the ENTRY_FUNCTION macro so that it generates one function which only contains the exception header and a second function which contains the original body of the entry function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add multi images supportSascha Hauer2013-07-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the make infrastructure to build multiple SoC or board specific images from a single barebox binary. The basic idea is that we no longer have a single pbl, but instead multiple pbls, one per image if necessary. Each pbl is defined by its entry function so that each pbl can do exactly what a given board needs. Additionally the pbls together with a self extracting barebox binary can be encapsulated in specific image formats. squashed in build fixes from Lucas Stach for make version >= 3.82: Split Multimage Makefile rule in explicit and implicit parts Fixes build with make version >=3.82 Frome the make 3.82 NEWS file: * WARNING: Backward-incompatibility! In previous versions of make it was acceptable to list one or more explicit targets followed by one or more pattern targets in the same rule and it worked "as expected". However, this was not documented as acceptable and if you listed any explicit targets AFTER the pattern targets, the entire rule would be mis-parsed. This release removes this ability completely: make will generate an error message if you mix explicit and pattern targets in the same rule. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Lucas Stach <dev@lynxeye.de>
* ARM: Allow to pass a devicetree via boarddataSascha Hauer2013-06-261-0/+2
| | | | | | | 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>
* Merge branch 'for-next/relocate'Sascha Hauer2013-04-041-0/+34
|\ | | | | | | | | Conflicts: arch/arm/lib/barebox.lds.S
| * ARM: Add relocatable binary supportSascha Hauer2013-03-071-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ARN: fixup vector addresses for relocatable binariesSascha Hauer2013-03-071-0/+8
| | | | | | | | | | | | | | With relocatable binaries the vector addresses cannot be supplied by the linker. This adds support for fixing them up during runtime. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: Add missing barebox_arm_boarddata functionSascha Hauer2013-03-101-0/+1
|/ | | | | | | | 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: Setup stack at end of SDRAMSascha Hauer2013-02-041-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM start: pickup parameters from pblSascha Hauer2013-02-041-1/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: add __noreturn to board_init_lowlevel_returnSascha Hauer2013-02-041-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Add new entry point for bareboxSascha Hauer2013-02-041-0/+1
| | | | | | | | | | Memory is a precious resource, so it makes sense to make it available as early as possible. By definition the lowlevel init code already knows where to find memory because it's the lowlevel init code which sets up the memory. Until all boards are converted this new entry is just a fallback to the old entry point. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: add assembly function for setting up C environmentSascha Hauer2012-10-051-0/+2
| | | | | | | | | | | Sometimes Assembler beats C. In this case a small assembler function called without parameters can: - copy a binary to its link address - clear the bss - return to the same position in the copied binary Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/arm-remove-arch-init-ll'Sascha Hauer2012-10-031-1/+0
|\ | | | | | | | | Conflicts: arch/arm/include/asm/barebox-arm.h
| * ARM: remove ARCH_HAS_LOWLEVEL_INITSascha Hauer2012-09-251-1/+0
| | | | | | | | | | | | | | | | This is unused now and not needed. We have a board_init_lowlevel. If a board needs some architecture setup it can always call it from its board_init_lowlevel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-4/+0
|\ \ | | | | | | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * | Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| |/ | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM lowlevel: Use get_runtime_offsetSascha Hauer2012-09-091-1/+0
| | | | | | | | | | | | | | | | The current approach to get the offset between link and runtime address is fragile. It requires a big fat comment to put no code above it and it requires an extra linker section. Instead use a small assembler function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: Add assembler function to get runtime offsetSascha Hauer2012-09-091-0/+1
|/ | | | | | | This function returns the offset between the address barebox is linked at and the address barebox is currently running at. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: get runtime offset of board_init_lowlevel_return by using separate sectionSascha Hauer2012-02-281-0/+1
| | | | | | | | We used to get the runtime offset of the board_init_lowlevel_return by doing a &board_init_lowlevel_return. This does not work in thumb-2 mode, so use a separate linker section for this function instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: move exception vectors away from start of binarySascha Hauer2012-02-281-0/+2
| | | | | | | | | | | | | | | | Traditionally U-Boot and barebox have the exception vectors at the start of the binary. There is no real reason in doing so, because in the majority of cases this data will not be at 0x0 where it could be used as vectors directly anyway. This patch puts the vectors into a separate linker section and defines an head function which is placed at the start of the image instead. Putting this in a separate function also has the advantage that it can be placed at the start of images which require an additional header like several Freescale i.MX images. As the head function contains the barebox arm magic those images can now also be detected as barebox images. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* move boards to arch/<architecure>/boardsJean-Christophe PLAGNIOL-VILLARD2010-07-231-1/+1
| | | | | | | | | | | | this will allow each arch to handle the boards more simply and depending on there need the env var BOARD will refer to the current board dirent for sandbox as we have only one board the board dirent is arch/sandbox/board Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: add missing call to arch_init_lowlevelSascha Hauer2010-06-231-0/+1
| | | | | | | This got lost during the switch to implement the lowlevel stuff in C. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: reimplement startup code in CSascha Hauer2010-05-031-0/+3
| | | | | | | Lets translate the startup code to a language we all understand better. Tested on pcm038 (arm v5) and pcm043 (arm v6). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: remove unused variables from header fileSascha Hauer2010-05-031-6/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename U-Boot-v2 project to bareboxSascha Hauer2009-12-151-0/+44
This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>