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