18 Mar, 2020

1 commit

  • Some config symbols are found in *almost* every _defconfig file for
    Allwinner boards, because those options are actually a platform choice,
    and not a per-board decision.
    Some of these options are older, some have recently been added.

    Move those options to be set for all Allwinner boards in their
    respective Kconfig files.

    The rationales are as follows:
    - NR_DRAM_BANKS: All Allwinner SoC map DRAM at one contiguous region of
    address space only, starting at 1 GB. So it's always one bank.
    - SPL_{DOS,EFI}_PARTITION: The Allwinner SPL does only support raw MMC
    accesses, we don't care about filesystems or partitions in there, so
    there is no need to define those symbols at all.
    - USE_PREBOOT: We start USB early when a keyboard is configured, using the
    preboot env variable, so we need to set this variable.
    - SYS_RELOC_GD_ENV_ADDR: We don't specify any ENV_ADDR, so need this
    symbol to be set (according to 8d8ee47e03e).
    - SYS_USB_EVENT_POLL_VIA_INT_QUEUE: According to commit eab9433aa55428,
    specifying this reduces the latency of the USB keyboard handling, so
    this was formerly enabled in config headers for all Allwinner boards.

    Signed-off-by: Andre Przywara
    Acked-by: Maxime Ripard
    Tested-by: Jagan Teki # Amarula A64-Relic
    Reviewed-by: Jagan Teki

    Andre Przywara
     

23 Jan, 2020

1 commit


03 Dec, 2019

1 commit


31 Oct, 2019

1 commit

  • The signature 0x55 0xAA in bytes 510 and 511 of the first sector can either
    indicate a DOS partition table of the first sector of a FAT file system.

    The current code tries to check if the partition table is valid by looking
    at the boot indicator of the partition entries. But first of all it does
    not count from 0 to 3 but only from 0 to 2. And second it misses to
    increment the pointer for the partition entry.

    If it is a FAT file system can be discovered by looking for the text 'FAT'
    at offset 0x36 or 'FAT32' at offset 0x52. In a DOS PBR there are no
    partition entries, so those bytes are undefined. Don't require the byte at
    offset 0x1BE to differ from 0x00 and 0x80.

    With the patch the logic is changed as follows:

    If the partition table has either an invalid boot flag for any partition or
    has no partition at all, check if the first sector is a DOS PBR by looking
    at the FAT* signature.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

20 Sep, 2019

1 commit


23 Aug, 2019

2 commits


12 Aug, 2019

1 commit


25 Jul, 2019

1 commit

  • This patch adds part_get_info_by_dev_and_name_or_num() function which
    allows us to get partition info from its number or name. Partition of
    interest is specified by string like "device_num:partition_number" or
    "device_num#partition_name".

    The patch was extracted from [1].

    [1] https://android-review.googlesource.com/c/platform/external/u-boot/+/729880/2

    Signed-off-by: Ruslan Trofymenko
    Signed-off-by: Igor Opaniuk
    Reviewed-by: Alistair Strachan
    Reviewed-by: Sam Protsenko
    Reviewed-by: Simon Glass

    Ruslan Trofymenko
     

24 Jul, 2019

1 commit


18 Jul, 2019

1 commit


17 Jul, 2019

1 commit

  • When building with GCC 9.1 an error occurs:

    disk/part_efi.c: In function ‘gpt_verify_partitions’:
    disk/part_efi.c:737:49: error: taking address of packed member of
    ‘struct _gpt_entry’ may result in an unaligned pointer value
    [-Werror=address-of-packed-member]
    737 | gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
    | ~~~~~~~~^~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[1]: *** [scripts/Makefile.build:279: disk/part_efi.o] Error 1
    make: *** [Makefile:1594: disk] Error 2

    Adjust gpt_convert_efi_name_to_char() to accept unaligned strings.

    Reported-by: Ramon Fried
    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

07 Jul, 2019

1 commit


21 Jun, 2019

1 commit

  • blk_get_device_by_str was skipping part_init when hw partition 0 was
    selected because it is the default. However, this caused issues when
    switching to a non-zero partition and then back to partition zero, as
    stale data from the wrong partition was returned.

    Remove this optimization and call part_init regardless of the selected
    partition.

    Signed-off-by: Robert Hancock

    Robert Hancock
     

15 Jun, 2019

1 commit


03 May, 2019

