Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
linuxppc@jdl.com | 8b22cc0 | 2005-09-20 14:32:37 -0500 | [diff] [blame] | 2 | #ifndef _ASM_POWERPC_VGA_H_ |
| 3 | #define _ASM_POWERPC_VGA_H_ |
| 4 | |
| 5 | #ifdef __KERNEL__ |
| 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | /* |
| 8 | * Access to VGA videoram |
| 9 | * |
| 10 | * (c) 1998 Martin Mares <mj@ucw.cz> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| 14 | #include <asm/io.h> |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | { |
David Gibson | f571872 | 2015-02-03 16:36:21 +1100 | [diff] [blame] | 29 | *addr = cpu_to_le16(val); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | static inline u16 scr_readw(volatile const u16 *addr) |
| 33 | { |
David Gibson | f571872 | 2015-02-03 16:36:21 +1100 | [diff] [blame] | 34 | return le16_to_cpu(*addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Matthew Wilcox | ac036f9 | 2017-09-08 16:14:15 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #define VT_BUF_HAVE_MEMCPYW |
Matthew Wilcox | ac036f9 | 2017-09-08 16:14:15 -0700 | [diff] [blame] | 44 | #define VT_BUF_HAVE_MEMMOVEW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #define scr_memcpyw memcpy |
Matthew Wilcox | ac036f9 | 2017-09-08 16:14:15 -0700 | [diff] [blame] | 46 | #define scr_memmovew memmove |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */ |
| 49 | |
linuxppc@jdl.com | 8b22cc0 | 2005-09-20 14:32:37 -0500 | [diff] [blame] | 50 | #ifdef __powerpc64__ |
Bjorn Helgaas | 4f1bcaf | 2006-06-22 14:47:32 -0700 | [diff] [blame] | 51 | #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s)) |
linuxppc@jdl.com | 8b22cc0 | 2005-09-20 14:32:37 -0500 | [diff] [blame] | 52 | #else |
Michael Ellerman | e88f157 | 2014-10-27 20:56:14 +1100 | [diff] [blame] | 53 | #define VGA_MAP_MEM(x,s) (x) |
linuxppc@jdl.com | 8b22cc0 | 2005-09-20 14:32:37 -0500 | [diff] [blame] | 54 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | #define vga_readb(x) (*(x)) |
| 57 | #define vga_writeb(x,y) (*(y) = (x)) |
| 58 | |
linuxppc@jdl.com | 8b22cc0 | 2005-09-20 14:32:37 -0500 | [diff] [blame] | 59 | #endif /* __KERNEL__ */ |
| 60 | #endif /* _ASM_POWERPC_VGA_H_ */ |