18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Access to VGA videoram 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * (c) 1998 Martin Mares <mj@ucw.cz> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _LINUX_ASM_VGA_H_ 98c2ecf20Sopenharmony_ci#define _LINUX_ASM_VGA_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/bug.h> 128c2ecf20Sopenharmony_ci#include <linux/string.h> 138c2ecf20Sopenharmony_ci#include <asm/types.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_RW 168c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMSETW 178c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMCPYW 188c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMMOVEW 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#undef scr_writew 218c2ecf20Sopenharmony_ci#undef scr_readw 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistatic inline void scr_writew(u16 val, u16 *addr) 248c2ecf20Sopenharmony_ci{ 258c2ecf20Sopenharmony_ci BUG_ON((long) addr >= 0); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci *addr = val; 288c2ecf20Sopenharmony_ci} 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic inline u16 scr_readw(const u16 *addr) 318c2ecf20Sopenharmony_ci{ 328c2ecf20Sopenharmony_ci BUG_ON((long) addr >= 0); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci return *addr; 358c2ecf20Sopenharmony_ci} 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic inline void scr_memsetw(u16 *p, u16 v, unsigned int n) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci BUG_ON((long) p >= 0); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci memset16(p, cpu_to_le16(v), n / 2); 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline void scr_memcpyw(u16 *d, u16 *s, unsigned int n) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci BUG_ON((long) d >= 0); 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci memcpy(d, s, n); 498c2ecf20Sopenharmony_ci} 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic inline void scr_memmovew(u16 *d, u16 *s, unsigned int n) 528c2ecf20Sopenharmony_ci{ 538c2ecf20Sopenharmony_ci BUG_ON((long) d >= 0); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci memmove(d, s, n); 568c2ecf20Sopenharmony_ci} 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define VGA_MAP_MEM(x,s) (x) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#endif 61