2 commits

  • Below is what happens on R-Car H3ULCB-KF using clean U-Boot
    v2019.04-00810-g6aebc0d11a10 and r8a7795_ulcb_defconfig:

    => ### interrupt autoboot
    => gpt verify mmc 1
    No partition list provided - only basic check
    Verify GPT: success!
    => ### keep calling 'gpt verify mmc 1'
    => ### on 58th call, we are out of memory:
    => gpt verify mmc 1
    alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries
    GPT: Failed to allocate memory for PTE
    gpt_verify_headers: *** ERROR: Invalid Backup GPT ***
    Verify GPT: error!

    This is caused by calling is_gpt_valid() twice (hence allocating pte
    also twice via alloc_read_gpt_entries()) while freeing pte only _once_
    in the caller of gpt_verify_headers(). Fix that by freeing the pte
    allocated and populated for primary GPT _before_ allocating and
    populating the pte for backup GPT. The latter will be freed by the
    caller of gpt_verify_headers().

    With the fix applied, the reproduction scenario [1-2] has been run
    hundreds of times in a loop w/o running into OOM.

    [1] gpt verify mmc 1
    [2] gpt verify mmc 1 $partitions

    Fixes: cef68bf9042dda ("gpt: part: Definition and declaration of GPT verification functions")
    Signed-off-by: Eugeniu Rosca
    Reviewed-by: Heinrich Schuchardt

    Eugeniu Rosca
     
  • Below is what happens on R-Car H3ULCB-KF using clean U-Boot
    v2019.04-00810-g6aebc0d11a10 and r8a7795_ulcb_defconfig:

    => ### interrupt autoboot
    => gpt guid mmc 1
    21200400-0804-0146-9dcc-a8c51255994f
    success!
    => ### keep calling 'gpt guid mmc 1'
    => ### on 59th call, we are out of memory:
    => gpt guid mmc 1
    alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries
    GPT: Failed to allocate memory for PTE
    get_disk_guid: *** ERROR: Invalid GPT ***
    alloc_read_gpt_entries: ERROR: Can't allocate 0X4000 bytes for GPT Entries
    GPT: Failed to allocate memory for PTE
    get_disk_guid: *** ERROR: Invalid Backup GPT ***
    error!

    After some inspection, it looks like get_disk_guid(), added via v2017.09
    commit 73d6d18b7147c9 ("GPT: add accessor function for disk GUID"),
    unlike other callers of is_gpt_valid(), doesn't free the memory pointed
    out by 'gpt_entry *gpt_pte'. The latter is allocated by is_gpt_valid()
    via alloc_read_gpt_entries().

    With the fix applied, the reproduction scenario has been run hundreds
    of times ('while true; do gpt guid mmc 1; done') w/o running into OOM.

    Fixes: 73d6d18b7147c9 ("GPT: add accessor function for disk GUID")
    Signed-off-by: Eugeniu Rosca
    Reviewed-by: Heinrich Schuchardt

    Eugeniu Rosca
     

27 Apr, 2019

1 commit


18 Jan, 2019

1 commit


15 Nov, 2018

1 commit


09 Oct, 2018

1 commit


11 Sep, 2018

1 commit

  • 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 .
    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

    Masahiro Yamada
     

11 Aug, 2018

1 commit

  • Underlying API should already print some meaningful error message, so
    this one is just brings more noise. E.g. we can see log like this:

    MMC: no card present
    ** Bad device mmc 0 **

    Obviously, second error message is unwanted. Let's only print it in case
    when DEBUG is defined to keep log short and clear.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     

14 Jun, 2018

1 commit

  • When building with -pedantic the current definition of EFI_GUID() causes
    an error 'initializer element is not constant'.

    Currently EFI_GUID() is used both as an anonymous constant and as an
    intializer. A conversion to efi_guid_t is not allowable when using
    EFI_GUID() as an initializer. But it is needed when using it as an
    anonymous constant.

    We should not use EFI_GUID() for anything but an initializer. So let's
    introduce a variable where needed and remove the conversion.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     

05 Jun, 2018

1 commit

  • In commit e163a931af34 ("cmd: gpt: backup boot code before writing MBR")
    there was added the procedure for storing old boot code when doing "gpt
    write". But instead of storing just backup code, the whole MBR was
    stored, and only specific fields were replaced further, keeping
    everything else intact. That's obviously not what we want.

    Fix the code to actually store only old boot code and zero out
    everything else. This fixes next testing case:

    => mmc write $loadaddr 0x0 0x7b
    => gpt write mmc 1 $partitions

    In case when $loadaddr address and further memory contains 0xff, the
    board was bricked (ROM-code probably didn't like partition entries that
    were clobbered with 0xff). With this patch applied, commands above don't
    brick the board.

    Signed-off-by: Sam Protsenko
    Cc: Alejandro Hernandez
    Tested-by: Andy Shevchenko

    Sam Protsenko
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

