Skip to content

Commit 5d75315

Browse files
Al Viroarndb
authored andcommitted
alpha: sort scr_mem{cpy,move}w() out
Take scr_memmove() out of line, make both it and scr_memcpyw() conditional upon VGA_CONSOLE or MDA_CONSOLE (if neither is selected, we are certain to be working with the kernel-allocated buffer rather than VRAM and defaults will work just fine). That allows to clean vt_buffer.h, but that's a separate story Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Paul E. McKenney <paulmck@kernel.org> Acked-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent fec50db commit 5d75315

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

arch/alpha/include/asm/vga.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define VT_BUF_HAVE_RW
1414
#define VT_BUF_HAVE_MEMSETW
1515
#define VT_BUF_HAVE_MEMCPYW
16+
#define VT_BUF_HAVE_MEMMOVEW
1617

1718
static inline void scr_writew(u16 val, volatile u16 *addr)
1819
{
@@ -40,6 +41,7 @@ static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
4041

4142
/* Do not trust that the usage will be correct; analyze the arguments. */
4243
extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
44+
extern void scr_memmovew(u16 *d, const u16 *s, unsigned int count);
4345

4446
/* ??? These are currently only used for downloading character sets. As
4547
such, they don't need memory barriers. Is this all they are intended

arch/alpha/kernel/io.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ void _memset_c_io(volatile void __iomem *to, unsigned long c, long count)
647647

648648
EXPORT_SYMBOL(_memset_c_io);
649649

650+
#if IS_ENABLED(CONFIG_VGA_CONSOLE) || IS_ENABLED(CONFIG_MDA_CONSOLE)
651+
652+
#include <asm/vga.h>
653+
650654
/* A version of memcpy used by the vga console routines to move data around
651655
arbitrarily between screen and main memory. */
652656

@@ -681,6 +685,21 @@ scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
681685

682686
EXPORT_SYMBOL(scr_memcpyw);
683687

688+
void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
689+
{
690+
if (d < s)
691+
scr_memcpyw(d, s, count);
692+
else {
693+
count /= 2;
694+
d += count;
695+
s += count;
696+
while (count--)
697+
scr_writew(scr_readw(--s), --d);
698+
}
699+
}
700+
EXPORT_SYMBOL(scr_memmovew);
701+
#endif
702+
684703
void __iomem *ioport_map(unsigned long port, unsigned int size)
685704
{
686705
return IO_CONCAT(__IO_PREFIX,ioportmap) (port);

0 commit comments

Comments
 (0)