Skip to contentSkip to conversation

Fix bugs in cmd_ide.c and cmd_scsi.c

PATCH New Denis Peter 2 participants 3 messages Mar 29, 2007 – Apr 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bugs in cmd_ide.c and cmd_scsi.c

Hello Wolfgang,

Quoted 8 lines · you

Dear Denis,

Quoted 2 lines · in message <[email protected]> you wrote:

Fix bugs in cmd_ide.c and scsi_cmd.c.

I tried to apply this patch but IO cannot because it has been mangled by your mailer - it wraps long lines.

I'm sorry, here the patch with correct mailer settings (hopefully)

with best regards,
Denis

Fix bugs in cmd_ide.c and scsi_cmd.c.

These bugs prevented to read/write more than one block from/to IDE drives, and didn't allow to use "diskboot" and "scsiboot" to boot from another device than device 0.

 common/cmd_ide.c  |    9 ++++++---
 common/cmd_scsi.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
common/cmd_ide.c +6 -3
index 2e185cc..ba984c3 100644
@@ -423,7 +423,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                }
                part = simple_strtoul(++ep, NULL, 16);
        }
-       if (get_partition_info (ide_dev_desc, part, &info)) {
+       if (get_partition_info (&ide_dev_desc[dev], part, &info)) {
+               printf ("error reading partinfo\n");
                SHOW_BOOT_PROGRESS (-1);
                return 1;
        }
@@ -1233,8 +1234,9 @@ static void ide_ident (block_dev_desc_t *dev_desc)
 
 /* ------------------------------------------------------------------------- */
 
-ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
+ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *vbuffer)
 {
+       ulong *buffer = (ulong *)vbuffer;
        ulong n = 0;
        unsigned char c;
        unsigned char pwrsave=0; /* power save */
@@ -1353,8 +1355,9 @@ IDE_READ_E:
 /* ------------------------------------------------------------------------- */
 
 
-ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
+ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *vbuffer)
 {
+       ulong *buffer = (ulong *)vbuffer;
        ulong n = 0;
        unsigned char c;
 #ifdef CONFIG_LBA48
common/cmd_scsi.c +1 -1
index da36ed9..00b84fa 100644
@@ -248,7 +248,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                }
                part = simple_strtoul(++ep, NULL, 16);
        }
-       if (get_partition_info (scsi_dev_desc, part, &info)) {
+       if (get_partition_info (&scsi_dev_desc[dev], part, &info)) {
                printf("error reading partinfo\n");
                return 1;
        }
#1 lore raw

PATCH 1/1 Fix bugs in cmd_ide.c and cmd_scsi.c

Quoted 2 lines · In message <[email protected]> you wrote:

I'm sorry, here the patch with correct mailer settings (hopefully)

Doesn't work for me either:

-> git am -3 -i -u /tmp/patch
Commit Body is:
--------------------------
Fix bugs in cmd_ide.c and cmd_scsi.c

These bugs prevented to read/write more than one block from/to IDE drives, and didn't allow to use "diskboot" and "scsiboot" to boot from another device than device 0.

 common/cmd_ide.c  |    9 ++++++---
 common/cmd_scsi.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y

Applying 'Fix bugs in cmd_ide.c and cmd_scsi.c'

error: patch failed: common/cmd_ide.c:423
error: common/cmd_ide.c: patch does not apply
error: patch failed: common/cmd_scsi.c:248
error: common/cmd_scsi.c: patch does not apply
Using index info to reconstruct a base tree...
error: patch failed: common/cmd_ide.c:423
error: common/cmd_ide.c: patch does not apply
error: patch failed: common/cmd_scsi.c:248
error: common/cmd_scsi.c: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001.
When you have resolved this problem run "git-am -i -3 --resolved". If you would prefer to skip this patch, instead run "git-am -i -3 --skip".

Same when I try to apply your patch manually:

-> patch -p1 --dry-run </tmp/patch
patching file common/cmd_ide.c
Hunk #1 FAILED at 423.
Hunk #2 FAILED at 1234.
Hunk #3 FAILED at 1355.
3 out of 3 hunks FAILED -- saving rejects to file common/cmd_ide.c.rej patching file common/cmd_scsi.c
Hunk #1 FAILED at 248.
1 out of 1 hunk FAILED -- saving rejects to file common/cmd_scsi.c.rej

Ah, I think you have also white space corrupted, i. e. spaces instead of tabs.

FIX YOUR MAILER!!!

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Brain: an apparatus with which we think we think.    - Ambrose Bierce
#2 lore raw

PATCH 1/1 Fix bugs in cmd_ide.c and cmd_scsi.c

Quoted 4 lines · you

In message <[email protected]> you wrote:

Doesn't work for me either:
...<snip>...

I'm sorry again. Changed my environment and tested the patch twice.

With best regards,

Denis

Fix bugs in cmd_ide.c and cmd_scsi.c

These bugs prevented to read/write more than one block from/to IDE drives, and didn't allow to use "diskboot" and "scsiboot" to boot from another device than device 0.

 common/cmd_ide.c  |    9 ++++++---
 common/cmd_scsi.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
common/cmd_ide.c +6 -3
index 2e185cc..3bce1eb 100644
@@ -423,7 +423,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		}
 		part = simple_strtoul(++ep, NULL, 16);
 	}
-	if (get_partition_info (ide_dev_desc, part, &info)) {
+	if (get_partition_info (&ide_dev_desc[dev], part, &info)) {
+		puts ("error reading partinfo\n");
 		SHOW_BOOT_PROGRESS (-1);
 		return 1;
 	}
@@ -1233,8 +1234,9 @@ static void ide_ident (block_dev_desc_t *dev_desc)
 
 /* ------------------------------------------------------------------------- */
 
-ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
+ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *vbuffer)
 {
+	ulong *buffer = (ulong *) vbuffer;
 	ulong n = 0;
 	unsigned char c;
 	unsigned char pwrsave=0; /* power save */
@@ -1353,8 +1355,9 @@ IDE_READ_E:
 /* ------------------------------------------------------------------------- */
 
 
-ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
+ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *vbuffer)
 {
+	ulong *buffer = (ulong *) vbuffer;
 	ulong n = 0;
 	unsigned char c;
 #ifdef CONFIG_LBA48
common/cmd_scsi.c +1 -1
index da36ed9..00b84fa 100644
@@ -248,7 +248,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		}
 		part = simple_strtoul(++ep, NULL, 16);
 	}
-	if (get_partition_info (scsi_dev_desc, part, &info)) {
+	if (get_partition_info (&scsi_dev_desc[dev], part, &info)) {
 		printf("error reading partinfo\n");
 		return 1;
 	}