Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / i386 / pc / vbe.h
blob570bb0fa6c669f69ae811b9b1285b18a60ee62f4
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_VBE_MACHINE_HEADER
20 #define GRUB_VBE_MACHINE_HEADER 1
22 #include <grub/video.h>
24 /* Default video mode to be used. */
25 #define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
27 /* VBE status codes. */
28 #define GRUB_VBE_STATUS_OK 0x004f
30 #define GRUB_VBE_CAPABILITY_DACWIDTH (1 << 0)
32 /* Bits from the GRUB_VBE "mode_attributes" field in the mode info struct. */
33 #define GRUB_VBE_MODEATTR_SUPPORTED (1 << 0)
34 #define GRUB_VBE_MODEATTR_RESERVED_1 (1 << 1)
35 #define GRUB_VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2)
36 #define GRUB_VBE_MODEATTR_COLOR (1 << 3)
37 #define GRUB_VBE_MODEATTR_GRAPHICS (1 << 4)
38 #define GRUB_VBE_MODEATTR_VGA_COMPATIBLE (1 << 5)
39 #define GRUB_VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6)
40 #define GRUB_VBE_MODEATTR_LFB_AVAIL (1 << 7)
41 #define GRUB_VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8)
42 #define GRUB_VBE_MODEATTR_INTERLACED_AVAIL (1 << 9)
43 #define GRUB_VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10)
44 #define GRUB_VBE_MODEATTR_STEREO_AVAIL (1 << 11)
45 #define GRUB_VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12)
47 /* Values for the GRUB_VBE memory_model field in the mode info struct. */
48 #define GRUB_VBE_MEMORY_MODEL_TEXT 0x00
49 #define GRUB_VBE_MEMORY_MODEL_CGA 0x01
50 #define GRUB_VBE_MEMORY_MODEL_HERCULES 0x02
51 #define GRUB_VBE_MEMORY_MODEL_PLANAR 0x03
52 #define GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL 0x04
53 #define GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256 0x05
54 #define GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR 0x06
55 #define GRUB_VBE_MEMORY_MODEL_YUV 0x07
57 /* Note:
59 Please refer to VESA BIOS Extension 3.0 Specification for more descriptive
60 meanings of following structures and how they should be used.
62 I have tried to maintain field name compatibility against specification
63 while following naming conventions used in GRUB. */
65 typedef grub_uint32_t grub_vbe_farptr_t;
66 typedef grub_uint32_t grub_vbe_physptr_t;
67 typedef grub_uint32_t grub_vbe_status_t;
69 struct grub_vbe_info_block
71 grub_uint8_t signature[4];
72 grub_uint16_t version;
74 grub_vbe_farptr_t oem_string_ptr;
75 grub_uint32_t capabilities;
76 grub_vbe_farptr_t video_mode_ptr;
77 grub_uint16_t total_memory;
79 grub_uint16_t oem_software_rev;
80 grub_vbe_farptr_t oem_vendor_name_ptr;
81 grub_vbe_farptr_t oem_product_name_ptr;
82 grub_vbe_farptr_t oem_product_rev_ptr;
84 grub_uint8_t reserved[222];
86 grub_uint8_t oem_data[256];
87 } __attribute__ ((packed));
89 struct grub_vbe_mode_info_block
91 /* Mandatory information for all VBE revisions. */
92 grub_uint16_t mode_attributes;
93 grub_uint8_t win_a_attributes;
94 grub_uint8_t win_b_attributes;
95 grub_uint16_t win_granularity;
96 grub_uint16_t win_size;
97 grub_uint16_t win_a_segment;
98 grub_uint16_t win_b_segment;
99 grub_vbe_farptr_t win_func_ptr;
100 grub_uint16_t bytes_per_scan_line;
102 /* Mandatory information for VBE 1.2 and above. */
103 grub_uint16_t x_resolution;
104 grub_uint16_t y_resolution;
105 grub_uint8_t x_char_size;
106 grub_uint8_t y_char_size;
107 grub_uint8_t number_of_planes;
108 grub_uint8_t bits_per_pixel;
109 grub_uint8_t number_of_banks;
110 grub_uint8_t memory_model;
111 grub_uint8_t bank_size;
112 grub_uint8_t number_of_image_pages;
113 grub_uint8_t reserved;
115 /* Direct Color fields (required for direct/6 and YUV/7 memory models). */
116 grub_uint8_t red_mask_size;
117 grub_uint8_t red_field_position;
118 grub_uint8_t green_mask_size;
119 grub_uint8_t green_field_position;
120 grub_uint8_t blue_mask_size;
121 grub_uint8_t blue_field_position;
122 grub_uint8_t rsvd_mask_size;
123 grub_uint8_t rsvd_field_position;
124 grub_uint8_t direct_color_mode_info;
126 /* Mandatory information for VBE 2.0 and above. */
127 grub_vbe_physptr_t phys_base_addr;
128 grub_uint32_t reserved2;
129 grub_uint16_t reserved3;
131 /* Mandatory information for VBE 3.0 and above. */
132 grub_uint16_t lin_bytes_per_scan_line;
133 grub_uint8_t bnk_number_of_image_pages;
134 grub_uint8_t lin_number_of_image_pages;
135 grub_uint8_t lin_red_mask_size;
136 grub_uint8_t lin_red_field_position;
137 grub_uint8_t lin_green_mask_size;
138 grub_uint8_t lin_green_field_position;
139 grub_uint8_t lin_blue_mask_size;
140 grub_uint8_t lin_blue_field_position;
141 grub_uint8_t lin_rsvd_mask_size;
142 grub_uint8_t lin_rsvd_field_position;
143 grub_uint32_t max_pixel_clock;
145 /* Reserved field to make structure to be 256 bytes long, VESA BIOS
146 Extension 3.0 Specification says to reserve 189 bytes here but
147 that doesn't make structure to be 256 bytes. So additional one is
148 added here. */
149 grub_uint8_t reserved4[189 + 1];
150 } __attribute__ ((packed));
152 struct grub_vbe_crtc_info_block
154 grub_uint16_t horizontal_total;
155 grub_uint16_t horizontal_sync_start;
156 grub_uint16_t horizontal_sync_end;
157 grub_uint16_t vertical_total;
158 grub_uint16_t vertical_sync_start;
159 grub_uint16_t vertical_sync_end;
160 grub_uint8_t flags;
161 grub_uint32_t pixel_clock;
162 grub_uint16_t refresh_rate;
163 grub_uint8_t reserved[40];
164 } __attribute__ ((packed));
166 struct grub_vbe_palette_data
168 grub_uint8_t blue;
169 grub_uint8_t green;
170 grub_uint8_t red;
171 grub_uint8_t alignment;
172 } __attribute__ ((packed));
174 struct grub_vbe_flat_panel_info
176 grub_uint16_t horizontal_size;
177 grub_uint16_t vertical_size;
178 grub_uint16_t panel_type;
179 grub_uint8_t red_bpp;
180 grub_uint8_t green_bpp;
181 grub_uint8_t blue_bpp;
182 grub_uint8_t reserved_bpp;
183 grub_uint32_t reserved_offscreen_mem_size;
184 grub_vbe_farptr_t reserved_offscreen_mem_ptr;
186 grub_uint8_t reserved[14];
187 } __attribute__ ((packed));
189 /* Prototypes for helper functions. */
190 /* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
191 grub_vbe_status_t
192 grub_vbe_bios_get_controller_info (struct grub_vbe_info_block *controller_info);
193 /* Call VESA BIOS 0x4f01 to get VBE Mode Information, return status. */
194 grub_vbe_status_t
195 grub_vbe_bios_get_mode_info (grub_uint32_t mode,
196 struct grub_vbe_mode_info_block *mode_info);
197 /* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
198 grub_vbe_status_t
199 grub_vbe_bios_get_mode (grub_uint32_t *mode);
200 /* Call VESA BIOS 0x4f05 to set memory window, return status. */
201 grub_vbe_status_t
202 grub_vbe_bios_set_memory_window (grub_uint32_t window, grub_uint32_t position);
203 /* Call VESA BIOS 0x4f05 to return memory window, return status. */
204 grub_vbe_status_t
205 grub_vbe_bios_get_memory_window (grub_uint32_t window,
206 grub_uint32_t *position);
207 /* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
208 grub_vbe_status_t
209 grub_vbe_bios_set_scanline_length (grub_uint32_t length);
210 /* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
211 grub_vbe_status_t
212 grub_vbe_bios_get_scanline_length (grub_uint32_t *length);
213 /* Call VESA BIOS 0x4f07 to get display start, return status. */
214 grub_vbe_status_t
215 grub_vbe_bios_get_display_start (grub_uint32_t *x,
216 grub_uint32_t *y);
218 grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
220 #define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
221 #define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
223 grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
224 grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
225 grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
226 struct grub_vbe_mode_info_block *mode_info);
227 grub_vbe_status_t
228 grub_vbe_bios_get_pm_interface (grub_uint16_t *seg, grub_uint16_t *offset,
229 grub_uint16_t *length);
232 #endif /* ! GRUB_VBE_MACHINE_HEADER */