All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation
@ 2010-09-13  9:17 Lei Wen
  2010-09-13  9:17 ` [U-Boot] [PATCH 2/2] mmc: print out avaible partition table Lei Wen
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-13  9:17 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 drivers/mmc/mmc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..42638f6 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 
 	blklen = mmc->write_bl_len;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		puts("operation exceed mmc boundary..\n"
+		     "This devices only have 0x%x blocks\n", mmc->block_dev.lba);
+		return 0;
+	}
 	err = mmc_set_blocklen(mmc, mmc->write_bl_len);
 
 	if (err) {
@@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 	if (!mmc)
 		return 0;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		puts("operation exceed mmc boundary..\n"
+		     "This devices only have 0x%x blocks\n", mmc->block_dev.lba);
+		return 0;
+	}
 	/* We always do full block reads from the card */
 	err = mmc_set_blocklen(mmc, mmc->read_bl_len);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH 2/2] mmc: print out avaible partition table
  2010-09-13  9:17 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
@ 2010-09-13  9:17 ` Lei Wen
  2010-09-13  9:47 ` [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Wolfgang Denk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-13  9:17 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 common/cmd_mmc.c |   20 ++++++++++++++++++++
 disk/part.c      |    3 +++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index c0b30d8..437dd88 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -154,6 +154,25 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			mmc_init(mmc);
 
 			return 0;
+		} else if (strncmp(argv[1], "part", 4) == 0) {
+			int dev = simple_strtoul(argv[2], NULL, 10);
+			block_dev_desc_t *mmc_dev;
+			struct mmc *mmc = find_mmc_device(dev);
+
+			if (!mmc) {
+				puts("no mmc devices available\n");
+				return 1;
+			}
+			mmc_init(mmc);
+			mmc_dev = mmc_get_dev(dev);
+			if (mmc_dev != NULL &&
+			    mmc_dev->type != DEV_TYPE_UNKNOWN) {
+				print_part(mmc_dev);
+				return 0;
+			}
+
+			puts("get mmc type error!\n");
+			return 1;
 		}
 
 	case 0:
@@ -230,5 +249,6 @@ U_BOOT_CMD(
 	"read <device num> addr blk# cnt\n"
 	"mmc write <device num> addr blk# cnt\n"
 	"mmc rescan <device num>\n"
+	"mmc part <device num>- lists avaiable partition on mmc\n"
 	"mmc list - lists available devices");
 #endif
diff --git a/disk/part.c b/disk/part.c
index 3ba88c7..1806fe6 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -364,6 +364,9 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
 	case IF_TYPE_DOC:
 		puts ("DOC");
 		break;
+	case IF_TYPE_MMC:
+		puts ("MMC");
+		break;
 	default:
 		puts ("UNKNOWN");
 		break;
-- 
1.7.0.4

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

* [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation
  2010-09-13  9:17 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
  2010-09-13  9:17 ` [U-Boot] [PATCH 2/2] mmc: print out avaible partition table Lei Wen
