summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/net'Sascha Hauer2018-01-051-2/+4
|\
| * nvvar: when setting a nvvar to NULL just free the contentSascha Hauer2017-12-011-2/+4
| | | | | | | | | | | | | | | | | | | | When a nvvar is about to be removed then it is set to NULL by barebox. This means for the variable to free it's memory. In this case also do not pass the value to the corresponding globalvar, since that would set the globalvar to NULL aswell, but we want to keep its current value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2018-01-051-3/+42
|\ \
| * | nvvar: Initialze from underlying device parameterSascha Hauer2017-11-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | When a nvvar is added with a NULL parameter then it's initialized with the value of the underlying global variable. Do this aswell when the nvvar is a device parameter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nv: add device parameter overwrites to completion listSascha Hauer2017-11-231-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | nv variables in the form dev.<devname>.* can be used to make device parameters persistent. Add these to the completion list to make setting these variables more convenient. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | globalvar: When a globalvar is created with a NULL value, use empty stringSascha Hauer2017-11-231-0/+3
| | | | | | | | | | | | | | | | | | | | | As a convenience for users of globalvar_add_simple_string() create an empty value for the variable when passed a NULL pointer as value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Bootm: remove uimage_close done later in bootm_bootClément Leger2017-12-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From 24e24f9998342b23cd8de4145c8098f93c60cdc7 Mon Sep 17 00:00:00 2001 From: Clement Leger <clement.leger@kalray.eu> Date: Thu, 14 Dec 2017 13:29:50 +0100 Subject: [PATCH] Bootm: fix double uimage_close When uimage crc fails, the error handling path call uimage_close in bootm_open_os_uimage and also in bootm_boot. This leads to crash/exception. Keep the main error handling path in bootm_boot and remove uimage_close from bootm_open_os_uimage to avoid double uimage_close. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | common: globalvar: fix removing multiple nvvars with wildcardsSascha Hauer2017-11-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nvvar_remove takes wildcards, so it can remove multiple variables. This means we cannot return after the first loop iteration, but instead must continue. Fixes: 609d3edc3ad9 (common: globvar: let nvvar_remove() report non-existing variable) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc:
* | | imx-bbu-nand-fcb: fix build on MX28 onlyLucas Stach2017-11-211-3/+15
|/ / | | | | | | | | | | | | | | | | This code may be compiled without ARCH_IMX6 present, so it must not depend on any functions provided by the architecture support. Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/omap'Sascha Hauer2017-11-134-9/+158
|\ \
| * | common: oftree: Add autoenable functionalityDaniel Schultz2017-11-071-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds an API to automatically enable either hardware components with existing device drivers or i2c clients. All functions take a device tree path to find the hardware and will fix up the node status in the kernel device tree, if it's accessible. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: Add function to read state MACDaniel Schultz2017-11-071-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | This API function allows to receive a copy of a MAC address from variables in a state. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: Add variable type as enumDaniel Schultz2017-11-072-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The variable_type struct holds a name of its type. Checking the type of a variable with this string needs much resources. This patch introduce a enum of the variable type for better type checking. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: Add variable_type to state_variableDaniel Schultz2017-11-073-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | Add a pointer in state_variable to the corresponding variable_type array element. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/nv'Sascha Hauer2017-11-131-1/+3
|\ \ \
| * | | common: globvar: let nvvar_remove() report non-existing variableEnrico Jorns2017-11-031-1/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The former implementation did not allow to detect whether the call to nvvar_remove() succeeded or failed and always returned 0. This changes the implementation to return 0 only if a variable with the given name was found and return ENOENT otherwise. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/efi'Sascha Hauer2017-11-132-0/+11
|\ \ \ | |_|/ |/| |
| * | efi-gui: add USB IO Protocol GUID definitionJean-Christophe PLAGNIOL-VILLARD2017-10-271-0/+1
| | | | | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | EFI: add poweroff supportJean-Christophe PLAGNIOL-VILLARD2017-10-271-0/+10
| |/ | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / uimage: fix: add can_lseek_backward and use in uimage_openMichael Grzeschik2017-11-101-2/+2
|/ | | | | | | | | | Since commit ce0cc7fe we support forward seek on tftpfs. This feature breaks the condition to check rather we open an uimage over tftp. Since backward seeking is the problem here, we add the function can_lseek_backward and check for it instead of the simple lseek. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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>