Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_POWERPC_VGA_H_
0003 #define _ASM_POWERPC_VGA_H_
0004 
0005 #ifdef __KERNEL__
0006 
0007 /*
0008  *  Access to VGA videoram
0009  *
0010  *  (c) 1998 Martin Mares <mj@ucw.cz>
0011  */
0012 
0013 
0014 #include <asm/io.h>
0015 
0016 
0017 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
0018 
0019 #define VT_BUF_HAVE_RW
0020 /*
0021  *  These are only needed for supporting VGA or MDA text mode, which use little
0022  *  endian byte ordering.
0023  *  In other cases, we can optimize by using native byte ordering and
0024  *  <linux/vt_buffer.h> has already done the right job for us.
0025  */
0026 
0027 static inline void scr_writew(u16 val, volatile u16 *addr)
0028 {
0029     *addr = cpu_to_le16(val);
0030 }
0031 
0032 static inline u16 scr_readw(volatile const u16 *addr)
0033 {
0034     return le16_to_cpu(*addr);
0035 }
0036 
0037 #define VT_BUF_HAVE_MEMSETW
0038 static inline void scr_memsetw(u16 *s, u16 v, unsigned int n)
0039 {
0040     memset16(s, cpu_to_le16(v), n / 2);
0041 }
0042 
0043 #define VT_BUF_HAVE_MEMCPYW
0044 #define VT_BUF_HAVE_MEMMOVEW
0045 #define scr_memcpyw memcpy
0046 #define scr_memmovew    memmove
0047 
0048 #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
0049 
0050 #ifdef __powerpc64__
0051 #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
0052 #else
0053 #define VGA_MAP_MEM(x,s) (x)
0054 #endif
0055 
0056 #define vga_readb(x) (*(x))
0057 #define vga_writeb(x,y) (*(y) = (x))
0058 
0059 #endif  /* __KERNEL__ */
0060 #endif  /* _ASM_POWERPC_VGA_H_ */