@ 2010-09-13  9:47 ` Wolfgang Denk
  2010-09-13 11:54 ` [U-Boot] [PATCH 1/2 V2] " Lei Wen
  2010-09-13 11:54 ` [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table Lei Wen
  3 siblings, 0 replies; 20+ messages in thread
From: Wolfgang Denk @ 2010-09-13  9:47 UTC (permalink / raw)
  To: u-boot

Dear Lei Wen,

when posting new versions of patches, please always

1) make sure the messages are properly threaded, i. e. make sure to
   provide proper references to the previous postings;
   "git send-email" asks for the message ID.
2) show in the Subject that tthios is a new version of the patch (for
   example by using "[PATCH 1/2 v2]", and add (in the comment section,
   i. e. below the "---" line, a description of what was changed
   respective to the previous version(s).

Thanks.

In message <1284369459-29997-1-git-send-email-leiwen@marvell.com> you wrote:
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
>  drivers/mmc/mmc.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index cf4ea16..42638f6 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
>  
>  	blklen = mmc->write_bl_len;
>  
> +	if ((start + blkcnt) > mmc->block_dev.lba) {
> +		puts("operation exceed mmc boundary..\n"
> +		     "This devices only have 0x%x blocks\n", mmc->block_dev.lba);

puts() does not perform output formatting. You want printf() here (and
below).

Also, try to use a shorter message, for example:

	printf("MMC: block number 0x%x = %d exceeds max (0x%x = %d)", ...);


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
"Beauty is transitory." "Beauty survives."
	-- Spock and Kirk, "That Which Survives", stardate unknown

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

* [U-Boot] [PATCH 1/2 V2] mmc: add boundary check for mmc operation
  2010-09-13  9:17 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
  2010-09-13  9:17 ` [U-Boot] [PATCH 2/2] mmc: print out avaible partition table Lei Wen
  2010-09-13  9:47 ` [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Wolfgang Denk
@ 2010-09-13 11:54 ` Lei Wen
  2010-09-13 13:40   ` Sergei Shtylyov
  2010-09-13 11:54 ` [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table Lei Wen
  3 siblings, 1 reply; 20+ messages in thread
From: Lei Wen @ 2010-09-13 11:54 UTC (permalink / raw)
  To: u-boot

Change log:
change the puts to printf to better formating.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 drivers/mmc/mmc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..42638f6 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 
 	blklen = mmc->write_bl_len;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		printf("MMC: block number 0x%x exceeds max(0x%x)",
+			start + blkcnt, mmc->block_dev.lba);
+		return 0;
+	}
 	err = mmc_set_blocklen(mmc, mmc->write_bl_len);
 
 	if (err) {
@@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 	if (!mmc)
 		return 0;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		printf("MMC: block number 0x%x exceeds max(0x%x)",
+			start + blkcnt, mmc->block_dev.lba);
+		return 0;
+	}
 	/* We always do full block reads from the card */
 	err = mmc_set_blocklen(mmc, mmc->read_bl_len);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table
  2010-09-13  9:17 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
                   ` (2 preceding siblings ...)
  2010-09-13 11:54 ` [U-Boot] [PATCH 1/2 V2] " Lei Wen
@ 2010-09-13 11:54 ` Lei Wen
  2010-09-13 13:41   ` Sergei Shtylyov
  3 siblings, 1 reply; 20+ messages in thread
From: Lei Wen @ 2010-09-13 11:54 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 common/cmd_mmc.c |   20 ++++++++++++++++++++
 disk/part.c      |    3 +++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index c0b30d8..437dd88 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -154,6 +154,25 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			mmc_init(mmc);
 
 			return 0;
+		} else if (strncmp(argv[1], "part", 4) == 0) {
+			int dev = simple_strtoul(argv[2], NULL, 10);
+			block_dev_desc_t *mmc_dev;
+			struct mmc *mmc = find_mmc_device(dev);
+
+			if (!mmc) {
+				puts("no mmc devices available\n");
+				return 1;
+			}
+			mmc_init(mmc);
+			mmc_dev = mmc_get_dev(dev);
+			if (mmc_dev != NULL &&
+			    mmc_dev->type != DEV_TYPE_UNKNOWN) {
+				print_part(mmc_dev);
+				return 0;
+			}
+
+			puts("get mmc type error!\n");
+			return 1;
 		}
 
 	case 0:
@@ -230,5 +249,6 @@ U_BOOT_CMD(
 	"read <device num> addr blk# cnt\n"
 	"mmc write <device num> addr blk# cnt\n"
 	"mmc rescan <device num>\n"
+	"mmc part <device num>- lists avaiable partition on mmc\n"
 	"mmc list - lists available devices");
 #endif
diff --git a/disk/part.c b/disk/part.c
index 3ba88c7..1806fe6 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -364,6 +364,9 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
 	case IF_TYPE_DOC:
 		puts ("DOC");
 		break;
+	case IF_TYPE_MMC:
+		puts ("MMC");
+		break;
 	default:
 		puts ("UNKNOWN");
 		break;
-- 
1.7.0.4

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

