+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
-\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef _FB_GOP_H_\r
-#define _FB_GOP_H_\r
-\r
-#include <Protocol/PciIo.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/GraphicsOutput.h>\r
-#include <Protocol/EdidActive.h>\r
-#include <Protocol/EdidDiscovered.h>\r
-\r
-#include <Guid/StatusCodeDataTypeId.h>\r
-#include <Guid/EventGroup.h>\r
-#include <Guid/FrameBufferInfoGuid.h>\r
-\r
-#include <Library/PcdLib.h>\r
-#include <Library/HobLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-\r
-#include <IndustryStandard/Pci.h>\r
-\r
-//\r
-// Packed format support: The number of bits reserved for each of the colors and the actual\r
-// position of RGB in the frame buffer is specified in the VBE Mode information\r
-//\r
-typedef struct {\r
- UINT8 Position; // Position of the color\r
- UINT8 Mask; // The number of bits expressed as a mask\r
-} FB_VIDEO_COLOR_PLACEMENT;\r
-\r
-//\r
-// BIOS Graphics Output Graphical Mode Data\r
-//\r
-typedef struct {\r
- UINT16 VbeModeNumber;\r
- UINT16 BytesPerScanLine;\r
- VOID *LinearFrameBuffer;\r
- UINTN FrameBufferSize;\r
- UINT32 HorizontalResolution;\r
- UINT32 VerticalResolution;\r
- UINT32 ColorDepth;\r
- UINT32 RefreshRate;\r
- UINT32 BitsPerPixel;\r
- FB_VIDEO_COLOR_PLACEMENT Red;\r
- FB_VIDEO_COLOR_PLACEMENT Green;\r
- FB_VIDEO_COLOR_PLACEMENT Blue;\r
- FB_VIDEO_COLOR_PLACEMENT Reserved;\r
- EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r
- EFI_PIXEL_BITMASK PixelBitMask;\r
-} FB_VIDEO_MODE_DATA;\r
-\r
-//\r
-// BIOS video child handle private data Structure\r
-//\r
-#define FB_VIDEO_DEV_SIGNATURE SIGNATURE_32 ('B', 'V', 'M', 'p')\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- EFI_HANDLE Handle;\r
-\r
- //\r
- // Consumed Protocols\r
- //\r
- EFI_PCI_IO_PROTOCOL *PciIo; \r
-\r
- //\r
- // Produced Protocols\r
- //\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r
- EFI_EDID_DISCOVERED_PROTOCOL EdidDiscovered;\r
- EFI_EDID_ACTIVE_PROTOCOL EdidActive;\r
-\r
- //\r
- // Graphics Output Protocol related fields\r
- //\r
- UINTN CurrentMode;\r
- UINTN MaxMode;\r
- FB_VIDEO_MODE_DATA *ModeData;\r
- \r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer;\r
- \r
- //\r
- // Status code\r
- //\r
- EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;\r
- \r
-} FB_VIDEO_DEV;\r
-\r
-#define FB_VIDEO_DEV_FROM_PCI_IO_THIS(a) CR (a, FB_VIDEO_DEV, PciIo, FB_VIDEO_DEV_SIGNATURE)\r
-#define FB_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS(a) CR (a, FB_VIDEO_DEV, GraphicsOutput, FB_VIDEO_DEV_SIGNATURE)\r
-\r
-#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gFbGopDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gFbGopComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gFbGopComponentName2;\r
-\r
-//\r
-// Driver Binding Protocol functions\r
-//\r
-\r
-/**\r
- Supported.\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\r
- path\r
-\r
- @retval EFI_STATUS EFI_SUCCESS:This controller can be managed by this\r
- driver, Otherwise, this controller cannot be\r
- managed by this driver\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FbGopDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\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\r
- path\r
-\r
- @return EFI_STATUS\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FbGopDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-\r
-/**\r
- Stop.\r
-\r
- @param This Pointer to driver binding protocol\r
- @param Controller Controller handle to connect\r
- @param NumberOfChildren Number of children handle created by this driver\r
- @param ChildHandleBuffer Buffer containing child handle created\r
-\r
- @retval EFI_SUCCESS Driver disconnected successfully from controller\r
- @retval EFI_UNSUPPORTED Cannot find FB_VIDEO_DEV structure\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FbGopDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-//\r
-// Private worker functions\r
-//\r
-\r
-/**\r
- Check for VBE device.\r
-\r
- @param FbGopPrivate Pointer to FB_VIDEO_DEV structure\r
-\r
- @retval EFI_SUCCESS VBE device found\r
-\r
-**/\r
-EFI_STATUS\r
-FbGopCheckForVbe (\r
- IN OUT FB_VIDEO_DEV *FbGopPrivate\r
- );\r
-\r
-\r
-\r
-/**\r
- Release resource for bios video instance.\r
-\r
- @param FbGopPrivate Video child device private data structure\r
-\r
-**/\r
-VOID\r
-FbGopDeviceReleaseResource (\r
- FB_VIDEO_DEV *FbGopPrivate\r
- );\r
-\r
-//\r
-// BIOS Graphics Output Protocol functions\r
-//\r
-\r
-/**\r
- Graphics Output protocol interface to get video mode.\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\r
- buffer.\r
- @param Info Caller allocated buffer that returns information\r
- about ModeNumber.\r
-\r
- @retval EFI_SUCCESS Mode information returned.\r
- @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r
- @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the\r
- video mode.\r
- @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r
- @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FbGopGraphicsOutputQueryMode (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN UINT32 ModeNumber,\r
- OUT UINTN *SizeOfInfo,\r
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
- );\r
-\r
-\r
-/**\r
- Graphics Output protocol interface to set video mode.\r
-\r
- @param This Protocol instance pointer.\r
- @param ModeNumber The mode number to be set.\r
-\r
- @retval EFI_SUCCESS Graphics mode was changed.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r
- request.\r
- @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FbGopGraphicsOutputSetMode (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
- IN UINT32 ModeNumber\r
- );\r
-\r
-\r
-/**\r
- Graphics Output protocol instance to block transfer for VBE device.\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\r
- BltOperation\r
- @param DestinationY The Y coordinate of the destination for\r
- BltOperation\r
- @param Width The width of a rectangle in the blt rectangle in\r
- pixels\r
- @param Height The height of a rectangle in the blt rectangle in\r
- pixels\r
- @param Delta Not used for EfiBltVideoFill and\r
- EfiBltVideoToVideo operation. If a Delta of 0 is\r
- used, the entire BltBuffer will be operated on. If\r
- a subrectangle of the BltBuffer is used, then\r
- Delta represents the number of bytes in a row of\r
- 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
-FbGopGraphicsOutputVbeBlt (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta\r
- );\r
-\r
-\r
-/**\r
- Graphics Output protocol instance to block transfer for VGA device.\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\r
- BltOperation\r
- @param DestinationY The Y coordinate of the destination for\r
- BltOperation\r
- @param Width The width of a rectangle in the blt rectangle in\r
- pixels\r
- @param Height The height of a rectangle in the blt rectangle in\r
- pixels\r
- @param Delta Not used for EfiBltVideoFill and\r
- EfiBltVideoToVideo operation. If a Delta of 0 is\r
- used, the entire BltBuffer will be operated on. If\r
- a subrectangle of the BltBuffer is used, then\r
- Delta represents the number of bytes in a row of\r
- 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
-FbGopGraphicsOutputVgaBlt (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta\r
- );\r
-\r
-/**\r
- Install child handles if the Handle supports MBR format.\r
-\r
- @param This Calling context.\r
- @param ParentHandle Parent Handle\r
- @param ParentPciIo Parent PciIo interface\r
- @param ParentLegacyBios Parent LegacyBios interface\r
- @param ParentDevicePath Parent Device Path\r
- @param RemainingDevicePath Remaining Device Path\r
-\r
- @retval EFI_SUCCESS If a child handle was added\r
- @retval other A child handle was not added\r
-\r
-**/\r
-EFI_STATUS\r
-FbGopChildHandleInstall (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ParentHandle,\r
- IN EFI_PCI_IO_PROTOCOL *ParentPciIo,\r
- IN VOID *ParentLegacyBios,\r
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\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
-FbGopChildHandleUninstall (\r
- EFI_DRIVER_BINDING_PROTOCOL *This,\r
- EFI_HANDLE Controller,\r
- EFI_HANDLE Handle\r
- );\r
-\r
-/**\r
- Release resource for bios video instance.\r
-\r
- @param FbGopPrivate Video child device private data structure\r
-\r
-**/\r
-VOID\r
-FbGopDeviceReleaseResource (\r
- FB_VIDEO_DEV *FbGopPrivate\r
- );\r
-\r
-/**\r
- Check if all video child handles have been uninstalled.\r
-\r
- @param Controller Video controller handle\r
-\r
- @return TRUE Child handles exist.\r
- @return FALSE All video child handles have been uninstalled.\r
-\r
-**/\r
-BOOLEAN\r
-HasChildHandle (\r
- IN EFI_HANDLE Controller\r
- );\r
-#endif\r