summaryrefslogtreecommitdiffstats
path: root/include/common.h
Commit message (Collapse)AuthorAgeFilesLines
* Add getenv_hex() to return an environment variable as hexSimon Glass2013-05-011-0/+13
| | | | | | | | This conversion is required in a number of places in U-Boot. Add a standard function to provide this feature, so we avoid all the different variations in the way it is coded. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Provide a way to map from host RAM to U-Boot RAMSimon Glass2013-05-011-0/+5
| | | | | | | | | | | | | | | | | | | | | In many cases, pointers to memory are passed around, and these pointers refer to U-Boot memory, not host memory. This in itself is not a problem. However, in a few places, we cast that pointer back to a ulong (being a U-Boot memory address). It is possible to convert many of these cases to avoid this. However there are data structures (e.g. struct bootm_headers) which use pointers. We could with a lot of effort adjust the structs and all code that uses them to use ulong instead of pointers. This seems like an unacceptable cost, since our objective with sandbox is to minimise the impact on U-Boot code while maximising the features available to sandbox. Therefore, create a map_to_sysmem() function which converts from a pointer to a U-Boot address. This can be used sparingly when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* arm: Remove support for unused s3c64xxBenoît Thébaudeau2013-04-121-1/+0
| | | | | | | | Following the removal of the smdk6400 board, the s3c64xx SoC becomes unused, so remove associated code. It will still be possible to restore it later from the Git history if necessary. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
* arm: Remove unused relocate_code() parametersBenoît Thébaudeau2013-04-121-4/+4
| | | | | | | | Commit e05e5de7fae5bec79617e113916dac6631251156 made the 2 1st parameters of ARM's relocate_code() useless since it moved the code handling them to crt0.S. So, drop these parameters. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
* arm: relocate_code() is no longer noreturnBenoît Thébaudeau2013-04-121-1/+5
| | | | | | | | | | Commit e05e5de7fae5bec79617e113916dac6631251156 made ARM's relocate_code() return to its caller, but it did not update its declaration accordingly. Fixing this function declaration fixes dropped C code following calls to relocate_code(). Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
* Adjust board_r.c for ppcSimon Glass2013-03-151-0/+1
| | | | | | This adds ppc features to the generic post-relocation board init. Signed-off-by: Simon Glass <sjg@chromium.org>
* Introduce generic pre-relocation board_f.cSimon Glass2013-03-151-0/+1
| | | | | | | | | | | | This file handles common pre-relocation init for boards which use the generic framework. It starts up the console, DRAM, performs relocation and then jumps to post-relocation init. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Wolfgang Denk <wd@denx.de> Acked-by: Wolfgang Denk <wd@denx.de>
* Update set_working_fdt_addr() to use setenv_addr()Simon Glass2013-02-281-1/+13
| | | | | | | We might as well use this common function instead of repeating the same code. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Add un/map_sysmen() to deal with sandbox's ram_bufSimon Glass2013-02-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | Sandbox doesn't actually provide U-Boot access to the machine's physical memory. Instead it provides a RAM buffer of configurable size, and all memory accesses are within that buffer. Sandbox memory starts at 0 and is CONFIG_DRAM_SIZE bytes in size. Allowing access outside this buffer might produce unpredictable results in the event of an error, and would expose the host machine's memory architecture to the sandbox U-Boot. Most U-Boot functions assume that they can just access memory at given address. For sandbox this is not true. Add a map_sysmem() call which converts a U-Boot address to a system address. In most cases this is a NOP, but for sandbox it returns a pointer to that memory inside the RAM buffer. To get a U-Boot feature to work correctly within sandbox, you should call map_sysmem() to get a pointer to the address, and then use that address for any U-Boot memory accesses. Signed-off-by: Simon Glass <sjg@chromium.org>
* Update print_buffer() to use constSimon Glass2013-02-281-1/+2
| | | | | | | | The buffer cannot be changed by this function, so change the buffer pointer to a const. This allows callers with const pointer to use the function without a cast. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add option to display customised memory informationSimon Glass2013-01-101-0/+9
| | | | | | | | | | | | | | | Some boards want to report more than just memory size. For example, it might be useful to display the memory type (DDR2, DDR3) or manufacturer. Add a weak function to support this requirement, accessed through a new 'meminfo' command. Any example of the DRAM: output is below, just for illustration: SMDK5250 # meminfo DRAM: 2 GiB Elpida DDR3 @ 800MHz Signed-off-by: Simon Glass <sjg@chromium.org>
* arm: move C runtime setup code in crt0.SAlbert ARIBAUD2013-01-081-1/+1
| | | | | | | | | | | | | | | | | | Move all the C runtime setup code from every start.S in arch/arm into arch/arm/lib/crt0.S. This covers the code sequence from setting up the initial stack to calling into board_init_r(). Also, rewrite the C runtime setup and make functions board_init_*() and relocate_code() behave according to normal C semantics (no jumping across the C stack any more, etc). Some SPL targets had to be touched because they use start.S explicitly or for some reason; the relevant maintainers and custodians are cc:ed. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
* env: Use getenv_yesno() more generallyJoe Hershberger2012-12-131-0/+5
| | | | | | | Move the getenv_yesno() to env_common.c and change most checks for 'y' or 'n' to use this helper. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* include/linux/byteorder: import latest endian definitions from linuxKim Phillips2012-11-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | u-boot's byteorder headers did not contain endianness attributions for use with sparse, causing a lot of false positives. Import the kernel's latest definitions, and enable them by including compiler.h and types.h. They come with 'const' added for some swab functions, so fix those up, too: include/linux/byteorder/big_endian.h:46:2: warning: passing argument 1 of '__swab64p' discards 'const' qualifier from pointer target type [enabled by default] Also, note: u-boot's historic __BYTE_ORDER definition has been preserved (for the time being at least). We also remove ad-hoc barrier() definitions, since we're including compiler.h in files that hadn't in the past: macb.c:54:0: warning: "barrier" redefined [enabled by default] In addition, including compiler.h in byteorder changes the 'noinline' definition to expand to __attribute__((noinline)). This fixes arch/powerpc/lib/bootm.c: bootm.c:329:16: error: attribute '__attribute__': unknown attribute bootm.c:329:16: error: expected ')' before '__attribute__' bootm.c:329:25: error: expected identifier or '(' before ')' token powerpc sparse builds yield: include/common.h:356:22: error: marked inline, but without a definition the unknown-reason inlining without a definition is considered obsolete given it was part of the 2002 initial commit, and no arm version was 'fixed.' also fixed: ydirectenv.h:60:0: warning: "inline" redefined [enabled by default] and: Configuring for devconcenter - Board: intip, Options: DEVCONCENTER make[1]: *** [4xx_ibm_ddr2_autocalib.o] Error 1 make: *** [arch/powerpc/cpu/ppc4xx/libppc4xx.o] Error 2 powerpc-fsl-linux-size: './u-boot': No such file 4xx_ibm_ddr2_autocalib.c: In function 'DQS_autocalibration': include/asm/ppc4xx-sdram.h:1407:13: sorry, unimplemented: inlining failed in call to 'ppc4xx_ibm_ddr2_register_dump': function body not available 4xx_ibm_ddr2_autocalib.c:1243:32: sorry, unimplemented: called from here and: In file included from crc32.c:50:0: crc32table.h:4:1: warning: implicit declaration of function '___constant_swab32' [-Wimplicit-function-declaration] crc32table.h:4:1: error: initializer element is not constant crc32table.h:4:1: error: (near initialization for 'crc32table_le[0]') Signed-off-by: Kim Phillips <kim.phillips@freescale.com> [trini: Remove '#endif' in include/common.h around setenv portion] Signed-off-by: Tom Rini <trini@ti.com>
* Support setenv_ulong() and setenv_addr() for powerpcSimon Glass2012-11-021-1/+1
| | | | | | | | | This includes were outside an #ifdef CONFIG_PPC, but there is not reason to exclude powerpc from using them. Move the declaration outside the #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
* ppc4xx: Remove AP1000 board supportStefan Roese2012-10-151-2/+2
| | | | | | | | | As the board seems to be unmaintained for some time, lets remove the support in mainline completely. Signed-off-by: Stefan Roese <sr@denx.de> Cc: James MacAulay <james.macaulay@amirix.com> Acked-by: Marek Vasut <marex@denx.de>
* ppc4xx: Remove IOP480 supportStefan Roese2012-10-151-1/+1
| | | | | | | | | | Since the IOP480 (PPC401/3 variant from PLX) is only used on 2 boards that are not actively maintained, lets remove support for it completely. This way the ppc4xx code will get a bit cleaner. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu> Acked-by: Marek Vasut <marex@denx.de>
* serial: Remove CONFIG_SERIAL_MULTI from remaining sourcesMarek Vasut2012-10-151-12/+0
| | | | | | | | | | | | Remove the parts depending either on disabled CONFIG_SERIAL_MULTI or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI is now enabled by default. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
* COMMON: Add __stringify() functionMarek Vasut2012-10-151-0/+1
| | | | | | | | | | | | | Copied from Linux kernel: commit 8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4 Date: Wed Apr 8 16:58:57 2009 +0800 Pull in the __stringify() macro from Linux kernel. This macro is usually used to convert numbers to strings at preprocessor level, yet it is not limited only to that. This is useful as it allows higher usage of puts() in favour of printf(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de>
* lib: add gzip lib function callbackLei Wen2012-09-291-0/+7
| | | | Signed-off-by: Lei Wen <leiwen@marvell.com>
* Add run_command_list() to run a list of commandsSimon Glass2012-08-091-0/+13
| | | | | | | | | This new function runs a list of commands separated by semicolon or newline. We move this out of cmd_source so that it can be used by other code. The PXE code also uses the new function. Suggested-by: Michael Walle <michael@walle.cc> Signed-off-by: Simon Glass <sjg@chromium.org>
* common.h: Remove include compiler.hMarek Vasut2012-07-201-2/+1
| | | | | | | | | | | | | Remove this as including it on global scale breaks a lot of things. This was reported by: Matthew McClintock <B29882@freescale.com> Fix found by: Tom Rini <trini@ti.com> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Tom Rini <trini@ti.com>
* common.h: Introduce DEFINE_CACHE_ALIGN_BUFFERMarek Vasut2012-07-181-3/+18
| | | | | | | | | | | | This is the out-of-function-scope counterpart of ALLOC_CACHE_ALIGN_BUFFER. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@ti.com> [ilya.yanok]: added missing <linux/compiler.h> include and {DEFINE,ALLOC}_ALIGN_BUFFER macros allowing explicit alignment specification. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
* net: use common rand()/srand() functionsMichael Walle2012-07-071-1/+3
| | | | | | | | | Replace rand() with the functions from lib/. The link-local network code stores its own seed, derived from the MAC address. Thus making it independent from calls to srand() in other modules. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* lib: add rand() functionMichael Walle2012-07-071-0/+8
| | | | | | | It's a PRNG using the simple and fast xorshift method. Signed-off-by: Michael Walle <michael@walle.cc> Cc: Wolfgang Denk <wd@denx.de>
* pxe: add support for parsing local syslinux filesRob Herring2012-06-211-0/+6
| | | | | | | | Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* MIPS: board.c: move extern declarations to u-boot-mips.hDaniel Schwierzeck2012-06-031-0/+3
| | | | | | This fixes some remaining checkpatch.pl warnings. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
* net: Allow filtering on debug traces in the net subsystemJoe Hershberger2012-05-231-7/+7
| | | | | | | | | | | | Add several levels of DEBUG prints so that you can limit the noise to the severety of your problem. DEBUG_LL_STATE = Link local state machine changes DEBUG_DEV_PKT = Packets or info directed to the device DEBUG_NET_PKT = Packets on info on the network at large DEBUG_INT_STATE = Internal network state changes Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* Merge branch 'master' of git://git.denx.de/u-boot-netWolfgang Denk2012-05-201-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://git.denx.de/u-boot-net: net: move bootfile init into eth_initialize net: punt bd->bi_ip_addr net: cosmetic: netconsole.c checkpatch compliance net: cosmetic: tftp.* checkpatch compliance net: cosmetic: sntp.* checkpatch compliance net: cosmetic: rarp.* checkpatch compliance net: cosmetic: nfs.* checkpatch compliance net: cosmetic: net.c checkpatch compliance net: cosmetic: eth.c checkpatch compliance net: cosmetic: bootp.* checkpatch compliance net: cosmetic: net.h checkpatch compliance net: Remove volatile from net API
| * net: cosmetic: net.c checkpatch complianceJoe Hershberger2012-05-151-0/+4
| | | | | | | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* | Add abs() macro to return absolute valueSimon Glass2012-05-151-0/+25
|/ | | | | | | | | This macro is generally useful to make it available in common. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com> Acked-by: Tom Rini <trini@ti.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Move bootstage timer out of lib/time.cSimon Glass2012-04-101-7/+0
| | | | | | | | | | | | The standalone example does not have get_timer() defined, so we cannot rely on it being available. Move the timer function into boootstage.c to avoid this problem. This corrects a build breakage for the standalone example on some boards. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu>
* Revert "Add board_pre_console_putc to deal with early console output"Simon Glass2012-03-231-7/+0
| | | | | | | | | | | This reverts commit 295d3942b806552503243f5cfb36aec6f1b5a9bf. It turns that this really doesn't work very nicely. Instead we should have a pre-console panic function so that we know that further execution is impossible and we don't need to worry about trampling on UARTs, etc. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Wolfgang Denk <wd@denx.de>
* bootstage: Define an optional microsecond timerSimon Glass2012-03-181-0/+7
| | | | | | | | | | | | Define timer_get_boot_us() which returns the number of microseconds since boot. If undefined then we use get_timer() * 1000. We can fit this in a 32-bit register which keeps everyone happy on the efficiency side. It will wrap around after about an hour. If we are still looking at it after an hour then we had better not be timing the boot. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstage: Create an initial header for boot progress integersSimon Glass2012-03-181-4/+2
| | | | | | | | | | | | At present boot_stage_progress() is called with various magic numbers. The new bootstage.h header will be used to turn these into symbolic names throughout the code. The intent is not that these numbers are passed to Linux. In fact by using an enum to track them we should eventually be able to remove the explict numbers and just have the stages count up from 0. Signed-off-by: Simon Glass <sjg@chromium.org>
* Stop using builtin_run_command()Simon Glass2012-03-061-1/+0
| | | | | | | | | | Boards can select either the 'built-in' parser or the hush parser. We should not call builtin_run_command() if we are using the hush parser. We use run_command() instead, since it knows how to call the correct parser. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Rename run_command2() to run_command()Simon Glass2012-03-061-1/+1
| | | | | | | This is a more sensible name, so rename it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Rename run_command() to builtin_run_command()Simon Glass2012-03-061-1/+1
| | | | | | | | | The current run_command() is only one of the parsing options - the other is hush. We should not call run_command() when the hush parser is being used. So we rename this function to better explain its purpose. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Remove CMD_PXE's static on run_command()Simon Glass2012-03-061-2/+0
| | | | | | | | It really isn't clear why this is here and there is no comment, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* davinci: add support for printing clock frequencyHadli, Manjunath2012-02-121-0/+1
| | | | | | | | | add support for printing various clock frequency info found in SOC such as ARM core frequency, DSP core frequency and DDR frequency as part of bdinfo command. Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com> Cc: Tom Rini <trini@ti.com>
* common: add possibility for readline_into_buffer timeoutHeiko Schocher2012-02-121-1/+2
| | | | | | | | | add possibility to add a timeout when reading a line into a buffer. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Mike Frysinger <vapier@gentoo.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Revert "common.h: remove value from bool defines"Wolfgang Denk2012-01-061-8/+8
| | | | | | | | | | | | | | | | This reverts commit 914c9ee971924665c9d2927fe83d8d70060b1eb8 which is causing tons of build warnings like start.S:39:0: warning: "_LINUX_CONFIG_H" redefined [enabled by default] /home/wd/git/u-boot/work/include/common.h:28:0: note: this is the location of the previous definition /work/wd/tmp-ppc/nand_spl/board/freescale/mpc8315erdb/start.S:39:0: warning: "_LINUX_CONFIG_H" redefined [enabled by default] /home/wd/git/u-boot/work/include/common.h:28:0: note: this is the location of the previous definition etc. Signed-off-by: Wolfgang Denk <wd@denx.de>
* common.h: remove value from bool definesIgor Grinberg2012-01-051-8/+8
| | | | | | | | Several boolean defines have a value assigned. Remove the value as defining the symbol is enough. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Move vsprintf functions into their own headerSimon Glass2011-12-171-10/+1
| | | | | | | common.h is very large, so before changing the vsprintf functions, move the prototypes into their own header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add board_pre_console_putc to deal with early console outputSimon Glass2011-12-091-0/+7
| | | | | | | | | | | | | | | | This patch adds support for console output before the console is inited. The main purpose of this is to deal with a very early panic() which would otherwise cause a silent hang. A new board_pre_console_putc() function is added to the board API. If provided by the board it will be called in the event of console output before the console is ready. This function should turn on all UARTs and spray the character out if it possibly can. The feature is controlled by a new CONFIG_PRE_CONSOLE_PUTC option. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Graeme Russ <graeme.russ@gmail.com>
* common: move extern char console_buffer[] to common.hIgor Grinberg2011-11-221-0/+1
| | | | | | | | | Extract all extern declarations for console_buffer[] out of c files into the common.h header. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Cc: Frank Gottschling <fgottschling@eltec.de> Cc: Murray Jensen <Murray.Jensen@csiro.au>
* DEBUG: Fix debug macrosMarek Vasut2011-10-271-10/+16
| | | | | | | | | | | | | The current implementation of debug doesn't play well with GCC4.6. This implementation also fixes GCC4.6 complaints about unused variables while maintaining code size. Also, drop the debugX() as that's not used anywhere anymore. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org>
* fdt: Add support for embedded device tree (CONFIG_OF_EMBED)Simon Glass2011-10-261-0/+1
| | | | | | | | | | | | | | | | | This new option allows U-Boot to embed a binary device tree into its image to allow run-time control of peripherals. This device tree is for U-Boot's own use and is not necessarily the same one as is passed to the kernel. The device tree compiler output should be placed in the $(obj) rooted tree. Since $(OBJCOPY) insists on adding the path to the generated symbol names, to ensure consistency it should be invoked from the directory where the .dtb file is located and given the input file name without the path. This commit contains my entry for the ugliest Makefile / shell interaction competition. Signed-off-by: Simon Glass <sjg@chromium.org>
* tftpput: add save_addr and save_size global variablesSimon Glass2011-10-261-0/+2
| | | | | | We need something akin to load_addr to handle saving data. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add setenv_ulong() and setenv_addr()Simon Glass2011-10-261-0/+2
| | | | | | | It seems we put numbers and addresses into environment variables a lot. We should have some functions to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud