1
0
Fork 0
Commit Graph

37 Commits (3e8bd469504f5d5a8800a2ea46d664dde701105b)

Author SHA1 Message Date
Simon Glass 3e8bd46950 dm: part: Rename some partition functions
Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Simon Glass 96e5b03c8a dm: part: Convert partition API use to linker lists
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 <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Simon Glass 4101f68792 dm: Drop the block_dev_desc_t typedef
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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Ben Whitten 192bc6948b Fix GCC format-security errors and convert sprintfs.
With format-security errors turned on, GCC picks up the use of sprintf with
a format parameter not being a string literal.

Simple uses of sprintf are also converted to use strcpy.

Signed-off-by: Ben Whitten <ben.whitten@gmail.com>
Acked-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-14 22:11:34 -05:00
Stephen Warren 7c4213f6a5 block: pass block dev not num to read/write/erase()
This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-13 21:05:18 -05:00
Stefan Monnier d29892ba85 part_dos.c: Don't wrap to negative after 2G sectors
In order to support large IDE disks we need to make certain types be
lbaint_t now.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Stefan Monnier <monnier@iro.umontreal.ca>
2016-01-13 16:33:20 -05:00
Simon Glass cf92e05c01 Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header
Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-09-11 17:15:20 -04:00
Darwin Dingel 4a36be9bdb disk: part_dos.c: Add a PBR check when MBR checking fails
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@alliedtelesis.co.nz>
2014-06-11 16:27:05 -04:00
Steve Rae e04350d299 disk: part_efi: clarify lbaint_t usage
- 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 <srae@broadcom.com>
2014-06-05 14:44:56 -04:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Egbert Eich 9d956e0fef disk/part_dos: check harder for partition table
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 <eich@suse.com>
2013-05-01 16:24:01 -04:00
Stephen Warren 2c1af9dcdc disk: define HAVE_BLOCK_DEVICE in a common place
This set of ifdefs is used in a number of places. Move its definition
somewhere common so it doesn't have to be repeated.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2013-03-14 11:06:44 -07:00
Stephen Warren e2e9b37898 disk: part_dos: print partition UUID in partition list
This information may be useful to compare against command "part uuid",
or if you want to manually paste the information into the kernel
command-line.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
[trini: print_one_part / print_part_dos output strings didn't quite
match before the changes]
Signed-off-by: Tom Rini <trini@ti.com>
2012-10-17 07:59:11 -07:00
Stephen Warren 304b571130 disk: part_dos: checkpatch cleanups
Minor cleanups required so later patches don't trigger checkpatch.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-10-17 07:59:11 -07:00
Stephen Warren d1efb6442a disk: part_dos: don't claim whole-disk FAT filesystems
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 <swarren@nvidia.com>
2012-10-08 11:15:04 -07:00
Stephen Warren d27b5f9398 disk: part_msdos: parse and store partition UUID
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 <swarren@nvidia.com>
2012-09-25 15:05:45 -07:00
Rob Herring 40e0e5686a disk/part: check bootable flag for DOS partitions
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@calxeda.com>
2012-09-25 14:43:19 -07:00
Marek Vasut b37d41aa24 Block: Remove MG DISK support
This driver is unused and obsolete.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: unsik Kim <donari75@gmail.com>
2012-06-21 20:53:09 +02:00
Eric Nelson dec049d924 part_dos: align disk buffers on cache line to enable DMA and cache
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-04-30 16:54:50 +02:00
Sergei Shtylyov 54193c5d81 part_dos: fix crash with big sector size
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it
tries to read the MBR into 512-byte buffer situated on stack. Instead use the
variable length arrays to be safe with any large sector size.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
2011-07-27 23:41:33 +02:00
Wolfgang Denk 66c2d73cfc FAT32: fix support for superfloppy-format (PBR)
"Superfloppy" format (in U-Boot called PBR) did not work for FAT32 as
the file system type string is at a different location. Add support
for FAT32.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:53:43 +02:00
Daniel Mack 78f4ca7976 part_dos: check status flags of partitions
Only read partitions which have 0x00 or 0x80 set in their status field.
All others are invalid.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
2009-10-18 22:50:21 +02:00
Wolfgang Denk 716655288a Partition support: remove newline from partition name
Remove bogus newline character that got added to the .name field of
the disk_partition_t structure.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-08-09 22:52:38 +02:00
unsik Kim 75eb82ec7c mflash: Initial mflash support
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 <donari75@gmail.com>
2009-04-03 23:47:06 +02:00
Mike Frysinger 7bd2722e89 disk: convert part_* files to COBJ-$(CONFIG_XXX) style
Move the CONFIG_XXX out of the part_XXX.c file and into Makefile to
avoid pointless compiles.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-02-18 00:50:51 +01:00
Dave Liu c7057b529c ata: add the support for SATA framework
- add the SATA framework
- add the SATA command line

