uvesafb.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #ifndef _UVESAFB_H
  2. #define _UVESAFB_H
  3. #include <uapi/video/uvesafb.h>
  4. /* VBE CRTC Info Block */
  5. struct vbe_crtc_ib {
  6. u16 horiz_total;
  7. u16 horiz_start;
  8. u16 horiz_end;
  9. u16 vert_total;
  10. u16 vert_start;
  11. u16 vert_end;
  12. u8 flags;
  13. u32 pixel_clock;
  14. u16 refresh_rate;
  15. u8 reserved[40];
  16. } __attribute__ ((packed));
  17. #define VBE_MODE_VGACOMPAT 0x20
  18. #define VBE_MODE_COLOR 0x08
  19. #define VBE_MODE_SUPPORTEDHW 0x01
  20. #define VBE_MODE_GRAPHICS 0x10
  21. #define VBE_MODE_LFB 0x80
  22. #define VBE_MODE_MASK (VBE_MODE_COLOR | VBE_MODE_SUPPORTEDHW | \
  23. VBE_MODE_GRAPHICS | VBE_MODE_LFB)
  24. /* VBE Mode Info Block */
  25. struct vbe_mode_ib {
  26. /* for all VBE revisions */
  27. u16 mode_attr;
  28. u8 winA_attr;
  29. u8 winB_attr;
  30. u16 win_granularity;
  31. u16 win_size;
  32. u16 winA_seg;
  33. u16 winB_seg;
  34. u32 win_func_ptr;
  35. u16 bytes_per_scan_line;
  36. /* for VBE 1.2+ */
  37. u16 x_res;
  38. u16 y_res;
  39. u8 x_char_size;
  40. u8 y_char_size;
  41. u8 planes;
  42. u8 bits_per_pixel;
  43. u8 banks;
  44. u8 memory_model;
  45. u8 bank_size;
  46. u8 image_pages;
  47. u8 reserved1;
  48. /* Direct color fields for direct/6 and YUV/7 memory models. */
  49. /* Offsets are bit positions of lsb in the mask. */
  50. u8 red_len;
  51. u8 red_off;
  52. u8 green_len;
  53. u8 green_off;
  54. u8 blue_len;
  55. u8 blue_off;
  56. u8 rsvd_len;
  57. u8 rsvd_off;
  58. u8 direct_color_info; /* direct color mode attributes */
  59. /* for VBE 2.0+ */
  60. u32 phys_base_ptr;
  61. u8 reserved2[6];
  62. /* for VBE 3.0+ */
  63. u16 lin_bytes_per_scan_line;
  64. u8 bnk_image_pages;
  65. u8 lin_image_pages;
  66. u8 lin_red_len;
  67. u8 lin_red_off;
  68. u8 lin_green_len;
  69. u8 lin_green_off;
  70. u8 lin_blue_len;
  71. u8 lin_blue_off;
  72. u8 lin_rsvd_len;
  73. u8 lin_rsvd_off;
  74. u32 max_pixel_clock;
  75. u16 mode_id;
  76. u8 depth;
  77. } __attribute__ ((packed));
  78. #define UVESAFB_DEFAULT_MODE "640x480-16"
  79. /* How long to wait for a reply from userspace [ms] */
  80. #define UVESAFB_TIMEOUT 5000
  81. /* Max number of concurrent tasks */
  82. #define UVESAFB_TASKS_MAX 16
  83. #define dac_reg (0x3c8)
  84. #define dac_val (0x3c9)
  85. struct uvesafb_pal_entry {
  86. u_char blue, green, red, pad;
  87. } __attribute__ ((packed));
  88. struct uvesafb_ktask {
  89. struct uvesafb_task t;
  90. void *buf;
  91. struct completion *done;
  92. u32 ack;
  93. };
  94. static int uvesafb_exec(struct uvesafb_ktask *tsk);
  95. #define UVESAFB_EXACT_RES 1
  96. #define UVESAFB_EXACT_DEPTH 2
  97. struct uvesafb_par {
  98. struct vbe_ib vbe_ib; /* VBE Info Block */
  99. struct vbe_mode_ib *vbe_modes; /* list of supported VBE modes */
  100. int vbe_modes_cnt;
  101. u8 nocrtc;
  102. u8 ypan; /* 0 - nothing, 1 - ypan, 2 - ywrap */
  103. u8 pmi_setpal; /* PMI for palette changes */
  104. u16 *pmi_base; /* protected mode interface location */
  105. void *pmi_start;
  106. void *pmi_pal;
  107. u8 *vbe_state_orig; /*
  108. * original hardware state, before the
  109. * driver was loaded
  110. */
  111. u8 *vbe_state_saved; /* state saved by fb_save_state */
  112. int vbe_state_size;
  113. atomic_t ref_count;
  114. int mode_idx;
  115. struct vbe_crtc_ib crtc;
  116. int mtrr_handle;
  117. };
  118. #endif /* _UVESAFB_H */