linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix ide-iops for big endian archs
@ 2002-09-25 12:32 Benjamin Herrenschmidt
  2002-09-25 18:22 ` Linus Torvalds
  2002-09-26 15:09 ` Alan Cox
  0 siblings, 2 replies; 14+ messages in thread
From: Benjamin Herrenschmidt @ 2002-09-25 12:32 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox
  Cc: Andre Hedrick, Linux Kernel Mailing List, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

Curently in 2.5 (afaik in -ac too), the ide-iops "s" routines used
to transfer datas in/out the data port are incorrect for big endian
machines. They are implemented with a loop of inw/outw which are
byteswapping, but a fifo transfer like that mustn't be swapped.

Here's a patch against current 2.5 (that should apply to 2.4 -ac too)
that fixes those with a #define for now. I have done some further
cleanup of the iops (removing the {IN,OUT}{BYTE,WORD,LONG} macros
and removing the "P" iops from the hwif structure) too, but Alan
didn't accept those yet.

I enclosed the patch as an attachement too in case the mailer screws
it up...


===== drivers/ide/ide-iops.c 1.1 vs edited =====
--- 1.1/drivers/ide/ide-iops.c	Wed Sep 11 08:54:11 2002
+++ edited/drivers/ide/ide-iops.c	Wed Sep 25 14:19:58 2002
@@ -54,12 +54,20 @@
 
 static inline void ide_insw (u32 port, void *addr, u32 count)
 {
+#ifdef __BIG_ENDIAN
+	insw(port, addr, count);
+#else	
 	while (count--) { *(u16 *)addr = IN_WORD(port); addr += 2; }
+#endif	
 }
 
 static inline void ide_insw_p (u32 port, void *addr, u32 count)
 {
-	while (count--) { *(u16 *)addr = IN_WORD_P(port); addr += 2; }
+#ifdef __BIG_ENDIAN
+	insw(port, addr, count);
+#else	
+	while (count--) { *(u16 *)addr = IN_WORD(port); addr += 2; }
+#endif	
 }
 
 static inline u32 ide_inl (u32 port)
@@ -106,12 +114,20 @@
 
 static inline void ide_outsw (u32 port, void *addr, u32 count)
 {
+#ifdef __BIG_ENDIAN
+	outsw(port, addr, count);
+#else
 	while (count--) { OUT_WORD(*(u16 *)addr, port); addr += 2; }
+#endif
 }
 
 static inline void ide_outsw_p (u32 port, void *addr, u32 count)
 {
+#ifdef __BIG_ENDIAN
+	outsw(port, addr, count);
+#else
 	while (count--) { OUT_WORD_P(*(u16 *)addr, port); addr += 2; }
+#endif
 }
 
 static inline void ide_outl (u32 addr, u32 port)

[-- Attachment #2: ide-fix.diff --]
[-- Type: application/text, Size: 1165 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <mailman.1032957359.10217.linux-kernel2news@redhat.com>]

end of thread, other threads:[~2002-09-26 21:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-25 12:32 [PATCH] fix ide-iops for big endian archs Benjamin Herrenschmidt
2002-09-25 18:22 ` Linus Torvalds
2002-09-25 22:44   ` Benjamin Herrenschmidt
2002-09-26 15:11     ` Alan Cox
2002-09-26 15:16       ` Benjamin Herrenschmidt
2002-09-26 16:04       ` Benjamin Herrenschmidt
2002-09-26 15:09 ` Alan Cox
2002-09-26 15:14   ` Benjamin Herrenschmidt
2002-09-26 20:58     ` Richard Zidlicky
2002-09-26 21:03       ` Benjamin Herrenschmidt
     [not found] <mailman.1032957359.10217.linux-kernel2news@redhat.com>
2002-09-25 18:19 ` Pete Zaitcev
2002-09-25 19:57   ` David S. Miller
2002-09-25 22:49     ` Benjamin Herrenschmidt
2002-09-25 22:48   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).