svga.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef _LINUX_SVGA_H
  2. #define _LINUX_SVGA_H
  3. #ifdef __KERNEL__
  4. #include <linux/pci.h>
  5. #include <video/vga.h>
  6. /* Terminator for register set */
  7. #define VGA_REGSET_END_VAL 0xFF
  8. #define VGA_REGSET_END {VGA_REGSET_END_VAL, 0, 0}
  9. struct vga_regset {
  10. u8 regnum;
  11. u8 lowbit;
  12. u8 highbit;
  13. };
  14. /* ------------------------------------------------------------------------- */
  15. #define SVGA_FORMAT_END_VAL 0xFFFF
  16. #define SVGA_FORMAT_END {SVGA_FORMAT_END_VAL, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, 0, 0, 0, 0, 0, 0}
  17. struct svga_fb_format {
  18. /* var part */
  19. u32 bits_per_pixel;
  20. struct fb_bitfield red;
  21. struct fb_bitfield green;
  22. struct fb_bitfield blue;
  23. struct fb_bitfield transp;
  24. u32 nonstd;
  25. /* fix part */
  26. u32 type;
  27. u32 type_aux;
  28. u32 visual;
  29. u32 xpanstep;
  30. u32 xresstep;
  31. };
  32. struct svga_timing_regs {
  33. const struct vga_regset *h_total_regs;
  34. const struct vga_regset *h_display_regs;
  35. const struct vga_regset *h_blank_start_regs;
  36. const struct vga_regset *h_blank_end_regs;
  37. const struct vga_regset *h_sync_start_regs;
  38. const struct vga_regset *h_sync_end_regs;
  39. const struct vga_regset *v_total_regs;
  40. const struct vga_regset *v_display_regs;
  41. const struct vga_regset *v_blank_start_regs;
  42. const struct vga_regset *v_blank_end_regs;
  43. const struct vga_regset *v_sync_start_regs;
  44. const struct vga_regset *v_sync_end_regs;
  45. };
  46. struct svga_pll {
  47. u16 m_min;
  48. u16 m_max;
  49. u16 n_min;
  50. u16 n_max;
  51. u16 r_min;
  52. u16 r_max; /* r_max < 32 */
  53. u32 f_vco_min;
  54. u32 f_vco_max;
  55. u32 f_base;
  56. };
  57. /* Write a value to the attribute register */
  58. static inline void svga_wattr(u8 index, u8 data)
  59. {
  60. inb(0x3DA);
  61. outb(index, 0x3C0);
  62. outb(data, 0x3C0);
  63. }
  64. /* Write a value to a sequence register with a mask */
  65. static inline void svga_wseq_mask(u8 index, u8 data, u8 mask)
  66. {
  67. vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask));
  68. }
  69. /* Write a value to a CRT register with a mask */
  70. static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask)
  71. {
  72. vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask));
  73. }
  74. static inline int svga_primary_device(struct pci_dev *dev)
  75. {
  76. u16 flags;
  77. pci_read_config_word(dev, PCI_COMMAND, &flags);
  78. return (flags & PCI_COMMAND_IO);
  79. }
  80. void svga_wcrt_multi(const struct vga_regset *regset, u32 value);
  81. void svga_wseq_multi(const struct vga_regset *regset, u32 value);
  82. void svga_set_default_gfx_regs(void);
  83. void svga_set_default_atc_regs(void);
  84. void svga_set_default_seq_regs(void);
  85. void svga_set_default_crt_regs(void);
  86. void svga_set_textmode_vga_regs(void);
  87. void svga_settile(struct fb_info *info, struct fb_tilemap *map);
  88. void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
  89. void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
  90. void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
  91. void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor);
  92. int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
  93. int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
  94. void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
  95. int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
  96. #endif /* __KERNEL__ */
  97. #endif /* _LINUX_SVGA_H */