07 Oct, 2017

1 commit


06 Oct, 2017

34 commits

  • A few of the big jobs are getting close to the time limit again, split a
    few more things out.

    Signed-off-by: Tom Rini

    Tom Rini
     
  • As reported by Coverity, we did not free dirnode in the case of failure.
    Do so now.

    Reported-by: Coverity (CID: 131221)
    Cc: Stefan Brüns
    Signed-off-by: Tom Rini

    Tom Rini
     
  • Coverity has found some problems with the return paths in parts of this
    code. We have a case where we were going to the wrong part of the
    unwind (open() failed so we cannot close the fd), a case where we were
    only free()ing our buf on the error path and finally a case where we did
    not munmap in the failure path.

    Reported-by: Coverity (CID: 138492, 138495, 143064)
    Signed-off-by: Tom Rini

    Tom Rini
     
  • We cannot leave this uninitialized, set it to 0.

    Reported-by: Coverity (CID: 144426)
    Signed-off-by: Tom Rini

    Tom Rini
     
  • For the initrd portion of handling our bootm arguments we do not have a
    sufficiently long enough buffer for some improbable 64bit cases. Expand
    this buffer to allow for a 64bit address and almost 256MB initrd to be
    used. Make use of strncpy/strncat when constructing the values here
    since we know what the worst case valid values are, length wise.

    Similarly for bootargs themselves, we need to make use of strlen/sizeof
    and strncpy/strncat to ensure that we don't overflow bootargs itself.

    Cc: Simon Glass
    Cc: Alexander Graf
    Reported-by: Coverity (CID: 131256)
    Signed-off-by: Tom Rini

    Tom Rini
     
  • When we have multiple messages provided, we need to be sure that we do
    not exceed the length of our 'message' buffer. In the for loop, make
    sure that pos is not larger than message. Only copy in at most however
    much of the message buffer remains. Finally, if we have not reached the
    end of the message buffer, put in a space and NULL, and if we have,
    ensure the buffer is now NULL termined.

    Reported-by: Coverity (CID: 165116)
    Signed-off-by: Tom Rini

    Tom Rini
     
  • Coverity scan has identified potential buffer overruns in these tests.
    Correct this by zeroing our buffer and using strncpy not strcpy.

    Reported-by: Coverity (CID: 155462, 155463)
    Cc: Joe Hershberger
    Cc: Simon Glass
    Cc: Bin Meng
    Signed-off-by: Tom Rini
    Reviewed-by: Simon Glass
    Reviewed-by: Joe Hershberger

    Tom Rini
     
  • With the overlay tests now being built in sandbox Coverity has found a
    number of issues in the tests. In short, if malloc ever failed we would
    leak the previous mallocs, so we need to do the usual goto pattern to
    free each in turn. Finally, we always looked at the free()d location to
    see how many tests had failed for the return code.

    Reported-by: Coverity (CID: 167224, 167227, 167230, 167236)
    Signed-off-by: Tom Rini

    Tom Rini
     
  • Create a common exit for most of the error handling code in
    do_rename_gpt_parts. Delete the list elements in disk_partitions
    before calling INIT_LIST_HEAD from get_gpt_info() a second time.

    The SIZEOF_MISMATCH error is not addressed, since that problem was
    already fixed by "GPT: incomplete initialization in
    allocate_disk_part".

    Signed-off-by: Alison Chaiken
    Reported-by: Coverity (CID: 167222, 167235, 167237)
    Reviewed-by: Tom Rini

    Alison Chaiken
     
  • The previous commit fixed a problem in FAT code where going back to the
    root directory using '..' wouldn't work correctly on FAT12 or FAT16.
    Add a test to exercise this case (which was once fixed in commit
    18a10d46f26 "fat: handle paths that include ../" but reintroduced due to
    the directory iterator refactoring).

    This test only very barely catches the problem - without the fix the
    size command still gives valid output but the additional spurious
    "Invalid FAT entry" error message makes it not get caught in the
    'egrep -A3 ' output. I tried to make a proper test that grows the root
    directory to two clusters lots of with dummy files but that causes the
    write tests to crash the sandbox totally...

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Tom Rini

    Tuomas Tynkkynen
     
  • If we end up back in the root directory via a '..' directory entry, set
    itr->is_root accordingly. Failing to do that gives spews like
    "Invalid FAT entry" and being unable to access directory entries located
    past the first cluster of the root directory.

    Fixes: 8eafae209c35 ("fat/fs: convert to directory iterators")
    Reviewed-by: Tom Rini
    Signed-off-by: Tuomas Tynkkynen

    Tuomas Tynkkynen
     
  • Currently we can only test FAT32 which is the default FAT version that
    mkfs.vfat creates by default. Instead make it explicitly create either a
    FAT16 or a FAT32 volume. This allows us to exercise more code, for
    instance the root directory handling is done differently in FAT32 than
    the older FATs.

    Adding FAT12 support is a much bigger job since the test creates a 2.5GB
    file and the FAT12 maximum partition size is way smaller than that.

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Tom Rini

    Tuomas Tynkkynen
     
  • The current code doesn't compute the group descriptor checksum correctly
    for the filesystems that e2fsprogs 1.43.4 creates (they have
    'Group descriptor size: 64' as reported by tune2fs). Extend the checksum
    calculation to be done as ext4_group_desc_csum() does in Linux.

    This fixes these errors in dmesg from running fs-test.sh and makes it
    succeed again:

    [1671902.620699] EXT4-fs (loop1): ext4_check_descriptors: Checksum for group 0 failed (35782!=10965)
    [1671902.620706] EXT4-fs (loop1): group descriptors corrupted!

    Signed-off-by: Tuomas Tynkkynen

    Tuomas Tynkkynen
     
  • The regulator bindings state that regulator prefixes are allowd to be
    in upper or lower case. However pmic_bind_children from pmic_uclass uses
    strncmp to compare DT node name against prefix. This comparison is case
    sensitive hence the regulator driver prefix case matters.

    Signed-off-by: Felix Brack

    Felix Brack
     
  • When eMMC was formattaed for Linux partition table, "userdata" partition
    is missing. In this case, part_get_info_by_name() iterates over all
    registered drivers (which are PART_TYPE_EFI, PART_TYPE_DOS and
    PART_TYPE_ISO). And when it comes to PART_TYPE_ISO (which has empty
    partition table), we can see next warning in U-Boot output:

    ** First descriptor is NOT a primary desc on 1:1 **

    This patch switches to part_get_info_by_name_type() API in order to
    check only EFI partitions for "userdata" partitions. This eliminates
    mentioned warning.

    Signed-off-by: Sam Protsenko
    Reviewed-by: Simon Glass

    Sam Protsenko
     
  • There is already existing function part_get_info_by_name().
    But sometimes user is particularly interested in looking for only
    specific partition type. This patch implements such an API that
    provides partition searching by name for specified partition type.

    Signed-off-by: Sam Protsenko
    Reviewed-by: Simon Glass

    Sam Protsenko
     
  • When using regular $partitions variable (for Linux boot), we can see
    some unwanted messages:

    > ERROR: cannot find partition: 'userdata'

    > at arch/arm/mach-omap2/utils.c:96/omap_mmc_get_part_size()
    > Warning: fastboot.userdata_size: unable to calc

    Let's remove those, as missing 'userdata' partition is correct behavior
    for Linux partition, and we don't want to see some Android-related
    messages in this case.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     
  • Note that this commit requires
    https://github.com/swarren/uboot-test-hooks/pull/14 to go in first.

    Signed-off-by: Tuomas Tynkkynen

    Tuomas Tynkkynen
     
  • This board builds an U-Boot binary that is bootable with QEMU's 'virt'
    machine on ARM. The minimal QEMU command line is:

    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin

    (Note that the 'highmem=off' parameter to the 'virt' machine is required for
    PCI to work in U-Boot.) This command line enables the following:
    - u-boot.bin loaded and executing in the emulated flash at address 0x0
    - A generated device tree blob placed at the start of RAM
    - A freely configurable amount of RAM, described by the DTB
    - A PL011 serial port, discoverable via the DTB
    - An ARMv7 architected timer
    - PSCI for rebooting the system
    - A generic ECAM-based PCI host controller, discoverable via the DTB

    Additionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus.
    The following ones are supported by both U-Boot and Linux:

    - To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
    - To add an Intel E1000 network adapter, pass e.g.:
    -net nic,model=e1000 -net user
    - To add an EHCI-compliant USB host controller, pass e.g.:
    -device usb-ehci,id=ehci
    - To add a NVMe disk, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo

    Signed-off-by: Tuomas Tynkkynen

    Tuomas Tynkkynen
     
  • QEMU emulates such a device with '-machine virt,highmem=off' on ARM.
    The 'highmem=off' part is required for things to work as the PCI code
    in U-Boot doesn't seem to support 64-bit BARs.

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Bin Meng

    Tuomas Tynkkynen
     
  • Use the new helpers to avoid boilerplate in the driver.

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Bin Meng

    Tuomas Tynkkynen
     
  • Use the new helper function to avoid boilerplate in the driver.

    Note that this changes __raw_writel et al. to writel. AFAICT this is
    no problem because:

    - The Linux driver for the same hardware uses the non-__raw variants as
    well (via pci_generic_config_write()).
    - This driver seems to be used only on MIPS so far, where the __raw and
    non-__raw accessors are the same.

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Bin Meng

    Tuomas Tynkkynen
     
  • This sort of pattern for implementing memory-mapped PCI config space
    accesses appears in U-Boot twice already, and a third user is coming up.
    So add helper functions to avoid code duplication, similar to how Linux
    has pci_generic_config_write and pci_generic_config_read.

    Signed-off-by: Tuomas Tynkkynen
    Reviewed-by: Bin Meng

    Tuomas Tynkkynen
     
  • In order to be able to select the right DTB, we need to have identified the
    board before spl_early_init() is called.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • u-boot can be embedded within a FIT image with multiple DTBs. It then
    selects at run-time which one is best suited for the platform.
    Use the same principle here for the SPL: put the DTBs in a FIT image,
    compress it (LZO, GZIP, or no compression) and append it at the end of the
    SPL.

    Signed-off-by: Jean-Jacques Hiblot
    [trini: Move default y of SPL_MULTI_DTB_FIT_DYN_ALLOC to it being the
    default choice if SYS_MALLOC_F, drop spl.h include from lib/fdtdec.c
    it's unused.]
    Signed-off-by Tom Rini

    Jean-Jacques Hiblot
     
  • Sort include files in accordance to U-Boot coding style.

    Signed-off-by: Jean-Jacques Hiblot

    Jean-Jacques Hiblot
     
  • Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • If board_fit_config_name_match() doesn't match any configuration node,
    then use the default one (if provided).

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • If the dtb is the first data of the FIT, the its offset is 0x0. Change the
    test to '
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • Those 2 functions don't modify their input, we can mark it const.
    This prevents compilation warnings when they are provided const input.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it
    MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing
    multiple DTBs. Also move the option to the Kconfig dedicated to the DTS
    options and create a README for this feature.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Jean-Jacques Hiblot
     
  • These macros are useful to avoid link error on 32-bit systems.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

05 Oct, 2017

5 commits