* [U-Boot] [PATCH 1/2 V2] mmc: add boundary check for mmc operation
  2010-09-13 11:54 ` [U-Boot] [PATCH 1/2 V2] " Lei Wen
@ 2010-09-13 13:40   ` Sergei Shtylyov
  2010-09-13 14:03     ` Lei Wen
  0 siblings, 1 reply; 20+ messages in thread
From: Sergei Shtylyov @ 2010-09-13 13:40 UTC (permalink / raw)
  To: u-boot

Hello.

Lei Wen wrote:

> Change log:
> change the puts to printf to better formating.

    This change log should have followed the "---" tear-line.

> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---

WBR, Sergei

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

* [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table
  2010-09-13 11:54 ` [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table Lei Wen
@ 2010-09-13 13:41   ` Sergei Shtylyov
  2010-09-13 14:03     ` Lei Wen
                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Sergei Shtylyov @ 2010-09-13 13:41 UTC (permalink / raw)
  To: u-boot

Hello.

Lei Wen wrote:

> Signed-off-by: Lei Wen <leiwen@marvell.com>
[...]

> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index c0b30d8..437dd88 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
[...]
> @@ -230,5 +249,6 @@ U_BOOT_CMD(
>  	"read <device num> addr blk# cnt\n"
>  	"mmc write <device num> addr blk# cnt\n"
>  	"mmc rescan <device num>\n"
> +	"mmc part <device num>- lists avaiable partition on mmc\n"

    Space is surely needed after <device num>.

WBR, Sergei

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

* [U-Boot] [PATCH 1/2 V2] mmc: add boundary check for mmc operation
  2010-09-13 13:40   ` Sergei Shtylyov
@ 2010-09-13 14:03     ` Lei Wen
  0 siblings, 0 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-13 14:03 UTC (permalink / raw)
  To: u-boot

Fix in V3..

Thanks,
Lei

On Mon, Sep 13, 2010 at 9:40 PM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:
> Hello.
>
> Lei Wen wrote:
>
>> Change log:
>> change the puts to printf to better formating.
>
> ? This change log should have followed the "---" tear-line.
>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>> ---
>
> WBR, Sergei
>

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

* [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table
  2010-09-13 13:41   ` Sergei Shtylyov
@ 2010-09-13 14:03     ` Lei Wen
  2010-09-13 14:07     ` [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation Lei Wen
  2010-09-13 14:07     ` [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table Lei Wen
  2 siblings, 0 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-13 14:03 UTC (permalink / raw)
  To: u-boot

Fixed in V3.

Thanks,
Lei

On Mon, Sep 13, 2010 at 9:41 PM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:
> Hello.
>
> Lei Wen wrote:
>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>
> [...]
>
>> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
>> index c0b30d8..437dd88 100644
>> --- a/common/cmd_mmc.c
>> +++ b/common/cmd_mmc.c
>
> [...]
>>
>> @@ -230,5 +249,6 @@ U_BOOT_CMD(
>> ? ? ? ?"read <device num> addr blk# cnt\n"
>> ? ? ? ?"mmc write <device num> addr blk# cnt\n"
>> ? ? ? ?"mmc rescan <device num>\n"
>> + ? ? ? "mmc part <device num>- lists avaiable partition on mmc\n"
>
> ? Space is surely needed after <device num>.
>
> WBR, Sergei
>

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-13 13:41   ` Sergei Shtylyov
  2010-09-13 14:03     ` Lei Wen
@ 2010-09-13 14:07     ` Lei Wen
  2010-09-17  3:22       ` Lei Wen
  2010-09-18 21:46       ` Wolfgang Denk
  2010-09-13 14:07     ` [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table Lei Wen
  2 siblings, 2 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-13 14:07 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Lei Wen <leiwen@marvell.com>
---
V2:
Change log:
change the puts to printf to better formating.

 drivers/mmc/mmc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..23928c1 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 
 	blklen = mmc->write_bl_len;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		printf("MMC: block number 0x%x exceeds max(0x%x)",
+			start + blkcnt, mmc->block_dev.lba);
+		return 0;
+	}
 	err = mmc_set_blocklen(mmc, mmc->write_bl_len);
 
 	if (err) {
@@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 	if (!mmc)
 		return 0;
 
+	if ((start + blkcnt) > mmc->block_dev.lba) {
+		printf("MMC: block number 0x%x exceeds max(0x%x)",
+			start + blkcnt, mmc->block_dev.lba);
+		return 0;
+	}
 	/* We always do full block reads from the card */
 	err = mmc_set_blocklen(mmc, mmc->read_bl_len);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table
  2010-09-13 13:41   ` Sergei Shtylyov
  2010-09-13 14:03     ` Lei Wen
  2010-09-13 14:07     ` [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation Lei Wen
@ 2010-09-13 14:07     ` Lei Wen
  2010-09-18 21:47       ` Wolfgang Denk
  2 siblings, 1 reply; 20+ messages in thread
From: Lei Wen @ 2010-09-13 14:07 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
V3: add additional space after <device num>

 common/cmd_mmc.c |   20 ++++++++++++++++++++
 disk/part.c      |    3 +++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index c0b30d8..45924e3 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -154,6 +154,25 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			mmc_init(mmc);
 
 			return 0;
+		} else if (strncmp(argv[1], "part", 4) == 0) {
+			int dev = simple_strtoul(argv[2], NULL, 10);
+			block_dev_desc_t *mmc_dev;
+			struct mmc *mmc = find_mmc_device(dev);
+
+			if (!mmc) {
+				puts("no mmc devices available\n");
+				return 1;
+			}
+			mmc_init(mmc);
+			mmc_dev = mmc_get_dev(dev);
+			if (mmc_dev != NULL &&
+			    mmc_dev->type != DEV_TYPE_UNKNOWN) {
+				print_part(mmc_dev);
+				return 0;
+			}
+
+			puts("get mmc type error!\n");
+			return 1;
 		}
 
 	case 0:
@@ -230,5 +249,6 @@ U_BOOT_CMD(
 	"read <device num> addr blk# cnt\n"
 	"mmc write <device num> addr blk# cnt\n"
 	"mmc rescan <device num>\n"
+	"mmc part <device num> - lists available partition on mmc\n"
 	"mmc list - lists available devices");
 #endif
diff --git a/disk/part.c b/disk/part.c
index 3ba88c7..1806fe6 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -364,6 +364,9 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
 	case IF_TYPE_DOC:
 		puts ("DOC");
 		break;
+	case IF_TYPE_MMC:
+		puts ("MMC");
+		break;
 	default:
 		puts ("UNKNOWN");
 		break;
-- 
1.7.0.4

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-13 14:07     ` [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation Lei Wen
@ 2010-09-17  3:22       ` Lei Wen
  2010-09-18 13:01         ` Lei Wen
  2010-09-18 21:46       ` Wolfgang Denk
  1 sibling, 1 reply; 20+ messages in thread
From: Lei Wen @ 2010-09-17  3:22 UTC (permalink / raw)
  To: u-boot

Hi,

Is it ok now for merging....?

Thanks,
Lei

On Mon, Sep 13, 2010 at 10:07 PM, Lei Wen <leiwen@marvell.com> wrote:
>
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
> V2:
> Change log:
> change the puts to printf to better formating.
>
> ?drivers/mmc/mmc.c | ? 10 ++++++++++
> ?1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index cf4ea16..23928c1 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
>
> ? ? ? ?blklen = mmc->write_bl_len;
>
> + ? ? ? if ((start + blkcnt) > mmc->block_dev.lba) {
> + ? ? ? ? ? ? ? printf("MMC: block number 0x%x exceeds max(0x%x)",
> + ? ? ? ? ? ? ? ? ? ? ? start + blkcnt, mmc->block_dev.lba);
> + ? ? ? ? ? ? ? return 0;
> + ? ? ? }
> ? ? ? ?err = mmc_set_blocklen(mmc, mmc->write_bl_len);
>
> ? ? ? ?if (err) {
> @@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
> ? ? ? ?if (!mmc)
> ? ? ? ? ? ? ? ?return 0;
>
> + ? ? ? if ((start + blkcnt) > mmc->block_dev.lba) {
> + ? ? ? ? ? ? ? printf("MMC: block number 0x%x exceeds max(0x%x)",
> + ? ? ? ? ? ? ? ? ? ? ? start + blkcnt, mmc->block_dev.lba);
> + ? ? ? ? ? ? ? return 0;
> + ? ? ? }
> ? ? ? ?/* We always do full block reads from the card */
> ? ? ? ?err = mmc_set_blocklen(mmc, mmc->read_bl_len);
>
> --
> 1.7.0.4
>
>

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-17  3:22       ` Lei Wen
@ 2010-09-18 13:01         ` Lei Wen
  0 siblings, 0 replies; 20+ messages in thread
From: Lei Wen @ 2010-09-18 13:01 UTC (permalink / raw)
  To: u-boot

Continue ping...

Best regards,
Lei

On Fri, Sep 17, 2010 at 11:22 AM, Lei Wen <adrian.wenl@gmail.com> wrote:
> Hi,
>
> Is it ok now for merging....?
>
> Thanks,
> Lei
>
> On Mon, Sep 13, 2010 at 10:07 PM, Lei Wen <leiwen@marvell.com> wrote:
>>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>> ---
>> V2:
>> Change log:
>> change the puts to printf to better formating.
>>
>> ?drivers/mmc/mmc.c | ? 10 ++++++++++
>> ?1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index cf4ea16..23928c1 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
>>
>> ? ? ? ?blklen = mmc->write_bl_len;
>>
>> + ? ? ? if ((start + blkcnt) > mmc->block_dev.lba) {
>> + ? ? ? ? ? ? ? printf("MMC: block number 0x%x exceeds max(0x%x)",
>> + ? ? ? ? ? ? ? ? ? ? ? start + blkcnt, mmc->block_dev.lba);
>> + ? ? ? ? ? ? ? return 0;
>> + ? ? ? }
>> ? ? ? ?err = mmc_set_blocklen(mmc, mmc->write_bl_len);
>>
>> ? ? ? ?if (err) {
>> @@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
>> ? ? ? ?if (!mmc)
>> ? ? ? ? ? ? ? ?return 0;
>>
>> + ? ? ? if ((start + blkcnt) > mmc->block_dev.lba) {
>> + ? ? ? ? ? ? ? printf("MMC: block number 0x%x exceeds max(0x%x)",
>> + ? ? ? ? ? ? ? ? ? ? ? start + blkcnt, mmc->block_dev.lba);
>> + ? ? ? ? ? ? ? return 0;
>> + ? ? ? }
>> ? ? ? ?/* We always do full block reads from the card */
>> ? ? ? ?err = mmc_set_blocklen(mmc, mmc->read_bl_len);
>>
>> --
>> 1.7.0.4
>>
>>
>

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-13 14:07     ` [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation Lei Wen
  2010-09-17  3:22       ` Lei Wen
@ 2010-09-18 21:46       ` Wolfgang Denk
  2010-09-20 10:39         ` Ghorai, Sukumar
  1 sibling, 1 reply; 20+ messages in thread
From: Wolfgang Denk @ 2010-09-18 21:46 UTC (permalink / raw)
  To: u-boot

Dear Lei Wen,

In message <1284386848-4670-1-git-send-email-leiwen@marvell.com> you wrote:
> 
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
> V2:
> Change log:
> change the puts to printf to better formating.
> 
>  drivers/mmc/mmc.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 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
Intel's new motto: United we stand. Divided we fall!

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

* [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table
  2010-09-13 14:07     ` [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table Lei Wen
@ 2010-09-18 21:47       ` Wolfgang Denk
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfgang Denk @ 2010-09-18 21:47 UTC (permalink / raw)
  To: u-boot

Dear Lei Wen,

In message <1284386848-4670-2-git-send-email-leiwen@marvell.com> you wrote:
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
> V3: add additional space after <device num>
> 
>  common/cmd_mmc.c |   20 ++++++++++++++++++++
>  disk/part.c      |    3 +++
>  2 files changed, 23 insertions(+), 0 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
Ninety-Ninety Rule of Project Schedules:
        The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-18 21:46       ` Wolfgang Denk
@ 2010-09-20 10:39         ` Ghorai, Sukumar
  2010-09-20 12:59           ` Lei Wen
  0 siblings, 1 reply; 20+ messages in thread
From: Ghorai, Sukumar @ 2010-09-20 10:39 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de]
> On Behalf Of Wolfgang Denk
> Sent: Sunday, September 19, 2010 3:17 AM
> To: Lei Wen
> Cc: u-boot at lists.denx.de; sshtylyov at mvista.com
> Subject: Re: [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc
> operation
> 
> Dear Lei Wen,
> 
> In message <1284386848-4670-1-git-send-email-leiwen@marvell.com> you
> wrote:
> >
> > Signed-off-by: Lei Wen <leiwen@marvell.com>
> > ---
> > V2:
> > Change log:
> > change the puts to printf to better formating.
> >
> >  drivers/mmc/mmc.c |   10 ++++++++++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> Applied, thanks.

[Ghorai] I was using the latest mmc/sd core for OMAP 4 and getting the following error. 
OMAP4430 SDP # mmc rescan 1
MMC: block number 0x1 exceeds max(0x0)OMAP4430 SDP #

Please let me know what I am missing.

> 
> 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
> Intel's new motto: United we stand. Divided we fall!
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-20 10:39         ` Ghorai, Sukumar
@ 2010-09-20 12:59           ` Lei Wen
  2010-09-20 13:28             ` Ghorai, Sukumar
  0 siblings, 1 reply; 20+ messages in thread
From: Lei Wen @ 2010-09-20 12:59 UTC (permalink / raw)
  To: u-boot

Hi Ghorai,

>
> [Ghorai] I was using the latest mmc/sd core for OMAP 4 and getting the following error.
> OMAP4430 SDP # mmc rescan 1
> MMC: block number 0x1 exceeds max(0x0)OMAP4430 SDP #
>
> Please let me know what I am missing.
>

I also test the latest code, and don't find the issue you report...
What would happen when you type "mmcinfo 1"? Seems your mmc card is
not init properly.

Best regards,
Lei

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-20 12:59           ` Lei Wen
@ 2010-09-20 13:28             ` Ghorai, Sukumar
  2010-10-12 19:20               ` Wolfgang Denk
  0 siblings, 1 reply; 20+ messages in thread
From: Ghorai, Sukumar @ 2010-09-20 13:28 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Lei Wen [mailto:adrian.wenl at gmail.com]
> Sent: Monday, September 20, 2010 6:29 PM
> To: Ghorai, Sukumar
> Cc: Wolfgang Denk; Lei Wen; u-boot at lists.denx.de; sshtylyov at mvista.com
> Subject: Re: [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc
> operation
> 
> Hi Ghorai,
> 
> >
> > [Ghorai] I was using the latest mmc/sd core for OMAP 4 and getting the
> following error.
> > OMAP4430 SDP # mmc rescan 1
> > MMC: block number 0x1 exceeds max(0x0)OMAP4430 SDP #
> >
> > Please let me know what I am missing.
[Ghorai] Thanks. 
I found the problem. It's a eMMC size calculation is wrong and here is the fix I am sending as a patch too in my next email.

From: Sukumar Ghorai <s-ghorai@ti.com>
Date: Mon, 20 Sep 2010 18:29:29 +0530
Subject: [PATCH 1/3] fix for eMMC capacity calculation

  capacity of the eMMC device available in ext-CSD register only

Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com>
---
drivers/mmc/mmc.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 80cd9bf..c543d83 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -627,6 +627,7 @@ int mmc_startup(struct mmc *mmc)
 	uint mult, freq;
 	u64 cmult, csize;
 	struct mmc_cmd cmd;
+	char ext_csd[512];
 
 	/* Put the Card in Identify Mode */
 	cmd.cmdidx = MMC_CMD_ALL_SEND_CID;
@@ -742,6 +743,16 @@ int mmc_startup(struct mmc *mmc)
 	if (err)
 		return err;
 
+	if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
+		/* check  ext_csd version and capacity */
+		err = mmc_send_ext_csd(mmc, ext_csd);
+		if (!err & (ext_csd[192] >= 2)) {
+			mmc->capacity = ext_csd[212] << 0 | ext_csd[213] << 8 |
+					ext_csd[214] << 16 | ext_csd[215] << 24;
+			mmc->capacity *= 512;
+		}
+	}
+
 	if (IS_SD(mmc))
 		err = sd_change_freq(mmc);
 	else
-- 
1.7.0.4
> >
> 
> I also test the latest code, and don't find the issue you report...
> What would happen when you type "mmcinfo 1"? Seems your mmc card is
> not init properly.
> 
> Best regards,
> Lei

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-09-20 13:28             ` Ghorai, Sukumar
@ 2010-10-12 19:20               ` Wolfgang Denk
  2010-10-12 19:48                 ` Ghorai, Sukumar
  0 siblings, 1 reply; 20+ messages in thread
From: Wolfgang Denk @ 2010-10-12 19:20 UTC (permalink / raw)
  To: u-boot

Dear Andy,

In message <2A3DCF3DA181AD40BDE86A3150B27B6B031606272A@dbde02.ent.ti.com> Sukumar Ghorai wrote:
...
> I found the problem. It's a eMMC size calculation is wrong and here is the
> fix I am sending as a patch too in my next email.
>
> From: Sukumar Ghorai <s-ghorai@ti.com>
> Date: Mon, 20 Sep 2010 18:29:29 +0530
> Subject: [PATCH 1/3] fix for eMMC capacity calculation
>
>   capacity of the eMMC device available in ext-CSD register only
>
> Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com>
> ---
> drivers/mmc/mmc.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)

Is this patch on your queue?

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
"Here's a fish hangs in the net like a poor man's right in  the  law.
'Twill hardly come out."     - Shakespeare, Pericles, Act II, Scene 1

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

* [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
  2010-10-12 19:20               ` Wolfgang Denk
@ 2010-10-12 19:48                 ` Ghorai, Sukumar
  0 siblings, 0 replies; 20+ messages in thread
From: Ghorai, Sukumar @ 2010-10-12 19:48 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de]
> Sent: Wednesday, October 13, 2010 12:51 AM
> To: Andy Fleming; Ghorai, Sukumar
> Cc: Lei Wen; Lei Wen; u-boot at lists.denx.de; sshtylyov at mvista.com
> Subject: Re: [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc
> operation
> 
> Dear Andy,
> 
> In message <2A3DCF3DA181AD40BDE86A3150B27B6B031606272A@dbde02.ent.ti.com>
> Sukumar Ghorai wrote:
> ...
> > I found the problem. It's a eMMC size calculation is wrong and here is
> the
> > fix I am sending as a patch too in my next email.
> >
> > From: Sukumar Ghorai <s-ghorai@ti.com>
> > Date: Mon, 20 Sep 2010 18:29:29 +0530
> > Subject: [PATCH 1/3] fix for eMMC capacity calculation
> >
> >   capacity of the eMMC device available in ext-CSD register only
> >
> > Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com>
> > ---
> > drivers/mmc/mmc.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> Is this patch on your queue?
[Ghorai] 
This has been submitted by Steve Sakoman sometime back.
http://www.mail-archive.com/u-boot at lists.denx.de/msg38692.html

> 
> 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
> "Here's a fish hangs in the net like a poor man's right in  the  law.
> 'Twill hardly come out."     - Shakespeare, Pericles, Act II, Scene 1

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

end of thread, other threads:[~2010-10-12 19:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-13  9:17 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
2010-09-13  9:17 ` [U-Boot] [PATCH 2/2] mmc: print out avaible partition table Lei Wen
2010-09-13  9:47 ` [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Wolfgang Denk
2010-09-13 11:54 ` [U-Boot] [PATCH 1/2 V2] " Lei Wen
2010-09-13 13:40   ` Sergei Shtylyov
2010-09-13 14:03     ` Lei Wen
2010-09-13 11:54 ` [U-Boot] [PATCH 2/2 V2] mmc: print out avaible partition table Lei Wen
2010-09-13 13:41   ` Sergei Shtylyov
2010-09-13 14:03     ` Lei Wen
2010-09-13 14:07     ` [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation Lei Wen
2010-09-17  3:22       ` Lei Wen
2010-09-18 13:01         ` Lei Wen
2010-09-18 21:46       ` Wolfgang Denk
2010-09-20 10:39         ` Ghorai, Sukumar
2010-09-20 12:59           ` Lei Wen
2010-09-20 13:28             ` Ghorai, Sukumar
2010-10-12 19:20               ` Wolfgang Denk
2010-10-12 19:48                 ` Ghorai, Sukumar
2010-09-13 14:07     ` [U-Boot] [PATCH 2/2 V3] mmc: print out avaible partition table Lei Wen
2010-09-18 21:47       ` 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.