09 Feb, 2018

1 commit

  • 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
     

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
     

06 Nov, 2017

1 commit

  • 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
     

05 Oct, 2017

1 commit

  • Since commit ff98cb90514d ("part: extract MBR signature from partitions")
    SPL boot on i.MX6 starts to fail:

    U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19)
    Trying to boot from MMC1
    (keep in loop)

    Use the original allocation scheme for the SPL case, so that MX6 boards
    can boot again.

    This is a temporary solution to avoid the boot regression.

    Signed-off-by: Fabio Estevam
    Acked-by: Rob Clark
    Tested-by: Peter Robinson

    Fabio Estevam
     

20 Sep, 2017

1 commit

  • EFI client programs need the signature information from the partition
    table to determine the disk a partition is on, so we need to fill that
    in here.

    Signed-off-by: Peter Jones
    [separated from efi_loader part, and fixed build-errors for non-
    CONFIG_EFI_PARTITION case]
    Signed-off-by: Rob Clark
    Signed-off-by: Alexander Graf

    Peter Jones
     

19 Sep, 2017

1 commit

  • The UEFI spec allows an EFI system partition (ESP, with the bootloader or
    kernel EFI apps on it) to reside on a disk using a "legacy" MBR
    partitioning scheme.
    But in contrast to actual legacy disks the ESP is not marked as
    "bootable" using bit 7 in byte 0 of the legacy partition entry, but is
    instead using partition *type* 0xef (in contrast to 0x0b or 0x0c for a
    normal FAT partition). The EFI spec isn't 100% clear on this, but it even
    seems to discourage the use of the bootable flag for ESPs.
    Also it seems that some EFI implementations (EDK2?) even seem to ignore
    partitions marked as bootable (probably since they believe they contain
    legacy boot code).
    The Debian installer [1] (*not* mini.iso), for instance, contains such an
    MBR, where none of the two partitions are marked bootable, but the ESP
    has clearly type 0xef.
    Now U-Boot cannot find the ESP on such a disk (USB flash drive) and
    fails to load the EFI grub and thus the installer.

    Since it all boils down to the distro bootcmds eventually calling
    "part list -bootable" to find potential boot partitions, it seems logical
    to just add this "partition type is 0xef" condition to the is_bootable()
    implementation.

    This allows the bog standard arm64 Debian-testing installer to boot from
    an USB pen drive on Allwinner A64 boards (Pine64, BananaPi-M64).
    (Ubuntu and other distribution installers don't have a legacy MBR, so
    U-Boot falls back to El Torito there).

    [1] https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/arm64/iso-cd/
    Signed-off-by: Andre Przywara
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Andre Przywara
     

18 Feb, 2017

1 commit

  • the socfpga bootrom supports mmc booting from either a raw image
    starting at 0x0, or from a partition of type 0xa2. This patch
    adds support for locating the boot image in the first type 0xa2
    partition found.

    Assigned a partition number of -1 will cause a search for a
    partition of type CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
    and use it to find the u-boot image

    Signed-off-by: Dalon Westergreen

    Dalon Westergreen
     

28 Jan, 2017

1 commit


02 Oct, 2016

3 commits

  • In both DOS and ISO partition tables the same code to create partition name
    like "hda1" was repeated.

    Code moved to into a new function part_set_generic_name() in part.c and optimized.
    Added recognition of MMC and SD types, name is like "mmcsda1".

    Signed-off-by: Petr Kulhavy
    Reviewed-by: Tom Rini
    Acked-by: Steve Rae
    Reviewed-by: Simon Glass

    Petr Kulhavy
     
  • Add special target "mbr" (otherwise configurable via CONFIG_FASTBOOT_MBR_NAME)
    to write MBR partition table.
    Partitions are now searched using the generic function which finds any
    partiiton by name. For MBR the partition names hda1, sda1, etc. are used.

    Signed-off-by: Petr Kulhavy
    Reviewed-by: Tom Rini
    Acked-by: Steve Rae
    Reviewed-by: Simon Glass

    Petr Kulhavy
     
  • So far partition search by name has been supported only on the EFI partition
    table. This patch extends the search to all partition tables.

    Rename part_get_info_efi_by_name() to part_get_info_by_name(), move it from
    part_efi.c into part.c and make it a generic function which traverses all part
    drivers and searches all partitions (in the order given by the linked list).

    For this a new variable struct part_driver.max_entries is added, which limits
    the number of partitions searched. For EFI this was GPT_ENTRY_NUMBERS.
    Similarly the limit is defined for DOS, ISO, MAC and AMIGA partition tables.

    Signed-off-by: Petr Kulhavy
    Reviewed-by: Tom Rini
    Acked-by: Steve Rae

    Petr Kulhavy
     

15 Mar, 2016

