summaryrefslogtreecommitdiff
path: root/disk/part_dos.c
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2014-07-16 08:51:30 +0200
committerStefano Babic <sbabic@denx.de>2014-07-16 08:51:30 +0200
commitdab5e3469d294a4e1ffed8407d296a78e02cc01f (patch)
treec6378034591210b3142ca3add806d52c6ea22b3b /disk/part_dos.c
parent14a1613140519a8d0a88e6054c302a8cb3e067a5 (diff)
parent524123a70761110c5cf3ccc5f52f6d4da071b959 (diff)
downloadu-boot-imx-dab5e3469d294a4e1ffed8407d296a78e02cc01f.zip
u-boot-imx-dab5e3469d294a4e1ffed8407d296a78e02cc01f.tar.gz
u-boot-imx-dab5e3469d294a4e1ffed8407d296a78e02cc01f.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot
Signed-off-by: Stefano Babic <sbabic@denx.de> Conflicts: boards.cfg
Diffstat (limited to 'disk/part_dos.c')
-rw-r--r--disk/part_dos.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/disk/part_dos.c b/disk/part_dos.c
index 05c3933..cf1a36e 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -21,6 +21,8 @@
#ifdef HAVE_BLOCK_DEVICE
+#define DOS_PART_DEFAULT_SECTOR 512
+
/* Convert char[4] in little endian format to the host format integer
*/
static inline int le32_to_int(unsigned char *le32)
@@ -168,6 +170,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
dos_partition_t *pt;
int i;
+ int dos_type;
if (dev_desc->block_read (dev_desc->dev, ext_part_sector, 1, (ulong *) buffer) != 1) {
printf ("** Can't read partition table on %d:%d **\n",
@@ -198,9 +201,10 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
(pt->sys_ind != 0) &&
(part_num == which_part) &&
(is_extended(pt->sys_ind) == 0)) {
- info->blksz = 512;
- info->start = ext_part_sector + le32_to_int (pt->start4);
- info->size = le32_to_int (pt->size4);
+ info->blksz = DOS_PART_DEFAULT_SECTOR;
+ info->start = (lbaint_t)(ext_part_sector +
+ le32_to_int(pt->start4));
+ info->size = (lbaint_t)le32_to_int(pt->size4);
switch(dev_desc->if_type) {
case IF_TYPE_IDE:
case IF_TYPE_SATA:
@@ -252,6 +256,22 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
part_num, which_part, info, disksig);
}
}
+
+ /* Check for DOS PBR if no partition is found */
+ dos_type = test_block_type(buffer);
+
+ if (dos_type == DOS_PBR) {
+ info->start = 0;
+ info->size = dev_desc->lba;
+ info->blksz = DOS_PART_DEFAULT_SECTOR;
+ info->bootable = 0;
+ sprintf ((char *)info->type, "U-Boot");
+#ifdef CONFIG_PARTITION_UUIDS
+ info->uuid[0] = 0;
+#endif
+ return 0;
+ }
+
return -1;
}