summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* memtest: fix list iteration in region setupSteffen Trumtrar2017-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | When memory regions start at 0, the current mem_test_request_regions function wrongly assumes that struct resource *r points at the correct region. It points to the first region however (which starts at 0). The comment states, that the code starts from the second entry. In include/linux/list.h the macro documentation however says: list_for_each_entry_from - iterate over list of given type from the current point The correct list iteration macro to use here is list_for_each_entry_continue, where the documentation says: Continue to iterate over list of given type, continuing after the current position. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: bootm_open_initrd_uimage(): propagate error if initrd verification failsMarc Kleine-Budde2017-09-201-0/+1
| | | | | | | | | | If the verification of an initrd inside of an uImage fails an error message is printed but the error is not propagated. Although this is not security relevant, as the verification is currently only a CRC32 check, the error should be returned. This patch fixes the problem. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: don't use uninitialized variableJuergen Borleis2017-09-061-1/+1
| | | | | | | Printing 'ret' makes no sense. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: use the given backend storage type nameJuergen Borleis2017-09-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Change 119f92b27e131a0cb506fe8d8bffe8010fb14a3d already tried to fix it, but forgets the 'direct' usecase. The 'backend-storage-type' node is optional. Its default depends on the capability of the used backend memory, which means "circular" or NULL. The latter defaults to 'direct' in the routines. If it is NULL, the devicetree fixup routine skips exporting a 'backend-storage-type' node to the kernel's devicetree. But currently if the 'backend-storage-type' node is explicitly given as 'direct', it will be skipped silently and set to NULL instead. In this case the user of the 'barebox-state' tool then ends up with the warning: "No backend-storage-type found, using default" which is annoying, because it was given. Storing the given value will still use a NULL if the 'backend-storage-type' node isn't defined, but stores everything else if it is defined. Then the 'backend-storage-type' node is present in the kernel's devicetree as well. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: provide an error message when an error occursJuergen Borleis2017-09-061-0/+1
| | | | | | | | A simple typo makes the state framework fail, but without an error message the developer is lost in the dark. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: add debugging helpJuergen Borleis2017-09-062-1/+8
| | | | | | | | | While working on the state documentation it turns out to be helpful to have more debug messages while a developer implements a 'state' variable set and tries to configure it correctly. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootchooser: allow an empty namespaceJuergen Borleis2017-09-061-6/+4
| | | | | | | | | The bootchooser's documentation states the 'namespace' for the state storage backend is optional. This change makes it really optional to allow a flat state variable set definition for the 'bootchooser' as well. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootchooser: avoid a use after freeJuergen Borleis2017-09-061-1/+1
| | | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: keep backward compatibilityJuergen Borleis2017-09-062-9/+27
| | | | | | | | | | | | | Previous 'state' variable set variants do not know and use metadata. The 'direct' storage backend's read function honors this, but not its counterpart the write function. This makes an update of the 'state' variable set impossible. This change makes backward compatibility explicit, else it complains in the read function as well. With some more debug output it helps the developer to do things right. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Lucas Stach2017-07-312-3/+1
|\
| * state: backend_storage: remove unreachable error messagePhilipp Zabel2017-07-201-2/+0
| | | | | | | | | | | | | | This looks like a leftover. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * state: backend_bucket_circular: promote old state debug message to infoPhilipp Zabel2017-07-201-1/+1
| | | | | | | | | | | | | | | | A report about the changed on-storage state format might be interesting to the user. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* | Merge branch 'for-next/efi'Lucas Stach2017-07-315-13/+75
|\ \
| * | 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_bucket_circular: fix old state readsPhilipp Zabel2017-07-201-1/+4
|/ | | | | | | | | | | | | When the circular bucket meta magic was not found, it is assumed that the whole written state is in the old on-storage format. In that case, the size of the circular bucket meta must not be subtracted from the read length, or the (complete_len > len) check in the raw backend's verify function will fail: state: Error, invalid data_len 16 in header, have data of len 24 Signed-off-by: Philipp Zabel <p.zabel@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>