vga.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_VGA_H_
  3. #define _ASM_POWERPC_VGA_H_
  4. #ifdef __KERNEL__
  5. /*
  6. * Access to VGA videoram
  7. *
  8. * (c) 1998 Martin Mares <[email protected]>
  9. */
  10. #include <asm/io.h>
  11. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
  12. #define VT_BUF_HAVE_RW
  13. /*
  14. * These are only needed for supporting VGA or MDA text mode, which use little
  15. * endian byte ordering.
  16. * In other cases, we can optimize by using native byte ordering and
  17. * <linux/vt_buffer.h> has already done the right job for us.
  18. */
  19. static inline void scr_writew(u16 val, volatile u16 *addr)
  20. {
  21. *addr = cpu_to_le16(val);
  22. }
  23. static inline u16 scr_readw(volatile const u16 *addr)
  24. {
  25. return le16_to_cpu(*addr);
  26. }
  27. #define VT_BUF_HAVE_MEMSETW
  28. static inline void scr_memsetw(u16 *s, u16 v, unsigned int n)
  29. {
  30. memset16(s, cpu_to_le16(v), n / 2);
  31. }
  32. #define VT_BUF_HAVE_MEMCPYW
  33. #define VT_BUF_HAVE_MEMMOVEW
  34. #define scr_memcpyw memcpy
  35. #define scr_memmovew memmove
  36. #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
  37. #ifdef __powerpc64__
  38. #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
  39. #else
  40. #define VGA_MAP_MEM(x,s) (x)
  41. #endif
  42. #define vga_readb(x) (*(x))
  43. #define vga_writeb(x,y) (*(y) = (x))
  44. #endif /* __KERNEL__ */
  45. #endif /* _ASM_POWERPC_VGA_H_ */