xref: /openbmc/linux/arch/x86/include/asm/vga.h (revision 711aab1d)
1 /*
2  *	Access to VGA videoram
3  *
4  *	(c) 1998 Martin Mares <mj@ucw.cz>
5  */
6 
7 #ifndef _ASM_X86_VGA_H
8 #define _ASM_X86_VGA_H
9 
10 #include <asm/set_memory.h>
11 
12 /*
13  *	On the PC, we can just recalculate addresses and then
14  *	access the videoram directly without any black magic.
15  *	To support memory encryption however, we need to access
16  *	the videoram as decrypted memory.
17  */
18 
19 #define VGA_MAP_MEM(x, s)					\
20 ({								\
21 	unsigned long start = (unsigned long)phys_to_virt(x);	\
22 								\
23 	if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))			\
24 		set_memory_decrypted(start, (s) >> PAGE_SHIFT);	\
25 								\
26 	start;							\
27 })
28 
29 #define vga_readb(x) (*(x))
30 #define vga_writeb(x, y) (*(y) = (x))
31 
32 #endif /* _ASM_X86_VGA_H */
33