writel(), readl() in <asm-ppc/io.h>
Hi,
In <asm-ppc/io.h>, writew(), readw(), writel(), and readl() are defined to little endian access for all platforms unless either CONFIG_APUS or CONFIG_8260_PCI9 is defined.
Why? Aren't they correct in big endian systems, are they? Maybe I miss something here.
Regards,
-Shawn.
Quoted 8 lines · Shawn Jin
Hi,
In <
asm-ppc/io.h>,writew(),readw(),writel(), andreadl()are defined to little endian access for all platforms unless eitherCONFIG_APUSorCONFIG_8260_PCI9is defined.Why? Aren't they correct in big endian systems, are they? Maybe I miss something here.
I'm not sure what your qustion is but I'll take a stab at an answer. :)
read*()/write*() are accessors for PCI and PCI only. PCI is little endian. PPC is big endian. All platforms must byte swap on access to PCI memory space except in special cases. The two exceptions must byte swap in hardware. Looks like it is due to errata in the 8260 PCI bridge case. APUS is probably byte swapping in hardware because APUS is simply odd.
-Matt
Quoted 1 line
read*()/write*() are accessors for PCI and PCI only. PCI is little
If read*()/write*() are designed for PCI access only as you claimed, that explains why they call in/out_leXX() funcitons.
The problem is that read*()/write*() are misused in some places, e.g., serial drivers such as serial8250. The serial_in() and serial_out() call read*() and write*() respectively. So what's your recommendation in such a case?
Regards,
-Shawn.
Quoted 9 lines · Shawn Jin
Quoted 1 line
read*()/write*() are accessors for PCI and PCI only. PCI is little
If read*()/write*() are designed for PCI access only as you claimed, that explains why they call in/out_leXX() funcitons.
The problem is that read*()/write*() are misused in some places, e.g., serial drivers such as serial8250. The
serial_in()andserial_out()call read*() and write*() respectively. So what's your recommendation in such a case?
Why do you think this is a problem? Why do you think they are misused? Please explain.
FYI, there _are_ serial PCI cards.
Signature · 1 line
Eugene
Quoted 7 lines
Quoted 4 lines
The problem is that read*()/write*() are misused in some places, e.g., serial drivers such as serial8250. The
serial_in()andserial_out()call read*() and write*() respectively. So what's your recommendation in such a case?=20
Why do you think this is a problem? Why do you think they are misused? Please explain.
IMHO, serial_in() and serial_out() should be able to handle all the possilbilities. But the current implementation cannot achieve this by simply calling read*() and write*() in the case that UART control registers are 32-bit or 16-bit wide and can only be acessed in 32/16 bits in some big endian systems. As Matt pointed out before, read*() and write*() are designed for PCI access only.
Regards,
-Shawn.
Quoted 9 lines · Shawn Jin
Quoted 1 line
read*()/write*() are accessors for PCI and PCI only. PCI is little
If read*()/write*() are designed for PCI access only as you claimed, that explains why they call in/out_leXX() funcitons.
The problem is that read*()/write*() are misused in some places, e.g., serial drivers such as serial8250. The
serial_in()andserial_out()call read*() and write*() respectively. So what's your recommendation in such a case?
Keep misusing them. There's no generic accessors for memory mapped I/O. People just started using them in generic drivers because they are convenient. I use the the __raw_read*() for non byte swapped access (or in/outbe32() depending on my memory barrier requirements.
Also, portions of the 8250 serial driver using readl/writel are assuming that the serial port in on PCI or other little endian bus. readb/writeb usage doesn't matter in that driver.
-Matt
Quoted 9 lines · Shawn Jin
Quoted 1 line
read*()/write*() are accessors for PCI and PCI only. PCI is little
If read*()/write*() are designed for PCI access only as you claimed, that explains why they call in/out_leXX() funcitons.
The problem is that read*()/write*() are misused in some places, e.g., serial drivers such as serial8250. The
serial_in()andserial_out()call read*() and write*() respectively. So what's your recommendation in such a case?
See here for the gory details:
http://lwn.net/Articles/102232/
http://lwn.net/Articles/132804/
Arthur
Quoted 1 line
This is what exactly I want. Thanks for the URL.
-Shawn.