uvesafb.h 2.9 KB

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