02 May, 2013

3 commits

  • For ISO we check the block size of the device if this is != the CD sector
    size we assume that the device has no ISO partition.

    Signed-off-by: Egbert Eich

    Egbert Eich
     
  • Disks beyond 2T in size use blocksizes of 4096 bytes. However a lot of
    code in u-boot still assumes a 512 byte blocksize.
    This patch fixes the handling of GPTs.

    Signed-off-by: Egbert Eich

    Egbert Eich
     
  • 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
     

03 Apr, 2013

1 commit


15 Mar, 2013

1 commit


05 Mar, 2013

1 commit


14 Dec, 2012

3 commits


07 Dec, 2012

1 commit

  • In order to calculate the capability, we use the below expression to check:
    ((dev_desc->lba * dev_desc->blksz)>0L)
    If the capability is greater than 4GB (e.g. 8GB = 8 * 1024 * 104 * 1024),
    the result will overflow, the low 32bit may be zero.

    Therefore, change to check each variable to fix this potential issue.

    Signed-off-by: Jerry Huang

    Jerry Huang
     

22 Oct, 2012

2 commits

  • This change addresses a few printf-formatting errors, and a typecast
    error.

    Signed-off-by: Taylor Hutt
    Signed-off-by: Simon Glass

    Taylor Hutt
     
  • Currently, if the disk partition code is compiled with all of the parition
    types compiled out, it hits an #error which stops the build. This change
    adjusts that file so that those functions will fall through to their defaults
    in those cases instead of breaking the build. These functions are needed
    because other code calls them, and that code is needed because other config
    options are overly broad and bring in support we don't need along with
    support we do.

    Also reduce repetition of the 6-term #ifdef throughout the file.

    Signed-off-by: Gabe Black
    Signed-off-by: Simon Glass

    Gabe Black
     

20 Oct, 2012

1 commit

  • When get_device_and_partition() finds a disk without a partition table,
    under some conditions, it "returns" a disk_partition_t that describes
    the entire raw disk. Make sure to initialize all fields in the partition
    descriptor in that case.

    The value chosen for name is just some arbitrary descriptive string.

    The value chosen for info matches the check at the end of
    get_device_and_partition(). However, it's probably not that important;
    it's not obvious that the value is really used.

    Reported-by: Benoît Thébaudeau
    Signed-off-by: Stephen Warren
    Reviewed-by: Benoît Thébaudeau
    Signed-off-by: Tom Rini

    Stephen Warren
     

17 Oct, 2012

9 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
     

29 Sep, 2012

1 commit

  • Commit 10a37fd "disk: get_device_and_partition() "auto" partition"
    prevented the use of "-" on the command-line to request fallback to the
    $bootdevice environment variable instead. This patch allows that, or an
    empty string "" to be used.

    Tested:
    setenv bootfile /boot/zImage
    setenv bootdevice 0:1
    ext2load mmc 0:1
    ext2load mmc -
    ext2load mmc ""

    Signed-off-by: Stephen Warren

    Stephen Warren
     

26 Sep, 2012

