-/*++\r
+/** @file\r
+\r
+ BiosVideo driver produce EFI_GRAPHIC_OUTPUT_PROTOCOL via LegacyBios Video rom.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-Module Name:\r
-\r
- BiosVideo.c\r
-\r
-Abstract:\r
-\r
- ConsoleOut Routines that speak VGA.\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
\r
#include "BiosVideo.h"\r
\r
//\r
// Global lookup tables for VGA graphics modes\r
//\r
-UINT8 mVgaLeftMaskTable[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };\r
+UINT8 mVgaLeftMaskTable[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };\r
+\r
+UINT8 mVgaRightMaskTable[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };\r
\r
-UINT8 mVgaRightMaskTable[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };\r
+UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };\r
\r
-UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };\r
+EFI_LEGACY_8259_PROTOCOL *mLegacy8259 = NULL;\r
+THUNK_CONTEXT mThunkContext;\r
\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL mVgaColorToGraphicsOutputColor[] = {\r
- {\r
- 0x00,\r
- 0x00,\r
- 0x00,\r
- 0x00\r
- },\r
- {\r
- 0x98,\r
- 0x00,\r
- 0x00,\r
- 0x00\r
- },\r
- {\r
- 0x00,\r
- 0x98,\r
- 0x00,\r
- 0x00\r
- },\r
- {\r
- 0x98,\r
- 0x98,\r
- 0x00,\r
- 0x00\r
- },\r
- {\r
- 0x00,\r
- 0x00,\r
- 0x98,\r
- 0x00\r
- },\r
- {\r
- 0x98,\r
- 0x00,\r
- 0x98,\r
- 0x00\r
- },\r
- {\r
- 0x00,\r
- 0x98,\r
- 0x98,\r
- 0x00\r
- },\r
- {\r
- 0x98,\r
- 0x98,\r
- 0x98,\r
- 0x00\r
- },\r
- {\r
- 0x10,\r
- 0x10,\r
- 0x10,\r
- 0x00\r
- },\r
- {\r
- 0xff,\r
- 0x10,\r
- 0x10,\r
- 0x00\r
- },\r
- {\r
- 0x10,\r
- 0xff,\r
- 0x10,\r
- 0x00\r
- },\r
- {\r
- 0xff,\r
- 0xff,\r
- 0x10,\r
- 0x00\r
- },\r
- {\r
- 0x10,\r
- 0x10,\r
- 0xff,\r
- 0x00\r
- },\r
- {\r
- 0xf0,\r
- 0x10,\r
- 0xff,\r
- 0x00\r
- },\r
- {\r
- 0x10,\r
- 0xff,\r
- 0xff,\r
- 0x00\r
- },\r
- {\r
- 0xff,\r
- 0xff,\r
- 0xff,\r
- 0x00\r
- }\r
+ //\r
+ // {B, G, R, reserved}\r
+ // \r
+ {0x00, 0x00, 0x00, 0x00}, // BLACK\r
+ {0x98, 0x00, 0x00, 0x00}, // LIGHTBLUE\r
+ {0x00, 0x98, 0x00, 0x00}, // LIGHGREEN\r
+ {0x98, 0x98, 0x00, 0x00}, // LIGHCYAN\r
+ {0x00, 0x00, 0x98, 0x00}, // LIGHRED\r
+ {0x98, 0x00, 0x98, 0x00}, // MAGENTA\r
+ {0x00, 0x98, 0x98, 0x00}, // BROWN\r
+ {0x98, 0x98, 0x98, 0x00}, // LIGHTGRAY\r
+ {0x10, 0x10, 0x10, 0x00},\r
+ {0xff, 0x10, 0x10, 0x00}, // BLUE\r
+ {0x10, 0xff, 0x10, 0x00}, // LIME\r
+ {0xff, 0xff, 0x10, 0x00}, // CYAN\r
+ {0x10, 0x10, 0xff, 0x00}, // RED\r
+ {0xf0, 0x10, 0xff, 0x00}, // FUCHSIA\r
+ {0x10, 0xff, 0xff, 0x00}, // YELLOW\r
+ {0xff, 0xff, 0xff, 0x00} // WHITE \r
};\r
\r
//\r
{1152, 870, 75}\r
};\r
\r
+/**\r
+ Install child hanlde for a detect BiosVideo device and install related protocol\r
+ into this handle, such as EFI_GRAPHIC_OUTPUT_PROTOCOL.\r
+\r
+ @param This Instance pointer of EFI_DRIVER_BINDING_PROTOCOL\r
+ @param ParentHandle Parent's controller handle\r
+ @param ParentPciIo Parent's EFI_PCI_IO_PROTOCOL instance pointer\r
+ @param ParentLegacy8259 Parent's EFI_LEGACY_8259_PROTOCOL instance pointer \r
+ @param ParentDevicePath Parent's BIOS Video controller device path\r
+ @param RemainingDevicePath Remaining device path node instance for children.\r
+\r
+ @return whether success to create children handle for a VGA device and install \r
+ related protocol into new children handle.\r
+\r
+**/\r
EFI_STATUS\r
BiosVideoChildHandleInstall (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
IN EFI_HANDLE ParentHandle,\r
IN EFI_PCI_IO_PROTOCOL *ParentPciIo,\r
IN EFI_LEGACY_8259_PROTOCOL *ParentLegacy8259,\r
+ IN THUNK_CONTEXT *ThunkContext,\r
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
;\r
\r
+/**\r
+ Deregister an video child handle and free resources\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Controller Video controller handle\r
+ @param Handle Video child handle\r
+\r
+ @return EFI_STATUS\r
+\r
+**/\r
+\r
EFI_STATUS\r
BiosVideoChildHandleUninstall (\r
EFI_DRIVER_BINDING_PROTOCOL *This,\r
)\r
;\r
\r
+/**\r
+ Collect the resource from destroyed bios video device.\r
+\r
+ @param BiosVideoPrivate Video child device private data structure\r
+**/\r
+\r
VOID\r
BiosVideoDeviceReleaseResource (\r
BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
;\r
\r
+/**\r
+ Driver Entry Point.\r
+\r
+ @param ImageHandle Handle of driver image.\r
+ @param SystemTable Pointer to system table.\r
+\r
+ @return EFI_STATUS\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverEntryPoint (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Driver Entry Point.\r
-\r
- Arguments:\r
-\r
- ImageHandle - Handle of driver image.\r
- SystemTable - Pointer to system table.\r
-\r
- Returns:\r
-\r
- EFI_STATUS\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;\r
}\r
\r
-VOID\r
-EFIAPI\r
-BiosVideoExitBootServices (\r
- EFI_EVENT Event,\r
- VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Callback function for exit boot service event\r
-\r
-Arguments:\r
-\r
- Event - EFI_EVENT structure\r
- Context - Event context\r
+/**\r
+ Test to see if Bios Video could be supported on the Controller.\r
\r
-Returns:\r
+ @param This Pointer to driver binding protocol\r
+ @param Controller Controller handle to connect\r
+ @param RemainingDevicePath A pointer to the remaining portion of a device path\r
\r
- None\r
-\r
---*/\r
-{\r
-/*\r
- BIOS_VIDEO_DEV *BiosVideoPrivate;\r
- EFI_IA32_REGISTER_SET Regs;\r
-\r
- //\r
- // Get our context\r
- //\r
- BiosVideoPrivate = (BIOS_VIDEO_DEV *) Context;\r
-\r
- //\r
- // Set the 80x25 Text VGA Mode\r
- //\r
- Regs.H.AH = 0x00;\r
- Regs.H.AL = 0x83;\r
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);\r
-\r
- Regs.H.AH = 0x11;\r
- Regs.H.AL = 0x14;\r
- Regs.H.BL = 0;\r
- BiosVideoPrivate->LegacyBios->Int86 (BiosVideoPrivate->LegacyBios, 0x10, &Regs);\r
-*/\r
-}\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval other This driver does not support this device.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingSupported (\r
IN EFI_HANDLE Controller,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Supported.\r
-\r
- Arguments:\r
-\r
- This - Pointer to driver binding protocol\r
- Controller - Controller handle to connect\r
- RemainingDevicePath - A pointer to the remaining portion of a device path\r
-\r
-\r
- Returns:\r
-\r
- EFI_STATUS - EFI_SUCCESS:This controller can be managed by this driver,\r
- Otherwise, this controller cannot be managed by this driver\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_LEGACY_8259_PROTOCOL *LegacyBios;\r
return Status;\r
}\r
\r
+/**\r
+ Install Graphics Output Protocol onto VGA device handles\r
+\r
+ @param This Pointer to driver binding protocol\r
+ @param Controller Controller handle to connect\r
+ @param RemainingDevicePath A pointer to the remaining portion of a device path\r
+\r
+ @return EFI_STATUS\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingStart (\r
IN EFI_HANDLE Controller,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Install Graphics Output Protocol onto VGA device handles\r
-\r
- Arguments:\r
-\r
- This - Pointer to driver binding protocol\r
- Controller - Controller handle to connect\r
- RemainingDevicePath - A pointer to the remaining portion of a device path\r
-\r
- Returns:\r
-\r
- EFI_STATUS\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
- EFI_LEGACY_8259_PROTOCOL *Legacy8259;\r
\r
PciIo = NULL;\r
//\r
}\r
\r
//\r
- // See if the Legacy BIOS Protocol is available\r
+ // Establish legacy environment for thunk call for all children handle.\r
//\r
- Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **) &Legacy8259);\r
- if (EFI_ERROR (Status)) {\r
- goto Done;\r
+ if (mLegacy8259 == NULL) {\r
+ Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **) &mLegacy8259);\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+ \r
+ InitializeBiosIntCaller(&mThunkContext);\r
+ InitializeInterruptRedirection(mLegacy8259);\r
}\r
\r
-\r
//\r
// Create child handle and install GraphicsOutputProtocol on it\r
//\r
This,\r
Controller,\r
PciIo,\r
- Legacy8259,\r
+ mLegacy8259,\r
+ &mThunkContext,\r
ParentDevicePath,\r
RemainingDevicePath\r
);\r
return Status;\r
}\r
\r
+/**\r
+ Stop this driver on Controller \r
+\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
+ @retval other This driver was not removed from this device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingStop (\r
IN UINTN NumberOfChildren,\r
IN EFI_HANDLE *ChildHandleBuffer\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Stop.\r
-\r
- Arguments:\r
-\r
- This - Pointer to driver binding protocol\r
- Controller - Controller handle to connect\r
- NumberOfChilren - Number of children handle created by this driver\r
- ChildHandleBuffer - Buffer containing child handle created\r
-\r
- Returns:\r
-\r
- EFI_SUCCESS - Driver disconnected successfully from controller\r
- EFI_UNSUPPORTED - Cannot find BIOS_VIDEO_DEV structure\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
- BIOS_VIDEO_DEV *BiosVideoPrivate;\r
BOOLEAN AllChildrenStopped;\r
UINTN Index;\r
\r
- BiosVideoPrivate = NULL;\r
-\r
if (NumberOfChildren == 0) {\r
//\r
// Close PCI I/O protocol on the controller handle\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Install child hanlde for a detect BiosVideo device and install related protocol\r
+ into this handle, such as EFI_GRAPHIC_OUTPUT_PROTOCOL.\r
+\r
+ @param This Instance pointer of EFI_DRIVER_BINDING_PROTOCOL\r
+ @param ParentHandle Parent's controller handle\r
+ @param ParentPciIo Parent's EFI_PCI_IO_PROTOCOL instance pointer\r
+ @param ParentLegacy8259 Parent's EFI_LEGACY_8259_PROTOCOL instance pointer \r
+ @param ParentDevicePath Parent's BIOS Video controller device path\r
+ @param RemainingDevicePath Remaining device path node instance for children.\r
+\r
+ @return whether success to create children handle for a VGA device and install \r
+ related protocol into new children handle.\r
+\r
+**/\r
EFI_STATUS\r
BiosVideoChildHandleInstall (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
IN EFI_HANDLE ParentHandle,\r
IN EFI_PCI_IO_PROTOCOL *ParentPciIo,\r
IN EFI_LEGACY_8259_PROTOCOL *ParentLegacy8259,\r
+ IN THUNK_CONTEXT *ParentThunkContext,\r
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Install child handles if the Handle supports MBR format.\r
-\r
-Arguments: \r
- This - Calling context.\r
- Handle - Parent Handle \r
- PciIo - Parent PciIo interface\r
- LegacyBios - Parent LegacyBios interface\r
- DevicePath - Parent Device Path\r
-\r
-Returns:\r
- EFI_SUCCESS - If a child handle was added\r
- other - A child handle was not added\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
// Initialize the child private structure\r
//\r
BiosVideoPrivate->Signature = BIOS_VIDEO_DEV_SIGNATURE;\r
- BiosVideoPrivate->Handle = NULL;\r
-\r
- /**\r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
- EFI_TPL_NOTIFY,\r
- BiosVideoExitBootServices,\r
- BiosVideoPrivate,\r
- &BiosVideoPrivate->ExitBootServicesEvent\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Done;\r
- }\r
- **/\r
- \r
+ BiosVideoPrivate->Handle = NULL;\r
+\r
//\r
// Fill in Graphics Output specific mode structures\r
//\r
//\r
// Child handle need to consume the Legacy Bios protocol\r
//\r
- BiosVideoPrivate->Legacy8259 = ParentLegacy8259;\r
-\r
+ BiosVideoPrivate->Legacy8259 = ParentLegacy8259;\r
+ BiosVideoPrivate->ThunkContext = ParentThunkContext;\r
+ \r
//\r
// When check for VBE, PCI I/O protocol is needed, so use parent's protocol interface temporally\r
//\r
BiosVideoPrivate->PciIo = ParentPciIo;\r
\r
- InitializeBiosIntCaller(BiosVideoPrivate);\r
- InitializeInterruptRedirection(BiosVideoPrivate);\r
-\r
//\r
// Check for VESA BIOS Extensions for modes that are compatible with Graphics Output\r
//\r
if (BiosVideoPrivate->ProduceGraphicsOutput) {\r
if (RemainingDevicePath == NULL) {\r
ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));\r
- AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;\r
+ AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;\r
AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;\r
- AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);\r
+ AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);\r
SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));\r
\r
BiosVideoPrivate->DevicePath = AppendDevicePathNode (\r
return Status;\r
}\r
\r
+/**\r
+ Deregister an video child handle and free resources\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Controller Video controller handle\r
+ @param Handle Video child handle\r
+\r
+ @return EFI_STATUS\r
+\r
+**/\r
EFI_STATUS\r
BiosVideoChildHandleUninstall (\r
EFI_DRIVER_BINDING_PROTOCOL *This,\r
EFI_HANDLE Controller,\r
EFI_HANDLE Handle\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Deregister an video child handle and free resources\r
-\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
- Controller - Video controller handle\r
- Handle - Video child handle\r
-\r
-Returns:\r
-\r
- EFI_STATUS\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_IA32_REGISTER_SET Regs;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Collect the resource from destroyed bios video device.\r
+\r
+ @param BiosVideoPrivate Video child device private data structure\r
+\r
+**/\r
VOID\r
BiosVideoDeviceReleaseResource (\r
BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
-/*++\r
-Routing Description:\r
-\r
- Release resources of an video child device before stopping it.\r
-\r
-Arguments:\r
-\r
- BiosVideoPrivate - Video child device private data structure\r
-\r
-Returns:\r
-\r
- NONE\r
- \r
----*/\r
{\r
if (BiosVideoPrivate == NULL) {\r
return ;\r
gBS->FreePool (BiosVideoPrivate->DevicePath);\r
}\r
\r
- //\r
- // Close the ExitBootServices event\r
- //\r
- if (BiosVideoPrivate->ExitBootServicesEvent != NULL) {\r
- gBS->CloseEvent (BiosVideoPrivate->ExitBootServicesEvent);\r
- }\r
-\r
gBS->FreePool (BiosVideoPrivate);\r
\r
return ;\r
}\r
\r
-STATIC\r
-UINT32\r
-CalculateEdidKey (\r
- VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming\r
- )\r
-/*++\r
-\r
- Routine Description:\r
+/**\r
\r
Generate a search key for a specified timing data.\r
\r
- Arguments:\r
\r
- EdidTiming - Pointer to EDID timing\r
+ @param EdidTiming - Pointer to EDID timing\r
\r
- Returns:\r
- The 32 bit unique key for search.\r
+ @return The 32 bit unique key for search.\r
\r
---*/\r
+**/\r
+STATIC\r
+UINT32\r
+CalculateEdidKey (\r
+ VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming\r
+ )\r
{\r
UINT32 Key;\r
\r
return Key;\r
}\r
\r
-STATIC\r
-BOOLEAN\r
-ParseEdidData (\r
- UINT8 *EdidBuffer,\r
- VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming\r
- )\r
-/*++\r
-\r
- Routine Description:\r
+/**\r
\r
Parse the Established Timing and Standard Timing in EDID data block.\r
\r
- Arguments:\r
\r
- EdidBuffer - Pointer to EDID data block\r
- ValidEdidTiming - Valid EDID timing information\r
+ @param EdidBuffer - Pointer to EDID data block\r
+ @param ValidEdidTiming - Valid EDID timing information\r
\r
- Returns:\r
- TRUE - The EDID data is valid.\r
- FALSE - The EDID data is invalid.\r
+ @return TRUE - The EDID data is valid.\r
+ FALSE - The EDID data is invalid.\r
\r
---*/\r
+**/\r
+STATIC\r
+BOOLEAN\r
+ParseEdidData (\r
+ UINT8 *EdidBuffer,\r
+ VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming\r
+ )\r
{\r
UINT8 CheckSum;\r
UINT32 Index;\r
return TRUE;\r
}\r
\r
-STATIC\r
-BOOLEAN\r
-SearchEdidTiming (\r
- VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming,\r
- VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming\r
- )\r
-/*++\r
-\r
- Routine Description:\r
+/**\r
\r
Search a specified Timing in all the valid EDID timings.\r
\r
- Arguments:\r
\r
- ValidEdidTiming - All valid EDID timing information.\r
- EdidTiming - The Timing to search for.\r
+ @param ValidEdidTiming - All valid EDID timing information.\r
+ @param EdidTiming - The Timing to search for.\r
\r
- Returns:\r
+ @return TRUE - Found.\r
+ FALSE - Not found.\r
\r
- TRUE - Found.\r
- FALSE - Not found.\r
-\r
---*/\r
+**/\r
+STATIC\r
+BOOLEAN\r
+SearchEdidTiming (\r
+ VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING *ValidEdidTiming,\r
+ VESA_BIOS_EXTENSIONS_EDID_TIMING *EdidTiming\r
+ )\r
{\r
UINT32 Index;\r
UINT32 Key;\r
#define PCI_DEVICE_ENABLED (EFI_PCI_COMMAND_IO_SPACE | EFI_PCI_COMMAND_MEMORY_SPACE)\r
\r
\r
+/**\r
+ Judge whether this device is VGA device.\r
+\r
+ @param PciIo Parent PciIo protocol instance pointer\r
+\r
+ @retval TRUE Is vga device\r
+ @retval FALSE Is no vga device\r
+**/\r
BOOLEAN\r
BiosVideoIsVga (\r
IN EFI_PCI_IO_PROTOCOL *PciIo\r
}\r
\r
\r
+/**\r
+ Check for VBE device\r
+\r
+ @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
+\r
+ @retval EFI_SUCCESS VBE device found\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoCheckForVbe (\r
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Check for VBE device\r
-\r
- Arguments:\r
-\r
- BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
-\r
- Returns:\r
-\r
- EFI_SUCCESS - VBE device found\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_IA32_REGISTER_SET Regs;\r
return Status;\r
}\r
\r
+/**\r
+ Check for VGA device\r
+\r
+ @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
+\r
+ @retval EFI_SUCCESS Standard VGA device found\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoCheckForVga (\r
IN OUT BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Check for VGA device\r
-\r
- Arguments:\r
-\r
- BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
-\r
- Returns:\r
-\r
- EFI_SUCCESS - Standard VGA device found\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
BIOS_VIDEO_MODE_DATA *ModeBuffer;\r
//\r
// Graphics Output Protocol Member Functions for VESA BIOS Extensions\r
//\r
+/**\r
+\r
+ Graphics Output protocol interface to get video mode\r
+\r
+\r
+ @param This - Protocol instance pointer.\r
+ @param ModeNumber - The mode number to return information on.\r
+ @param SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r
+ @param Info - Caller allocated buffer that returns information about ModeNumber.\r
+\r
+ @return EFI_SUCCESS - Mode information returned.\r
+ EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
+ EFI_INVALID_PARAMETER - One of the input args was NULL.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputQueryMode (\r
OUT UINTN *SizeOfInfo,\r
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Graphics Output protocol interface to get video mode\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ModeNumber - The mode number to return information on.\r
- Info - Caller allocated buffer that returns information about ModeNumber.\r
- SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r
-\r
- Returns:\r
- EFI_SUCCESS - Mode information returned.\r
- EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
- EFI_INVALID_PARAMETER - One of the input args was NULL.\r
-\r
---*/\r
{\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
EFI_STATUS Status;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ Graphics Output protocol interface to set video mode\r
+\r
+\r
+ @param This - Protocol instance pointer.\r
+ @param ModeNumber - The mode number to be set.\r
+\r
+ @return EFI_SUCCESS - Graphics mode was changed.\r
+ EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
+ EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputSetMode (\r
IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
IN UINT32 ModeNumber\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Graphics Output protocol interface to set video mode\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ModeNumber - The mode number to be set.\r
-\r
- Returns:\r
- EFI_SUCCESS - Graphics mode was changed.\r
- EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
- EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ Update physical frame buffer, copy 4 bytes block, then copy remaining bytes.\r
+\r
+\r
+ @param PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
+ @param VbeBuffer - The data to transfer to screen\r
+ @param MemAddress - Physical frame buffer base address\r
+ @param DestinationX - The X coordinate of the destination for BltOperation\r
+ @param DestinationY - The Y coordinate of the destination for BltOperation\r
+ @param TotalBytes - The total bytes of copy\r
+ @param VbePixelWidth - Bytes per pixel\r
+ @param BytesPerScanLine - Bytes per scan line\r
+\r
+ @return None.\r
+\r
+**/\r
VOID\r
CopyVideoBuffer (\r
IN EFI_PCI_IO_PROTOCOL *PciIo,\r
IN UINT32 VbePixelWidth,\r
IN UINTN BytesPerScanLine\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Update physical frame buffer, copy 4 bytes block, then copy remaining bytes.\r
-\r
-Arguments:\r
-\r
- PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
- VbeBuffer - The data to transfer to screen\r
- MemAddress - Physical frame buffer base address\r
- DestinationX - The X coordinate of the destination for BltOperation\r
- DestinationY - The Y coordinate of the destination for BltOperation\r
- TotalBytes - The total bytes of copy\r
- VbePixelWidth - Bytes per pixel\r
- BytesPerScanLine - Bytes per scan line\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
UINTN FrameBufferAddr;\r
UINTN CopyBlockNum;\r
//\r
// BUGBUG : Add Blt for 16 bit color, 15 bit color, and 8 bit color modes\r
//\r
+/**\r
+\r
+ Graphics Output protocol instance to block transfer for VBE device\r
+\r
+\r
+ @param This - Pointer to Graphics Output protocol instance\r
+ @param BltBuffer - The data to transfer to screen\r
+ @param BltOperation - The operation to perform\r
+ @param SourceX - The X coordinate of the source for BltOperation\r
+ @param SourceY - The Y coordinate of the source for BltOperation\r
+ @param DestinationX - The X coordinate of the destination for BltOperation\r
+ @param DestinationY - The Y coordinate of the destination for BltOperation\r
+ @param Width - The width of a rectangle in the blt rectangle in pixels\r
+ @param Height - The height of a rectangle in the blt rectangle in pixels\r
+ @param Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
+ If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
+ If a subrectangle of the BltBuffer is used, then Delta represents\r
+ the number of bytes in a row of the BltBuffer.\r
+\r
+ @return EFI_INVALID_PARAMETER - Invalid parameter passed in\r
+ EFI_SUCCESS - Blt operation success\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputVbeBlt (\r
IN UINTN Height,\r
IN UINTN Delta\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Graphics Output protocol instance to block transfer for VBE device\r
-\r
-Arguments:\r
-\r
- This - Pointer to Graphics Output protocol instance\r
- BltBuffer - The data to transfer to screen\r
- BltOperation - The operation to perform\r
- SourceX - The X coordinate of the source for BltOperation\r
- SourceY - The Y coordinate of the source for BltOperation\r
- DestinationX - The X coordinate of the destination for BltOperation\r
- DestinationY - The Y coordinate of the destination for BltOperation\r
- Width - The width of a rectangle in the blt rectangle in pixels\r
- Height - The height of a rectangle in the blt rectangle in pixels\r
- Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
- If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
- If a subrectangle of the BltBuffer is used, then Delta represents\r
- the number of bytes in a row of the BltBuffer.\r
-\r
-Returns:\r
-\r
- EFI_INVALID_PARAMETER - Invalid parameter passed in\r
- EFI_SUCCESS - Blt operation success\r
-\r
---*/\r
{\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
BIOS_VIDEO_MODE_DATA *Mode;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ Write graphics controller registers\r
+\r
+\r
+ @param PciIo - Pointer to PciIo protocol instance of the controller\r
+ @param Address - Register address\r
+ @param Data - Data to be written to register\r
+\r
+ @return None\r
+\r
+**/\r
STATIC\r
VOID\r
WriteGraphicsController (\r
IN UINTN Address,\r
IN UINTN Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Write graphics controller registers\r
-\r
-Arguments:\r
-\r
- PciIo - Pointer to PciIo protocol instance of the controller\r
- Address - Register address\r
- Data - Data to be written to register\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
{\r
Address = Address | (Data << 8);\r
PciIo->Io.Write (\r
);\r
}\r
\r
+/**\r
+\r
+ Read the four bit plane of VGA frame buffer\r
+\r
+\r
+ @param PciIo - Pointer to PciIo protocol instance of the controller\r
+ @param HardwareBuffer - Hardware VGA frame buffer address\r
+ @param MemoryBuffer - Memory buffer address\r
+ @param WidthInBytes - Number of bytes in a line to read\r
+ @param Height - Height of the area to read\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
VgaReadBitPlanes (\r
EFI_PCI_IO_PROTOCOL *PciIo,\r
UINTN WidthInBytes,\r
UINTN Height\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Read the four bit plane of VGA frame buffer\r
-\r
-Arguments:\r
-\r
- PciIo - Pointer to PciIo protocol instance of the controller\r
- HardwareBuffer - Hardware VGA frame buffer address\r
- MemoryBuffer - Memory buffer address\r
- WidthInBytes - Number of bytes in a line to read\r
- Height - Height of the area to read\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
{\r
UINTN BitPlane;\r
UINTN Rows;\r
}\r
}\r
\r
+/**\r
+\r
+ Internal routine to convert VGA color to Grahpics Output color\r
+\r
+\r
+ @param MemoryBuffer - Buffer containing VGA color\r
+ @param X - The X coordinate of pixel on screen\r
+ @param Y - The Y coordinate of pixel on screen\r
+ @param BltBuffer - Buffer to contain converted Grahpics Output color\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
VgaConvertToGraphicsOutputColor (\r
UINT8 *MemoryBuffer,\r
UINTN Y,\r
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Internal routine to convert VGA color to Grahpics Output color\r
-\r
-Arguments:\r
-\r
- MemoryBuffer - Buffer containing VGA color\r
- X - The X coordinate of pixel on screen\r
- Y - The Y coordinate of pixel on screen\r
- BltBuffer - Buffer to contain converted Grahpics Output color\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
{\r
UINTN Mask;\r
UINTN Bit;\r
*BltBuffer = mVgaColorToGraphicsOutputColor[Color];\r
}\r
\r
-UINT8\r
-VgaConvertColor (\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Internal routine to convert Grahpics Output color to VGA color\r
\r
-Arguments:\r
-\r
- BltBuffer - buffer containing Grahpics Output color\r
\r
-Returns:\r
+ @param BltBuffer - buffer containing Grahpics Output color\r
\r
- Converted VGA color\r
+ @return Converted VGA color\r
\r
---*/\r
+**/\r
+UINT8\r
+VgaConvertColor (\r
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
+ )\r
{\r
UINT8 Color;\r
\r
return Color;\r
}\r
\r
+/**\r
+ Grahpics Output protocol instance to block transfer for VGA device\r
+\r
+ @param This Pointer to Grahpics Output protocol instance\r
+ @param BltBuffer The data to transfer to screen\r
+ @param BltOperation The operation to perform\r
+ @param SourceX The X coordinate of the source for BltOperation\r
+ @param SourceY The Y coordinate of the source for BltOperation\r
+ @param DestinationX The X coordinate of the destination for BltOperation\r
+ @param DestinationY The Y coordinate of the destination for BltOperation\r
+ @param Width The width of a rectangle in the blt rectangle in pixels\r
+ @param Height The height of a rectangle in the blt rectangle in pixels\r
+ @param Delta Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
+ If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
+ If a subrectangle of the BltBuffer is used, then Delta represents\r
+ the number of bytes in a row of the BltBuffer.\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter passed in\r
+ @retval EFI_SUCCESS Blt operation success\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputVgaBlt (\r
IN UINTN Height,\r
IN UINTN Delta\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Grahpics Output protocol instance to block transfer for VGA device\r
-\r
-Arguments:\r
-\r
- This - Pointer to Grahpics Output protocol instance\r
- BltBuffer - The data to transfer to screen\r
- BltOperation - The operation to perform\r
- SourceX - The X coordinate of the source for BltOperation\r
- SourceY - The Y coordinate of the source for BltOperation\r
- DestinationX - The X coordinate of the destination for BltOperation\r
- DestinationY - The Y coordinate of the destination for BltOperation\r
- Width - The width of a rectangle in the blt rectangle in pixels\r
- Height - The height of a rectangle in the blt rectangle in pixels\r
- Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
- If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
- If a subrectangle of the BltBuffer is used, then Delta represents\r
- the number of bytes in a row of the BltBuffer.\r
-\r
-Returns:\r
-\r
- EFI_INVALID_PARAMETER - Invalid parameter passed in\r
- EFI_SUCCESS - Blt operation success\r
-\r
---*/\r
{\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
EFI_TPL OriginalTPL;\r
//\r
// VGA Mini Port Protocol Functions\r
//\r
+/**\r
+ VgaMiniPort protocol interface to set mode\r
+\r
+ @param This Pointer to VgaMiniPort protocol instance\r
+ @param ModeNumber The index of the mode\r
+\r
+ @retval EFI_UNSUPPORTED The requested mode is not supported\r
+ @retval EFI_SUCCESS The requested mode is set successfully\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoVgaMiniPortSetMode (\r
IN EFI_VGA_MINI_PORT_PROTOCOL *This,\r
IN UINTN ModeNumber\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- VgaMiniPort protocol interface to set mode\r
-\r
-Arguments:\r
-\r
- This - Pointer to VgaMiniPort protocol instance\r
- ModeNumber - The index of the mode\r
-\r
-Returns:\r
-\r
- EFI_UNSUPPORTED - The requested mode is not supported\r
- EFI_SUCCESS - The requested mode is set successfully\r
-\r
---*/\r
{\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\r
EFI_IA32_REGISTER_SET Regs;\r
-/*++\r
+/** @file\r
\r
Copyright (c) 2006 - 2007, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-Module Name:\r
-\r
- UefiBiosVideo.h\r
- \r
-Abstract: \r
-\r
-Revision History\r
---*/\r
+**/\r
\r
#ifndef _BIOS_GRAPHICS_OUTPUT_H\r
#define _BIOS_GRAPHICS_OUTPUT_H\r
EFI_HANDLE Handle;\r
\r
//\r
- // Consumed Protocols\r
+ // Consumed Protocols inherited from parent controller.\r
//\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
EFI_LEGACY_8259_PROTOCOL *Legacy8259;\r
-\r
+ THUNK_CONTEXT *ThunkContext;\r
+ \r
//\r
// Produced Protocols\r
//\r
//\r
BOOLEAN VgaCompatible;\r
BOOLEAN ProduceGraphicsOutput;\r
- EFI_EVENT ExitBootServicesEvent;\r
\r
//\r
// Graphics Output Protocol related fields\r
//\r
// Driver Binding Protocol functions\r
//\r
+/**\r
+ Test to see if Bios Video could be supported on the Controller.\r
+\r
+ @param This Pointer to driver binding protocol\r
+ @param Controller Controller handle to connect\r
+ @param RemainingDevicePath A pointer to the remaining portion of a device path\r
+\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval other This driver does not support this device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingSupported (\r
IN EFI_HANDLE Controller,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- This - GC_TODO: add argument description\r
- Controller - GC_TODO: add argument description\r
- RemainingDevicePath - GC_TODO: add argument description\r
+;\r
\r
-Returns:\r
+/**\r
+ Install Graphics Output Protocol onto VGA device handles\r
\r
- GC_TODO: add return values\r
+ @param This Pointer to driver binding protocol\r
+ @param Controller Controller handle to connect\r
+ @param RemainingDevicePath A pointer to the remaining portion of a device path\r
\r
---*/\r
-;\r
+ @return EFI_STATUS\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingStart (\r
IN EFI_HANDLE Controller,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- This - GC_TODO: add argument description\r
- Controller - GC_TODO: add argument description\r
- RemainingDevicePath - GC_TODO: add argument description\r
+;\r
\r
-Returns:\r
+/**\r
+ Stop this driver on Controller \r
\r
- GC_TODO: add return values\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
+ @retval other This driver was not removed from this device.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoDriverBindingStop (\r
IN UINTN NumberOfChildren,\r
IN EFI_HANDLE *ChildHandleBuffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- This - GC_TODO: add argument description\r
- Controller - GC_TODO: add argument description\r
- NumberOfChildren - GC_TODO: add argument description\r
- ChildHandleBuffer - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
;\r
\r
//\r
// Private worker functions\r
//\r
+/**\r
+ Check for VBE device\r
+\r
+ @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
+\r
+ @retval EFI_SUCCESS VBE device found\r
+\r
+**/\r
EFI_STATUS\r
BiosVideoCheckForVbe (\r
BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- BiosVideoPrivate - GC_TODO: add argument description\r
+;\r
\r
-Returns:\r
+/**\r
+ Check for VGA device\r
\r
- GC_TODO: add return values\r
+ @param BiosVideoPrivate - Pointer to BIOS_VIDEO_DEV structure\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Standard VGA device found\r
+**/\r
\r
EFI_STATUS\r
BiosVideoCheckForVga (\r
BIOS_VIDEO_DEV *BiosVideoPrivate\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- BiosVideoPrivate - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
;\r
\r
-STATIC\r
-EFI_STATUS\r
-DeRegisterVideoChildHandle (\r
- EFI_DRIVER_BINDING_PROTOCOL *This,\r
- EFI_HANDLE Controller,\r
- EFI_HANDLE Handle\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Deregister an video child handle and free resources\r
+/**\r
+ Collect the resource from destroyed bios video device.\r
\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
- Controller - Video controller handle\r
- Handle - Video child handle\r
-\r
-Returns:\r
-\r
- EFI_STATUS\r
-\r
---*/\r
-;\r
+ @param BiosVideoPrivate Video child device private data structure\r
\r
+**/\r
VOID\r
BiosVideoDeviceReleaseResource (\r
BIOS_VIDEO_DEV *BiosVideoChildPrivate\r
)\r
-/*++\r
-Routing Description:\r
+;\r
\r
- Release resources of a video child device before stopping it.\r
+//\r
+// BIOS Graphics Output Protocol functions\r
+//\r
+/**\r
\r
-Arguments:\r
+ Graphics Output protocol interface to get video mode\r
\r
- BiosVideoChildPrivate - Video child device private data structure\r
\r
-Returns:\r
+ @param This - Protocol instance pointer.\r
+ @param ModeNumber - The mode number to return information on.\r
+ @param SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r
+ @param Info - Caller allocated buffer that returns information about ModeNumber.\r
\r
- NONE\r
- \r
----*/\r
-;\r
+ @return EFI_SUCCESS - Mode information returned.\r
+ EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
+ EFI_INVALID_PARAMETER - One of the input args was NULL.\r
\r
-//\r
-// BIOS Graphics Output Protocol functions\r
-//\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputQueryMode (\r
OUT UINTN *SizeOfInfo,\r
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
)\r
-/*++\r
+;\r
\r
-Routine Description:\r
+/**\r
\r
- Graphics Output protocol interface to get video mode\r
+ Graphics Output protocol interface to set video mode\r
\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ModeNumber - The mode number to return information on.\r
- Info - Caller allocated buffer that returns information about ModeNumber.\r
- SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.\r
\r
- Returns:\r
- EFI_SUCCESS - Mode information returned.\r
- EFI_BUFFER_TOO_SMALL - The Info buffer was too small.\r
- EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.\r
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()\r
- EFI_INVALID_PARAMETER - One of the input args was NULL.\r
+ @param This - Protocol instance pointer.\r
+ @param ModeNumber - The mode number to be set.\r
\r
---*/\r
-;\r
+ @return EFI_SUCCESS - Graphics mode was changed.\r
+ EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
+ EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputSetMode (\r
IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
IN UINT32 ModeNumber\r
)\r
-/*++\r
-\r
-Routine Description:\r
+;\r
\r
- Graphics Output protocol interface to set video mode\r
+/**\r
\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ModeNumber - The mode number to be set.\r
+ Graphics Output protocol instance to block transfer for VBE device\r
\r
- Returns:\r
- EFI_SUCCESS - Graphics mode was changed.\r
- EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r
- EFI_UNSUPPORTED - ModeNumber is not supported by this device.\r
-\r
---*/\r
-;\r
\r
+ @param This - Pointer to Graphics Output protocol instance\r
+ @param BltBuffer - The data to transfer to screen\r
+ @param BltOperation - The operation to perform\r
+ @param SourceX - The X coordinate of the source for BltOperation\r
+ @param SourceY - The Y coordinate of the source for BltOperation\r
+ @param DestinationX - The X coordinate of the destination for BltOperation\r
+ @param DestinationY - The Y coordinate of the destination for BltOperation\r
+ @param Width - The width of a rectangle in the blt rectangle in pixels\r
+ @param Height - The height of a rectangle in the blt rectangle in pixels\r
+ @param Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
+ If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
+ If a subrectangle of the BltBuffer is used, then Delta represents\r
+ the number of bytes in a row of the BltBuffer.\r
+\r
+ @return EFI_INVALID_PARAMETER - Invalid parameter passed in\r
+ EFI_SUCCESS - Blt operation success\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputVbeBlt (\r
IN UINTN Height,\r
IN UINTN Delta\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Graphics Output protocol instance to block transfer for VBE device\r
-\r
-Arguments:\r
-\r
- This - Pointer to Graphics Output protocol instance\r
- BltBuffer - The data to transfer to screen\r
- BltOperation - The operation to perform\r
- SourceX - The X coordinate of the source for BltOperation\r
- SourceY - The Y coordinate of the source for BltOperation\r
- DestinationX - The X coordinate of the destination for BltOperation\r
- DestinationY - The Y coordinate of the destination for BltOperation\r
- Width - The width of a rectangle in the blt rectangle in pixels\r
- Height - The height of a rectangle in the blt rectangle in pixels\r
- Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
- If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
- If a subrectangle of the BltBuffer is used, then Delta represents\r
- the number of bytes in a row of the BltBuffer.\r
-\r
-Returns:\r
-\r
- EFI_INVALID_PARAMETER - Invalid parameter passed in\r
- EFI_SUCCESS - Blt operation success\r
-\r
---*/\r
;\r
\r
+/**\r
+ Grahpics Output protocol instance to block transfer for VGA device\r
+\r
+ @param This Pointer to Grahpics Output protocol instance\r
+ @param BltBuffer The data to transfer to screen\r
+ @param BltOperation The operation to perform\r
+ @param SourceX The X coordinate of the source for BltOperation\r
+ @param SourceY The Y coordinate of the source for BltOperation\r
+ @param DestinationX The X coordinate of the destination for BltOperation\r
+ @param DestinationY The Y coordinate of the destination for BltOperation\r
+ @param Width The width of a rectangle in the blt rectangle in pixels\r
+ @param Height The height of a rectangle in the blt rectangle in pixels\r
+ @param Delta Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
+ If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
+ If a subrectangle of the BltBuffer is used, then Delta represents\r
+ the number of bytes in a row of the BltBuffer.\r
+\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter passed in\r
+ @retval EFI_SUCCESS Blt operation success\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoGraphicsOutputVgaBlt (\r
IN UINTN Height,\r
IN UINTN Delta\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Grahpics Output protocol instance to block transfer for VGA device\r
-\r
-Arguments:\r
-\r
- This - Pointer to Grahpics Output protocol instance\r
- BltBuffer - The data to transfer to screen\r
- BltOperation - The operation to perform\r
- SourceX - The X coordinate of the source for BltOperation\r
- SourceY - The Y coordinate of the source for BltOperation\r
- DestinationX - The X coordinate of the destination for BltOperation\r
- DestinationY - The Y coordinate of the destination for BltOperation\r
- Width - The width of a rectangle in the blt rectangle in pixels\r
- Height - The height of a rectangle in the blt rectangle in pixels\r
- Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.\r
- If a Delta of 0 is used, the entire BltBuffer will be operated on.\r
- If a subrectangle of the BltBuffer is used, then Delta represents\r
- the number of bytes in a row of the BltBuffer.\r
-\r
-Returns:\r
-\r
- EFI_INVALID_PARAMETER - Invalid parameter passed in\r
- EFI_SUCCESS - Blt operation success\r
-\r
---*/\r
;\r
\r
//\r
// BIOS VGA Mini Port Protocol functions\r
//\r
+/**\r
+ VgaMiniPort protocol interface to set mode\r
+\r
+ @param This Pointer to VgaMiniPort protocol instance\r
+ @param ModeNumber The index of the mode\r
+\r
+ @retval EFI_UNSUPPORTED The requested mode is not supported\r
+ @retval EFI_SUCCESS The requested mode is set successfully\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosVideoVgaMiniPortSetMode (\r
IN EFI_VGA_MINI_PORT_PROTOCOL *This,\r
IN UINTN ModeNumber\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- VgaMiniPort protocol interface to set mode\r
-\r
-Arguments:\r
-\r
- This - Pointer to VgaMiniPort protocol instance\r
- ModeNumber - The index of the mode\r
-\r
-Returns:\r
-\r
- EFI_UNSUPPORTED - The requested mode is not supported\r
- EFI_SUCCESS - The requested mode is set successfully\r
-\r
---*/\r
;\r
\r
+/**\r
+ Judge whether this device is VGA device.\r
+\r
+ @param PciIo Parent PciIo protocol instance pointer\r
\r
+ @retval TRUE Is vga device\r
+ @retval FALSE Is no vga device\r
+**/\r
BOOLEAN\r
BiosVideoIsVga (\r
IN EFI_PCI_IO_PROTOCOL *PciIo\r
\r
#define VGA_GRAPHICS_CONTROLLER_BIT_MASK_REGISTER 0x08\r
\r
+/**\r
+ Initialize legacy environment for BIOS INI caller.\r
+ \r
+ @param ThunkContext the instance pointer of THUNK_CONTEXT\r
+**/\r
VOID\r
InitializeBiosIntCaller (\r
- IN BIOS_VIDEO_DEV *BiosDev\r
+ THUNK_CONTEXT *ThunkContext\r
);\r
\r
+/**\r
+ Initialize interrupt redirection code and entries, because\r
+ IDT Vectors 0x68-0x6f must be redirected to IDT Vectors 0x08-0x0f.\r
+ Or the interrupt will lost when we do thunk.\r
+ NOTE: We do not reset 8259 vector base, because it will cause pending\r
+ interrupt lost.\r
+ \r
+ @param Legacy8259 Instance pointer for EFI_LEGACY_8259_PROTOCOL.\r
+ \r
+**/ \r
VOID\r
InitializeInterruptRedirection (\r
- IN BIOS_VIDEO_DEV *BiosDev\r
+ IN EFI_LEGACY_8259_PROTOCOL *Legacy8259\r
);\r
\r
+/**\r
+ Thunk to 16-bit real mode and execute a software interrupt with a vector \r
+ of BiosInt. Regs will contain the 16-bit register context on entry and \r
+ exit.\r
+ \r
+ @param This Protocol instance pointer.\r
+ @param BiosInt Processor interrupt vector to invoke\r
+ @param Reg Register contexted passed into (and returned) from thunk to 16-bit mode\r
+ \r
+ @retval TRUE Thunk completed, and there were no BIOS errors in the target code.\r
+ See Regs for status.\r
+ @retval FALSE There was a BIOS erro in the target code. \r
+**/ \r
BOOLEAN\r
EFIAPI\r
LegacyBiosInt86 (\r