-/*++\r
+/** @file\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+ BiosVideo driver produce EFI_GRAPHIC_OUTPUT_PROTOCOL via LegacyBios Video rom.\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
http://opensource.org/licenses/bsd-license.php \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
+UINT8 mVgaRightMaskTable[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };\r
\r
-UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };\r
+UINT8 mVgaBitMaskTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };\r
+\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
+ Test to see if Bios Video could be supported on the Controller.\r
\r
- Callback function for exit boot service event\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
-Arguments:\r
-\r
- Event - EFI_EVENT structure\r
- Context - Event context\r
-\r
-Returns:\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
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
sizeof (BIOS_VIDEO_DEV),\r
- &BiosVideoPrivate\r
+ (VOID**) &BiosVideoPrivate\r
);\r
if (EFI_ERROR (Status)) {\r
goto Done;\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
+ IA32_REGISTER_SET Regs;\r
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;\r
BIOS_VIDEO_DEV *BiosVideoPrivate;\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
//\r
CheckSum = 0;\r
for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE; Index ++) {\r
- CheckSum = CheckSum + EdidBuffer[Index];\r
+ CheckSum = (UINT8)(CheckSum + EdidBuffer[Index]);\r
}\r
if (CheckSum != 0) {\r
return FALSE;\r
//\r
// A valid Standard Timing\r
//\r
- HorizontalResolution = BufferIndex[0] * 8 + 248;\r
- AspectRatio = BufferIndex[1] >> 6;\r
+ HorizontalResolution = (UINT8) (BufferIndex[0] * 8 + 248);\r
+ AspectRatio = (UINT8) (BufferIndex[1] >> 6);\r
switch (AspectRatio) {\r
case 0:\r
- VerticalResolution = HorizontalResolution / 16 * 10;\r
+ VerticalResolution = (UINT8) (HorizontalResolution / 16 * 10);\r
break;\r
case 1:\r
- VerticalResolution = HorizontalResolution / 4 * 3;\r
+ VerticalResolution = (UINT8) (HorizontalResolution / 4 * 3);\r
break;\r
case 2:\r
- VerticalResolution = HorizontalResolution / 5 * 4;\r
+ VerticalResolution = (UINT8) (HorizontalResolution / 5 * 4);\r
break;\r
case 3:\r
- VerticalResolution = HorizontalResolution / 16 * 9;\r
+ VerticalResolution = (UINT8) (HorizontalResolution / 16 * 9);\r
break;\r
default:\r
- VerticalResolution = HorizontalResolution / 4 * 3;\r
+ VerticalResolution = (UINT8) (HorizontalResolution / 4 * 3);\r
break;\r
}\r
- RefreshRate = (BufferIndex[1] & 0x1f) + 60;\r
+ RefreshRate = (UINT8) ((BufferIndex[1] & 0x1f) + 60);\r
TempTiming.HorizontalResolution = HorizontalResolution;\r
TempTiming.VerticalResolution = VerticalResolution;\r
TempTiming.RefreshRate = RefreshRate;\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
+ IA32_REGISTER_SET Regs;\r
UINT16 *ModeNumberPtr;\r
BOOLEAN ModeFound;\r
BOOLEAN EdidFound;\r
//\r
// Test to see if the Video Adapter is compliant with VBE 3.0\r
//\r
+ // INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION\r
+ //\r
+ // AX = 4F00h\r
+ // ES:DI -> buffer for SuperVGA information (see #00077)\r
+ // Return: AL = 4Fh if function supported\r
+ // AH = status\r
+ // 00h successful\r
+ // ES:DI buffer filled\r
+ // 01h failed\r
+ // ---VBE v2.0---\r
+ // 02h function not supported by current hardware configuration\r
+ // 03h function invalid in current video mode\r
+ // Desc: determine whether VESA BIOS extensions are present and the capabilities\r
+ // supported by the display adapter\r
+ //\r
gBS->SetMem (&Regs, sizeof (Regs), 0);\r
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION;\r
gBS->SetMem (BiosVideoPrivate->VbeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK), 0);\r
BiosVideoPrivate->VbeInformationBlock->VESASignature = VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE;\r
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock);\r
+ Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock);\r
Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeInformationBlock);\r
\r
LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs);\r
- \r
+ \r
Status = EFI_DEVICE_ERROR;\r
\r
//\r
//\r
// Read EDID information\r
//\r
+ // INT 10 - VESA VBE/DC (Display Data Channel) - READ EDID\r
+ //\r
+ // AX = 4F15h\r
+ // BL = 01h\r
+ // CX = 0000h\r
+ // DX = 0000h\r
+ // ES:DI -> 128-byte buffer for EDID record (see #00127)\r
+ // Return: AL = 4Fh if function supported\r
+ // AH = status\r
+ // 00h successful\r
+ // ES:DI buffer filled\r
+ // 01h failed (e.g. non-DDC monitor)\r
+ //\r
gBS->SetMem (&Regs, sizeof (Regs), 0);\r
Regs.X.AX = VESA_BIOS_EXTENSIONS_EDID;\r
Regs.X.BX = 1;\r
Regs.X.CX = 0;\r
Regs.X.DX = 0;\r
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeEdidDataBlock);\r
+ Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeEdidDataBlock);\r
Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeEdidDataBlock);\r
\r
LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs);\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE,\r
- &BiosVideoPrivate->EdidDiscovered.Edid\r
+ (VOID**) &BiosVideoPrivate->EdidDiscovered.Edid\r
);\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE,\r
- &BiosVideoPrivate->EdidActive.Edid\r
+ (VOID**)&BiosVideoPrivate->EdidActive.Edid\r
);\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
//\r
// Get the information about the mode\r
//\r
+ // INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION\r
+ //\r
+ // AX = 4F01h\r
+ // CX = SuperVGA video mode (see #04082 for bitfields)\r
+ // ES:DI -> 256-byte buffer for mode information (see #00079)\r
+ // Return: AL = 4Fh if function supported\r
+ // AH = status\r
+ // 00h successful\r
+ // ES:DI buffer filled\r
+ // 01h failed\r
+ // Desc: determine the attributes of the specified video mode\r
+ //\r
gBS->SetMem (&Regs, sizeof (Regs), 0);\r
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION;\r
Regs.X.CX = *ModeNumberPtr;\r
gBS->SetMem (BiosVideoPrivate->VbeModeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK), 0);\r
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeModeInformationBlock);\r
+ Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeModeInformationBlock);\r
Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeModeInformationBlock);\r
\r
LegacyBiosInt86 (BiosVideoPrivate, 0x10, &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
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),\r
- Info\r
+ (VOID**) Info\r
);\r
if (EFI_ERROR (Status)) {\r
return 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
- EFI_IA32_REGISTER_SET Regs;\r
+ IA32_REGISTER_SET Regs;\r
BIOS_VIDEO_MODE_DATA *ModeData;\r
\r
BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This);\r
return EFI_UNSUPPORTED;\r
}\r
\r
- if (ModeNumber == This->Mode->Mode) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
ModeData = &BiosVideoPrivate->ModeData[ModeNumber];\r
\r
if (BiosVideoPrivate->LineBuffer) {\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
ModeData->BytesPerScanLine,\r
- &BiosVideoPrivate->LineBuffer\r
+ (VOID**) &BiosVideoPrivate->LineBuffer\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
4 * 480 * 80,\r
- &BiosVideoPrivate->VgaFrameBuffer\r
+ (VOID**) &BiosVideoPrivate->VgaFrameBuffer\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
ModeData->BytesPerScanLine * ModeData->VerticalResolution,\r
- &BiosVideoPrivate->VbeFrameBuffer\r
+ (VOID**) &BiosVideoPrivate->VbeFrameBuffer\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
Regs.X.AX = VESA_BIOS_EXTENSIONS_SET_MODE;\r
Regs.X.BX = (UINT16) (ModeData->VbeModeNumber | VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER);\r
gBS->SetMem (BiosVideoPrivate->VbeCrtcInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK), 0);\r
- Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock);\r
+ Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock);\r
Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock);\r
+ \r
LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs);\r
\r
//\r
//\r
// Frame BufferSize remain unchanged\r
//\r
- This->Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) ModeData->LinearFrameBuffer;\r
+ This->Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS)(UINTN)ModeData->LinearFrameBuffer;\r
This->Mode->FrameBufferSize = ModeData->FrameBufferSize;\r
\r
BiosVideoPrivate->HardwareNeedsStarting = FALSE;\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
);\r
}\r
break;\r
+ default:\r
+ break;\r
}\r
\r
gBS->RestoreTPL (OriginalTPL);\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
PciIo->Mem.Read (\r
PciIo,\r
EfiPciIoWidthUint8,\r
- EFI_PCI_IO_PASS_THROUGH_BAR,\r
- (UINT64) Source,\r
+ (UINT8) EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ (UINT64)(UINTN) Source,\r
WidthInBytes,\r
(VOID *) Destination\r
);\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
UINT8 *MemAddress;\r
UINTN BytesPerScanLine;\r
- UINTN BytesPerBitPlane;\r
+ //UINTN BytesPerBitPlane;\r
UINTN Bit;\r
UINTN Index;\r
UINTN Index1;\r
PciIo = BiosVideoPrivate->PciIo;\r
MemAddress = BiosVideoPrivate->ModeData[CurrentMode].LinearFrameBuffer;\r
BytesPerScanLine = BiosVideoPrivate->ModeData[CurrentMode].BytesPerScanLine >> 3;\r
- BytesPerBitPlane = BytesPerScanLine * BiosVideoPrivate->ModeData[CurrentMode].VerticalResolution;\r
+ //BytesPerBitPlane = BytesPerScanLine * BiosVideoPrivate->ModeData[CurrentMode].VerticalResolution;\r
VgaFrameBuffer = BiosVideoPrivate->VgaFrameBuffer;\r
\r
if (This == NULL || ((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) {\r
PciIo,\r
EfiPciIoWidthUint8,\r
EFI_PCI_IO_PASS_THROUGH_BAR,\r
- (UINT64) (DestinationAddress + Offset),\r
+ (UINT64) ((UINTN)DestinationAddress + Offset),\r
EFI_PCI_IO_PASS_THROUGH_BAR,\r
- (UINT64) (SourceAddress + Offset),\r
+ (UINT64) ((UINTN)SourceAddress + Offset),\r
Bytes\r
);\r
}\r
LeftMask = mVgaLeftMaskTable[DestinationX & 0x07];\r
RightMask = mVgaRightMaskTable[(DestinationX + Width - 1) & 0x07];\r
if (Bytes == 0) {\r
- LeftMask &= RightMask;\r
+ LeftMask = (UINT8) (LeftMask & RightMask);\r
RightMask = 0;\r
}\r
\r
PciIo,\r
EfiPciIoWidthUint8,\r
EFI_PCI_IO_PASS_THROUGH_BAR,\r
- (UINT64) Address1,\r
+ (UINT64)(UINTN) Address1,\r
1,\r
&Data\r
);\r
PciIo,\r
EfiPciIoWidthUint8,\r
EFI_PCI_IO_PASS_THROUGH_BAR,\r
- (UINT64) Address1,\r
+ (UINT64)(UINTN) Address1,\r
1,\r
&BiosVideoPrivate->LineBuffer[Index1]\r
);\r
}\r
}\r
\r
+ break;\r
+ default:\r
break;\r
}\r
\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
+ IA32_REGISTER_SET Regs;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r