blob: fcf721682a7119f0fa8f90560939a78d7da559c2 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
linuxppc@jdl.com8b22cc02005-09-20 14:32:37 -05002#ifndef _ASM_POWERPC_VGA_H_
3#define _ASM_POWERPC_VGA_H_
4
5#ifdef __KERNEL__
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007/*
8 * Access to VGA videoram
9 *
10 * (c) 1998 Martin Mares <mj@ucw.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14#include <asm/io.h>
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
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
27static inline void scr_writew(u16 val, volatile u16 *addr)
28{
David Gibsonf5718722015-02-03 16:36:21 +110029 *addr = cpu_to_le16(val);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030}
31
32static inline u16 scr_readw(volatile const u16 *addr)
33{
David Gibsonf5718722015-02-03 16:36:21 +110034 return le16_to_cpu(*addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070035}
36
Matthew Wilcoxac036f92017-09-08 16:14:15 -070037#define VT_BUF_HAVE_MEMSETW
38static inline void scr_memsetw(u16 *s, u16 v, unsigned int n)
39{
40 memset16(s, cpu_to_le16(v), n / 2);
41}
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#define VT_BUF_HAVE_MEMCPYW
Matthew Wilcoxac036f92017-09-08 16:14:15 -070044#define VT_BUF_HAVE_MEMMOVEW
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#define scr_memcpyw memcpy
Matthew Wilcoxac036f92017-09-08 16:14:15 -070046#define scr_memmovew memmove
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
49
linuxppc@jdl.com8b22cc02005-09-20 14:32:37 -050050#ifdef __powerpc64__
Bjorn Helgaas4f1bcaf2006-06-22 14:47:32 -070051#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
linuxppc@jdl.com8b22cc02005-09-20 14:32:37 -050052#else
Michael Ellermane88f1572014-10-27 20:56:14 +110053#define VGA_MAP_MEM(x,s) (x)
linuxppc@jdl.com8b22cc02005-09-20 14:32:37 -050054#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
56#define vga_readb(x) (*(x))
57#define vga_writeb(x,y) (*(y) = (x))
58
linuxppc@jdl.com8b22cc02005-09-20 14:32:37 -050059#endif /* __KERNEL__ */
60#endif /* _ASM_POWERPC_VGA_H_ */