[U-Boot-Users] [PATCH] ATA identity, Endian swap

Reading of ATA drive id is broken in cmd_ide.c for big endian cpu:s that are not ppc.
If I am not mistaken, the text strings should be endian swapped on big endian cpu:s, but not for little ones.
* Patch by Thomas Lange, 10 Oct 2003: Endian swap ATA identity for all big endian cpu:s, not just ppc.
/Thomas
--- u-boot-0.4.8/common/cmd_ide.c 2003-07-01 23:07:07.000000000 +0200 +++ u-boot-0.4.8_new/common/cmd_ide.c 2003-10-08 23:56:06.000000000 +0200 @@ -164,9 +164,6 @@ static uchar ide_wait (int dev, ulong t
static void __inline__ ide_outb(int dev, int port, unsigned char val); static unsigned char __inline__ ide_inb(int dev, int port); -#ifdef __PPC__ -static void input_swap_data(int dev, ulong *sect_buf, int words); -#endif static void input_data(int dev, ulong *sect_buf, int words); static void output_data(int dev, ulong *sect_buf, int words); static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); @@ -809,7 +806,13 @@ output_data_short(int dev, ulong *sect_b *pbuf = 0; } # endif /* CONFIG_AMIGAONEG3SE */ +#endif /* __PPC_ */
+/* We only need to swap data if we are running on a big endian cpu. */ +/* But Au1x00 cpu:s already swaps data in big endian mode! */ +#if defined(__LITTLE_ENDIAN) || defined(CONFIG_AU1X00) +#define input_swap_data(x,y,z) input_data(x,y,z) +#else static void input_swap_data(int dev, ulong *sect_buf, int words) { @@ -821,9 +824,7 @@ input_swap_data(int dev, ulong *sect_buf *dbuf++ = ld_le16(pbuf); } } -#else /* ! __PPC__ */ -#define input_swap_data(x,y,z) input_data(x,y,z) -#endif /* __PPC__ */ +#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
#ifdef __PPC__

In message 3F849B9F.2030403@corelatus.com you wrote:
Reading of ATA drive id is broken in cmd_ide.c for big endian cpu:s that are not ppc.
If I am not mistaken, the text strings should be endian swapped on big endian cpu:s, but not for little ones.
- Patch by Thomas Lange, 10 Oct 2003: Endian swap ATA identity for all big endian cpu:s, not just ppc.
Added, thanks. Will show up on CVS soon.
Best regards,
Wolfgang Denk
participants (2)
-
Thomas Lange
-
Wolfgang Denk