6 commits

  • Rename these functions so that part_ is at the start. This more clearly
    identifies these functions as partition functions.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • To ease conversion to driver model, add helper functions which deal with
    calling each block device method. With driver model we can reimplement these
    functions with the same arguments.

    Use inline functions to avoid increasing code size on some boards.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     
  • This is a device number, and we want to use 'dev' to mean a driver model
    device. Rename the member.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     
  • Rename three partition functions so that they start with part_. This makes
    it clear what they relate to.

    Signed-off-by: Simon Glass
    Tested-by: Stephen Warren

    Simon Glass
     
  • We can use linker lists instead of explicitly declaring each function.
    This makes the code shorter by avoiding switch() statements and lots of
    header file declarations.

    While this does clean up the code it introduces a few code issues with SPL.
    SPL never needs to print partition information since this all happens from
    commands. SPL mostly doesn't need to obtain information about a partition
    either, except in a few cases. Add these cases so that the code will be
    dropped from each partition driver when not needed. This avoids code bloat.

    I think this is still a win, since it is not a bad thing to be explicit
    about which features are used in SPL. But others may like to weigh in.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini
    Tested-by: Stephen Warren

    Simon Glass
     
  • Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
    and causes 80-column violations, rename it to struct blk_desc.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     

15 Jan, 2016

1 commit


14 Jan, 2016

2 commits


12 Sep, 2015

1 commit


12 Jun, 2014

1 commit

  • Bug: SDCard with a messed up partition but still has a FAT signature
    intact is readable in Linux but unreadable in uboot with 'fatls'.

    Fix: When partition info checking fails, there is no checking for a
    FAT signature (DOS_PBR) which will fail 'fatls'. FAT signature checking
    is done when no valid partition is found in partition table. If FAT
    signature is found, the disk will be read as PBR and continue
    processing.

    Signed-off-by: Darwin Dingel

    Darwin Dingel
     

06 Jun, 2014

1 commit

  • - update the comments regarding lbaint_t usage
    - cleanup casting of values related to the lbaint_t type
    - cleanup of a type that requires a u64

    Tested on little endian ARMv7 and ARMv8 configurations

    Signed-off-by: Steve Rae

    Steve Rae
     

24 Jul, 2013

1 commit


02 May, 2013

1 commit

  • Devices that used to have a whole disk FAT filesystem but got then
    partitioned will most likely still have a FAT or FAT32 signature
    in the first sector as this sector does not get overwritten by
    a partitioning tool (otherwise the tool would risk to kill the mbr).

    The current partition search algorithm will erronously detects such
    a device as a raw FAT device.

    Instead of looking for the FAT or FAT32 signatures immediately we
    use the same algorithm as used by the Linux kernel and first check
    for a valid boot indicator flag on each of the 4 partitions.
    If the value of this flag is invalid for the first entry we then
    do the raw partition check.
    If the flag for any higher partition is wrong we assume the device
    is neiter a MBR nor PBR device.

    Signed-off-by: Egbert Eich

    Egbert Eich
     

15 Mar, 2013

1 commit


17 Oct, 2012

2 commits


09 Oct, 2012

1 commit

  • Logically, a disk that contains a raw FAT filesystem does not in fact
    have a partition table. However, test_part_dos() was claiming that such
    disks did in fact have a DOS-style partition table. This caused
    get_device_and_partition() not to return a whole-disk disk_partition_t,
    since part_type != PART_TYPE_UNKNOWN.

    part_dos.c's print_partition_extended() detected the raw FAT filesystem
    condition and printed a fake partition table that encompassed the whole
    disk.

    However, part_dos.c's get_partition_info_extended() did not return any
    valid partitions in this case. This combination caused
    get_device_and_partition() not to find any valid partitions, and hence
    to return an error.

    Fix test_part_dos() not to claim that raw FAT filesystems are DOS
    partition tables. In turn, this causes get_device_and_partition() to
    return a whole-disk disk_partition_t, and hence the following commands
    work:

    fatls mmc 0 /
    fatls mmc 0:auto /

    An alternative would be to modify print_partition_extended() to detect
    raw FAT filesystems, just like print_partition_extended() does, and to
    return a fake partition in this case. However, this seems logically
    incorrect, and also duplicates code, since get_device_and_partition()
    falls back to returning a whole-disk partition when there is no partition
    table on the device.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

26 Sep, 2012

2 commits


22 Jun, 2012

1 commit


30 Apr, 2012

1 commit


28 Jul, 2011

1 commit


25 Jul, 2010

1 commit


19 Oct, 2009

1 commit


10 Aug, 2009

1 commit


04 Apr, 2009

1 commit

  • Mflash is fusion memory device mainly targeted consumer eletronic and
    mobile phone.
    Internally, it have nand flash and other hardware logics and supports
    some different operation (ATA, IO, XIP) modes.

    IO mode is custom mode for the host that doesn't have IDE interface.
    (Many mobile targeted SoC doesn't have IDE bus)

    This driver support mflash IO mode.

    Followings are brief descriptions about IO mode.

    1. IO mode based on ATA protocol and uses some custom command. (read
    confirm, write confirm)
    2. IO mode uses SRAM bus interface.

    Signed-off-by: unsik Kim

    unsik Kim
     

18 Feb, 2009

1 commit


27 Mar, 2008

1 commit