29 Apr, 2018

1 commit

  • If SPL serial support is disabled nothing brings in sprintf, snprintf
    or simple_strtoul:

    env/built-in.o: In function `regex_callback':
    env/attr.c:128: undefined reference to `sprintf'
    disk/built-in.o: In function `blk_get_device_by_str':
    disk/part.c:386: undefined reference to `simple_strtoul'
    disk/part.c:395: undefined reference to `simple_strtoul'
    disk/built-in.o: In function `blk_get_device_part_str':
    disk/part.c:522: undefined reference to `simple_strtoul'
    disk/built-in.o: In function `part_set_generic_name':
    disk/part.c:704: undefined reference to `sprintf'
    drivers/built-in.o: In function `init_peripheral_ep':
    drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
    drivers/built-in.o: In function `musb_core_init':
    drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'

    Add those dependencies here.

    Signed-off-by: Alex Kiernan

    Alex Kiernan
     

28 Apr, 2018

1 commit


17 Apr, 2018

1 commit

  • We enabled CONFIG_ISO_PARTITION by default for distro boot, so that U-Boot
    could load distro images that usually get shipped as iso images. These images
    usually come with a board agnostic boot environment.

    However, there is very little point in having ISO support enabled (for anyone
    really) in SPL, as the whole idea of SPL is to load U-Boot proper which again
    is board specific. So the fact that we enable ISO support in U-Boot proper does
    not mean at all that we want ISO support in U-Boot SPL.

    Hence, let's remove the Kconfig dependency. Along the way, let's also clean up
    all those default configs that disabled SPL ISO support.

    Signed-off-by: Alexander Graf

    Alexander Graf
     

14 Mar, 2018

2 commits


09 Feb, 2018

2 commits

  • config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE
    based on a list of enabled options. Moving HAVE_BLOCK_DEVICE to
    Kconfig allows us to drastically shrink the logic in
    config_fallbacks.h

    Signed-off-by: Adam Ford
    [trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE]
    Signed-off-by: Tom Rini

    Adam Ford
     
  • config_fallback.h has some logic that checks a variety of options
    and selects LIB_UUID if it hasn't already been selected. This
    will all LIB_UUID in Kconfig and select this option for the list
    of options to allow us to remove the logic from fallbacks

    Signed-off-by: Adam Ford

    Adam Ford
     

08 Feb, 2018

1 commit

  • Commit ff98cb90514d ("part: extract MBR signature from partitions")
    blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from
    "unsigned char" to "legacy_mbr" which caused allocation of size =
    (typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough
    for "legacy_mbr" structure.

    Signed-off-by: Alexey Brodkin
    Cc: Rob Clark
    Cc: Peter Jones
    Cc: Alexander Graf
    Cc: Tom Rini

    Alexey Brodkin
     

19 Dec, 2017

1 commit


07 Dec, 2017

2 commits


30 Nov, 2017

1 commit


06 Nov, 2017

2 commits

  • The check in part_get_info_extended() for a successful partition
    searching misses a condition for extended partition. In case of
    (ext_part_sector == 0), we should anyway mark the partition as found,
    even if it's an extended partition, i.e. (is_extended(pt->sys_ind) == 0).
    Otherwise, the extended partition (type 0x0f) will never be identified,
    and the following recursive call to part_get_info_extended() will get a
    wrong 'part_num' and 'which_part' parameter. In the end, all those
    partitions in extended table will not be identified.

    Let's add the missing OR condition of (ext_part_sector == 0) for
    is_extended() check to fix the problem.

    The issue is discovered by running fastboot flash to an extended
    partition on eMMC.

    $ fastboot flash mmcsda5 cache.img
    target reported max download size of 536870912 bytes
    sending 'mmcsda5' (18796 KB)...
    OKAY [ 2.144s]
    writing 'mmcsda5'...
    FAILED (remote: cannot find partition)
    finished. total time: 2.261s

    Signed-off-by: Shawn Guo

    Shawn Guo
     
  • Before this patch one could receive following errors when executing
    "gpt write" command on machine with cache enabled:

    display5 factory > gpt write mmc ${mmcdev} ${partitions}
    Writing GPT:
    CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0]
    CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8]
    CACHE: Misaligned operation at range [4ef8f9f8, 4ef939f8]
    CACHE: Misaligned operation at range [4ef8f7f0, 4ef8f9f0]
    success!

    To alleviate this problem - the calloc()s have been replaced with
    malloc_cache_aligned() and memset().

    After those changes the buffers are properly aligned (with both start
    address and size) to SoC cache line.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski