* ioremap() and CONFIG_SWAP_IO_SPACE
@ 2004-08-25 9:30 Thomas Koeller
2004-08-25 9:32 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Koeller @ 2004-08-25 9:30 UTC (permalink / raw)
To: linux-mips
Hi,
my platform (PMC-Sierra Yosemite in big endian mode),
like many others, uses ioremap() to map device
registers, such as the RM9000's OCD registers.
To access those registers, the return value of
ioremap() is casted to a suitable pointer type and
dereferenced. This of course works, but the return
value of ioremap() is documented not to be a
directly dereferenceable pointer value, and accesses
to ioremapped addresses should be performed using
the readx/writex APIs.
I therefore decided to straighten this out and use those
APIs throughout, but that did not work. The platform
defines 'CONFIG_SWAP_IO_SPACE=y', which causes all
accesses through readx/writex to be byte-swapped. That
is not really appropriate, as the registers are in big
endian order. I therefore tried to change that setting
in yosemite_defconfig, only to find that every time
I do 'make oldconfig' it returns to its original
value of 'y'.
So here are my questions:
1. Am I right to conclude that the platform configuration
should not set CONFIG_SWAP_IO_SPACE, or am I missing
something?
2. What is the mechanism that causes that setting to
always revert to enabled when doing 'make oldconfig'?
How do I avoid that?
thanks,
Thomas
--
--------------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
thomas dot koeller at baslerweb dot com
http://www.baslerweb.com
==============================
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioremap() and CONFIG_SWAP_IO_SPACE
2004-08-25 9:30 ioremap() and CONFIG_SWAP_IO_SPACE Thomas Koeller
@ 2004-08-25 9:32 ` Geert Uytterhoeven
2004-10-19 10:45 ` Thomas Koeller
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2004-08-25 9:32 UTC (permalink / raw)
To: Thomas Koeller; +Cc: Linux/MIPS Development
On Wed, 25 Aug 2004, Thomas Koeller wrote:
> my platform (PMC-Sierra Yosemite in big endian mode),
> like many others, uses ioremap() to map device
> registers, such as the RM9000's OCD registers.
> To access those registers, the return value of
> ioremap() is casted to a suitable pointer type and
> dereferenced. This of course works, but the return
> value of ioremap() is documented not to be a
> directly dereferenceable pointer value, and accesses
> to ioremapped addresses should be performed using
> the readx/writex APIs.
In theory, ioremap() and readb() and friends are meant for PCI memory space
only. RM9000's OCD registers are not PCI memory space, so there's no strict
guarantee readb() and friends will actually work.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioremap() and CONFIG_SWAP_IO_SPACE
2004-08-25 9:32 ` Geert Uytterhoeven
@ 2004-10-19 10:45 ` Thomas Koeller
2004-10-19 18:31 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Koeller @ 2004-10-19 10:45 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-mips
On Wednesday 25 August 2004 11:32, Geert Uytterhoeven wrote:
> On Wed, 25 Aug 2004, Thomas Koeller wrote:
> > my platform (PMC-Sierra Yosemite in big endian mode),
> > like many others, uses ioremap() to map device
> > registers, such as the RM9000's OCD registers.
> > To access those registers, the return value of
> > ioremap() is casted to a suitable pointer type and
> > dereferenced. This of course works, but the return
> > value of ioremap() is documented not to be a
> > directly dereferenceable pointer value, and accesses
> > to ioremapped addresses should be performed using
> > the readx/writex APIs.
>
> In theory, ioremap() and readb() and friends are meant for PCI memory space
> only. RM9000's OCD registers are not PCI memory space, so there's no strict
> guarantee readb() and friends will actually work.
>
Well, the ioremap() man page uses the term 'bus memory';
there is no reference to PCI at all. I guess there could
be multiple buses on one machine with different byte swapping
requirements? There is also an article written by alan cox
(http://www.kernelnewbies.org/documents/kdoc/deviceiobook.pdf)
that describes ioremap() as a general mechanism of accessing
memory-mapped io devices, with no reference to PCI at all.
Anyway, if ioremap() and readx()/writex() are for PCI memory
access only, how am I supposed to access memory-mapped io
devices that are not on a PCI bus?
Thomas
--
--------------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany
Tel +49 (4102) 463-390
Fax +49 (4102) 463-46390
mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com
==============================
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioremap() and CONFIG_SWAP_IO_SPACE
2004-10-19 10:45 ` Thomas Koeller
@ 2004-10-19 18:31 ` Ralf Baechle
2004-10-20 8:47 ` Thomas Koeller
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2004-10-19 18:31 UTC (permalink / raw)
To: Thomas Koeller; +Cc: Geert Uytterhoeven, linux-mips
On Tue, Oct 19, 2004 at 12:45:59PM +0200, Thomas Koeller wrote:
> Well, the ioremap() man page uses the term 'bus memory';
> there is no reference to PCI at all. I guess there could
> be multiple buses on one machine with different byte swapping
> requirements? There is also an article written by alan cox
> (http://www.kernelnewbies.org/documents/kdoc/deviceiobook.pdf)
> that describes ioremap() as a general mechanism of accessing
> memory-mapped io devices, with no reference to PCI at all.
>
> Anyway, if ioremap() and readx()/writex() are for PCI memory
> access only, how am I supposed to access memory-mapped io
> devices that are not on a PCI bus?
If the standard readX() / writeX() functions don't suffice for some reason
then a bus specific versions in a separate header file are needed.
An example are the ISA versions. For compatibility with super old
versions from before ioremap or where things on i386 at least seemed to
work without ioremap a special isa_readX() / isa_writeX() is supplied.
Again for compatibility reasons these macros are defined in <asm/io.h>,
not in a separate header file.
> Basler Vision Technologies
> An der Strusbek 60-62
> 22926 Ahrensburg
> Germany
Oh, not in Basel :-)
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioremap() and CONFIG_SWAP_IO_SPACE
2004-10-19 18:31 ` Ralf Baechle
@ 2004-10-20 8:47 ` Thomas Koeller
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Koeller @ 2004-10-20 8:47 UTC (permalink / raw)
To: linux-mips
On Tuesday 19 October 2004 20:31, Ralf Baechle wrote:
>
> If the standard readX() / writeX() functions don't suffice for some reason
> then a bus specific versions in a separate header file are needed.
>
So I guess I will have to create something like ocd_readl()/ocd_writel().
> An example are the ISA versions. For compatibility with super old
> versions from before ioremap or where things on i386 at least seemed to
> work without ioremap a special isa_readX() / isa_writeX() is supplied.
> Again for compatibility reasons these macros are defined in <asm/io.h>,
> not in a separate header file.
>
Much confusion could be avoided, then, if readX()/writeX() were name
pci_readX()/pci_writeX(), and, of course, CONFIG_SWAP_IO_SPACE were
named CONFIG_SWAP_PCI_SPACE.
Thomas
--
--------------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
thomas dot koeller at baslerweb dot com
http://www.baslerweb.com
==============================
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-10-20 8:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-25 9:30 ioremap() and CONFIG_SWAP_IO_SPACE Thomas Koeller
2004-08-25 9:32 ` Geert Uytterhoeven
2004-10-19 10:45 ` Thomas Koeller
2004-10-19 18:31 ` Ralf Baechle
2004-10-20 8:47 ` Thomas Koeller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.