8 commits

  • The MSDOS/MBR partition table includes a 32-bit unique ID, often referred
    to as the NT disk signature. When combined with a partition number within
    the table, this can form a unique ID similar in concept to EFI/GPT's
    partition UUID.

    This patch generates UUIDs in the format 0002dd75-01, which matches the
    format expected by the Linux kernel.

    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • Each EFI partition table entry contains a UUID. Extend U-Boot's struct
    disk_partition to be able to store this information, and modify
    get_partition_info_efi() to fill it in.

    The implementation of uuid_string() was derived from the Linux kernel,
    tag v3.6-rc4 file lib/vsprintf.c function uuid_string().

    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • Enhance get_partition_info_efi() to range-check the partition number.
    This prevents invalid partitions being accessed, and prevents access
    beyond the end of the gpt_pte[] array.

    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • Rework get_device_and_partition() to:
    a) Implement a new partition ID of "auto", which requests that U-Boot
    search for the first "bootable" partition, and fall back to the first
    valid partition if none is found. This way, users don't need to
    specify an explicit partition in their commands.
    b) Make use of get_device().
    c) Add parameter to indicate whether returning a whole device is
    acceptable, or whether a partition is mandatory.
    d) Make error-checking of the user's device-/partition-specification
    more complete. In particular, if strtoul() doesn't convert all
    characters, it's an error rather than just ignored.

    The resultant device/partition returned by the function will be as
    follows, based on whether the disk has a partition table (ptable) or not,
    and whether the calling command allows the whole device to be returned
    or not.

    (D and P are integers, P >= 1)

    D
    D:
    No ptable:
    !allow_whole_dev: error
    allow_whole_dev: device D
    ptable:
    device D partition 1
    D:0
    !allow_whole_dev: error
    allow_whole_dev: device D
    D:P
    No ptable: error
    ptable: device D partition P
    D:auto
    No ptable:
    !allow_whole_dev: error
    allow_whole_dev: device D
    ptable:
    first partition in device D with bootable flag set.
    If none, first valid paratition in device D.

    Note: In order to review this patch, it's probably easiest to simply
    look at the file contents post-application, rather than reading the
    patch itself.

    Signed-off-by: Rob Herring
    [swarren: Rob implemented scanning for bootable partitions. I fixed a
    couple of issues there, switched the syntax to ":auto", added the
    error-checking rework, and ":0" syntax for the whole device]
    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • This patch introduces function get_device(). This looks up a
    block_dev_desc_t from an interface name (e.g. mmc) and device number
    (e.g. 0). This function is essentially the non-partition-specific
    prefix of get_device_and_partition().

    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • All block device related commands (scsiboot, fatload, ext2ls, etc.) have
    simliar duplicated device and partition parsing and selection code. This
    adds a common function to replace various implementations.

    The new function has an enhancement over current versions. If no device
    or partition is specified on the command line, the bootdevice env variable
    will be used (scsiboot does this).

    Signed-off-by: Rob Herring

    Rob Herring
     
  • Determine which partitions are bootable/active. In the partition listing,
    print "Boot" for partitions with the bootable/active flag set.

    Signed-off-by: Rob Herring

    Rob Herring
     
  • Now that get_device_and_partition() always calls get_partition_info()
    when disk.c is compiled, we must always compile the function, rather
    than ifdef it away.

    The implementation must be conditional based on CONFIG_CMD_* etc., since
    that's what e.g. part_dos.c uses to ifdef out get_partition_info_dos();
    CONFIG_DOS_PARTITION can be enabled even without those commands being
    enabled.

    Technically, this change is required before Rob's "disk/part: introduce
    get_device_and_partition" patch. However, at least when the compiler
    optimizer is turned on, it isn't required before then in practice,
    since get_device_and_partition() calls get_dev(), which is stubbed out
    in disk.c under exactly the same conditions that get_partition_info()
    is not compiled, and hence the compiler never generates code for the
    call to the missing function. However, in my later patch "disk:
    get_device_and_partition() "auto" partition and cleanup", the optimizer
    doesn't succeed at this, and may attempt to reference the undefined
    function.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

02 Sep, 2012

1 commit


22 Jun, 2012

1 commit


30 Apr, 2012

1 commit


27 Mar, 2012

1 commit

  • The patch below fixes device enumeration through the U-Boot API.

    Device enumeration crashes when the system in question doesn't
    have any RAM mapped to address zero (I discovered this on a
    BeagleBone board), since the enumeration calls get_dev with a
    NULL ifname sometimes which then gets passed down to strncmp().

    This fix simply ensures that get_dev returns NULL when invoked
    with a NULL ifname.

    Signed-off-by: Tim Kientzle
    Signed-off-by: Anatolij Gustschin

    Tim Kientzle
     

07 Dec, 2011

1 commit

  • Fix errors noticed after enabling CONFIG_EFI_PARTITION
    for the OMAP3 EVM board:

    part_efi.c: In function 'print_part_efi':
    part_efi.c:133:5: warning: passing argument 3 of 'is_gpt_valid'
    from incompatible pointer type
    part_efi.c:95:12: note: expected 'struct gpt_header *' but arg
    ument is of type 'struct gpt_header **'
    part_efi.c: In function 'get_partition_info_efi':
    part_efi.c:173:4: warning: passing argument 3 of 'is_gpt_valid
    ' from incompatible pointer type
    part_efi.c:95:12: note: expected 'struct gpt_header *' but arg
    ument is of type 'struct gpt_header **'
    part_efi.c: In function 'alloc_read_gpt_entries':
    part_efi.c:384:18: error: 'CONFIG_SYS_CACHELINE_SIZE' undeclare
    d (first use in this function)

    Signed-off-by: Sanjeev Premi
    Cc: Tom Rini
    Cc: Anton staaf
    Signed-off-by: Sandeep Paulraj

    Sanjeev Premi
     

06 Dec, 2011

1 commit

  • Commit deb5ca80275e8cfa74d5680b41204e08a095eca5 "disk: part_efi: fix
    **pgpt_pte == NULL" modified the code to pass "&gpt_head" to
    is_gpt_valid() rather than the previous "gpt_head". However, gpt_head
    is a pointer to the buffer, not the actual buffer, since it was allocated
    using ALLOC_CACHE_ALIGN_BUFFER. This caused is_gpt_valid() to read the
    disk block onto the stack rather than into the buffer, causing the
    code to fail.

    This change reverts that portion of the commit mentioned above.

    Signed-off-by: Stephen Warren
    Acked-by: Doug Anderson
    Tested-by: Simon Glass
    Acked-by: Mike Frysinger
    Tested-by: Anton Staaf

    Stephen Warren
     

28 Oct, 2011

2 commits