]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BiosVideoThunkDxe/BiosVideo.h
The unicode char and shift unicode char should be unicode but not ascii char.
[mirror_edk2.git] / DuetPkg / BiosVideoThunkDxe / BiosVideo.h
index 2123090ddb6755234fb6fb5f473e2f490ce0cd34..406bb531435f5341f72e9b1562630e20f366b979 100644 (file)
@@ -1,4 +1,4 @@
-/*++\r
+/** @file\r
 \r
 Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
@@ -9,17 +9,10 @@ http://opensource.org/licenses/bsd-license.php
 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
 \r
-  BiosVideo.h\r
-    \r
-Abstract: \r
-\r
-Revision History\r
---*/\r
-\r
-#ifndef _BIOS_UGA_H\r
-#define _BIOS_UGA_H\r
+#ifndef _BIOS_GRAPHICS_OUTPUT_H\r
+#define _BIOS_GRAPHICS_OUTPUT_H\r
 \r
 #include <Uefi.h>\r
 \r
@@ -34,24 +27,19 @@ Revision History
 #include <Protocol/UgaDraw.h>\r
 #include <Protocol/VgaMiniPort.h>\r
 #include <Protocol/Legacy8259.h>\r
-#include <Protocol/LegacyBios.h>\r
+#include <Protocol/EdidActive.h>\r
+#include <Protocol/EdidDiscovered.h>\r
+#include <Protocol/DevicePath.h>\r
 \r
 #include <Library/UefiLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/DevicePathLib.h>\r
 \r
 #include <IndustryStandard/Pci22.h>\r
 \r
 #include "VesaBiosExtensions.h"\r
-//\r
-// Driver Produced Protocol Prototypes\r
-//\r
-//#include EFI_PROTOCOL_DEFINITION (DriverBinding)\r
-//#include EFI_PROTOCOL_DEFINITION (ComponentName)\r
-//#include EFI_PROTOCOL_DEFINITION (ComponentName2)\r
-//#include EFI_PROTOCOL_DEFINITION (UgaDraw)\r
-//#include EFI_PROTOCOL_DEFINITION (VgaMiniPort)\r
 \r
 //\r
 // Packed format support: The number of bits reserved for each of the colors and the actual\r
@@ -63,59 +51,62 @@ typedef struct {
 } BIOS_VIDEO_COLOR_PLACEMENT;\r
 \r
 //\r
-// BIOS UGA Draw Graphical Mode Data\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
   BIOS_VIDEO_COLOR_PLACEMENT  Red;\r
   BIOS_VIDEO_COLOR_PLACEMENT  Green;\r
   BIOS_VIDEO_COLOR_PLACEMENT  Blue;\r
+  BIOS_VIDEO_COLOR_PLACEMENT  Reserved;\r
+  EFI_GRAPHICS_PIXEL_FORMAT   PixelFormat;\r
+  EFI_PIXEL_BITMASK           PixelBitMask;\r
 } BIOS_VIDEO_MODE_DATA;\r
 \r
 //\r
-// BIOS UGA Device Structure\r
+// BIOS video child handle private data Structure\r
 //\r
-#define BIOS_VIDEO_DEV_SIGNATURE  SIGNATURE_32 ('B', 'V', 'M', 'p')\r
+#define BIOS_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
+  // Consumed Protocols inherited from parent controller.\r
   //\r
   EFI_PCI_IO_PROTOCOL                         *PciIo;\r
-  //EFI_LEGACY_BIOS_THUNK_PROTOCOL              *LegacyBios;\r
-\r
+  EFI_LEGACY_8259_PROTOCOL                    *Legacy8259;\r
+  THUNK_CONTEXT                               *ThunkContext;\r
+  \r
   //\r
   // Produced Protocols\r
   //\r
-  EFI_UGA_DRAW_PROTOCOL                       UgaDraw;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL                GraphicsOutput;\r
+  EFI_EDID_DISCOVERED_PROTOCOL                EdidDiscovered;\r
+  EFI_EDID_ACTIVE_PROTOCOL                    EdidActive;\r
   EFI_VGA_MINI_PORT_PROTOCOL                  VgaMiniPort;\r
 \r
   //\r
   // General fields\r
   //\r
-  EFI_EVENT                                   ExitBootServicesEvent;\r
   BOOLEAN                                     VgaCompatible;\r
-  BOOLEAN                                     ProduceUgaDraw;\r
+  BOOLEAN                                     ProduceGraphicsOutput;\r
 \r
   //\r
