]> 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 c8a3f3c92d55bc32bf5157eb93829ab2045ee957..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,14 +9,7 @@ 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
-  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
@@ -37,7 +30,6 @@ Revision History
 #include <Protocol/EdidActive.h>\r
 #include <Protocol/EdidDiscovered.h>\r
 #include <Protocol/DevicePath.h>\r
-#include <Protocol/LegacyBios.h>\r
 \r
 #include <Library/UefiLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -88,11 +80,12 @@ typedef struct {
   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
@@ -106,7 +99,6 @@ typedef struct {
   //\r
   BOOLEAN                                     VgaCompatible;\r
   BOOLEAN                                     ProduceGraphicsOutput;\r
-  EFI_EVENT                                   ExitBootServicesEvent;\r
 \r
   //\r
   // Graphics Output Protocol related fields\r
@@ -140,6 +132,9 @@ typedef struct {
 \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
@@ -150,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
@@ -157,25 +163,18 @@ BiosVideoDriverBindingSupported (
   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
@@ -183,25 +182,21 @@ BiosVideoDriverBindingStart (
   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
@@ -210,120 +205,70 @@ BiosVideoDriverBindingStop (
   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
@@ -332,52 +277,52 @@ BiosVideoGraphicsOutputQueryMode (
   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
@@ -392,36 +337,29 @@ BiosVideoGraphicsOutputVbeBlt (
   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
@@ -436,65 +374,37 @@ BiosVideoGraphicsOutputVgaBlt (
   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
@@ -543,22 +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
-  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
   IN  BIOS_VIDEO_DEV                 *BiosDev,\r
   IN  UINT8                           BiosInt,\r
-  IN  EFI_IA32_REGISTER_SET           *Regs\r
+  IN  IA32_REGISTER_SET           *Regs\r
   );    \r
   \r
 #endif\r