The IDE driver can use 32-bit addresses in LBA mode, in which case it 
spits multiple warnings during compilation. Fix them.

Signed-off-by: Guennadi Liakhovetski <[EMAIL PROTECTED]>

---

On Mon, 28 Apr 2008, Wolfgang Denk wrote:

> In message <[EMAIL PROTECTED]> you wrote:
> > This patch is based on the port by Mihai Georgian (see linkstation.c for 
> > Copyright information) and implements support for LinkStation / KuroBox HD 
> > and HG PPC models from Buffalo Technology, whereby HD is deactivated at 
> > the moment, pending network driver fixing.
> 
> The code throws a lot of compiler warnings:
> 
> ===== LOG/linkstation_HGLAN =====
> cmd_ide.c: In function 'ide_read':
> cmd_ide.c:1267: warning: integer constant is too large for 'long' type
> cmd_ide.c:1321: warning: right shift count >= width of type
> cmd_ide.c:1322: warning: right shift count >= width of type
> cmd_ide.c: In function 'ide_write':
> cmd_ide.c:1386: warning: integer constant is too large for 'long' type
> cmd_ide.c:1411: warning: right shift count >= width of type
> cmd_ide.c:1412: warning: right shift count >= width of type

I think, these have been there for a while, in any case, patch below. 
Haven't found an IDE custodian.

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 8ace970..a3ba353 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -1264,7 +1264,7 @@ ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, 
void *buffer)
 #ifdef CONFIG_LBA48
        unsigned char lba48 = 0;
 
-       if (blknr & 0x0000fffff0000000) {
+       if (blknr & 0x0000fffff0000000ULL) {
                /* more than 28 bits used, use 48bit mode */
                lba48 = 1;
        }
@@ -1318,8 +1318,13 @@ ulong ide_read (int device, lbaint_t blknr, ulong 
blkcnt, void *buffer)
                        /* write high bits */
                        ide_outb (device, ATA_SECT_CNT, 0);
                        ide_outb (device, ATA_LBA_LOW,  (blknr >> 24) & 0xFF);
+#ifdef CFG_64BIT_LBA
                        ide_outb (device, ATA_LBA_MID,  (blknr >> 32) & 0xFF);
                        ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
+#else
+                       ide_outb (device, ATA_LBA_MID,  0);
+                       ide_outb (device, ATA_LBA_HIGH, 0);
+#endif
                }
 #endif
                ide_outb (device, ATA_SECT_CNT, 1);
@@ -1383,7 +1388,7 @@ ulong ide_write (int device, lbaint_t blknr, ulong 
blkcnt, void *buffer)
 #ifdef CONFIG_LBA48
        unsigned char lba48 = 0;
 
-       if (blknr & 0x0000fffff0000000) {
+       if (blknr & 0x0000fffff0000000ULL) {
                /* more than 28 bits used, use 48bit mode */
                lba48 = 1;
        }
@@ -1408,8 +1413,13 @@ ulong ide_write (int device, lbaint_t blknr, ulong 
blkcnt, void *buffer)
                        /* write high bits */
                        ide_outb (device, ATA_SECT_CNT, 0);
                        ide_outb (device, ATA_LBA_LOW,  (blknr >> 24) & 0xFF);
+#ifdef CFG_64BIT_LBA
                        ide_outb (device, ATA_LBA_MID,  (blknr >> 32) & 0xFF);
                        ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
+#else
+                       ide_outb (device, ATA_LBA_MID,  0);
+                       ide_outb (device, ATA_LBA_HIGH, 0);
+#endif
                }
 #endif
                ide_outb (device, ATA_SECT_CNT, 1);

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to