summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/usbgadget'Sascha Hauer2017-10-192-14/+73
|\
| * bbu: Add function to iterate over registered handlersSascha Hauer2017-09-271-0/+15
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Add error messagesSascha Hauer2017-09-271-4/+9
| | | | | | | | | | | | | | Add error messages when file list parsing fails. Also, forward the error from file_list_parse_one() instead of using -EINVAL for every error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Add GPL header to fileSascha Hauer2017-09-271-0/+11
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Fix memory leak in failure pathSascha Hauer2017-09-271-1/+1
| | | | | | | | | | | | | | In case of a parse error not only the list header has to be freed, but also the entries. Use file_list_free() for this purpose. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Allow only unique names on listSascha Hauer2017-09-271-1/+7
| | | | | | | | | | | | The key to a file_list is it's name, so ensure it's unique. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Add function to get entry by its nameSascha Hauer2017-09-271-0/+12
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * file_list: Add function to add an entry to the listSascha Hauer2017-09-271-9/+19
| | | | | | | | | | | | | | | | Add file_list_add_entry() to add a single entry to a file_list. Then use it in file_list_parse_one() instead of open coding adding a new entry. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-263-8/+0
| | | | | | | | | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-bbu-nand-fcb: read_firmware_all(): Spell "Secondary firmware" with a ↵Marc Kleine-Budde2017-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | capital "S" "Primary firmware" is writte with a capital "P" so adjust "Secondary firmware" to use a capital "S". Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console_countdown: ignore errors in getchar()Aleksander Morgado2017-09-261-6/+8
|/ | | | | | | | | | | | | | | | | | The getchar() call may return an error reported as a -1, e.g. when the console detects a RATP message and switches to RATP mode. In general it probably is a good idea to ignore these errors in the console countdown operation; and in particular for the RATP usecase, this also prevents from interfering with the countdown and menu just when switching one of the consoles to RATP mode. As a hint, this is what the standard console was printing due to this issue when the RATP console was activated: Hit m for menu or any other key to stop autoboot: [: missing `]' Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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.