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#ifndef _ASM_VGA_H 88c2ecf20Sopenharmony_ci#define _ASM_VGA_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/string.h> 118c2ecf20Sopenharmony_ci#include <asm/addrspace.h> 128c2ecf20Sopenharmony_ci#include <asm/byteorder.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* 158c2ecf20Sopenharmony_ci * On the PC, we can just recalculate addresses and then 168c2ecf20Sopenharmony_ci * access the videoram directly without any black magic. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define VGA_MAP_MEM(x, s) CKSEG1ADDR(0x10000000L + (unsigned long)(x)) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define vga_readb(x) (*(x)) 228c2ecf20Sopenharmony_ci#define vga_writeb(x, y) (*(y) = (x)) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_RW 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * These are only needed for supporting VGA or MDA text mode, which use little 278c2ecf20Sopenharmony_ci * endian byte ordering. 288c2ecf20Sopenharmony_ci * In other cases, we can optimize by using native byte ordering and 298c2ecf20Sopenharmony_ci * <linux/vt_buffer.h> has already done the right job for us. 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#undef scr_writew 338c2ecf20Sopenharmony_ci#undef scr_readw 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic inline void scr_writew(u16 val, volatile u16 *addr) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci *addr = cpu_to_le16(val); 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistatic inline u16 scr_readw(volatile const u16 *addr) 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci return le16_to_cpu(*addr); 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic inline void scr_memsetw(u16 *s, u16 v, unsigned int count) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci memset16(s, cpu_to_le16(v), count / 2); 488c2ecf20Sopenharmony_ci} 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define scr_memcpyw(d, s, c) memcpy(d, s, c) 518c2ecf20Sopenharmony_ci#define scr_memmovew(d, s, c) memmove(d, s, c) 528c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMCPYW 538c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMMOVEW 548c2ecf20Sopenharmony_ci#define VT_BUF_HAVE_MEMSETW 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#endif /* _ASM_VGA_H */ 57