vbe.h 2.8 KB

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