summaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2018-09-23efi_loader: buffer size for load optionsHeinrich Schuchardt
The number of bytes in an utf-8 string is an upper limit for the number of words in the equivalent utf-16 string. In so far the inumbant coding works correctly. For non-ASCII characters the utf-16 string is shorter. With the patch only the necessary buffer size is allocated for the load options. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi: sandbox: Tidy up copy_fdt() to work with sandboxSimon Glass
At present this function takes a pointer as its argument, then passes this to efi_allocate_pages(), which actually takes an address. It uses casts, which are not supported on sandbox. Also the function calculates the FDT size rounded up to the neared EFI page size, then its caller recalculates the size and adds a bit more to it. This function is much better written as something that works with addresses only, and returns both the address and the size of the relocated FDT. Also, copy_fdt() returns NULL on error, but really should propagate the error from efi_allocate_pages(). To do this it needs to return an efi_status_t, not a void *. Update the code in this way, so that it is easier to follow, and also supports sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23efi: Relocate FDT to 127MB instead of 128MBSimon Glass
Sandbox only has 128MB of memory so we cannot relocate the device tree up to start at 128MB. Use 127MB instead, which should be safe. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-19fix: cmd: mvebu: Exclude mvebu commands from SPL buildsKonstantin Porotchkin
Exclude mvebu commands from SPL builds Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
2018-09-11Merge tag 'fpga-for-v2018.11' of git://git.denx.de/u-boot-microblazeTom Rini
FPGA changes for v2018.11 - add fpga tests to cover fpga commands - fpga Kconfig cleanup - fix cmd/fpga.c - add support for missing fpga loadmk commands - add fpga fragment to MAINTAINERS
2018-09-11cmd: fpga: Fix loads commandMichal Simek
Convert last loads command to fpga subcommands. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Use CMD_RET_FAILURE instead of simple 1Michal Simek
Use standard return command failure macro. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Add support for missing fpga loadmk commandsMichal Simek
There are ways how to call fpga loadmk 1. Full command fpga loadmk [dev] [address] 2. Dev setup via variable set fpga [dev] fpga loadmk [address] 3. Address setup via variable set fpgadata [address] fpga loadmk [dev] 4. Dev and address setup via variables set fpga [dev] set fpgadata [address] fpga loadmk Before this patch only cases 1 and 3 are working but the part of code was trying to support also cases 2 and 4. This patch is adding support for cases 2 and 4 to have all of combinations supported. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Fix loadmk commandMichal Simek
Convert loadmk command to fpga subcommands. Not all combinations are working but they have never worked properly. This will be fixed later. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Fix loadfs commandMichal Simek
Convert loadfs command to fpga subcommands. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Fix dump and all direct fpga load commandsMichal Simek
Separate dump, load, loadb, loadp and loadbp commands to separate functions to make it clear how they are called and what parameters they need. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Extract fpga info command to separate functionMichal Simek
Move fpga info to U_BOOT_CMD_MKENT subcommand. Also use strtol instead of simple_strtoul. The reason is that if -1 is passed (or fpga info without "fpga" variable) the list of all fpgas is shown. This functionality is in the fpga core but it couldn't be performed. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Create new do_fpga_wrapper for using u-boot subcommandsMichal Simek
Create command wrapper to clean fpga subcommands. The function logic is taken from cmd_dm.c Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Clean wrong_parms handlingMichal Simek
There is no reason to check parameters in separate switch. Check them directly when they are read. Also there is no reason to check loadmk case separately because fpga_data address must be non zero too. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Remove parameter checking from fpga loadfs commandMichal Simek
Parameter checking is dead code because all the time there must be all params assigned. If they are not assigned there is no 9th parameters passed and checking before return CMD_RET_USAGE. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Move parameter checking for loadfs/loadsMichal Simek
There is no reason to check parameters in separate switch before main one. This patch is simplifying error path and checking parameters right after assignment. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Cleanup error handling in connection to FPGA_NONEMichal Simek
Incorrect command is already handled and FPGA_NONE should be used only one. In case of error CMD_RET_USAGE can be returned directly without any addition logic around. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Move fpga_get_op to avoid local function declarationMichal Simek
Move fpga_get_op() to top of file to remove local function declaration and also remove useless retyping. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Move error handling to do_fpga()Michal Simek
Clean fpga_get_op() error handling by moving checking/print to do_fpga. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-11cmd: fpga: Remove fit image support passed without fpga deviceMichal Simek
The patch applied in 2010 "cmd_fpga: cleanup help and check parameters" (sha1: a790b5b2326be9d7c9ad9e3d9b51a8bfabc62d07" was adding this checking + if (dev == FPGA_INVALID_DEVICE) { + puts("FPGA device not specified\n"); + op = FPGA_NONE; + } which simply broke one command flow which was setenv fpga <dev> fpga loadmk <addr> // legacy image fpga loadmk <addr>:<fit_image_name> //fit image Also this sequence for FIT image is completely broken setenv fpga <dev> setenv fpgadata <addr>:<fit_image_name> fpga loadmk (Note: For legacy images this is working fine). even from code I don't think this has ever worked properly for fit image (dev = FPGA_INVALID_DEVICE should be rejected by fpga core). Fit image support was in 2008 added by: "[new uImage] Add new uImage fromat support to fpga command" (sha1: c28c4d193dbfb20b2dd3a5447640fd6de7fd0720) Just a summary of these facts that none found this for pretty long time it shouldn't be a problem to remove this flow (without fpga dev) completely to simplify the code. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-10cmd: part: use MAX_SEARCH_PARTITIONS for part searchKever Yang
Use Macro instead of hard code. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-09-10Remove <inttypes.h> includes and PRI* usages in printf() entirelyMasahiro Yamada
In int-ll64.h, we always use the following typedefs: typedef unsigned int u32; typedef unsigned long uintptr_t; typedef unsigned long long u64; This does not need to match to the compiler's <inttypes.h>. Do not include it. The use of PRI* makes the code super-ugly. You can simply use "l" for printing uintptr_t, "ll" for u64, and no modifier for u32. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-26cmd: ubi: change 'default y' for SUNXI to 'imply' in KconfigMasahiro Yamada
It is not preferred to put SUNXI-specific code in the common place. Change it to 'imply' property of ARCH_SUNXI. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-24Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini
2018-08-24u-boot: align cache flushes in load_elf_image_shdr to line boundariesNeil Stainton
Prevent cache warning messages when using the 'bootelf' command on an Arm target. Round down each section start address and round up the respective section end to the nearest cache line. Currently when using bootelf to load an image on Arm, several warnings such as the following appear in the console: CACHE: Misaligned operation at range [87800000, 8783c5e0] CACHE: Misaligned operation at range [8783c5e0, 8784b3e0] Signed-off-by: Neil Stainton <nstainton@asl-control.co.uk> [trini: Reword commit message to include the info after the --- which included the Signed-off-by line, and change ' at ' to '@'] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-08-21Merge tag 'signed-efi-2018.09' of git://github.com/agraf/u-bootTom Rini
Patch queue for efi - 2018-08-21 A few fixes for 2018.09. Most noticable are: - unbreak x86 target (-fdata-section fallout) - fix undefined behavior in a few corner cases - make Jetson TX1 boot again - RTS fixes - implement reset for simple output
2018-08-21cmd: Add bind/unbind commands to bind a device to a driver from the command lineJean-Jacques Hiblot
In some cases it can be useful to be able to bind a device to a driver from the command line. The obvious example is for versatile devices such as USB gadget. Another use case is when the devices are not yet ready at startup and require some setup before the drivers are bound (ex: FPGA which bitsream is fetched from a mass storage or ethernet) usage example: bind usb_dev_generic 0 usb_ether unbind usb_dev_generic 0 usb_ether or unbind eth 1 bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether unbind /ocp/omap_dwc3@48380000/usb@48390000 Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-08-21cmd: fastboot: Validate user inputSam Protsenko
In case when user provides '-' as USB controller index, like this: => fastboot - data abort occurs in strcmp() function in do_fastboot(), here: if (!strcmp(argv[1], "udp")) (tested on BeagleBone Black). That's because argv[1] is NULL when user types in the '-', and null pointer dereference occurs in strcmp() (which is ok according to C standard specification). So we must validate user input to prevent such behavior. While at it, check also the result of strtoul() function and handle error cases properly. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-08-21cmd: efi: Clarify calculation precedence for '&' and '?'Eugeniu Rosca
Fix cppcheck complaint: [cmd/efi.c:173]: (style) Clarify calculation precedence for '&' and '?'. Fixes: f1a0bafb5802 ("efi: Add a command to display the memory map") Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-08-21efi: Add EFI_MEMORY_{NV, MORE_RELIABLE, RO} attributesEugeniu Rosca
With this update, the memory attributes are in sync with Linux kernel v4.18-rc4. They also match page 190 of UEFI 2.7 spec [1]. [1] http://www.uefi.org/sites/default/files/resources/UEFI_Spec_2_7.pdf Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-08-21efi: Fix truncation of constant valueEugeniu Rosca
Starting with commit 867a6ac86dd8 ("efi: Add start-up library code"), sparse constantly complains about truncated constant value in efi.h: include/efi.h:176:35: warning: cast truncates bits from constant value (8000000000000000 becomes 0) This can get quite noisy, preventing real issues to be noticed: $ make defconfig *** Default configuration is based on 'sandbox_defconfig' $ make C=2 -j12 2>&1 | grep truncates | wc -l 441 After the patch is applied: $ make C=2 -j12 2>&1 | grep truncates | wc -l 0 $ sparse --version v0.5.2 Following the suggestion of Heinrich Schuchardt, instead of only fixing the root-cause, I replaced the whole enum of _SHIFT values by ULL defines. This matches both the UEFI 2.7 spec and the Linux kernel implementation. Some ELF size comparison before and after the patch (gcc 7.3.0): efi-x86_payload64_defconfig: text data bss dec hex filename 407174 29432 278676 715282 aea12 u-boot.old 407152 29464 278676 715292 aea1c u-boot.new -22 +32 0 +10 efi-x86_payload32_defconfig: text data bss dec hex filename 447075 30308 280076 757459 b8ed3 u-boot.old 447053 30340 280076 757469 b8edd u-boot.new -22 +32 0 +10 Fixes: 867a6ac86dd8 ("efi: Add start-up library code") Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-08-20cmd: Add dtimg commandSam Protsenko
dtimg command allows user to work with Android DTB/DTBO image format. Such as, getting the address of desired DTB/DTBO file, printing the dump of the image in U-Boot shell, etc. This command is needed to provide Android boot with new Android DT image format further. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-08-17Convert CONFIG_MII et al to KconfigAdam Ford
This converts the following to Kconfig: CONFIG_MII CONFIG_DRIVER_TI_EMAC Signed-off-by: Adam Ford <aford173@gmail.com> Acked-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-08-11Merge branch 'master' of git://git.denx.de/u-boot-videoTom Rini
2018-08-11cmd: Add axi commandMario Six
Add a command to debug the AXI bus. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-08-10elf: Add support for PPC64 ELF V1 ABI in bootelfRob Bracero
This update adds PPC64 ELF V1 ABI support to bootelf for both the program header and section header options. Elf64 support was already present for the program header option, but it was not handling the PPC64 ELF V1 ABI case. For the PPC64 ELF V1 ABI, the e_entry field of the elf header must be treated as function descriptor pointer instead of a function address. The first doubleword of the function descriptor is the function's entry address. Signed-off-by: Rob Bracero <robbracero@gmail.com> [trini: Fix whitespace issues] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-08-10sata: fix sata_Probe return value checkTroy Kisky
sata_probe returns 1 for failure, so don't checkout for < 0 fixes: f19f1ecb6025 dm: sata: Support driver model with the 'sata' command Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-30Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini
Patch queue for efi - 2018-07-25 Highlights this time: - Many small fixes to improve spec compatibility (found by SCT) - Almost enough to run with sandbox target - GetTime() improvements - Enable EFI_LOADER and HYP entry on ARMv7 with NONSEC=y
2018-07-30tpmv2: Make it select CMD_LOGTom Rini
The TPMv2 code requires the log functionality, so select it. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-30dm: Change CMD_DM enablingMichal Simek
CMD_DM is used for debug purpose and it shouldn't be enabled by default via Kconfig. Unfortunately this is in the tree for quite a long time that's why solution is to use imply DM for all targets which are enabling DM. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-07-30Kconfig: Sort bool, default, select and imply optionsMichal Simek
Fix Kconfig bool, default, select and imply options to be alphabetically sorted. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-30Kconfig: Replace spaces with tabs and missing newlineMichal Simek
Trivial Kconfig cleanup. Use tabs instead of spaces and every Kconfig entry should be separated by newline. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-07-28tpm: allow TPM v1 and v2 to be compiled at the same timeMiquel Raynal
While there is probably no reason to do so in a real life situation, it will allow to compile test both stacks with the same sandbox defconfig. As we cannot define two 'tpm' commands at the same time, the command for TPM v1 is still called 'tpm' and the one for TPM v2 'tpm2'. While this is the exact command name that must be written into eg. test files, any user already using the TPM v2 stack can continue to do so by just writing 'tpm' because as long as TPM v1 support is not compiled, U-Boot prompt will search for the closest command named after 'tpm'. The command set can also be changed at runtime (not supported yet, but ready to be), but as one can compile only either one stack or the other, there is still one spot in the code where conditionals are used: to retrieve the v1 or v2 command set. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: In sandbox_tpm2_fill_buf() use NULL not \0 to ensure NULL terminated string due to LLVM warning] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-26Merge branch 'master' of git://git.denx.de/u-boot-netTom Rini
2018-07-26net: Read bootfile from env on netboot_common()Joe Hershberger
Instead of depending on a env callback for bootfile, read it explicitly. We do this because the bootfile can be specified on the command line and if it is, we will overwrite the internal variable. If a netboot_common() is called again with no bootfile parameter, we want to use the one in the environment. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2018-07-26cmd/ubi.c: Fix format warningTom Rini
On 64bit platforms we would otherwise see: ../cmd/ubi.c: In function 'ubi_volume_read': ../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=] Fixes: 68c7025d99db ("cmd: ubi: print load size after establishing volume size") Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-25efi_loader: remove unused efi_get_time_init()Heinrich Schuchardt
Remove unused function efi_get_time_init(). Initialization of the RTC has to be done in board bring up not in the EFI subsystem. There is no RTC device in the UEFI spec. The RTC is only accessed through the runtime services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-07-25efi_loader: calculate crc32 for EFI tablesHeinrich Schuchardt
For the boot and runtime services tables and for the system table the crc32 has to be set in the header. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-07-25efi: Drop error return in efi_carve_out_dt_rsv()Simon Glass
This function currently returns an error code, but never uses it. There is no function comment so it is not obvious why. Presuambly the error is not important. Update the function to explain its purpose and why it ignores the error. Drop the useful error return value. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-07-25efi: Tidy up device-tree-size calculation in copy_fdt()Simon Glass
This is a bit confusing at present since it adds 4KB to the pointer, then rounds it up. It looks like a bug, but is not. Move the 4KB addition into a separate statement and expand the comment. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>