From: "Benjamin Herrenschmidt" <benh@kernel.crashing.org>
To: "Linus Torvalds" <torvalds@transmeta.com>,
"Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Andre Hedrick" <andre@linux-ide.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Jens Axboe" <axboe@suse.de>
Subject: [PATCH] fix ide-iops for big endian archs
Date: Wed, 25 Sep 2002 14:32:23 +0200 [thread overview]
Message-ID: <20020925123223.16082@192.168.4.1> (raw)
[-- 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 --]
next reply other threads:[~2002-09-25 12:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-25 12:32 Benjamin Herrenschmidt [this message]
2002-09-25 18:22 ` [PATCH] fix ide-iops for big endian archs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020925123223.16082@192.168.4.1 \
--to=benh@kernel.crashing.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andre@linux-ide.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).