-  // UGA Draw related fields\r
+  // Graphics Output Protocol related fields\r
   //\r
   BOOLEAN                                     HardwareNeedsStarting;\r
-  UINTN                                       CurrentMode;\r
-  UINTN                                       MaxMode;\r
   BIOS_VIDEO_MODE_DATA                        *ModeData;\r
   UINT8                                       *LineBuffer;\r
-  EFI_UGA_PIXEL                               *VbeFrameBuffer;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL               *VbeFrameBuffer;\r
   UINT8                                       *VgaFrameBuffer;\r
 \r
   //\r
@@ -125,6 +116,7 @@ typedef struct {
   EFI_PHYSICAL_ADDRESS                        PagesBelow1MB;            // Buffer for all VBE Information Blocks\r
   VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK      *VbeInformationBlock;     // 0x200 bytes.  Must be allocated below 1MB\r
   VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK *VbeModeInformationBlock; // 0x100 bytes.  Must be allocated below 1MB\r
+  VESA_BIOS_EXTENSIONS_EDID_DATA_BLOCK        *VbeEdidDataBlock;        // 0x80  bytes.  Must be allocated below 1MB\r
   VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK *VbeCrtcInformationBlock; // 59 bytes.  Must be allocated below 1MB\r
   UINTN                                       VbeSaveRestorePages;      // Number of 4KB pages in VbeSaveRestoreBuffer\r
   EFI_PHYSICAL_ADDRESS                        VbeSaveRestoreBuffer;     // Must be allocated below 1MB\r
@@ -134,10 +126,15 @@ typedef struct {
   EFI_DEVICE_PATH_PROTOCOL                    *DevicePath;\r
 } BIOS_VIDEO_DEV;\r
 \r
-#define BIOS_VIDEO_DEV_FROM_UGA_DRAW_THIS(a)      CR (a, BIOS_VIDEO_DEV, UgaDraw, BIOS_VIDEO_DEV_SIGNATURE)\r
-\r
+#define BIOS_VIDEO_DEV_FROM_PCI_IO_THIS(a)      CR (a, BIOS_VIDEO_DEV, PciIo, BIOS_VIDEO_DEV_SIGNATURE)\r
+#define BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS(a)      CR (a, BIOS_VIDEO_DEV, GraphicsOutput, BIOS_VIDEO_DEV_SIGNATURE)\r
 #define BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS(a) CR (a, BIOS_VIDEO_DEV, VgaMiniPort, BIOS_VIDEO_DEV_SIGNATURE)\r
 \r
+#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER   0xffff\r
+\r
+#define EFI_SEGMENT(_Adr)     (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)\r
+#define EFI_OFFSET(_Adr)      (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)\r
+\r
 //\r
 // Global Variables\r
 //\r
@@ -148,6 +145,17 @@ extern EFI_COMPONENT_NAME2_PROTOCOL  gBiosVideoComponentName2;
 //\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
@@ -155,27 +163,18 @@ BiosVideoDriverBindingSupported (
   IN EFI_HANDLE                   Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
-/*++\r
-  \r
-  Routine Description:\r
+;\r
 \r
-    Supported.\r
-    \r
-  Arguments:\r
+/**\r
+  Install Graphics Output Protocol onto VGA device handles\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
+  @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
-  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
+  @return EFI_STATUS\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BiosVideoDriverBindingStart (\r
@@ -183,25 +182,21 @@ BiosVideoDriverBindingStart (
   IN EFI_HANDLE                   Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
-/*++\r
-  \r
-  Routine Description:\r
+;\r
 \r
-    Install UGA Draw Protocol onto VGA device handles\r
-  \r
-  Arguments:\r
+/**\r
+  Stop this driver on Controller \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
+  @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
-    EFI_STATUS\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
@@ -210,256 +205,206 @@ BiosVideoDriverBindingStop (
   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
 \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
-  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
 \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
+\r
 EFI_STATUS\r
 BiosVideoCheckForVga (\r
   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
 \r
-//\r
-// BIOS UGA Draw Protocol functions\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-BiosVideoUgaDrawGetMode (\r
-  IN  EFI_UGA_DRAW_PROTOCOL  *This,\r
-  OUT UINT32                 *HorizontalResolution,\r
-  OUT UINT32                 *VerticalResolution,\r
-  OUT UINT32                 *ColorDepth,\r
-  OUT UINT32                 *RefreshRate\r
-  )\r
-/*++\r
+/**\r
+  Collect the resource from destroyed bios video device.\r
 \r
-Routine Description:\r
+  @param BiosVideoPrivate   Video child device private data structure\r
 \r
-  UGA protocol interface to get video mode\r
+**/\r
+VOID\r
+BiosVideoDeviceReleaseResource (\r
+  BIOS_VIDEO_DEV  *BiosVideoChildPrivate\r
+  )\r
+;\r
 \r
-Arguments:\r
+//\r
+// BIOS Graphics Output Protocol functions\r
+//\r
+/**\r
 \r
-  This                  - Pointer to UGA draw protocol instance\r
-  HorizontalResolution  - Horizontal Resolution, in pixels\r
-  VerticalResolution    - Vertical Resolution, in pixels\r
-  ColorDepth            - Bit number used to represent color value of a pixel \r
-  RefreshRate           - Refresh rate, in Hertz\r
+  Graphics Output protocol interface to get video mode\r
 \r
-Returns:\r
 \r
-  EFI_DEVICE_ERROR - Hardware need starting\r
-  EFI_INVALID_PARAMETER - Invalid parameter passed in\r
-  EFI_SUCCESS - Video mode query successfully\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
---*/\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
-BiosVideoUgaDrawSetMode (\r
-  IN  EFI_UGA_DRAW_PROTOCOL  *This,\r
-  IN  UINT32                 HorizontalResolution,\r
-  IN  UINT32                 VerticalResolution,\r
-  IN  UINT32                 ColorDepth,\r
-  IN  UINT32                 RefreshRate\r
+BiosVideoGraphicsOutputQueryMode (\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
-Routine Description:\r
-\r
-  UGA draw protocol interface to set video mode\r
+;\r
 \r
-Arguments:\r
+/**\r
 \r
-  This                  - Pointer to UGA draw protocol instance\r
-  HorizontalResolution  - Horizontal Resolution, in pixels\r
-  VerticalResolution    - Vertical Resolution, in pixels\r
-  ColorDepth            - Bit number used to represent color value of a pixel \r
-  RefreshRate           - Refresh rate, in Hertz\r
+  Graphics Output protocol interface to set video mode\r
 \r
-Returns:\r
 \r
-  EFI_DEVICE_ERROR - Device error\r
-  EFI_SUCCESS - Video mode set successfully\r
-  EFI_UNSUPPORTED - Cannot support this video mode\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
-BiosVideoUgaDrawVbeBlt (\r
-  IN  EFI_UGA_DRAW_PROTOCOL  *This,\r
-  IN  EFI_UGA_PIXEL          *BltBuffer, OPTIONAL\r
-  IN  EFI_UGA_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
+BiosVideoGraphicsOutputSetMode (\r
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
+  IN  UINT32                       ModeNumber\r
   )\r
-/*++\r
-\r
-Routine Description:\r
+;\r
 \r
-  UGA draw protocol instance to block transfer for VBE device\r
+/**\r
 \r
-Arguments:\r
+  Graphics Output protocol instance to block transfer for VBE device\r
 \r
-  This          - Pointer to UGA draw 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 EfiUgaVideoFill and EfiUgaVideoToVideo 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
+  @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
-  EFI_INVALID_PARAMETER - Invalid parameter passed in\r
-  EFI_SUCCESS - Blt operation success\r
+  @return EFI_INVALID_PARAMETER - Invalid parameter passed in\r
+          EFI_SUCCESS - Blt operation success\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BiosVideoGraphicsOutputVbeBlt (\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
+  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
-BiosVideoUgaDrawVgaBlt (\r
-  IN  EFI_UGA_DRAW_PROTOCOL  *This,\r
-  IN  EFI_UGA_PIXEL          *BltBuffer, OPTIONAL\r
-  IN  EFI_UGA_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
+BiosVideoGraphicsOutputVgaBlt (\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
-Routine Description:\r
-\r
-  UGA draw protocol instance to block transfer for VGA device\r
-\r
-Arguments:\r
-\r
-  This          - Pointer to UGA draw 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 EfiUgaVideoFill and EfiUgaVideoToVideo 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
@@ -508,4 +453,50 @@ BiosVideoIsVga (
 \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
+  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  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
+  IN  BIOS_VIDEO_DEV                 *BiosDev,\r
+  IN  UINT8                           BiosInt,\r
+  IN  IA32_REGISTER_SET           *Regs\r
+  );    \r
+  \r
 #endif\r