summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-09-10 22:30:53 +0000
committerwdenk <wdenk>2003-09-10 22:30:53 +0000
commit7205e4075d8b50e4dd89fe39ed03860b23cbb704 (patch)
tree0dfa865e7087ff4ee07967a2531c91ff5645a802 /disk
parent149dded2b178bc0fb62cb6f61b87968d914b580a (diff)
downloadu-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.zip
u-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.tar.gz
u-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.tar.bz2
* 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.
Diffstat (limited to 'disk')
-rw-r--r--disk/part_dos.c21
-rw-r--r--disk/part_dos.h4
2 files changed, 22 insertions, 3 deletions
diff --git a/disk/part_dos.c b/disk/part_dos.c
index 32333c7..d05f650 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -67,6 +67,17 @@ static void print_one_part (dos_partition_t *p, int ext_part_sector, int part_nu
(is_extended (p->sys_ind) ? " Extd" : ""));
}
+static int test_block_type(unsigned char *buffer)
+{
+ if((buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
+ (buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
+ return (-1);
+ } /* no DOS Signature at all */
+ if(strncmp(&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
+ return DOS_PBR; /* is PBR */
+ return DOS_MBR; /* Is MBR */
+}
+
int test_part_dos (block_dev_desc_t *dev_desc)
{
@@ -94,14 +105,18 @@ static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_s
dev_desc->dev, ext_part_sector);
return;
}
- if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
- buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
+ i=test_block_type(buffer);
+ if(i==-1) {
printf ("bad MBR sector signature 0x%02x%02x\n",
buffer[DOS_PART_MAGIC_OFFSET],
buffer[DOS_PART_MAGIC_OFFSET + 1]);
return;
}
-
+ if(i==DOS_PBR) {
+ printf (" 1\t\t 0\t%10ld\t%2x\n",
+ dev_desc->lba, buffer[DOS_PBR_MEDIA_TYPE_OFFSET]);
+ return;
+ }
/* Print all primary/logical partitions */
pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
for (i = 0; i < 4; i++, pt++) {
diff --git a/disk/part_dos.h b/disk/part_dos.h
index cc3fa81..ac93f20 100644
--- a/disk/part_dos.h
+++ b/disk/part_dos.h
@@ -34,6 +34,10 @@
#endif
#define DOS_PART_TBL_OFFSET 0x1be
#define DOS_PART_MAGIC_OFFSET 0x1fe
+#define DOS_PBR_FSTYPE_OFFSET 0x36
+#define DOS_PBR_MEDIA_TYPE_OFFSET 0x15
+#define DOS_MBR 0
+#define DOS_PBR 1
typedef struct dos_partition {
unsigned char boot_ind; /* 0x80 - active */