Signed-off-by: Dave Liu <daveliu@freescale.com>
2008-03-26 23:38:51 +01:00
Jon Loeliger cde5c64d17 disk/: Remove obsolete references to CONFIG_COMMANDS
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-09 17:22:37 -05:00
Jon Loeliger 45cdb9b72c disk/: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04 00:23:13 +02:00
Wolfgang Denk 77ddac9480 Cleanup for GCC-4.x 2005-10-13 16:45:02 +02:00
wdenk 1968e615d4 Cleanup USB and partition defines 2005-02-24 23:23:29 +00:00
wdenk 3f85ce2785 * CVS add missing files
* Cleanup compiler warnings

* Fix problem with side effects in macros in include/usb.h

* Patch by David Benson, 13 Nov 2003:
  bug 841358 - fix TFTP download size limit

* Fixing bug 850768:
  improper flush_cache() in load_serial()

* Fixing bug 834943:
  MPC8540 - missing volatile declarations

* Patch by Stephen Williams, 09 Feb 2004:
  Add support for Xilinx SystemACE chip:
  - New files common/cmd_ace.c and include/systemace.h
  - Hook systemace support into cmd_fat and the partition manager

* Patch by Travis Sawyer, 09 Feb 2004:
  Add bi_opbfreq & bi_iic_fast to 440GX bd_info as needed for Linux
2004-02-23 16:11:30 +00:00
wdenk 7205e4075d * Patches by Denis Peter, 9 Sep 2003:
add FAT support for IDE, SCSI and USB

* Patches by Gleb Natapov, 2 Sep 2003:
  - cleanup of POST code for unsupported architectures
  - MPC824x locks way0 of data cache for use as initial RAM;
    this patch unlocks it after relocation to RAM and invalidates
    the locked entries.

* Patch by Gleb Natapov, 30 Aug 2003:
  new I2C driver for mpc107 bridge. Now works from flash.

* Patch by Dave Ellis, 11 Aug 2003:
  - JFFS2: fix typo in common/cmd_jffs2.c
  - JFFS2: fix CFG_JFFS2_SORT_FRAGMENTS option
  - JFFS2: remove node version 0 warning
  - JFFS2: accept JFFS2 PADDING nodes
  - SXNI855T: add AM29LV800 support
  - SXNI855T: move environment from EEPROM to flash
  - SXNI855T: boot from JFFS2 in NOR or NAND flash

* Patch by Bill Hargen, 11 Aug 2003:
  fixes for I2C on MPC8240
  - fix i2c_write routine
  - fix iprobe command
  - eliminates use of global variables, plus dead code, cleanup.
2003-09-10 22:30:53 +00:00
wdenk 149dded2b1 * Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD
2003-09-10 18:20:28 +00:00
wdenk b0fce99bfc Fix some missing commands, cleanup header files
(autoscript, bmp, bsp, fat, mmc, nand, portio, ...)
2003-06-29 21:03:46 +00:00
wdenk 8bde7f776c * Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
2003-06-27 21:31:46 +00:00
wdenk 7f70e85309 * Patch by David Updegraff, 22 Apr 2003:
update for CrayL1 board

* Patch by Pantelis Antoniou, 21 Apr 2003:
  add boot support for ARTOS (a proprietary OS)

* Patch by Steven Scholz, 11 Apr 2003:
  Add support for RTC DS1338

* Patch by Rod Boyce, 24 Jan 2003:
  Fix counting of extended partitions in diskboot command
2003-05-20 14:25:27 +00:00
wdenk fe8c2806cd Initial revision 2002-11-03 00:38:21 +00:00