summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* efi: efi: register barebox-update handlerSteffen Trumtrar2017-07-111-0/+4
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* blspec: skip all devicetree tests if entry doesn't specify oneSteffen Trumtrar2017-07-111-8/+8
| | | | | | | | | | | | If the blspec entry does not specify a devicetree to test against, it doesn't make any sense to check the compatible of the machine or find the root node. Instead of first testing the barebox devicetree check if the entry specifies one. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* efi: efi: load state from devicetreeSteffen Trumtrar2017-07-111-0/+59
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* common: efi: do not use undefined kconfig optionSteffen Trumtrar2017-07-101-2/+1
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* state: fix compile warnings for dev_err expansionSteffen Trumtrar2017-07-103-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following warnings: CC common/state/backend_format_dtb.o In file included from include/common.h:33:0, from common/state/backend_format_dtb.c:18: common/state/backend_format_dtb.c: In function ‘state_backend_format_dtb_verify’: include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=] (level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \ ^ include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’ __dev_printf(3, (dev) , format , ## arg) ^~~~~~~~~~~~ common/state/backend_format_dtb.c:52:3: note: in expansion of macro ‘dev_err’ dev_err(fdtb->dev, "Error, stored DTB length (%d) longer than read buffer (%d)\n", ^~~~~~~ include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=] (level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \ ^ include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’ __dev_printf(3, (dev) , format , ## arg) ^~~~~~~~~~~~ common/state/backend_format_dtb.c:52:3: note: in expansion of macro ‘dev_err’ dev_err(fdtb->dev, "Error, stored DTB length (%d) longer than read buffer (%d)\n", ^~~~~~~ CC common/state/backend_format_raw.o In file included from include/common.h:33:0, from common/state/backend_format_raw.c:18: common/state/backend_format_raw.c: In function ‘backend_format_raw_verify’: include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘ssize_t {aka long int}’ [-Wformat=] (level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \ ^ include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’ __dev_printf(3, (dev) , format , ## arg) ^~~~~~~~~~~~ common/state/backend_format_raw.c:111:3: note: in expansion of macro ‘dev_err’ dev_err(backend_raw->dev, "Error, buffer length (%d) is shorter than the minimum required header length\n", ^~~~~~~ CC common/state/backend_storage.o In file included from common/state/backend_storage.c:24:0: common/state/backend_storage.c: In function ‘state_storage_mtd_buckets_init’: include/printk.h:52:52: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 5 has type ‘uint32_t {aka unsigned int}’ [-Wformat=] (level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \ ^ include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’ __dev_printf(3, (dev) , format , ## arg) ^~~~~~~~~~~~ common/state/backend_storage.c:250:3: note: in expansion of macro ‘dev_err’ dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %ld, erasesize %zu\n", ^~~~~~~ Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* state: backend: always pass backend type to Linux dtbSascha Hauer2017-06-231-1/+2
| | | | | | | | | | When the "backend-storage-type" property is unset in the barebox dtb then barebox will use the default. Instead of leaving the property unset in the Linux dtb, set it to the value we used as default. By making the default explicit to Linux we force Linux to the same backend type, even when the defaults may differ. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2017-06-141-16/+2
|\
| * state: do not complain about missing backend-storage-typeSascha Hauer2017-05-231-7/+2
| | | | | | | | | | | | | | | | backend-storage-type is irrelevant for mtd devices, so do not complain about this option missing. The mtd backend will print messages if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: remove unused variablesSascha Hauer2017-05-111-9/+0
| | | | | | | | | | | | | | | | There's no need to check for the existence of the backend property as this is done implicitly later anyway. With this check removed of_path is only assigned, but never used. Remove the unused code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2017-06-143-2/+4
|\ \
| * | hush: make source_aliases[] constIan Abbott2017-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Although the elements of `source_aliases[]` are of type `const char *`, the elements themselves are not const-qualified. Make them `const`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: allow <cmd>_aliases[] to be constIan Abbott2017-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commands with aliases define an array of alias strings such as: static const char *<cmd>_aliases[] = { "<alias1>", NULL}; Although the elements are of type `const char *`, the elements themselves are not `const`-qualified. If the array is declared as: static const char * const <cmd>_aliases[] = { "<alias1>", NULL}; then the compiler warns about const qualifiers being discarded. This is because the `aliases` member of `struct command` is declared as `const char *aliases;`. Change the declaration of the `aliases` member of `struct command` to `const char * const *aliases;` so that it can point to a `const` array of `const char *`. Also change the declaration of the `aliases` variable in `register_command()` to avoid unnecessary type casts. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Create automount entries for the default mount pathesSascha Hauer2017-05-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In barebox the default mount path for a cdev is /mnt/<cdevname> which can be mounted with "mount <cdevname>" without specifying a target path explicitly. Simplify this further by creating automount entries for the default mount pathes which makes a manual mount completely unnecessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2017-06-141-3/+3
|\ \ \
| * | | imx-bbu-nand-fcb: add support for imx6ullChristian Hemp2017-05-221-3/+3
| |/ / | | | | | | | | | | | | | | | | | | The i.MX 6ull secures the fcb with bch 40. This is identical to i.MX 6ul. Signed-off-by: Christian Hemp <c.hemp@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/directory-links'Sascha Hauer2017-06-141-0/+1
|\ \ \
| * | | errno: Include string for ELOOPSascha Hauer2017-05-111-0/+1
| | |/ | |/| | | | | | | | | | | | | | | | Needed for printing a correct error message when symbolic link loops are encountered. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Revert "nv: Do not create globalvars from nvvars"Sascha Hauer2017-06-131-21/+21
| | | | | | | | | | | | This reverts commit 35d8e858bea17ec4796069c9c27fd0b134125eaf.
* | | Revert "globalvar: remove code for unqualified globalvars"Sascha Hauer2017-06-131-1/+42
| | | | | | | | | | | | This reverts commit e4f81050e098074792730b61563538d9e394e3d6.
* | | Revert "globalvar: make globalvar functions more consistent"Sascha Hauer2017-06-137-16/+30
| | | | | | | | | | | | This reverts commit 1b4a05c9263ae26083526acfabdea1ef96531a1d.
* | | Revert "param: remove unnecessary device_d * argument"Sascha Hauer2017-06-131-7/+7
| | | | | | | | | | | | This reverts commit 0071bacb4c7cab21c9fab8540f5aa9922a270a85.
* | | Revert "globalvar: don't use nv_device if CONFIG_NVVAR is disabled"Sascha Hauer2017-06-131-11/+1
| | | | | | | | | | | | This reverts commit b378e8c9427b45d856d052a6df4a879a2cee670c.
* | | Revert "globalvar: make nv_device static"Sascha Hauer2017-06-131-1/+1
| | | | | | | | | | | | This reverts commit f655902cfad63b9ba5cea7d0c9fc9c3632143e02.
* | | Revert "nv: Fix setting of nv.dev.<devname>.<param> variables"Sascha Hauer2017-06-131-23/+42
| | | | | | | | | | | | This reverts commit eaf884ba55def055fd81ff3291a1a534fc8bd8f9.
* | | Revert "globalvar: Fix value of new globalvar when nvvar exists"Sascha Hauer2017-06-131-2/+2
| | | | | | | | | | | | This reverts commit f8a177478c1b79e369ecc65501d9d15ff573339f.
* | | ratp: only allow bidirectional consolesAleksander Morgado2017-06-071-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore requests to switch to RATP mode in input-only or output-only consoles. This actually also avoids segfaulting later on: #0 0x0000000000000000 in ?? () #1 0x000000000040b2a4 in console_send (r=<optimized out>, pkt=0x7fffffffd8ec, len=4) at common/ratp.c:102 #2 0x000000000042ab99 in ratp_behaviour_a (pkt=0x7ffff7298780, ri=0x7ffff72766d0) at lib/ratp.c:530 #3 ratp_state_machine (pkt=0x7ffff7298780, ri=0x7ffff72766d0) at lib/ratp.c:1384 #4 ratp_poll (ratp=0x7ffff7277ed8) at lib/ratp.c:1561 #5 0x000000000042b2ab in ratp_establish (ratp=ratp@entry=0x7ffff7277ed8, active=active@entry=false, timeout_ms=timeout_ms@entry=100) at lib/ratp.c:1645 #6 0x000000000040b888 in barebox_ratp (cdev=cdev@entry=0x7ffff7212bd0) at common/ratp.c:470 #7 0x00000000004046c3 in getc_raw () at common/console.c:416 ... Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | globalvar: Fix value of new globalvar when nvvar existsSascha Hauer2017-05-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When a new globalvar with a value is created and the corresponding nvvar exists, then the globalvar gets the value of the nvvar, not from the newly assigned value as expected. nv quux=foo; global quux=bar; echo ${global.quux} Should give "bar", not "foo". Fix this. Reported-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | nv: Fix setting of nv.dev.<devname>.<param> variablesSascha Hauer2017-05-081-42/+23
|/ | | | | | | | | | | | | | | | | | nv variables with the form nv.dev.<devname>.<param> shall be mirrored to the device parameter <param> of the device named <devname>. This is broken since: | commit 35d8e858bea17ec4796069c9c27fd0b134125eaf | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Thu Apr 6 15:23:56 2017 +0200 | | nv: Do not create globalvars from nvvars Fix this by attaching the setting of the mirror device parameter directly to the nv device rather than to the global device. Reported-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: initialize dummy clocksource staticallySascha Hauer2017-05-051-6/+1
| | | | | | | | | | | | | | | | | | | | Assigning the dummy clocksource in a initcall has the problem that get_time_ns() crashes before that initcall is executed. This happens when dmesg support is enabled in conjunction with CONFIG_DEBUG_INITCALLS. In this case the dmesg code wants to have the timestamp of a log message. Solve this by setting the current clocksource to the dummy clock statically and not at runtime. This way we always have a dummy clock available. Fixes: commit 8972eb7ff17ad058a6c6018305bb912138ab0ca2 Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Date: Fri Mar 3 13:34:02 2017 +0100 clocksource: move dummy clock source to init_clock Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2017-05-051-3/+25
|\
| * state: Create alias in of_state_fixup()Sascha Hauer2017-05-041-1/+12
| | | | | | | | | | | | | | | | When the kernel device tree is fixed up we assume that it doesn't have a state node, so we must also assume that it doesn't have a alias. Create it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: Make an alias mandatorySascha Hauer2017-05-041-2/+4
| | | | | | | | | | | | | | | | The userspace barebox-state utility gets confused when no alias exists. Make the alias mandatory, so that people make it right^tm without having to ask. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: warn when a state node will be overwrittenSascha Hauer2017-05-041-0/+9
| | | | | | | | | | | | | | | | | | People do not seem to know that a state node in the kernel device tree will be overwritten by barebox. Print a warning when this happens so that people can get an idea why changes in the kernel device tree state node do not have any effect. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/socfpga'Sascha Hauer2017-05-051-0/+29
|\ \
| * | ARM: socfpga: add arria10 supportSteffen Trumtrar2017-05-031-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Arria10 is a SoC + FPGA like the Cyclone5 SoCFPGA that is already supported in barebox. Both a the same in some parts, but totaly different in others. Most of the hardware blocks are the same in the SoC parts. The OCRAM is larger on the Arria10 and the SDRAM controller is different. The serial core only supports 32bit accesses (different to the 8bit accesses on the Cyclone5). As Arria10 has 256KB of OCRAM, it is possible to fit a larger barebox (and/or use PBL) instead of the two stage bootprocess used on the Cyclone5 and its 64KB OCRAM. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ARM: socfpga: make debug_ll configurableSteffen Trumtrar2017-05-031-0/+20
| |/ | | | | | | | | | | | | | | Allow configuring the serial port and clock rate instead of hardcoding it. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/parameter-types'Sascha Hauer2017-05-0510-67/+51
|\ \
| * | param: remove unnecessary device_d * argumentSascha Hauer2017-04-111-7/+7
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | globalvar: make globalvar functions more consistentSascha Hauer2017-04-117-30/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the device parameter functions also make the globalvar functions more consistent. This also adds support for readonly globalvars and changes several existing globalvars which should really be readonly to readonly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | param: make parameter functions more consistentSascha Hauer2017-04-113-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch creates a consitent set of device parameter functions. With this we have: dev_add_param_<type><access> "type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, bitmask The improvement here is that we now can exactly specify the width of the int type parameters and also correctly distinguish between signed and unsigned variables which means that a variable no longer ends up with INT_MAX when it's assigned -1. "access" can be empty for regular read/write parameter, "_ro" for readonly parameters which get their value from a variable pointer in the background or "_fixed" for parameters which are set to a fixed value (without a pointer in the background). Some more exotic types are not (yet) implemented, like dev_add_param_ip_ro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | console: Use dev_add_param_stringSascha Hauer2017-04-111-26/+24
| | | | | | | | | | | | | | | | | | | | | dev_add_param_string allows to pass a priv * so that the device_d * argument is not needed and can be removed later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2017-05-054-5/+5
|\ \ \
| * | | state: backend_bucket_circular: drop unused free_pattern constantAntony Pavlov2017-05-031-1/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | globalvar: make nv_device staticAntony Pavlov2017-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nv_device isn't used outside of common/globalvar.c so make it static. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | xfuncs: Be more informative when out of memory panic occursSascha Hauer2017-04-282-3/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | When one of the xfuncs panics we can be a bit more informative. We can at least print the amount of bytes we wanted to allocate and how much memory we have left. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2017-05-052-3/+143
|\ \ \ | |_|/ |/| |
| * | imx-bbu-nand-fcb: add support for imx6ulJan Remmet2017-05-052-3/+143
| |/ | | | | | | | | | | | | | | | | | | | | | | imx6ul secure the fcb with bch 40. The imx-kobs tool use a own modified bch lib. They reverse the bit order of the data and the ecc. To use the bch lib in barebox the bytes in the data buffers must be reversed. The data layout on nand is bit aligned. But with 40 bits this is not an issue for imx6ul now. Signed-off-by: Jan Remmet <J.Remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: BLSPEC needs boot infrastructure and at least simple command supportLucas Stach2017-04-261-0/+3
| | | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | globalvar: don't use nv_device if CONFIG_NVVAR is disabledAntony Pavlov2017-04-251-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment barebox crashes if CONFIG_NVVAR is disabled because of access to unregistered nv_device in get_param_by_name(&nv_device, "version"). How to reproduce the crash: barebox$ unset ARCH barebox$ unset CROSS_COMPILE barebox$ make sandbox_defconfig barebox$ sed -i "s/CONFIG_ENV_HANDLING=y/# CONFIG_ENV_HANDLING is not set/" .config barebox$ make oldconfig barebox$ ./barebox Segmentation fault Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | state: backend_raw: init digest earlierSascha Hauer2017-04-241-4/+6
| | | | | | | | | | | | | | | | | | In backend_format_raw_pack() digest_length is used before it's initialized in backend_raw_digest_init() which results in a too small memory allocation for the raw backend. Fix this and prevent a memory corruption. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>