vga.h 740 B

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