summaryrefslogtreecommitdiffstats
path: root/include/common.h
Commit message (Collapse)AuthorAgeFilesLines
* Shell: Handle aborting loops betterSascha Hauer2019-04-241-1/+3
| | | | | | | | | | | | | | | | | | It's easy to get stuck in an infinite loop in the hush shell: while true; do sleep 1; done The 'sleep' command will check for ctrl-c with the ctrlc() function. This will abort the sleep command. Hush then checks for ctrl-c again in the loop. The ctrl-c in the buffer has already been eaten by the sleep command, so the loop will continue. With this patch we remember the presence of a ctrl-c character in a variable instead of checking for a new character each time. The variable must be resetted explicitly by calling ctrlc_handled() which will be called by the shell in the outer loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: move prototype to include/printk.hSascha Hauer2018-12-031-10/+0
| | | | | | | It's where the kernel has the print_hex_dump prototypes aswell, it's a better match for these. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment: Do not use environment when overlapping with other partitionsSascha Hauer2018-09-261-0/+10
| | | | | | | | | | | Environment partitions are usually specified with their hardcoded offset and size, either in the device tree or the board file. These partitions potentially overlap with other partitions read from the partition table. Overlapping partitions for sure have bad effects. Be more friendly to our users and warn them when such a situation occurs and stop using that partition for storing the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include/common: Make use of ALIGN and ALIGN_DOWNAndrey Smirnov2018-08-221-2/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include/common.h: move IOMEM declaration for MIPS to arch/mips/include/asm/io.hPeter Mamonov2018-05-241-5/+2
| | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: use root_node compatible as suggestion for a hostnameOleksij Rempel2018-01-171-0/+1
| | | | | | | | | | | | | | | | on some SoCs we can use generic PLL and RAM initialization. In this cases we create board file only to provide a host name. With this patch host name will be created from device tree compatible. For example: compatible = "board_vendor,board", "chip_vendor,soc" the host name will be: "board" This function will not overwrite a host name which is already set by board or machine code. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move ALIGN_DOWN() to include/linux/kernel.hMasahiro Yamada2018-01-051-2/+0
| | | | | | | | | | Linux commit ed067d4a859f ("linux/kernel.h: Add ALIGN_DOWN macro") moved ALIGN_DOWN to include/linux/kernel.h. Let's do likewise. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* poweroff: Allow to register poweroff handlersSascha Hauer2017-03-301-3/+0
| | | | | | | | | | Allow to register handlers for poweroff. This allows to have multiple poweroff implementations in a single binary. The implementation is close to the restart handlers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* libfile: move open_and_lseek() to libfileSascha Hauer2016-04-151-1/+0
| | | | | | | libfile is a collection of helpers for handling files. open_and_lseek() is a perfect match for this, so move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move crc specific stuff to crc.hSascha Hauer2016-04-151-6/+0
| | | | | | | We have a crc.h, so move our crc function prototypes there to further cleanup common.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move shell prototypes to shell.hSascha Hauer2016-04-151-11/+0
| | | | | | We have a shell,h, so move shell specific prototypes there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include/common.h: remove unused struct memarea_infoSascha Hauer2016-04-151-10/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move run_command prototype to command.hSascha Hauer2016-04-151-1/+0
| | | | | | run_command fits much better into command.h, move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Remove do_execute and thumb2_executeTrent Piepho2015-12-071-6/+0
| | | | | | | | | | | | | | | | | | | | In commit 104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee support was added for Thumb2. It added do_execute() as a way to provide arch dependent calling veneers for use in "go" and thumb2_execute() as the thumb2 to arm veneer. But thumb2_execute() isn't necessary as gcc generates a proper calling sequence from a standard function pointer call. Thumb2 barebox is compiled with the AAPCS ABI which requires this. It also had a bug and didn't pass the arguments properly, but code execute via "go" rarely uses arguments so this wasn't very noticeable. Since thumb2 was always the only user of do_execute(), go ahead and delete that too. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: remove duplicate xdelay declarationsSascha Hauer2015-09-231-4/+1
| | | | | | | | ndelay is declared in include/clock.h, udelay in include/common.h and mdelay in include/common.h and include/clock.h. Move them all to include/clock.h and remove duplicates. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* restart: replace reset_cpu with registered restart handlersSascha Hauer2015-08-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | This replaces the reset_cpu() function which every SoC or board must provide with registered handlers. This makes it possible to have multiple reset functions for boards which have multiple ways to reset the machine. Also boards which have no way at all to reset the machine no longer have to provide a dummy reset_cpu() function. The problem this solves is that some machines have external PMICs or similar to reset the system which have to be preferred over the internal SoC reset, because the PMIC can reset not only the SoC but also the external devices. To pick the right way to reset a machine each handler has a priority. The default priority is 100 and all currently existing restart handlers are registered with this priority. of_get_restart_priority() allows to retrieve the priority from the device tree which makes it possible for boards to give certain restart handlers a higher priority in order to use this one instead of the default one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: move board_shutdown to exitcall infrastructureHerve Codina2015-07-131-1/+0
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: move arch_shutdown to exitcall infrastructureHerve Codina2015-07-131-2/+0
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move some macros and prototypesMasahiro Yamada2015-01-291-58/+0
| | | | | | | | | | The include/common.h is still cluttered (although much better than U-Boot). It contains various utility macros that originates in Linux. Move them to the original place, include/linux/kernel.h, to slim down include/common.h. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* asm-generic/bug.h: move BUG(), BUG_ON(), WARN(), WARN_ON() macrosMasahiro Yamada2015-01-291-32/+0
| | | | | | | | In Linux, these macros are defined in include/asm-generic/bug.h. To tidy up common.h, move BUG(), BUG_ON(), WARN(), WARN_ON() there. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/bug.h: move BUILD_BUG_ON*() macrosMasahiro Yamada2015-01-291-19/+1
| | | | | | | | | | | In Linux, the macros BUILD_BUG_ON* are defined in include/linux/bug.h. To tidy up common.h, move BUILD_BUG_* there. MAYBE_BUILD_BUG_ON is not used in barebox and it was removed from Linux long time ago. Drop it from barebox, too. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move *_MAX, *_MIN macrosMasahiro Yamada2015-01-211-13/+0
| | | | | | | | | | | Linux defines *_MAX, *_MIN macros in include/linux/kernel.h. Let's follow this way to slim down the common.h. This change should have no impact because include/common.h already includes <linux/kernel.h>. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common.h: use special IOMEM() for MIPSAntony Pavlov2014-09-111-0/+6
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-host'Sascha Hauer2014-08-071-0/+16
|\ | | | | | | | | Conflicts: drivers/usb/core/Makefile
| * include: import {lower,upper}_32_bits helpersSebastian Hesselbarth2014-07-281-0/+16
| | | | | | | | | | | | | | | | This imports {lower,upper}_32_bits defines to allow to get upper and lower 32b part of a 64b number. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add release stringSascha Hauer2014-07-221-0/+1
|/ | | | | | | | | Currently we only have version_string which contains information about the date the binary was compiled and by whom it has been compiled. This adds a release_string which only contains the plain release version. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: fix macro WARNChristoph Fritz2014-05-131-1/+2
| | | | | Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add shell_expand functionSascha Hauer2014-03-281-0/+9
| | | | | | shell_expand expands shell variables in a string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* run_command: remove unused flag parameterSascha Hauer2014-03-071-2/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: bareboxcrc32 as host and target userspacetoolMichael Grzeschik2013-12-041-0/+2
| | | | | | | | This patch adds the crc32 command to be build as host and optionally as target tool. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: add a macro to align an array on the stackAndre Heider2013-10-221-0/+11
| | | | | | | | | | | The macro can be used for temporary stack buffers which need to meet a minimum alignment requirement. This will be used by bcm2835 mailbox users, where all buffers need to be aligned. Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* shutdown: add board call backJean-Christophe PLAGNIOL-VILLARD2013-09-241-0/+1
| | | | | | | | so if we need to do something switch in the board we can fill this function pointer (as example on Animeo IP shutdown some rs232 & rs485) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/boardinfo'Sascha Hauer2013-09-051-1/+4
|\ | | | | | | | | | | | | Conflicts: arch/mips/boards/qemu-malta/init.c commands/bootm.c drivers/of/base.c
| * Make hostname available to C CodeSascha Hauer2013-08-161-0/+2
| | | | | | | | | | | | | | The boards often have a sane default for the hostname. Provide a C function for setting/getting it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * introduce barebox_set_modelSascha Hauer2013-08-161-0/+1
| | | | | | | | | | | | | | | | Instead of calling of_get_model() in barebox_get_model() add a barebox_set_model() and use it to set the boardinfo once it's available from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * remove remaining references of CONFIG_BOARDINFOSascha Hauer2013-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | With this all code uses barebox_get_model() and no longer a compile time generated string. Also this renames barebox_boardinfo() to barebox_get_model() since we are going to add the corresponding _set_ function and 'model' corresponds to the devicetree notion. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | move print_hex_dump function to include/common.hSascha Hauer2013-08-071-0/+8
|/ | | | | | | | print_hex_dump is a standard kernel function, so move it outside the ubi header files to make it usable for other code derived from the kernel aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: Change address pointer to type const void *Sascha Hauer2013-07-221-1/+1
| | | | | | | No need to force a width of the pointer, so use void *. Also it's not modified in memory_display, so also add a const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-07-011-0/+2
|\
| * add function to get boardinfo stringSascha Hauer2013-06-241-0/+2
| | | | | | | | | | | | | | | | When using devicetrees the boardinfo (or model) can be obtained from the devicetree. Add a function to get the boardinfo so that we have a chance to add information from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: add ALIGN_DOWN macroAlexander Aring2013-06-051-0/+1
| | | | | | | | | | Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: fix codestyle in ALIGN macrosAlexander Aring2013-06-051-2/+2
|/ | | | | Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use a common define for RW_BUF_SIZESascha Hauer2013-04-171-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: move memory_display to separate fileSascha Hauer2013-04-171-1/+1
| | | | | | | | memory_display is a function which should generally be available. Currently it depends on memory command support being compiled in, so move the function to a separate file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory commands: export common functionsSascha Hauer2013-04-171-0/+4
| | | | | | | The memory commands all use open_and_lseek and mem_parse_options. Export them to be able to split the memory commands into separate files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-02-041-0/+2
|\
| * common: add PAGE_ALIGN_DOWN macroAlexander Aring2013-01-181-0/+1
| | | | | | | | | | | | | | | | Add PAGE_ALIGN_DOWN macro, which is like PAGE_ALIGN macro but returns the lower page boundary of address. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * arm-mmu: move PAGE_ALIGN macro to common.hAlexander Aring2013-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | PAGE_ALIGN macro is needed to align addresses to page boundaries. Move this macro to another PAGE_* defines. Commands which uses remap_range function needs this macro. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/compile-log-level'Sascha Hauer2013-02-041-16/+1
|\ \ | | | | | | | | | | | | Conflicts: drivers/usb/host/ehci-hcd.c
| * | consolidate print* in a single headerJean-Christophe PLAGNIOL-VILLARD2013-01-271-16/+1
| |/ | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>