]>
Commit | Line | Data |
---|---|---|
f1294e4a | 1 | /** @file\r |
7da78b1f | 2 | \r |
3 | Copyright (c) 2006 - 2007, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
f1294e4a | 12 | **/\r |
7da78b1f | 13 | \r |
0d92cdc2 | 14 | #ifndef _BIOS_GRAPHICS_OUTPUT_H\r |
15 | #define _BIOS_GRAPHICS_OUTPUT_H\r | |
7da78b1f | 16 | \r |
17 | #include <Uefi.h>\r | |
18 | \r | |
19 | //\r | |
20 | // Driver Consumed Protocol Prototypes\r | |
21 | //\r | |
22 | #include <Protocol/DevicePath.h>\r | |
23 | #include <Protocol/PciIo.h>\r | |
24 | #include <Protocol/DriverBinding.h>\r | |
25 | #include <Protocol/ComponentName.h>\r | |
26 | #include <Protocol/ComponentName2.h>\r | |
27 | #include <Protocol/UgaDraw.h>\r | |
28 | #include <Protocol/VgaMiniPort.h>\r | |
29 | #include <Protocol/Legacy8259.h>\r | |
0d92cdc2 | 30 | #include <Protocol/EdidActive.h>\r |
31 | #include <Protocol/EdidDiscovered.h>\r | |
32 | #include <Protocol/DevicePath.h>\r | |
7da78b1f | 33 | \r |
34 | #include <Library/UefiLib.h>\r | |
35 | #include <Library/DebugLib.h>\r | |
36 | #include <Library/UefiBootServicesTableLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
0d92cdc2 | 38 | #include <Library/DevicePathLib.h>\r |
7da78b1f | 39 | \r |
1a573c7e | 40 | #include <IndustryStandard/Pci.h>\r |
7da78b1f | 41 | \r |
42 | #include "VesaBiosExtensions.h"\r | |
7da78b1f | 43 | \r |
44 | //\r | |
45 | // Packed format support: The number of bits reserved for each of the colors and the actual\r | |
46 | // position of RGB in the frame buffer is specified in the VBE Mode information\r | |
47 | //\r | |
48 | typedef struct {\r | |
49 | UINT8 Position; // Position of the color\r | |
50 | UINT8 Mask; // The number of bits expressed as a mask\r | |
51 | } BIOS_VIDEO_COLOR_PLACEMENT;\r | |
52 | \r | |
53 | //\r | |
0d92cdc2 | 54 | // BIOS Graphics Output Graphical Mode Data\r |
7da78b1f | 55 | //\r |
56 | typedef struct {\r | |
57 | UINT16 VbeModeNumber;\r | |
58 | UINT16 BytesPerScanLine;\r | |
59 | VOID *LinearFrameBuffer;\r | |
0d92cdc2 | 60 | UINTN FrameBufferSize;\r |
7da78b1f | 61 | UINT32 HorizontalResolution;\r |
62 | UINT32 VerticalResolution;\r | |
7da78b1f | 63 | UINT32 RefreshRate;\r |
64 | UINT32 BitsPerPixel;\r | |
65 | BIOS_VIDEO_COLOR_PLACEMENT Red;\r | |
66 | BIOS_VIDEO_COLOR_PLACEMENT Green;\r | |
67 | BIOS_VIDEO_COLOR_PLACEMENT Blue;\r | |
0d92cdc2 | 68 | BIOS_VIDEO_COLOR_PLACEMENT Reserved;\r |
69 | EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r | |
70 | EFI_PIXEL_BITMASK PixelBitMask;\r | |
7da78b1f | 71 | } BIOS_VIDEO_MODE_DATA;\r |
72 | \r | |
73 | //\r | |
0d92cdc2 | 74 | // BIOS video child handle private data Structure\r |
7da78b1f | 75 | //\r |
0d92cdc2 | 76 | #define BIOS_VIDEO_DEV_SIGNATURE SIGNATURE_32 ('B', 'V', 'M', 'p')\r |
7da78b1f | 77 | \r |
78 | typedef struct {\r | |
79 | UINTN Signature;\r | |
80 | EFI_HANDLE Handle;\r | |
81 | \r | |
82 | //\r | |
f1294e4a | 83 | // Consumed Protocols inherited from parent controller.\r |
7da78b1f | 84 | //\r |
85 | EFI_PCI_IO_PROTOCOL *PciIo;\r | |
0d92cdc2 | 86 | EFI_LEGACY_8259_PROTOCOL *Legacy8259;\r |
f1294e4a | 87 | THUNK_CONTEXT *ThunkContext;\r |
88 | \r | |
7da78b1f | 89 | //\r |
90 | // Produced Protocols\r | |
91 | //\r | |
0d92cdc2 | 92 | EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r |
93 | EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered;\r | |
94 | EFI_EDID_ACTIVE_PROTOCOL EdidActive;\r | |
7da78b1f | 95 | EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;\r |
96 | \r | |
97 | //\r | |
98 | // General fields\r | |
99 | //\r | |
7da78b1f | 100 | BOOLEAN VgaCompatible;\r |
0d92cdc2 | 101 | BOOLEAN ProduceGraphicsOutput;\r |
7da78b1f | 102 | \r |
103 | //\r | |
0d92cdc2 | 104 | // Graphics Output Protocol related fields\r |
7da78b1f | 105 | //\r |
106 | BOOLEAN HardwareNeedsStarting;\r | |
7da78b1f | 107 | BIOS_VIDEO_MODE_DATA *ModeData;\r |
108 | UINT8 *LineBuffer;\r | |
0d92cdc2 | 109 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer;\r |
7da78b1f | 110 | UINT8 *VgaFrameBuffer;\r |
111 | \r | |
112 | //\r | |
113 | // VESA Bios Extensions related fields\r | |
114 | //\r | |
115 | UINTN NumberOfPagesBelow1MB; // Number of 4KB pages in PagesBelow1MB\r | |
116 | EFI_PHYSICAL_ADDRESS PagesBelow1MB; // Buffer for all VBE Information Blocks\r | |
117 | VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK *VbeInformationBlock; // 0x200 bytes. Must be allocated below 1MB\r | |
118 | VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *VbeModeInformationBlock; // 0x100 bytes. Must be allocated below 1MB\r | |
0d92cdc2 | 119 | VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK *VbeEdidDataBlock; // 0x80 bytes. Must be allocated below 1MB\r |
7da78b1f | 120 | VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *VbeCrtcInformationBlock; // 59 bytes. Must be allocated below 1MB\r |
121 | UINTN VbeSaveRestorePages; // Number of 4KB pages in VbeSaveRestoreBuffer\r | |
122 | EFI_PHYSICAL_ADDRESS VbeSaveRestoreBuffer; // Must be allocated below 1MB\r | |
123 | //\r | |
124 | // Status code\r | |
125 | //\r | |
126 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
127 | } BIOS_VIDEO_DEV;\r | |
128 | \r | |
0d92cdc2 | 129 | #define BIOS_VIDEO_DEV_FROM_PCI_IO_THIS(a) CR (a, BIOS_VIDEO_DEV, PciIo, BIOS_VIDEO_DEV_SIGNATURE)\r |
130 | #define BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS(a) CR (a, BIOS_VIDEO_DEV, GraphicsOutput, BIOS_VIDEO_DEV_SIGNATURE)\r | |
7da78b1f | 131 | #define BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS(a) CR (a, BIOS_VIDEO_DEV, VgaMiniPort, BIOS_VIDEO_DEV_SIGNATURE)\r |
132 | \r | |
0d92cdc2 | 133 | #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff\r |
134 | \r | |
d0c94e59 | 135 | #define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)\r |
136 | #define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)\r | |
137 | \r | |
7da78b1f | 138 | //\r |
139 | // Global Variables\r | |
140 | //\r | |
141 | extern EFI_DRIVER_BINDING_PROTOCOL gBiosVideoDriverBinding;\r | |
142 | extern EFI_COMPONENT_NAME_PROTOCOL gBiosVideoComponentName;\r | |
143 | extern EFI_COMPONENT_NAME2_PROTOCOL gBiosVideoComponentName2;\r | |
144 | \r | |
145 | //\r | |
146 | // Driver Binding Protocol functions\r | |
147 | //\r | |
f1294e4a | 148 | /**\r |
149 | Test to see if Bios Video could be supported on the Controller.\r | |
150 | \r | |
151 | @param This Pointer to driver binding protocol\r | |
152 | @param Controller Controller handle to connect\r | |
153 | @param RemainingDevicePath A pointer to the remaining portion of a device path\r | |
154 | \r | |
155 | @retval EFI_SUCCESS This driver supports this device.\r | |
156 | @retval other This driver does not support this device.\r | |
157 | \r | |
158 | **/\r | |
7da78b1f | 159 | EFI_STATUS\r |
160 | EFIAPI\r | |
161 | BiosVideoDriverBindingSupported (\r | |
162 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
163 | IN EFI_HANDLE Controller,\r | |
164 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
165 | )\r | |
f1294e4a | 166 | ;\r |
0d92cdc2 | 167 | \r |
f1294e4a | 168 | /**\r |
169 | Install Graphics Output Protocol onto VGA device handles\r | |
0d92cdc2 | 170 | \r |
f1294e4a | 171 | @param This Pointer to driver binding protocol\r |
172 | @param Controller Controller handle to connect\r | |
173 | @param RemainingDevicePath A pointer to the remaining portion of a device path\r | |
7da78b1f | 174 | \r |
f1294e4a | 175 | @return EFI_STATUS\r |
7da78b1f | 176 | \r |
f1294e4a | 177 | **/\r |
7da78b1f | 178 | EFI_STATUS\r |
179 | EFIAPI\r | |
180 | BiosVideoDriverBindingStart (\r | |
181 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
182 | IN EFI_HANDLE Controller,\r | |
183 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
184 | )\r | |
f1294e4a | 185 | ;\r |
0d92cdc2 | 186 | \r |
f1294e4a | 187 | /**\r |
188 | Stop this driver on Controller \r | |
0d92cdc2 | 189 | \r |
f1294e4a | 190 | @param This Protocol instance pointer.\r |
191 | @param Controller Handle of device to stop driver on\r | |
192 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
193 | children is zero stop the entire bus driver.\r | |
194 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
7da78b1f | 195 | \r |
f1294e4a | 196 | @retval EFI_SUCCESS This driver is removed Controller.\r |
197 | @retval other This driver was not removed from this device.\r | |
7da78b1f | 198 | \r |
f1294e4a | 199 | **/\r |
7da78b1f | 200 | EFI_STATUS\r |
201 | EFIAPI\r | |
202 | BiosVideoDriverBindingStop (\r | |
203 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
204 | IN EFI_HANDLE Controller,\r | |
205 | IN UINTN NumberOfChildren,\r | |
206 | IN EFI_HANDLE *ChildHandleBuffer\r | |
207 | )\r | |
7da78b1f | 208 | ;\r |
209 | \r | |
210 | //\r | |
211 | // Private worker functions\r | |
212 | //\r | |
f1294e4a | 213 | /**\r |
214 | Check for VBE device\r | |
215 | \r | |
216 | @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r | |
217 | \r | |
218 | @retval EFI_SUCCESS VBE device found\r | |
219 | \r | |
220 | **/\r | |
7da78b1f | 221 | EFI_STATUS\r |
222 | BiosVideoCheckForVbe (\r | |
223 | BIOS_VIDEO_DEV *BiosVideoPrivate\r | |
224 | )\r | |
f1294e4a | 225 | ;\r |
0d92cdc2 | 226 | \r |
f1294e4a | 227 | /**\r |
228 | Check for VGA device\r | |
0d92cdc2 | 229 | \r |
f1294e4a | 230 | @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r |
0d92cdc2 | 231 | \r |
f1294e4a | 232 | @retval EFI_SUCCESS Standard VGA device found\r |
233 | **/\r | |
7da78b1f | 234 | \r |
235 | EFI_STATUS\r | |
236 | BiosVideoCheckForVga (\r | |
237 | BIOS_VIDEO_DEV *BiosVideoPrivate\r | |
238 | )\r | |
7da78b1f | 239 | ;\r |
240 | \r | |
f1294e4a | 241 | /**\r |
242 | Collect the resource from destroyed bios video device.\r | |
7da78b1f | 243 | \r |
f1294e4a | 244 | @param BiosVideoPrivate Video child device private data structure\r |
7da78b1f | 245 | \r |
f1294e4a | 246 | **/\r |
0d92cdc2 | 247 | VOID\r |
248 | BiosVideoDeviceReleaseResource (\r | |
249 | BIOS_VIDEO_DEV *BiosVideoChildPrivate\r | |
250 | )\r | |
f1294e4a | 251 | ;\r |
0d92cdc2 | 252 | \r |
f1294e4a | 253 | //\r |
254 | // BIOS Graphics Output Protocol functions\r | |
255 | //\r | |
256 | /**\r | |
0d92cdc2 | 257 | \r |
f1294e4a | 258 | Graphics Output protocol interface to get video mode\r |
0d92cdc2 | 259 | \r |
0d92cdc2 | 260 | \r |
f1294e4a | 261 | @param This - Protocol instance pointer.\r |
262 | @param ModeNumber - The mode number to return information on.\r | |
263 | @param SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r | |
264 | @param Info - Caller allocated buffer that returns information about ModeNumber.\r | |
0d92cdc2 | 265 | \r |
f1294e4a | 266 | @return EFI_SUCCESS - Mode information returned.\r |
267 | EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r | |
268 | EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r | |
269 | EFI_INVALID_PARAMETER - One of the input args was NULL.\r | |
0d92cdc2 | 270 | \r |
f1294e4a | 271 | **/\r |
7da78b1f | 272 | EFI_STATUS\r |
273 | EFIAPI\r | |
0d92cdc2 | 274 | BiosVideoGraphicsOutputQueryMode (\r |
275 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r | |
276 | IN UINT32 ModeNumber,\r | |
277 | OUT UINTN *SizeOfInfo,\r | |
278 | OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r | |
7da78b1f | 279 | )\r |
f1294e4a | 280 | ;\r |
7da78b1f | 281 | \r |
f1294e4a | 282 | /**\r |
7da78b1f | 283 | \r |
f1294e4a | 284 | Graphics Output protocol interface to set video mode\r |
7da78b1f | 285 | \r |
7da78b1f | 286 | \r |
f1294e4a | 287 | @param This - Protocol instance pointer.\r |
288 | @param ModeNumber - The mode number to be set.\r | |
7da78b1f | 289 | \r |
f1294e4a | 290 | @return EFI_SUCCESS - Graphics mode was changed.\r |
291 | EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r | |
292 | EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r | |
0d92cdc2 | 293 | \r |
f1294e4a | 294 | **/\r |
0d92cdc2 | 295 | EFI_STATUS\r |
296 | EFIAPI\r | |
297 | BiosVideoGraphicsOutputSetMode (\r | |
298 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r | |
299 | IN UINT32 ModeNumber\r | |
300 | )\r | |
f1294e4a | 301 | ;\r |
0d92cdc2 | 302 | \r |
f1294e4a | 303 | /**\r |
0d92cdc2 | 304 | \r |
f1294e4a | 305 | Graphics Output protocol instance to block transfer for VBE device\r |
0d92cdc2 | 306 | \r |
7da78b1f | 307 | \r |
f1294e4a | 308 | @param This - Pointer to Graphics Output protocol instance\r |
309 | @param BltBuffer - The data to transfer to screen\r | |
310 | @param BltOperation - The operation to perform\r | |
311 | @param SourceX - The X coordinate of the source for BltOperation\r | |
312 | @param SourceY - The Y coordinate of the source for BltOperation\r | |
313 | @param DestinationX - The X coordinate of the destination for BltOperation\r | |
314 | @param DestinationY - The Y coordinate of the destination for BltOperation\r | |
315 | @param Width - The width of a rectangle in the blt rectangle in pixels\r | |
316 | @param Height - The height of a rectangle in the blt rectangle in pixels\r | |
317 | @param Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r | |
318 | If a Delta of 0 is used, the entire BltBuffer will be operated on.\r | |
319 | If a subrectangle of the BltBuffer is used, then Delta represents\r | |
320 | the number of bytes in a row of the BltBuffer.\r | |
321 | \r | |
322 | @return EFI_INVALID_PARAMETER - Invalid parameter passed in\r | |
323 | EFI_SUCCESS - Blt operation success\r | |
324 | \r | |
325 | **/\r | |
7da78b1f | 326 | EFI_STATUS\r |
327 | EFIAPI\r | |
0d92cdc2 | 328 | BiosVideoGraphicsOutputVbeBlt (\r |
329 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r | |
330 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r | |
331 | IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r | |
332 | IN UINTN SourceX,\r | |
333 | IN UINTN SourceY,\r | |
334 | IN UINTN DestinationX,\r | |
335 | IN UINTN DestinationY,\r | |
336 | IN UINTN Width,\r | |
337 | IN UINTN Height,\r | |
338 | IN UINTN Delta\r | |
7da78b1f | 339 | )\r |
7da78b1f | 340 | ;\r |
341 | \r | |
f1294e4a | 342 | /**\r |
343 | Grahpics Output protocol instance to block transfer for VGA device\r | |
344 | \r | |
345 | @param This Pointer to Grahpics Output protocol instance\r | |
346 | @param BltBuffer The data to transfer to screen\r | |
347 | @param BltOperation The operation to perform\r | |
348 | @param SourceX The X coordinate of the source for BltOperation\r | |
349 | @param SourceY The Y coordinate of the source for BltOperation\r | |
350 | @param DestinationX The X coordinate of the destination for BltOperation\r | |
351 | @param DestinationY The Y coordinate of the destination for BltOperation\r | |
352 | @param Width The width of a rectangle in the blt rectangle in pixels\r | |
353 | @param Height The height of a rectangle in the blt rectangle in pixels\r | |
354 | @param Delta Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r | |
355 | If a Delta of 0 is used, the entire BltBuffer will be operated on.\r | |
356 | If a subrectangle of the BltBuffer is used, then Delta represents\r | |
357 | the number of bytes in a row of the BltBuffer.\r | |
358 | \r | |
359 | @retval EFI_INVALID_PARAMETER Invalid parameter passed in\r | |
360 | @retval EFI_SUCCESS Blt operation success\r | |
361 | \r | |
362 | **/\r | |
7da78b1f | 363 | EFI_STATUS\r |
364 | EFIAPI\r | |
0d92cdc2 | 365 | BiosVideoGraphicsOutputVgaBlt (\r |
366 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r | |
367 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r | |
368 | IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r | |
369 | IN UINTN SourceX,\r | |
370 | IN UINTN SourceY,\r | |
371 | IN UINTN DestinationX,\r | |
372 | IN UINTN DestinationY,\r | |
373 | IN UINTN Width,\r | |
374 | IN UINTN Height,\r | |
375 | IN UINTN Delta\r | |
7da78b1f | 376 | )\r |
7da78b1f | 377 | ;\r |
378 | \r | |
379 | //\r | |
380 | // BIOS VGA Mini Port Protocol functions\r | |
381 | //\r | |
f1294e4a | 382 | /**\r |
383 | VgaMiniPort protocol interface to set mode\r | |
384 | \r | |
385 | @param This Pointer to VgaMiniPort protocol instance\r | |
386 | @param ModeNumber The index of the mode\r | |
387 | \r | |
388 | @retval EFI_UNSUPPORTED The requested mode is not supported\r | |
389 | @retval EFI_SUCCESS The requested mode is set successfully\r | |
390 | \r | |
391 | **/\r | |
7da78b1f | 392 | EFI_STATUS\r |
393 | EFIAPI\r | |
394 | BiosVideoVgaMiniPortSetMode (\r | |
395 | IN EFI_VGA_MINI_PORT_PROTOCOL *This,\r | |
396 | IN UINTN ModeNumber\r | |
397 | )\r | |
7da78b1f | 398 | ;\r |
399 | \r | |
f1294e4a | 400 | /**\r |
401 | Judge whether this device is VGA device.\r | |
402 | \r | |
403 | @param PciIo Parent PciIo protocol instance pointer\r | |
7da78b1f | 404 | \r |
f1294e4a | 405 | @retval TRUE Is vga device\r |
406 | @retval FALSE Is no vga device\r | |
407 | **/\r | |
7da78b1f | 408 | BOOLEAN\r |
409 | BiosVideoIsVga (\r | |
410 | IN EFI_PCI_IO_PROTOCOL *PciIo\r | |
411 | )\r | |
412 | ;\r | |
413 | \r | |
414 | \r | |
415 | //\r | |
416 | // Standard VGA Definitions\r | |
417 | //\r | |
418 | #define VGA_HORIZONTAL_RESOLUTION 640\r | |
419 | #define VGA_VERTICAL_RESOLUTION 480\r | |
420 | #define VGA_NUMBER_OF_BIT_PLANES 4\r | |
421 | #define VGA_PIXELS_PER_BYTE 8\r | |
422 | #define VGA_BYTES_PER_SCAN_LINE (VGA_HORIZONTAL_RESOLUTION / VGA_PIXELS_PER_BYTE)\r | |
423 | #define VGA_BYTES_PER_BIT_PLANE (VGA_VERTICAL_RESOLUTION * VGA_BYTES_PER_SCAN_LINE)\r | |
424 | \r | |
425 | #define VGA_GRAPHICS_CONTROLLER_ADDRESS_REGISTER 0x3ce\r | |
426 | #define VGA_GRAPHICS_CONTROLLER_DATA_REGISTER 0x3cf\r | |
427 | \r | |
428 | #define VGA_GRAPHICS_CONTROLLER_SET_RESET_REGISTER 0x00\r | |
429 | \r | |
430 | #define VGA_GRAPHICS_CONTROLLER_ENABLE_SET_RESET_REGISTER 0x01\r | |
431 | \r | |
432 | #define VGA_GRAPHICS_CONTROLLER_COLOR_COMPARE_REGISTER 0x02\r | |
433 | \r | |
434 | #define VGA_GRAPHICS_CONTROLLER_DATA_ROTATE_REGISTER 0x03\r | |
435 | #define VGA_GRAPHICS_CONTROLLER_FUNCTION_REPLACE 0x00\r | |
436 | #define VGA_GRAPHICS_CONTROLLER_FUNCTION_AND 0x08\r | |
437 | #define VGA_GRAPHICS_CONTROLLER_FUNCTION_OR 0x10\r | |
438 | #define VGA_GRAPHICS_CONTROLLER_FUNCTION_XOR 0x18\r | |
439 | \r | |
440 | #define VGA_GRAPHICS_CONTROLLER_READ_MAP_SELECT_REGISTER 0x04\r | |
441 | \r | |
442 | #define VGA_GRAPHICS_CONTROLLER_MODE_REGISTER 0x05\r | |
443 | #define VGA_GRAPHICS_CONTROLLER_READ_MODE_0 0x00\r | |
444 | #define VGA_GRAPHICS_CONTROLLER_READ_MODE_1 0x08\r | |
445 | #define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_0 0x00\r | |
446 | #define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_1 0x01\r | |
447 | #define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_2 0x02\r | |
448 | #define VGA_GRAPHICS_CONTROLLER_WRITE_MODE_3 0x03\r | |
449 | \r | |
450 | #define VGA_GRAPHICS_CONTROLLER_MISCELLANEOUS_REGISTER 0x06\r | |
451 | \r | |
452 | #define VGA_GRAPHICS_CONTROLLER_COLOR_DONT_CARE_REGISTER 0x07\r | |
453 | \r | |
454 | #define VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER 0x08\r | |
455 | \r | |
f1294e4a | 456 | /**\r |
457 | Initialize legacy environment for BIOS INI caller.\r | |
458 | \r | |
459 | @param ThunkContext the instance pointer of THUNK_CONTEXT\r | |
460 | **/\r | |
0d92cdc2 | 461 | VOID\r |
462 | InitializeBiosIntCaller (\r | |
f1294e4a | 463 | THUNK_CONTEXT *ThunkContext\r |
0d92cdc2 | 464 | );\r |
465 | \r | |
f1294e4a | 466 | /**\r |
467 | Initialize interrupt redirection code and entries, because\r | |
468 | IDT Vectors 0x68-0x6f must be redirected to IDT Vectors 0x08-0x0f.\r | |
469 | Or the interrupt will lost when we do thunk.\r | |
470 | NOTE: We do not reset 8259 vector base, because it will cause pending\r | |
471 | interrupt lost.\r | |
472 | \r | |
473 | @param Legacy8259 Instance pointer for EFI_LEGACY_8259_PROTOCOL.\r | |
474 | \r | |
475 | **/ \r | |
0d92cdc2 | 476 | VOID\r |
477 | InitializeInterruptRedirection (\r | |
f1294e4a | 478 | IN EFI_LEGACY_8259_PROTOCOL *Legacy8259\r |
0d92cdc2 | 479 | );\r |
480 | \r | |
f1294e4a | 481 | /**\r |
482 | Thunk to 16-bit real mode and execute a software interrupt with a vector \r | |
483 | of BiosInt. Regs will contain the 16-bit register context on entry and \r | |
484 | exit.\r | |
485 | \r | |
486 | @param This Protocol instance pointer.\r | |
487 | @param BiosInt Processor interrupt vector to invoke\r | |
488 | @param Reg Register contexted passed into (and returned) from thunk to 16-bit mode\r | |
489 | \r | |
490 | @retval TRUE Thunk completed, and there were no BIOS errors in the target code.\r | |
491 | See Regs for status.\r | |
492 | @retval FALSE There was a BIOS erro in the target code. \r | |
493 | **/ \r | |
0d92cdc2 | 494 | BOOLEAN\r |
495 | EFIAPI\r | |
496 | LegacyBiosInt86 (\r | |
497 | IN BIOS_VIDEO_DEV *BiosDev,\r | |
498 | IN UINT8 BiosInt,\r | |
d0c94e59 | 499 | IN IA32_REGISTER_SET *Regs\r |
0d92cdc2 | 500 | ); \r |
501 | \r | |
7da78b1f | 502 | #endif\r |