Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  Access to VGA videoram
0004  *
0005  *  (c) 1998 Martin Mares <mj@ucw.cz>
0006  */
0007 
0008 #ifndef _ASM_X86_VGA_H
0009 #define _ASM_X86_VGA_H
0010 
0011 #include <asm/set_memory.h>
0012 
0013 /*
0014  *  On the PC, we can just recalculate addresses and then
0015  *  access the videoram directly without any black magic.
0016  *  To support memory encryption however, we need to access
0017  *  the videoram as decrypted memory.
0018  */
0019 
0020 #define VGA_MAP_MEM(x, s)                   \
0021 ({                              \
0022     unsigned long start = (unsigned long)phys_to_virt(x);   \
0023                                 \
0024     if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))         \
0025         set_memory_decrypted(start, (s) >> PAGE_SHIFT); \
0026                                 \
0027     start;                          \
0028 })
0029 
0030 #define vga_readb(x) (*(x))
0031 #define vga_writeb(x, y) (*(y) = (x))
0032 
0033 #endif /* _ASM_X86_VGA_H */