vbe.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /******************************************************************************
  2. * Copyright (c) 2004, 2008 IBM Corporation
  3. * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-2-Clause
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial implementation
  10. *****************************************************************************/
  11. #ifndef _VBE_H
  12. #define _VBE_H
  13. /* these structs are for input from and output to OF */
  14. struct __packed vbe_screen_info {
  15. u8 display_type; /* 0=NONE, 1= analog, 2=digital */
  16. u16 screen_width;
  17. u16 screen_height;
  18. /* bytes per line in framebuffer, may be more than screen_width */
  19. u16 screen_linebytes;
  20. u8 color_depth; /* color depth in bits per pixel */
  21. u32 framebuffer_address;
  22. u8 edid_block_zero[128];
  23. };
  24. struct __packed vbe_screen_info_input {
  25. u8 signature[4];
  26. u16 size_reserved;
  27. u8 monitor_number;
  28. u16 max_screen_width;
  29. u8 color_depth;
  30. };
  31. /* these structs only store the required a subset of the VBE-defined fields */
  32. struct __packed vbe_info {
  33. char signature[4];
  34. u16 version;
  35. u32 oem_string_ptr;
  36. u32 capabilities;
  37. u32 modes_ptr;
  38. u16 total_memory;
  39. u16 oem_version;
  40. u32 vendor_name_ptr;
  41. u32 product_name_ptr;
  42. u32 product_rev_ptr;
  43. };
  44. struct __packed vesa_mode_info {
  45. u16 mode_attributes; /* 00 */
  46. u8 win_a_attributes; /* 02 */
  47. u8 win_b_attributes; /* 03 */
  48. u16 win_granularity; /* 04 */
  49. u16 win_size; /* 06 */
  50. u16 win_a_segment; /* 08 */
  51. u16 win_b_segment; /* 0a */
  52. u32 win_func_ptr; /* 0c */
  53. u16 bytes_per_scanline; /* 10 */
  54. u16 x_resolution; /* 12 */
  55. u16 y_resolution; /* 14 */
  56. u8 x_charsize; /* 16 */
  57. u8 y_charsize; /* 17 */
  58. u8 number_of_planes; /* 18 */
  59. u8 bits_per_pixel; /* 19 */
  60. u8 number_of_banks; /* 20 */
  61. u8 memory_model; /* 21 */
  62. u8 bank_size; /* 22 */
  63. u8 number_of_image_pages; /* 23 */
  64. u8 reserved_page;
  65. u8 red_mask_size;
  66. u8 red_mask_pos;
  67. u8 green_mask_size;
  68. u8 green_mask_pos;
  69. u8 blue_mask_size;
  70. u8 blue_mask_pos;
  71. u8 reserved_mask_size;
  72. u8 reserved_mask_pos;
  73. u8 direct_color_mode_info;
  74. u32 phys_base_ptr;
  75. u32 offscreen_mem_offset;
  76. u16 offscreen_mem_size;
  77. u8 reserved[206];
  78. };
  79. struct vbe_mode_info {
  80. u16 video_mode;
  81. bool valid;
  82. union {
  83. struct vesa_mode_info vesa;
  84. u8 mode_info_block[256];
  85. };
  86. };
  87. struct vbe_ddc_info {
  88. u8 port_number; /* i.e. monitor number */
  89. u8 edid_transfer_time;
  90. u8 ddc_level;
  91. u8 edid_block_zero[128];
  92. };
  93. #define VESA_GET_INFO 0x4f00
  94. #define VESA_GET_MODE_INFO 0x4f01
  95. #define VESA_SET_MODE 0x4f02
  96. #define VESA_GET_CUR_MODE 0x4f03
  97. extern struct vbe_mode_info mode_info;
  98. struct graphic_device;
  99. int vbe_get_video_info(struct graphic_device *gdev);
  100. struct video_priv;
  101. struct video_uc_platdata;
  102. int vbe_setup_video_priv(struct vesa_mode_info *vesa,
  103. struct video_priv *uc_priv,
  104. struct video_uc_platdata *plat);
  105. int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void));
  106. #endif