1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_POWERPC_VGA_H_ 3 #define _ASM_POWERPC_VGA_H_ 4 5 #ifdef __KERNEL__ 6 7 /* 8 * Access to VGA videoram 9 * 10 * (c) 1998 Martin Mares <mj@ucw.cz> 11 */ 12 13 14 #include <asm/io.h> 15 16 17 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) 18 19 #define VT_BUF_HAVE_RW 20 /* 21 * These are only needed for supporting VGA or MDA text mode, which use little 22 * endian byte ordering. 23 * In other cases, we can optimize by using native byte ordering and 24 * <linux/vt_buffer.h> has already done the right job for us. 25 */ 26 27 static inline void scr_writew(u16 val, volatile u16 *addr) 28 { 29 *addr = cpu_to_le16(val); 30 } 31 32 static inline u16 scr_readw(volatile const u16 *addr) 33 { 34 return le16_to_cpu(*addr); 35 } 36 37 #define VT_BUF_HAVE_MEMSETW 38 static inline void scr_memsetw(u16 *s, u16 v, unsigned int n) 39 { 40 memset16(s, cpu_to_le16(v), n / 2); 41 } 42 43 #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */ 44 45 #ifdef __powerpc64__ 46 #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s)) 47 #else 48 #define VGA_MAP_MEM(x,s) (x) 49 #endif 50 51 #define vga_readb(x) (*(x)) 52 #define vga_writeb(x,y) (*(y) = (x)) 53 54 #endif /* __KERNEL__ */ 55 #endif /* _ASM_POWERPC_VGA_H_ */ 56