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 _ASM_X86_VGA_H 98c2ecf20Sopenharmony_ci#define _ASM_X86_VGA_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <asm/set_memory.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci * On the PC, we can just recalculate addresses and then 158c2ecf20Sopenharmony_ci * access the videoram directly without any black magic. 168c2ecf20Sopenharmony_ci * To support memory encryption however, we need to access 178c2ecf20Sopenharmony_ci * the videoram as decrypted memory. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define VGA_MAP_MEM(x, s) \ 218c2ecf20Sopenharmony_ci({ \ 228c2ecf20Sopenharmony_ci unsigned long start = (unsigned long)phys_to_virt(x); \ 238c2ecf20Sopenharmony_ci \ 248c2ecf20Sopenharmony_ci if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT)) \ 258c2ecf20Sopenharmony_ci set_memory_decrypted(start, (s) >> PAGE_SHIFT); \ 268c2ecf20Sopenharmony_ci \ 278c2ecf20Sopenharmony_ci start; \ 288c2ecf20Sopenharmony_ci}) 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define vga_readb(x) (*(x)) 318c2ecf20Sopenharmony_ci#define vga_writeb(x, y) (*(y) = (x)) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#endif /* _ASM_X86_VGA_H */ 34