1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *	Access to VGA videoram
4 *
5 *	(c) 1998 Martin Mares <mj@ucw.cz>
6 */
7
8#ifndef _LINUX_ASM_VGA_H_
9#define _LINUX_ASM_VGA_H_
10
11#include <linux/bug.h>
12#include <linux/string.h>
13#include <asm/types.h>
14
15#define VT_BUF_HAVE_RW
16#define VT_BUF_HAVE_MEMSETW
17#define VT_BUF_HAVE_MEMCPYW
18#define VT_BUF_HAVE_MEMMOVEW
19
20#undef scr_writew
21#undef scr_readw
22
23static inline void scr_writew(u16 val, u16 *addr)
24{
25	BUG_ON((long) addr >= 0);
26
27	*addr = val;
28}
29
30static inline u16 scr_readw(const u16 *addr)
31{
32	BUG_ON((long) addr >= 0);
33
34	return *addr;
35}
36
37static inline void scr_memsetw(u16 *p, u16 v, unsigned int n)
38{
39	BUG_ON((long) p >= 0);
40
41	memset16(p, cpu_to_le16(v), n / 2);
42}
43
44static inline void scr_memcpyw(u16 *d, u16 *s, unsigned int n)
45{
46	BUG_ON((long) d >= 0);
47
48	memcpy(d, s, n);
49}
50
51static inline void scr_memmovew(u16 *d, u16 *s, unsigned int n)
52{
53	BUG_ON((long) d >= 0);
54
55	memmove(d, s, n);
56}
57
58#define VGA_MAP_MEM(x,s) (x)
59
60#endif
61