Re: [PATCH] fix ide-iops for big endian archs

Benjamin Herrenschmidt
2002-09-26T09:12:07Z

>
>On Wed, 25 Sep 2002, Benjamin Herrenschmidt wrote:
>> --- 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
>
>If insw is correct on big-endian, then it sure as hell should be correct
>on little-endian. I don't understand why we wouldn't use insw on PC's,
>since it's smaller and much more traditional.

Well, i'm pretty sure it is, though I didn't want to post a patch
affecting what currently work, I prefer letting you or other
x86 addicts figure that out :)

In the case of ide_inswp though, there is a real problem as there
is no equivalent of the "p" functions on non-x86 anyway, and you
can't easily reproduce the "insw" semantics with {in,out}{w,l}
without adding useless double-byteswap on BE. But on the other
hand, the IDE layer doesn't use ide_inswp() callback, and the
case where "p" functions are used is currently broken on BE
as well (see ide_{input,output}_data when drive->slow is true).

I suggest that you get this patch in asap (eventually swithing
to insw unconditionally in ide_insw) so at least 2.5 works again
properly on BE, further cleanup of the iops is pending, I'm waiting
for Alan own experiments before I push again my own that remove
all "p" iops and all of the {IN,OUT}{BYTE,WORD,LONG} macros.

Ben.