aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2020-04-17Kconfig: fix typos in CMD_BEDBUG descriptionHeinrich Schuchardt1-1/+1
Fix documentation bug reported by 'make refcheckdocs'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-17image: Add compressed Image parsing support in booti.Atish Patra1-1/+39
Add compressed Image parsing support so that booti can parse both flat and compressed Image to boot Linux. Currently, it is difficult to calculate a safe address for every board where the compressed image can be decompressed. It is also not possible to figure out the size of the compressed file as well. Thus, user need to set two additional environment variables kernel_comp_addr_r and filesize to make this work. Following compression methods are supported for now. lzma, lzo, bzip2, gzip. lz4 support is not added as ARM64 kernel generates a lz4 compressed image with legacy header which U-Boot doesn't know how to parse and decompress. Tested on HiFive Unleashed and Qemu for RISC-V. Tested on Qemu for ARM64. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Fix minor rST formatting problems] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-04-17cmd: mem: Add bitflip memory test to alternate mtestStefan Roese1-0/+60
This additional bitflip memory test is inspired by the bitflip test in memtester v4.3.0. It show some errors on some problematic GARDENA MT7688 based boards. The other memory tests usually don't show any errors here. Signed-off-by: Stefan Roese <sr@denx.de>
2020-04-17cmd: mem: Use IS_ENABLED instead of alt_test variableStefan Roese1-6/+1
This patch uses the IS_ENABLED() macro to check, which mtest variant is enabled. Signed-off-by: Stefan Roese <sr@denx.de>
2020-04-17cmd: mem: Drop eldk-4.2 workaround and use cast in unmap_sysmem()Stefan Roese1-12/+2
Use a cast instead of the "eldk-4.2" workaround for unmap_sysmem(). Signed-off-by: Stefan Roese <sr@denx.de>
2020-04-17cmd: mem: Correctly count the errors in mtestStefan Roese1-7/+4
This patch changes mtest to correctly count the overall errors and print them even in the abort (Ctrl-C) case. Signed-off-by: Stefan Roese <sr@denx.de>
2020-04-17cmd: fat: remove unused includesHeinrich Schuchardt1-6/+0
Remove unused includes from cmd/fat.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-17cmd: Add unlz4 commandYusuke Ashiduka3-0/+53
This command is a new command called "unlz4" that decompresses from memory into memory. Used with the CONFIG_CMD_UNLZ4 optionenabled. Signed-off-by: Yusuke Ashiduka <ashiduka@fujitsu.com> [trini: Use %zd / %zX not %ld / %lX in printf] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-04-16Merge tag 'efi-2020-07-rc1' of ↵Tom Rini3-8/+98
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-07-rc1 This pull request * provides an implementation of UEFI secure booting * fixes a problem with the rsa_mod_exp driver which stops some boards from booting when CONFIG_RSA is enabled which is needed for UEFI secure booting * enables the EFI_RNG_PROTOCOL if DM_RNG is enabled * fixes some function comments
2020-04-16fdt: Fix 'system' commandTom Warren1-1/+1
'fdt systemsetup' wasn't working, due to the fact that the 'set' command was being parsed in do_fdt() by only testing for the leading 's' instead of "se", which kept the "sys" test further down from executing. Changed to test for "se" instead, now 'fdt systemsetup' works (to test the ft_system_setup proc w/o having to boot a kernel). Signed-off-by: Tom Warren <twarren@nvidia.com>
2020-04-16cmd: efidebug: add "test bootmgr" sub-commandAKASHI Takahiro1-1/+77
This sub-command will be used to test image authentication, in particular, a case where efi_load_image() failed with EFI_SECURITY_VIOLATION but we still want to try efi_start_image(). We won't run such a case under normal bootmgr because it simply refuses to call efi_start_image() if anything but EFI_SUCCESS is returned when loading an image. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-16cmd: env: add "-at" option to "env set -e" commandAKASHI Takahiro2-3/+7
With "-at" option, EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS will be passed to SetVariable() to authenticate the variable. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-16cmd: env: use appropriate guid for authenticated UEFI variableAKASHI Takahiro1-4/+14
A signature database variable is associated with a specific guid. For convenience, if user doesn't supply any guid info, "env set|print -e" should complement it. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-13Merge branch 'next'Tom Rini2-229/+1
Pull in changes that have been pending in our 'next' branch. This includes: - A large number of CI improvements including moving to gcc-9.2 for all platforms. - amlogic, xilinx, stm32, TI SoC updates - USB and i2c subsystem updtaes - Re-sync Kbuild/etc logic with v4.19 of the Linux kernel. - RSA key handling improvements
2020-04-09cmd: Add test and fix bugs for dm driversSean Anderson1-2/+2
Add a test for the dm drivers command. Also fix a null pointer dereference revealed by said test. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-07Merge tag 'xilinx-for-v2020.07' of ↵Tom Rini3-6/+9
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2020.07 common: - Align ENV_FAT_INTERFACE - Fix MAC address source print log - Improve based autodetection code xilinx: - Enable netconsole Microblaze: - Setup default ENV_OFFSET/ENV_SECT_SIZE Zynq: - Multiple DT updates/fixes - Use DEVICE_TREE environment variable for DTB selection - Switch to single zynq configuration - Enable NOR flash via DM - Minor SPL print removal - Enable i2c mux driver ZynqMP: - Print multiboot register - Enable cache commands in mini mtest - Multiple DT updates/fixes - Fix firmware probing when driver is not enabled - Specify 3rd backup RAM boot mode in SPL - Add SPL support for zcu102 v1.1 and zcu111 revA - Redesign debug uart enabling and psu_init delay - Enable full u-boot run from EL3 - Enable u-boot.itb generation without ATF with U-Boot in EL3 Versal: - Enable distro default - Enable others SPI flashes - Enable systems without DDR Drivers: - Gem: - Flush memory after freeing - Handle mdio bus separately - Watchdog: - Get rid of unused global data pointer - Enable window watchdog timer - Serial: - Change reinitialization logic in zynq serial driver Signed-off-by: Tom Rini <trini@konsulko.com>
2020-03-31Merge branch 'next' of git://git.denx.de/u-boot-usb into nextTom Rini3-18/+51
2020-03-31Merge branch '2020-03-31-master-imports'Tom Rini1-2/+2
- mpc8xxx GPIO, SPI bugfixes - Add VxWorks to FIT images - macb ethernet driver bugfix
2020-03-31cmd: mmc: fix typo 'a EMMC'Heinrich Schuchardt1-2/+2
%s/a EMMC/an eMMC/g Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2020-03-28efi_loader: only reserve memory if fdt node enabledHeinrich Schuchardt1-1/+2
Sub-nodes of /reserved-memory may be disabled. In this case we should not reserve memory in the memory map. Reported-by: Patrick DELAUNAY <patrick.delaunay@st.com> Fixes: fef907b2e440 ("efi_loader: create reservations after ft_board_setup") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Atish Patra <atish.patra@wdc.com>
2020-03-28cmd: efidebug: fix int to pointer castHeinrich Schuchardt1-3/+5
On 32 bit systems fix warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Fixes: a415d61eac26 ("cmd: map addresses to sysmem in efidebug memmap") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-17Merge tag 'ti-v2020.07-next' of ↵Tom Rini2-229/+1
https://gitlab.denx.de/u-boot/custodians/u-boot-ti into next K3 J721E: * OSPI boot support * Support for loading remote cores in R5 SPL * PMIC ESM Support * Minor fixes for R5F and C7x remoteproc drivers K3 AM654: * Update AVS class 0 voltages. * Add I2C nodes DRA7xx/AM57xx: * Fixed Android boot on AM57xx AM33/AM43/Davinci: * switch to driver model for the net and mdio driver for baltos * Add DM/DTS support for omap video driver * Enable fastboot on am335x-evm
2020-03-17cmd: bootefi: Parse reserved-memory node from DTAtish Patra1-9/+34
Currently, bootefi only parses memory reservation block to setup EFI reserved memory mappings. However, it doesn't parse the reserved-memory[1] device tree node that also can contain the reserved memory regions. Add capability to parse reserved-memory node and update the EFI memory mappings accordingly. 1. <U-Boot source>/doc/device-tree-bindings/reserved-memory/reserved-memory.txt] Signed-off-by: Atish Patra <atish.patra@wdc.com> Fix an endless loop. The /reserved-memory node may have children without reg property. Remove a superfluous debug statement. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-17cmd: map addresses to sysmem in efidebug memmapHeinrich Schuchardt1-2/+4
Addresses in the sandbox's device tree are in the sandbox's virtual address space. If we want to compare memory reservations in the device-tree with the output of 'efidebug memmap', we need to convert back to this address space. Adjust the output of the 'efidebug memmap' command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-17efi_loader: create reservations after ft_board_setupHeinrich Schuchardt1-3/+3
Some memory reservations are made in ft_board_setup(). Ensure that we create reserved memory map entries after ft_board_setup(). The downside of this patch is that if bootefi is called multiple times with an devicetree argument superfluous reservations for the old copies of the device tree will exist. But that is still better than missing a reservation. Deleting the superfluous reservations is not possible because reservations in the memory map are rounded to page size and may be coallesced. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-13cmd: gpio: Make `gpio input` return pin value againAlex Kiernan1-1/+6
4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") correctly changed the behaviour of the gpio command to return CMD_RET_SUCCESS or CMD_RET_FAILURE, but any existing script which expects the return value to be the pin value is broken by this change. Reinstate the legacy behaviour for `gpio input` only. Fixes: 4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alex Kiernan <alex.kiernan@hivehome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-03-11cmd: efidebug: correct error messageHeinrich Schuchardt1-1/+1
Add the missing line feed at the error message if the variable referred to by 'efidebug boot rm' does not exist. Shorten the format string by using the variable name instead of the number of the boot variable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-11cmd: efidebug: fix a failure of "boot rm" sub-commandAKASHI Takahiro1-2/+3
There is a wrong usage of utf8_utf16_strncpy() in "boot rm" command, and then it will end up with a failure of this command due to a wrong value of an interim variable ("var_name16"). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-03lib: elf: Move the generic elf loading/validating functions to libKeerthy2-229/+1
Move the generic elf loading/validating functions to lib/ so that they can be re-used and accessed by code existing outside cmd. While at it remove the duplicate static version of load_elf_image_phdr under arch/arm/mach-imx/imx_bootaux.c. Signed-off-by: Keerthy <j-keerthy@ti.com> Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-02-28efi_loader: Implement FileLoad2 for initramfs loadingIlias Apalodimas1-0/+4
Following kernel's proposal for an arch-agnostic initrd loading mechanism [1] let's implement the U-boot counterpart. This new approach has a number of advantages compared to what we did up to now. The file is loaded into memory only when requested limiting the area of TOCTOU attacks. Users will be allowed to place the initramfs file on any u-boot accessible partition instead of just the ESP one. Finally this is an attempt of a generic interface across architectures in the linux kernel so it makes sense to support that. The file location is intentionally only supported as a config option argument(CONFIG_EFI_INITRD_FILESPEC), in an effort to enhance security. Although U-boot is not responsible for verifying the integrity of the initramfs, we can enhance the offered security by only accepting a built-in option, which will be naturally verified by UEFI Secure Boot. This can easily change in the future if needed and configure that via ENV or UEFI variable. [1] https://lore.kernel.org/linux-efi/20200207202637.GA3464906@rani.riverdale.lan/T/#m4a25eb33112fab7a22faa0fd65d4d663209af32f Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-26efi_loader: implement EFI_RT_PROPERTIES_TABLEHeinrich Schuchardt1-0/+4
UEFI spec 2.8 errata A replaces the RuntimeServicesSupported variable defined in UEFI spec 2.8 by the configuration table EFI_RT_PROPERTIES_TABLE. So let's follow suit. Cc: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Ard Biesheuvel <ardb@kernel.org>
2020-02-19efi_loader: fix efi_install_fdt() descriptionHeinrich Schuchardt1-5/+5
In the function description use the correct parameter name. Mention EFI_FDT_USE_INTERNAL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-11Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dmTom Rini14-5/+104
sandbox conversion to SDL2 TPM TEE driver Various minor sandbox video enhancements New driver model core utility functions
2020-02-09cmd: mdc/mwc: normalize disjoint MX_CYCLIC usageJoel Johnson2-11/+5
Both CMD_MX_CYCLIC and MX_CYCLIC are in use and defined in Kconfig, but only the non-CMD version currently does anything. This changes all usages to prefer the CMD_MX_CYCLIC option (since it's only affecting addition of the commands), and switches defconfigs using the non-CMD version to use the CMD version. Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Tom Rini <trini@konsulko.com>
2020-02-07cmd/elf.c: Add SPDX tagTom Rini1-10/+1
Based on reading the text of the license comment this appears to be the BSD-2-Clause license but with an imperfect word match as BSD-2-Clause was not (as far as I recall) a common license choice at the time the code was written. Cc: Wolfgang Denk <wd@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2020-02-07cmd: gpio: Correct do_gpio() return valueLuka Kovacic1-5/+17
Use the correct return value in function do_gpio() and update commands documentation with the return values from command_ret_t enum. CMD_RET_SUCCESS is returned on command success and CMD_RET_FAILURE is returned on command failure. The command was returning the pin value, which caused confusion when debugging (#define DEBUG). Signed-off-by: Luka Kovacic <luka.kovacic@sartura.hr> Tested-by: Robert Marko <robert.marko@sartura.hr>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass8-0/+8
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Require users of devres to include the headerSimon Glass4-0/+5
At present devres.h is included in all files that include dm.h but few make use of it. Also this pulls in linux/compat which adds several more headers. Drop the automatic inclusion and require files to include devres themselves. This provides a good indication of which files use devres. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2020-02-05cmd: Add command to dump drivers and compatible stringsSean Anderson1-1/+11
This adds a subcommand to dm to dump out what drivers are installed, and their compatible strings. I have found this useful in ensuring that I have the correct drivers compiled, and that I have put in the correct compatible strings. Signed-off-by Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-02-05cmd: tpm: add a subcommand devicePhilippe Reynes4-4/+80
The command tpm (and tpm2) search the tpm and use it. On sandbox, there are two tpm (tpm 1.x and tpm 2.0). So the command tpm and tpm2 are always executed with the first tpm (tpm 1.x), and the command tpm2 always fails. This add a subcommand device to command tpm and command tpm2. Then the command tpm and tpm2 use the device selected with the subcommand device. To be compatible with previous behaviour, if the subcommand device is not used before a tpm (or tpm2) command, the device 0 is selected. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2020-02-04doc: android: Convert to Sphinx formatSam Protsenko1-1/+1
Convert Android documentation from regular txt format to Sphinx (RST). Also add Android index.rst file and reference it in root index.rst, so that Android documentation is visible. Test: $ make htmldocs $ xdg-open doc/output/index.html Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04doc: android: Add documentation for Android Boot ImageSam Protsenko1-0/+2
Describe Android Boot Image format, how its support is implemented in U-Boot and associated commands usage. Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04cmd: abootimg: Add abootimg commandSam Protsenko3-0/+267
This command can be used to extract fields and image payloads from Android Boot Image. It can be used for example to implement boot flow where dtb is taken from boot.img (as v2 incorporated dtb inside of boot.img). Using this command, one can obtain needed dtb blob from boot.img in scripting manner, and then apply needed dtbo's (from "dtbo" partition) on top of that, providing then the resulting image to bootm command in order to boot the Android. Also right now this command has the sub-command to get an address and size of recovery dtbo from recovery image (for non-A/B devices only, see [1,2] for details). It can be tested like this: => mmc dev 1 => part start mmc 1 boot_a boot_start => part size mmc 1 boot_a boot_size => mmc read $loadaddr $boot_start $boot_size => abootimg get ver => abootimg dump dtb [1] https://source.android.com/devices/bootloader/boot-image-header [2] https://source.android.com/devices/architecture/dto/partitions Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-30cmd/gpt: Address error cases during gpt rename more correctlyTom Rini1-35/+12
New analysis by the tool has shown that we have some cases where we weren't handling the error exit condition correctly. When we ran into the ENOMEM case we wouldn't exit the function and thus incorrect things could happen. Rework the unwinding such that we don't need a helper function now and free what we may have allocated. Fixes: 18030d04d25d ("GPT: fix memory leaks identified by Coverity") Reported-by: Coverity (CID: 275475, 275476) Cc: Alison Chaiken <alison@she-devel.com> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Cc: Jordy <jordy@simplyhacker.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-01-27Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-spiTom Rini1-4/+10
- spi cs accessing slaves (Bin Meng) - spi prevent overriding established bus (Marcin Wojtas) - support speed in spi command (Marek Vasut) - add W25N01GV spinand (Robert Marko) - move cadence_qspi to use spi-mem (Vignesh Raghavendra) - add octal mode (Vignesh Raghavendra)
2020-01-27pmic: allow dump command for non contiguous register mapsMartin Fuzzey1-2/+10
Some PMICs (such as the DA9063) have non-contiguous register maps. Attempting to read the non implemented registers returns an error rather than a dummy value which causes 'pmic dump' to terminate prematurely. Fix this by allowing the PMIC driver to return -ENODATA for such registers, which will then be displayed as '--' by pmic dump. Use a single error code rather than any error code so that we can distinguish between a hardware failure reading the PMIC and a non implemented register known to the driver. Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
2020-01-27cmd: sata: Add block unbind device functionPeng Ma1-0/+2
If we didn't unbind the sata from block device, the same devices would be added after sata remove, This patch is to resolve this issue as below: => sata info SATA#0: (3.0 Gbps) SATA#1: (3.0 Gbps) Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) => sata stop => sata info SATA#0: (3.0 Gbps) SATA#1: (3.0 Gbps) Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300 Type: Hard Disk Supports 48-bit addressing Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Signed-off-by: Peng Ma <peng.ma@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-27cmd: spi: Permit setting bus frequencyMarek Vasut1-4/+10
The 'sspi' command hard-coded 1 MHz bus frequency for all transmissions. Allow changing that at runtime by specifying '@freq' bus frequency in Hz. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-01-24cmd: mtd: solve bad block support in erase commandPatrick Delaunay1-12/+12
This patch modify the loop in mtd erase command to erase one by one the blocks in the requested area. It solves issue on "mtd erase" command on nand with existing bad block, the command is interrupted on the first bad block with the trace: "Skipping bad block at 0xffffffffffffffff" In MTD driver (nand/raw), when a bad block is present on the MTD device, the erase_op.fail_addr is not updated and we have the initial value MTD_FAIL_ADDR_UNKNOWN = (ULL)-1. This case seems normal in nand_base.c:nand_erase_nand(), we have the 2 exit cases during the loop: 1/ we have a bad block (nand_block_checkbad) instr->state = MTD_ERASE_FAILED loop interrupted (goto erase_exit) 2/ if block erase failed (status & NAND_STATUS_FAIL) instr->state = MTD_ERASE_FAILED; instr->fail_addr = ((loff_t)page << chip->page_shift); loop interrupted (goto erase_exit) So erase_op.fail_addr can't be used if bad blocks were present in the erased area; we need to use mtd_erase only one block to detect and skip these existing bad blocks (as it is done in nand_util.c). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2020-01-23zfs: remove unused buf variableJoel Johnson1-1/+0
Remove unused variable to silence compiler warning Signed-off-by: Joel Johnson <mrjoel@lixil.net>