Commit 8af57f8b authored by Stuart Menefy's avatar Stuart Menefy Committed by Paul Mundt

sh: generic_in/outs{bwl} optimizations.

After performing the port2addr conversion, and checking that the data is
correctly aligned, simply call __raw_readsX/writesX. These have already been
optimised.
Signed-off-by: default avatarStuart Menefy <stuart.menefy@st.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 7d9c0351
...@@ -73,35 +73,19 @@ u32 generic_inl_p(unsigned long port) ...@@ -73,35 +73,19 @@ u32 generic_inl_p(unsigned long port)
void generic_insb(unsigned long port, void *dst, unsigned long count) void generic_insb(unsigned long port, void *dst, unsigned long count)
{ {
volatile u8 *port_addr; __raw_readsb(__ioport_map(port, 1), dst, count);
u8 *buf = dst; dummy_read();
port_addr = (volatile u8 __force *)__ioport_map(port, 1);
while (count--)
*buf++ = *port_addr;
} }
void generic_insw(unsigned long port, void *dst, unsigned long count) void generic_insw(unsigned long port, void *dst, unsigned long count)
{ {
volatile u16 *port_addr; __raw_readsw(__ioport_map(port, 2), dst, count);
u16 *buf = dst;
port_addr = (volatile u16 __force *)__ioport_map(port, 2);
while (count--)
*buf++ = *port_addr;
dummy_read(); dummy_read();
} }
void generic_insl(unsigned long port, void *dst, unsigned long count) void generic_insl(unsigned long port, void *dst, unsigned long count)
{ {
volatile u32 *port_addr; __raw_readsl(__ioport_map(port, 4), dst, count);
u32 *buf = dst;
port_addr = (volatile u32 __force *)__ioport_map(port, 4);
while (count--)
*buf++ = *port_addr;
dummy_read(); dummy_read();
} }
...@@ -145,37 +129,19 @@ void generic_outl_p(u32 b, unsigned long port) ...@@ -145,37 +129,19 @@ void generic_outl_p(u32 b, unsigned long port)
*/ */
void generic_outsb(unsigned long port, const void *src, unsigned long count) void generic_outsb(unsigned long port, const void *src, unsigned long count)
{ {
volatile u8 *port_addr; __raw_writesb(__ioport_map(port, 1), src, count);
const u8 *buf = src; dummy_read();
port_addr = (volatile u8 __force *)__ioport_map(port, 1);
while (count--)
*port_addr = *buf++;
} }
void generic_outsw(unsigned long port, const void *src, unsigned long count) void generic_outsw(unsigned long port, const void *src, unsigned long count)
{ {
volatile u16 *port_addr; __raw_writesw(__ioport_map(port, 2), src, count);
const u16 *buf = src;
port_addr = (volatile u16 __force *)__ioport_map(port, 2);
while (count--)
*port_addr = *buf++;
dummy_read(); dummy_read();
} }
void generic_outsl(unsigned long port, const void *src, unsigned long count) void generic_outsl(unsigned long port, const void *src, unsigned long count)
{ {
volatile u32 *port_addr; __raw_writesl(__ioport_map(port, 4), src, count);
const u32 *buf = src;
port_addr = (volatile u32 __force *)__ioport_map(port, 4);
while (count--)
*port_addr = *buf++;
dummy_read(); dummy_read();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment