]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - disk/part_dos.c
Merge branch 'master' of git://git.denx.de/u-boot-video
[karo-tx-uboot.git] / disk / part_dos.c
index 3fe901ba1bdc974127ced2a382274890011e02b5..ab984cddf75dff7e4b3e631a099d8ebf2b2cc9f7 100644 (file)
 #include <ide.h>
 #include "part_dos.h"
 
-#if defined(CONFIG_CMD_IDE) || \
-    defined(CONFIG_CMD_SATA) || \
-    defined(CONFIG_CMD_SCSI) || \
-    defined(CONFIG_CMD_USB) || \
-    defined(CONFIG_MMC) || \
-    defined(CONFIG_SYSTEMACE)
+#ifdef HAVE_BLOCK_DEVICE
 
 /* Convert char[4] in little endian format to the host format integer
  */
@@ -79,13 +74,26 @@ static void print_one_part(dos_partition_t *p, int ext_part_sector,
 
 static int test_block_type(unsigned char *buffer)
 {
+       int slot;
+       struct dos_partition *p;
+
        if((buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
            (buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
                return (-1);
        } /* no DOS Signature at all */
-       if (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0 ||
-           strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET],"FAT32",5)==0) {
-               return DOS_PBR; /* is PBR */
+       p = (struct dos_partition *)&buffer[DOS_PART_TBL_OFFSET];
+       for (slot = 0; slot < 3; slot++) {
+               if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+                       if (!slot &&
+                           (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],
+                                    "FAT", 3) == 0 ||
+                            strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET],
+                                    "FAT32", 5) == 0)) {
+                               return DOS_PBR; /* is PBR */
+                       } else {
+                               return -1;
+                       }
+               }
        }
        return DOS_MBR;     /* Is MBR */
 }