Skip to contentSkip to conversation

readb/__raw_readb/gsc_readb and ioremap

parisc-linux Matthew Wilcox 2 participants 2 messages Oct 31, 2004

lore
Share & tools
lore
#0 lore raw

I've been looking at asm/io.h (patch just committed).

I feel the need to explain a bit about what's going on because it seems a little confused.

gsc_read/writeX:
- Don't byteswap
- Can be used on raw memory addresses (ie f-space)
__raw_read/writeX:
- Don't byteswap
- Should be used on ioremap'ed address
read/writeX:
- Byteswap
- Should be used on ioremap'ed address

It was the case that __raw_readl was the same as gsc_readl, but non-parisc drivers are using __raw_readl now, so we have to change that.

At the moment, ioremap() is a nop. That really ought to change, and it's what the USE_HPPA_IOREMAP define is for. There's at least one problem with the USE_HPPA_IOREMAP code -- it doesn't byteswap.

So I've rearranged the code. Now:

gsc_readl returns the value found at the physical address. If USE_HPPA_IOREMAP is set, __raw_readl returns the value found at the virtual address. If not, it's a #define to gsc_readl. readl is a #define to byteswap the result from __raw_readl.

There's now prototypes for readX/writeX, so there's a lot of warnings to clean up. I suspect we should start by declaring parisc_device->hpa to be a void __iomem * ... or maybe we should start by inventing a parisc_iomap() interface. Anyway, maybe I'll start trying to make USE_HPPA_IOREMAP work next ...

Signature · 10 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
#1 lore raw
Quoted 6 lines · Matthew Wilcox

__raw_read/writeX:
- Don't byteswap
- Should be used on ioremap'ed address
read/writeX:
- Byteswap
- Should be used on ioremap'ed address

Willy confirmed there is another subtle difference between the two sets of functions:
__raw_read/writeX relax PCI ordering requirements. read/writeX enforce PCI Ordering requirements.

Willy correctly ignored this topic since parisc machines are strongly ordered for IO as well (so far at least).
But I didn't want folks to think byte swapping was the only difference.

Be VERY careful of using __raw_XXX forms outside of parisc specific code.

grant
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux