All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume
@ 2011-12-21 17:08 Kyle Moffett
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Kyle Moffett @ 2011-12-21 17:08 UTC (permalink / raw)
  To: u-boot

This series fixes several bugs in the FAT code and the USB storage
stack to make it possible to read from a FAT filesystem image embedded
as an "El-Torito boot image" in an ISO9660 volume (IE: a CD or DVD).

This has been tested on the eXMeritus HWW-1U-1A

I've addressed the review commentary on these patches and I believe
that they should be acceptable for merging into "next" now.

Cheers,
Kyle Moffett

--
Interested in my work on the Debian powerpcspe port?
I'm keeping a blog here: http://pureperl.blogspot.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables
  2011-12-21 17:08 [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Kyle Moffett
@ 2011-12-21 17:08 ` Kyle Moffett
  2012-01-05 16:14   ` Wolfgang Denk
  2012-01-05 19:12   ` Wolfgang Denk
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling Kyle Moffett
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Kyle Moffett @ 2011-12-21 17:08 UTC (permalink / raw)
  To: u-boot

The FAT filesystem code currently ends up requiring that the partition
table be a DOS MBR, as it checks for the DOS 0x55 0xAA signature on the
partition table (which may be Mac, EFI, ISO9660, etc) before actually
computing the partition offset.

This fixes support for accessing a FAT filesystem in an ISO9660 boot
volume (El-Torito format) by reordering the filesystem checks and
reading the 0x55 0xAA "DOS boot signature" and FAT/FAT32 magic number
from the first sector of the partition instead of from sector 0.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

--

v2:
I have removed the unnecessary static initializers.  All the variables
are memset to 0 as part of the BSS, and cur_dev is only initialized
after the rest of the variables have been set correctly.

---
 fs/fat/fat.c |  117 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 54 insertions(+), 63 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9a29458..9ceb3ec 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -43,50 +43,31 @@ static void downcase (char *str)
 	}
 }
 
-static block_dev_desc_t *cur_dev = NULL;
+static block_dev_desc_t *cur_dev;
+static unsigned int cur_part_nr;
+static disk_partition_t cur_part_info;
 
-static unsigned long part_offset = 0;
-
-static int cur_part = 1;
-
-#define DOS_PART_TBL_OFFSET	0x1be
-#define DOS_PART_MAGIC_OFFSET	0x1fe
+#define DOS_BOOT_MAGIC_OFFSET	0x1fe
 #define DOS_FS_TYPE_OFFSET	0x36
 #define DOS_FS32_TYPE_OFFSET	0x52
 
-static int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
+static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
 {
-	if (cur_dev == NULL)
+	if (!cur_dev || !cur_dev->block_read)
 		return -1;
 
-	startblock += part_offset;
-
-	if (cur_dev->block_read) {
-		return cur_dev->block_read(cur_dev->dev, startblock, getsize,
-					   (unsigned long *) bufptr);
-	}
-	return -1;
+	return cur_dev->block_read(cur_dev->dev,
+			cur_part_info.start + block, nr_blocks, buf);
 }
 
 int fat_register_device (block_dev_desc_t * dev_desc, int part_no)
 {
 	unsigned char buffer[dev_desc->blksz];
+	unsigned int found_partition = 0;
 
-	if (!dev_desc->block_read)
-		return -1;
+	/* First close any currently found FAT filesystem */
+	cur_dev = NULL;
 
-	cur_dev = dev_desc;
-	/* check if we have a MBR (on floppies we have only a PBR) */
-	if (dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *)buffer) != 1) {
-		printf("** Can't read from device %d **\n",
-			dev_desc->dev);
-		return -1;
-	}
-	if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
-	    buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
-		/* no signature found */
-		return -1;
-	}
 #if (defined(CONFIG_CMD_IDE) || \
      defined(CONFIG_CMD_MG_DISK) || \
      defined(CONFIG_CMD_SATA) || \
@@ -94,45 +75,55 @@ int fat_register_device (block_dev_desc_t * dev_desc, int part_no)
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
      defined(CONFIG_SYSTEMACE) )
-	{
-		disk_partition_t info;
-
-		/* First we assume there is a MBR */
-		if (!get_partition_info(dev_desc, part_no, &info)) {
-			part_offset = info.start;
-			cur_part = part_no;
-		} else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],
-				    "FAT", 3) == 0) ||
-			   (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET],
-				    "FAT32", 5) == 0)) {
-			/* ok, we assume we are on a PBR only */
-			cur_part = 1;
-			part_offset = 0;
-		} else {
+
+	/* Read the partition table, if present */
+	if (!get_partition_info(dev_desc, part_no, &cur_part_info)) {
+		cur_dev = dev_desc;
+		cur_part_nr = part_no;
+	}
+#endif
+
+	/* Otherwise it might be a superfloppy (whole-disk FAT filesystem) */
+	if (!cur_dev) {
+		if (part_no != 1) {
 			printf("** Partition %d not valid on device %d **\n",
-				part_no, dev_desc->dev);
+					part_no, dev_desc->dev);
 			return -1;
 		}
+
+		found_partition = 1;
+		cur_dev = dev_desc;
+		cur_part_nr = 1;
+		cur_part_info.start = 0;
+		cur_part_info.size = dev_desc->lba;
+		cur_part_info.blksz = dev_desc->blksz;
+		memset(cur_part_info.name, 0, sizeof(cur_part_info.name));
+		memset(cur_part_info.type, 0, sizeof(cur_part_info.type));
 	}
-#else
-	if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) ||
-	    (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) {
-		/* ok, we assume we are on a PBR only */
-		cur_part = 1;
-		part_offset = 0;
-	} else {
-		/* FIXME we need to determine the start block of the
-		 * partition where the DOS FS resides. This can be done
-		 * by using the get_partition_info routine. For this
-		 * purpose the libpart must be included.
-		 */
-		part_offset = 32;
-		cur_part = 1;
+
+	/* Make sure it has a valid FAT header */
+	if (disk_read(0, 1, buffer) != 1) {
+		cur_dev = NULL;
+		return -1;
 	}
-#endif
-	return 0;
+
+	/* Check if it's actually a DOS volume */
+	if (memcmp(buffer + DOS_BOOT_MAGIC_OFFSET, "\x55\xAA", 2)) {
+		cur_dev = NULL;
+		return -1;
+	}
+
+	/* Check for FAT12/FAT16/FAT32 filesystem */
+	if (!memcmp(buffer + DOS_FS_TYPE_OFFSET, "FAT", 3))
+		return 0;
+	if (!memcmp(buffer + DOS_FS32_TYPE_OFFSET, "FAT32", 5))
+		return 0;
+
+	cur_dev = NULL;
+	return -1;
 }
 
+
 /*
  * Get the first occurence of a directory delimiter ('/' or '\') in a string.
  * Return index into string if found, -1 otherwise.
@@ -1170,7 +1161,7 @@ int file_fat_detectfs (void)
 	vol_label[11] = '\0';
 	volinfo.fs_type[5] = '\0';
 
-	printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part,
+	printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part_nr,
 		volinfo.fs_type, vol_label);
 
 	return 0;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling
  2011-12-21 17:08 [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Kyle Moffett
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
@ 2011-12-21 17:08 ` Kyle Moffett
  2012-01-05 16:15   ` Wolfgang Denk
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM Kyle Moffett
  2012-02-26 23:08 ` [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Marek Vasut
  3 siblings, 1 reply; 10+ messages in thread
From: Kyle Moffett @ 2011-12-21 17:08 UTC (permalink / raw)
  To: u-boot

The FAT filesystem fails silently in inexplicable ways when given a
filesystem with a block-size that does not match the device sector size.
In theory this is not an unsupportable combination but requires a major
rewrite of a lot of the filesystem.  Until that occurs, the filesystem
should detect that scenario and display a helpful error message.

This scenario in particular occurred on a 512-byte blocksize FAT fs
stored in an El-Torito boot volume on a CD-ROM (2048-byte sector size).

Additionally, in many circumstances the ->block_read method will not
return a negative number to indicate an error but instead return 0 to
indicate the number of blocks successfully read (IE: None).

The FAT filesystem should defensively check to ensure that it got all of
the sectors that it asked for when reading.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

--

v2: No change

---
 fs/fat/fat.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9ceb3ec..afe486f 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -276,6 +276,8 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer,
 {
 	__u32 idx = 0;
 	__u32 startsect;
+	__u32 nr_sect;
+	int ret;
 
 	if (clustnum > 0) {
 		startsect = mydata->data_begin +
@@ -286,16 +288,19 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer,
 
 	debug("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
 
-	if (disk_read(startsect, size / mydata->sect_size, buffer) < 0) {
-		debug("Error reading data\n");
+	nr_sect = size / mydata->sect_size;
+	ret = disk_read(startsect, nr_sect, buffer);
+	if (ret != nr_sect) {
+		debug("Error reading data (got %d)\n", ret);
 		return -1;
 	}
 	if (size % mydata->sect_size) {
 		__u8 tmpbuf[mydata->sect_size];
 
 		idx = size / mydata->sect_size;
-		if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
-			debug("Error reading data\n");
+		ret = disk_read(startsect + idx, 1, tmpbuf);
+		if (ret != 1) {
+			debug("Error reading data (got %d)\n", ret);
 			return -1;
 		}
 		buffer += idx * mydata->sect_size;
@@ -804,6 +809,11 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
 
 	mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0];
 	mydata->clust_size = bs.cluster_size;
+	if (mydata->sect_size != cur_part_info.blksz) {
+		printf("Error: FAT sector size mismatch (fs=%hu, dev=%lu)\n",
+				mydata->sect_size, cur_part_info.blksz);
+		return -1;
+	}
 
 	if (mydata->fatsize == 32) {
 		mydata->data_begin = mydata->rootdir_sect -
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM
  2011-12-21 17:08 [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Kyle Moffett
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling Kyle Moffett
@ 2011-12-21 17:08 ` Kyle Moffett
  2012-01-05 16:16   ` Wolfgang Denk
  2012-02-26 23:08 ` [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Marek Vasut
  3 siblings, 1 reply; 10+ messages in thread
From: Kyle Moffett @ 2011-12-21 17:08 UTC (permalink / raw)
  To: u-boot

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

--

v2:
Minor whitespace fixes

---
 common/usb_storage.c |   45 +++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index d9a2585..de84c8d 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -151,6 +151,7 @@ struct us_data {
 	unsigned int	irqpipe;	 	/* pipe for release_irq */
 	unsigned char	irqmaxp;		/* max packed for irq Pipe */
 	unsigned char	irqinterval;		/* Intervall for IRQ Pipe */
+	unsigned long	max_xfer_blk;		/* Max blocks per xfer */
 	ccb		*srb;			/* current srb */
 	trans_reset	transport_reset;	/* reset routine */
 	trans_cmnd	transport;		/* transport routine */
@@ -1041,14 +1042,13 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor,
 }
 #endif /* CONFIG_USB_BIN_FIXUP */
 
-#define USB_MAX_READ_BLK 20
-
 unsigned long usb_stor_read(int device, unsigned long blknr,
 			    unsigned long blkcnt, void *buffer)
 {
 	unsigned long start, blks, buf_addr;
 	unsigned short smallblks;
 	struct usb_device *dev;
+	struct us_data *ss;
 	int retry, i;
 	ccb *srb = &usb_ccb;
 
@@ -1066,13 +1066,14 @@ unsigned long usb_stor_read(int device, unsigned long blknr,
 		if (dev->devnum == usb_dev_desc[device].target)
 			break;
 	}
+	ss = (struct us_data *)dev->privptr;
 
 	usb_disable_asynch(1); /* asynch transfer not allowed */
 	srb->lun = usb_dev_desc[device].lun;
 	buf_addr = (unsigned long)buffer;
 	start = blknr;
 	blks = blkcnt;
-	if (usb_test_unit_ready(srb, (struct us_data *)dev->privptr)) {
+	if (usb_test_unit_ready(srb, ss)) {
 		printf("Device NOT ready\n   Request Sense returned %02X %02X"
 		       " %02X\n", srb->sense_buf[2], srb->sense_buf[12],
 		       srb->sense_buf[13]);
@@ -1086,19 +1087,18 @@ unsigned long usb_stor_read(int device, unsigned long blknr,
 		/* XXX need some comment here */
 		retry = 2;
 		srb->pdata = (unsigned char *)buf_addr;
-		if (blks > USB_MAX_READ_BLK)
-			smallblks = USB_MAX_READ_BLK;
+		if (blks > ss->max_xfer_blk)
+			smallblks = ss->max_xfer_blk;
 		else
 			smallblks = (unsigned short) blks;
 retry_it:
-		if (smallblks == USB_MAX_READ_BLK)
+		if (smallblks == ss->max_xfer_blk)
 			usb_show_progress();
 		srb->datalen = usb_dev_desc[device].blksz * smallblks;
 		srb->pdata = (unsigned char *)buf_addr;
-		if (usb_read_10(srb, (struct us_data *)dev->privptr, start,
-		    smallblks)) {
+		if (usb_read_10(srb, ss, start, smallblks)) {
 			USB_STOR_PRINTF("Read ERROR\n");
-			usb_request_sense(srb, (struct us_data *)dev->privptr);
+			usb_request_sense(srb, ss);
 			if (retry--)
 				goto retry_it;
 			blkcnt -= blks;
@@ -1113,19 +1113,18 @@ retry_it:
 			start, smallblks, buf_addr);
 
 	usb_disable_asynch(0); /* asynch transfer allowed */
-	if (blkcnt >= USB_MAX_READ_BLK)
+	if (blkcnt >= ss->max_xfer_blk)
 		debug("\n");
 	return blkcnt;
 }
 
-#define USB_MAX_WRITE_BLK 20
-
 unsigned long usb_stor_write(int device, unsigned long blknr,
 				unsigned long blkcnt, const void *buffer)
 {
 	unsigned long start, blks, buf_addr;
 	unsigned short smallblks;
 	struct usb_device *dev;
+	struct us_data *ss;
 	int retry, i;
 	ccb *srb = &usb_ccb;
 
@@ -1143,6 +1142,7 @@ unsigned long usb_stor_write(int device, unsigned long blknr,
 		if (dev->devnum == usb_dev_desc[device].target)
 			break;
 	}
+	ss = (struct us_data *)dev->privptr;
 
 	usb_disable_asynch(1); /* asynch transfer not allowed */
 
@@ -1150,7 +1150,7 @@ unsigned long usb_stor_write(int device, unsigned long blknr,
 	buf_addr = (unsigned long)buffer;
 	start = blknr;
 	blks = blkcnt;
-	if (usb_test_unit_ready(srb, (struct us_data *)dev->privptr)) {
+	if (usb_test_unit_ready(srb, ss)) {
 		printf("Device NOT ready\n   Request Sense returned %02X %02X"
 		       " %02X\n", srb->sense_buf[2], srb->sense_buf[12],
 			srb->sense_buf[13]);
@@ -1166,19 +1166,18 @@ unsigned long usb_stor_write(int device, unsigned long blknr,
 		 */
 		retry = 2;
 		srb->pdata = (unsigned char *)buf_addr;
-		if (blks > USB_MAX_WRITE_BLK)
-			smallblks = USB_MAX_WRITE_BLK;
+		if (blks > ss->max_xfer_blk)
+			smallblks = ss->max_xfer_blk;
 		else
 			smallblks = (unsigned short) blks;
 retry_it:
-		if (smallblks == USB_MAX_WRITE_BLK)
+		if (smallblks == ss->max_xfer_blk)
 			usb_show_progress();
 		srb->datalen = usb_dev_desc[device].blksz * smallblks;
 		srb->pdata = (unsigned char *)buf_addr;
-		if (usb_write_10(srb, (struct us_data *)dev->privptr, start,
-		    smallblks)) {
+		if (usb_write_10(srb, ss, start, smallblks)) {
 			USB_STOR_PRINTF("Write ERROR\n");
-			usb_request_sense(srb, (struct us_data *)dev->privptr);
+			usb_request_sense(srb, ss);
 			if (retry--)
 				goto retry_it;
 			blkcnt -= blks;
@@ -1193,7 +1192,7 @@ retry_it:
 			start, smallblks, buf_addr);
 
 	usb_disable_asynch(0); /* asynch transfer allowed */
-	if (blkcnt >= USB_MAX_WRITE_BLK)
+	if (blkcnt >= ss->max_xfer_blk)
 		debug("\n");
 	return blkcnt;
 
@@ -1419,6 +1418,12 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
 	USB_STOR_PRINTF(" address %d\n", dev_desc->target);
 	USB_STOR_PRINTF("partype: %d\n", dev_desc->part_type);
 
+	/*
+	 * The U-Boot EHCI driver cannot handle more than 4096 * 5 bytes in a
+	 * transfer without running itself out of qt_buffers.
+	 */
+	ss->max_xfer_blk = (4096 * 5) / dev_desc->blksz;
+
 	init_part(dev_desc);
 
 	USB_STOR_PRINTF("partype: %d\n", dev_desc->part_type);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
@ 2012-01-05 16:14   ` Wolfgang Denk
  2012-01-05 19:12   ` Wolfgang Denk
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-01-05 16:14 UTC (permalink / raw)
  To: u-boot

Dear Kyle Moffett,

In message <1324487292-7299-2-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> The FAT filesystem code currently ends up requiring that the partition
> table be a DOS MBR, as it checks for the DOS 0x55 0xAA signature on the
> partition table (which may be Mac, EFI, ISO9660, etc) before actually
> computing the partition offset.
> 
> This fixes support for accessing a FAT filesystem in an ISO9660 boot
> volume (El-Torito format) by reordering the filesystem checks and
> reading the 0x55 0xAA "DOS boot signature" and FAT/FAT32 magic number
> from the first sector of the partition instead of from sector 0.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> 
> --
> 
> v2:
> I have removed the unnecessary static initializers.  All the variables
> are memset to 0 as part of the BSS, and cur_dev is only initialized
> after the rest of the variables have been set correctly.
> 
> ---
>  fs/fat/fat.c |  117 +++++++++++++++++++++++++++-------------------------------
>  1 files changed, 54 insertions(+), 63 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Plan to throw one away.  You will anyway."
                              - Fred Brooks, "The Mythical Man Month"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling Kyle Moffett
@ 2012-01-05 16:15   ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-01-05 16:15 UTC (permalink / raw)
  To: u-boot

Dear Kyle Moffett,

In message <1324487292-7299-3-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> The FAT filesystem fails silently in inexplicable ways when given a
> filesystem with a block-size that does not match the device sector size.
> In theory this is not an unsupportable combination but requires a major
> rewrite of a lot of the filesystem.  Until that occurs, the filesystem
> should detect that scenario and display a helpful error message.
> 
> This scenario in particular occurred on a 512-byte blocksize FAT fs
> stored in an El-Torito boot volume on a CD-ROM (2048-byte sector size).
> 
> Additionally, in many circumstances the ->block_read method will not
> return a negative number to indicate an error but instead return 0 to
> indicate the number of blocks successfully read (IE: None).
> 
> The FAT filesystem should defensively check to ensure that it got all of
> the sectors that it asked for when reading.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> 
> --
> 
> v2: No change
> 
> ---
>  fs/fat/fat.c |   18 ++++++++++++++----
>  1 files changed, 14 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
CONSUMER NOTICE:  Because  of  the  "Uncertainty  Principle,"  It  Is
Impossible  for  the  Consumer  to  Find  Out  at  the Same Time Both
Precisely Where This Product Is and How Fast It Is Moving.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM Kyle Moffett
@ 2012-01-05 16:16   ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-01-05 16:16 UTC (permalink / raw)
  To: u-boot

Dear Kyle Moffett,

In message <1324487292-7299-4-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> When performing large bulk reads from a CD or DVD using the U-Boot
> usb_storage driver, it generates requests of up to 20 blocks at a time.
> 
> With a standard 512-byte block size, that is 10240 bytes and within the
> limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).
> 
> Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
> maximum transfer size of 40960 bytes, which does not fit.
> 
> Since the EHCI specification is impossibly obtuse and far beyond my
> comprehension, I chose to dynamically compute the limit based on the
> blocksize.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> 
> --
> 
> v2:
> Minor whitespace fixes
> 
> ---
>  common/usb_storage.c |   45 +++++++++++++++++++++++++--------------------
>  1 files changed, 25 insertions(+), 20 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"An organization dries up if you don't challenge it with growth."
       - Mark Shepherd, former President and CEO of Texas Instruments

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
  2012-01-05 16:14   ` Wolfgang Denk
@ 2012-01-05 19:12   ` Wolfgang Denk
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-01-05 19:12 UTC (permalink / raw)
  To: u-boot

Dear Kyle Moffett,

In message <1324487292-7299-2-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> The FAT filesystem code currently ends up requiring that the partition
> table be a DOS MBR, as it checks for the DOS 0x55 0xAA signature on the
> partition table (which may be Mac, EFI, ISO9660, etc) before actually
> computing the partition offset.
> 
> This fixes support for accessing a FAT filesystem in an ISO9660 boot
> volume (El-Torito format) by reordering the filesystem checks and
> reading the 0x55 0xAA "DOS boot signature" and FAT/FAT32 magic number
> from the first sector of the partition instead of from sector 0.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

Arghhhh... This causes build warnings:

fat.c: In function 'fat_register_device':
fat.c:66:15: warning: variable 'found_partition' set but not used
[-Wunused-but-set-variable]


I fix this when applying.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Bankers do it with interest (penalty for early withdrawal).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume
  2011-12-21 17:08 [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Kyle Moffett
                   ` (2 preceding siblings ...)
  2011-12-21 17:08 ` [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM Kyle Moffett
@ 2012-02-26 23:08 ` Marek Vasut
  2012-03-30 21:03   ` Wolfgang Denk
  3 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2012-02-26 23:08 UTC (permalink / raw)
  To: u-boot

> This series fixes several bugs in the FAT code and the USB storage
> stack to make it possible to read from a FAT filesystem image embedded
> as an "El-Torito boot image" in an ISO9660 volume (IE: a CD or DVD).
> 
> This has been tested on the eXMeritus HWW-1U-1A
> 
> I've addressed the review commentary on these patches and I believe
> that they should be acceptable for merging into "next" now.
> 
> Cheers,
> Kyle Moffett

Hi,

what's the status of this patch/patchset?

Thanks
M

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume
  2012-02-26 23:08 ` [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Marek Vasut
@ 2012-03-30 21:03   ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2012-03-30 21:03 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

In message <201202270008.56572.marex@denx.de> you wrote:
> > This series fixes several bugs in the FAT code and the USB storage
> > stack to make it possible to read from a FAT filesystem image embedded
> > as an "El-Torito boot image" in an ISO9660 volume (IE: a CD or DVD).
> > 
> > This has been tested on the eXMeritus HWW-1U-1A
> > 
> > I've addressed the review commentary on these patches and I believe
> > that they should be acceptable for merging into "next" now.
> > 
> > Cheers,
> > Kyle Moffett
> 
> 
> what's the status of this patch/patchset?

It has been applied long ago.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Be kind to unkind people - they need it the most.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-03-30 21:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 17:08 [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Kyle Moffett
2011-12-21 17:08 ` [U-Boot] [PATCH v2 1/3] fs/fat: Fix FAT detection to support non-DOS partition tables Kyle Moffett
2012-01-05 16:14   ` Wolfgang Denk
2012-01-05 19:12   ` Wolfgang Denk
2011-12-21 17:08 ` [U-Boot] [PATCH v2 2/3] fs/fat: Improve error handling Kyle Moffett
2012-01-05 16:15   ` Wolfgang Denk
2011-12-21 17:08 ` [U-Boot] [PATCH v2 3/3] usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM Kyle Moffett
2012-01-05 16:16   ` Wolfgang Denk
2012-02-26 23:08 ` [U-Boot] [PATCH v2 0/3] Enable access to FAT filesystem in an ISO9660 El-Torito volume Marek Vasut
2012-03-30 21:03   ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.