Skip to contentSkip to conversation

fix ide-iops for big endian archs

PATCH Pete Zaitcev 3 participants 4 messages Sep 25, 2002 – Sep 26, 2002 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines

From: "Benjamin Herrenschmidt" <[email protected]>
Date: Wed, 25 Sep 2002 14:32:23 +0200

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.

Dunno about ppc, but sparc works just fine as it is in 2.4. When was the last time you examined include/asm-sparc/ide.h?

IDE uses ide_insw instead of plain insw specifically to resolve this kind of issue, and you are trying to defeat the mechanism designed to help you. I smell a fish here.

-- Pete

#2 lore raw

From: Pete Zaitcev <[email protected]>
Date: Wed, 25 Sep 2002 14:19:46 -0400

IDE uses ide_insw instead of plain insw specifically to resolve this kind of issue, and you are trying to defeat the mechanism designed to help you. I smell a fish here.

They're trying to abstract out as much as possible in 2.5.x, maybe a bit too much :-)

#4 lore raw
In reply to Pete Zaitcev
Quoted 7 lines
Quoted 4 lines

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.

Dunno about ppc, but sparc works just fine as it is in 2.4. When was the last time you examined include/asm-sparc/ide.h?

I'm talking about 2.4-ac with the new IDE code, not Marcelo 2.4.

Quoted 3 lines

IDE uses ide_insw instead of plain insw specifically to resolve this kind of issue, and you are trying to defeat the mechanism designed to help you. I smell a fish here.

Again, I'm talking about the new layer. In this, the iops functions are no longer macros defined by include/asm*/ide.h, but are now function pointers inside the hwif structure (so we can now deal with real MMIO or CPU register based IDE without playing macro tricks in asm*/ide.h).

The problem resides in the default implementation of those iops in the new ide-iops.c file, which currently re-implements insw as a loop of IN_WORD, which usually translates to inw, and thus would cause incorrect endianness.

My patch fixes that. Ultimately, we want to completely get rid of the uppercase {IN,OUT}{BYTE,WORD,LONG} macros though.

The principle is that ide-iops.c will provide reasonable "default" ops for PIO (and MMIO if my next patch gets in), any "different" interface can provide it's own ops, and you keep the ability to mix different kind of interfaces on the same machine (like an embeded CPU-register based interface _and_ a PCI based interface using different iops).

Ben.

#3 lore raw
In reply to David S. Miller
Quoted 6 lines

IDE uses ide_insw instead of plain insw specifically to resolve this kind of issue, and you are trying to defeat the mechanism designed to help you. I smell a fish here.

They're trying to abstract out as much as possible in 2.5.x, maybe a bit too much :-)

Well, no, we are changing the abstraction but didn't quite yet remove rests of the old one ;)

Ben.