]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code scrub for VgaClass Driver.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 23 Apr 2009 09:31:15 +0000 (09:31 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 23 Apr 2009 09:31:15 +0000 (09:31 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8163 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/ComponentName.c
IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/ComponentName.h [deleted file]
IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClass.c
IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClass.h
IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf

index 50058ef5d895074db7656b460f58ea34f3e71311..89deaa5027aecb4d24f99d1b0eed584d372f9e0f 100644 (file)
@@ -1,6 +1,7 @@
-/**@file\r
+/** @file\r
+  UEFI Component Name(2) protocol implementation for VGA Class Driver. \r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -53,10 +54,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVgaClassDriverNameTable[
   by This does not support the language specified by Language,\r
   then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -64,8 +64,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVgaClassDriverNameTable[
                                 number of languages supported by a driver is up\r
                                 to the driver writer. Language is specified\r
                                 in RFC 3066 or ISO 639-2 language code format.\r
-\r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
                                 specified by Language.\r
@@ -73,11 +72,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVgaClassDriverNameTable[
   @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
                                 This and the language specified by Language was\r
                                 returned in DriverName.\r
-\r
   @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
   @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
                                 the language specified by Language.\r
 \r
@@ -112,15 +108,13 @@ VgaClassComponentNameGetDriverName (
   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
   support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
 \r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
-\r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
                                 drivers.  It will also be NULL for a bus drivers\r
@@ -128,8 +122,7 @@ VgaClassComponentNameGetDriverName (
                                 controller.  It will not be NULL for a bus\r
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
-\r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
                                 requesting, and it must match one of the\r
@@ -137,8 +130,7 @@ VgaClassComponentNameGetDriverName (
                                 number of languages supported by a driver is up\r
                                 to the driver writer. Language is specified in\r
                                 RFC 3066 or ISO 639-2 language code format.\r
-\r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
                                 ChildHandle in the language specified by\r
@@ -149,20 +141,14 @@ VgaClassComponentNameGetDriverName (
                                 the language specified by Language for the\r
                                 driver specified by This was returned in\r
                                 DriverName.\r
-\r
   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
-\r
   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
                                 EFI_HANDLE.\r
-\r
   @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
   @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
                                 managing the controller specified by\r
                                 ControllerHandle and ChildHandle.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
                                 the language specified by Language.\r
 \r
diff --git a/IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/ComponentName.h b/IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/ComponentName.h
deleted file mode 100644 (file)
index 0a2012f..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/**@file\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \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
-**/\r
-\r
-#ifndef _VGA_CLASS_COMPONENT_NAME_H\r
-#define _VGA_CLASS_COMPONENT_NAME_H\r
-\r
-#include <PiDxe.h>\r
-#include <Protocol/ComponentName.h>\r
-\r
-extern EFI_COMPONENT_NAME_PROTOCOL   gVgaClassComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL  gVgaClassComponentName2;\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-/**\r
-  Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
-  This function retrieves the user readable name of a driver in the form of a\r
-  Unicode string. If the driver specified by This has a user readable name in\r
-  the language specified by Language, then a pointer to the driver name is\r
-  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
-  by This does not support the language specified by Language,\r
-  then EFI_UNSUPPORTED is returned.\r
-\r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
-                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
-                                array indicating the language. This is the\r
-                                language of the driver name that the caller is\r
-                                requesting, and it must match one of the\r
-                                languages specified in SupportedLanguages. The\r
-                                number of languages supported by a driver is up\r
-                                to the driver writer. Language is specified\r
-                                in RFC 3066 or ISO 639-2 language code format.\r
-\r
-  @param  DriverName[out]       A pointer to the Unicode string to return.\r
-                                This Unicode string is the name of the\r
-                                driver specified by This in the language\r
-                                specified by Language.\r
-\r
-  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
-                                This and the language specified by Language was\r
-                                returned in DriverName.\r
-\r
-  @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
-  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
-  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
-                                the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassComponentNameGetDriverName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
-  IN  CHAR8                        *Language,\r
-  OUT CHAR16                       **DriverName\r
-  );\r
-\r
-\r
-/**\r
-  Retrieves a Unicode string that is the user readable name of the controller\r
-  that is being managed by a driver.\r
-\r
-  This function retrieves the user readable name of the controller specified by\r
-  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
-  driver specified by This has a user readable name in the language specified by\r
-  Language, then a pointer to the controller name is returned in ControllerName,\r
-  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
-  managing the controller specified by ControllerHandle and ChildHandle,\r
-  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
-  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
-  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
-                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
-  @param  ControllerHandle[in]  The handle of a controller that the driver\r
-                                specified by This is managing.  This handle\r
-                                specifies the controller whose name is to be\r
-                                returned.\r
-\r
-  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
-                                the name of.  This is an optional parameter that\r
-                                may be NULL.  It will be NULL for device\r
-                                drivers.  It will also be NULL for a bus drivers\r
-                                that wish to retrieve the name of the bus\r
-                                controller.  It will not be NULL for a bus\r
-                                driver that wishes to retrieve the name of a\r
-                                child controller.\r
-\r
-  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
-                                array indicating the language.  This is the\r
-                                language of the driver name that the caller is\r
-                                requesting, and it must match one of the\r
-                                languages specified in SupportedLanguages. The\r
-                                number of languages supported by a driver is up\r
-                                to the driver writer. Language is specified in\r
-                                RFC 3066 or ISO 639-2 language code format.\r
-\r
-  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
-                                This Unicode string is the name of the\r
-                                controller specified by ControllerHandle and\r
-                                ChildHandle in the language specified by\r
-                                Language from the point of view of the driver\r
-                                specified by This.\r
-\r
-  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
-                                the language specified by Language for the\r
-                                driver specified by This was returned in\r
-                                DriverName.\r
-\r
-  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
-\r
-  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
-                                EFI_HANDLE.\r
-\r
-  @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
-  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
-  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
-                                managing the controller specified by\r
-                                ControllerHandle and ChildHandle.\r
-\r
-  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
-                                the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassComponentNameGetControllerName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
-  IN  EFI_HANDLE                                      ControllerHandle,\r
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
-  IN  CHAR8                                           *Language,\r
-  OUT CHAR16                                          **ControllerName\r
-  );\r
-\r
-\r
-#endif\r
index 5b5877d90541935b1793c9f3654a004bf7e8715a..dbf9aa9f706c0b51f1aa817eece3165631a4a412 100644 (file)
@@ -1,7 +1,7 @@
-/**@file\r
-  This driver produces a VGA console.\r
+/** @file\r
+  VGA Class Driver that managers VGA devices and produces Simple Text Output Protocol.\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -26,53 +26,11 @@ EFI_DRIVER_BINDING_PROTOCOL gVgaClassDriverBinding = {
   NULL\r
 };\r
 \r
-/**\r
-  The user Entry Point for module VgaClass. The user code starts with this function.\r
-\r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
-  @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
-  @retval EFI_SUCCESS       The entry point is executed successfully.\r
-  @retval other             Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeVgaClass(\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
-\r
-  //\r
-  // Install driver model protocol(s).\r
-  //\r
-  Status = EfiLibInstallDriverBindingComponentName2 (\r
-             ImageHandle,\r
-             SystemTable,\r
-             &gVgaClassDriverBinding,\r
-             ImageHandle,\r
-             &gVgaClassComponentName,\r
-             &gVgaClassComponentName2\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-\r
-  return Status;\r
-}\r
-\r
 //\r
 // Local variables\r
 //\r
 CHAR16               CrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };\r
 \r
-typedef struct {\r
-  CHAR16  Unicode;\r
-  CHAR8   PcAnsi;\r
-  CHAR8   Ascii;\r
-} UNICODE_TO_CHAR;\r
-\r
 //\r
 // This list is used to define the valid extend chars.\r
 // It also provides a mapping from Unicode to PCANSI or\r
@@ -344,53 +302,220 @@ UNICODE_TO_CHAR  UnicodeToPcAnsiOrAscii[] = {
   }\r
 };\r
 \r
-//\r
-// Private worker functions\r
-//\r
+/**\r
+  Entrypoint of this VGA Class Driver.\r
+\r
+  This function is the entrypoint of this VGA Class Driver. It installs Driver Binding\r
+  Protocols together with Component Name Protocols.\r
+\r
+  @param  ImageHandle       The firmware allocated handle for the EFI image.\r
+  @param  SystemTable       A pointer to the EFI System Table.\r
+  \r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeVgaClass(\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS              Status;\r
+\r
+  //\r
+  // Install driver model protocol(s).\r
+  //\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
+             ImageHandle,\r
+             SystemTable,\r
+             &gVgaClassDriverBinding,\r
+             ImageHandle,\r
+             &gVgaClassComponentName,\r
+             &gVgaClassComponentName2\r
+             );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Internal worker function to program CRTC register via PCI I/O Protocol.\r
+  \r
+  @param VgaClassDev  device instance object\r
+  @param Address      Address of register to write\r
+  @param Data         Data to write to register.\r
+\r
+**/\r
+VOID\r
+WriteCrtc (\r
+  IN  VGA_CLASS_DEV  *VgaClassDev,\r
+  IN  UINT16         Address,\r
+  IN  UINT8          Data\r
+  )\r
+{\r
+  VgaClassDev->PciIo->Io.Write (\r
+                           VgaClassDev->PciIo,\r
+                           EfiPciIoWidthUint8,\r
+                           VgaClassDev->VgaMiniPort->CrtcAddressRegisterBar,\r
+                           VgaClassDev->VgaMiniPort->CrtcAddressRegisterOffset,\r
+                           1,\r
+                           &Address\r
+                           );\r
+\r
+  VgaClassDev->PciIo->Io.Write (\r
+                           VgaClassDev->PciIo,\r
+                           EfiPciIoWidthUint8,\r
+                           VgaClassDev->VgaMiniPort->CrtcDataRegisterBar,\r
+                           VgaClassDev->VgaMiniPort->CrtcDataRegisterOffset,\r
+                           1,\r
+                           &Data\r
+                           );\r
+}\r
+\r
+/**\r
+  Internal worker function to set cursor's position to VgaClass device\r
+  \r
+  @param  VgaClassDev   Private data structure for device instance.\r
+  @param  Column        Colomn of position to set cursor to.\r
+  @param  Row           Row of position to set cursor to.\r
+  @param  MaxColumn     Max value of column.\r
+  \r
+**/\r
 VOID\r
 SetVideoCursorPosition (\r
   IN  VGA_CLASS_DEV  *VgaClassDev,\r
   IN  UINTN          Column,\r
   IN  UINTN          Row,\r
   IN  UINTN          MaxColumn\r
-  );\r
+  )\r
+{\r
+  Column    = Column & 0xff;\r
+  Row       = Row & 0xff;\r
+  MaxColumn = MaxColumn & 0xff;\r
 \r
-VOID\r
-WriteCrtc (\r
-  IN  VGA_CLASS_DEV  *VgaClassDev,\r
-  IN  UINT16         Address,\r
-  IN  UINT8          Data\r
-  );\r
+  WriteCrtc (\r
+    VgaClassDev,\r
+    CRTC_CURSOR_LOCATION_HIGH,\r
+    (UINT8) ((Row * MaxColumn + Column) >> 8)\r
+    );\r
+  WriteCrtc (\r
+    VgaClassDev,\r
+    CRTC_CURSOR_LOCATION_LOW,\r
+    (UINT8) ((Row * MaxColumn + Column) & 0xff)\r
+    );\r
+}\r
+\r
+/**\r
+  Internal worker function to detect if a Unicode char is for Box Drawing text graphics.\r
 \r
+  @param  Graphic  Unicode char to test.\r
+  @param  PcAnsi   Pointer to PCANSI equivalent of Graphic for output.\r
+                   If NULL, then PCANSI value is not returned.\r
+  @param  Ascii    Pointer to ASCII equivalent of Graphic for output.\r
+                   If NULL, then ASCII value is not returned.\r
+\r
+  @retval TRUE     Gpaphic is a supported Unicode Box Drawing character.\r
+  @retval FALSE    Gpaphic is not a supported Unicode Box Drawing character.\r
+\r
+**/\r
 BOOLEAN\r
 LibIsValidTextGraphics (\r
   IN  CHAR16  Graphic,\r
   OUT CHAR8   *PcAnsi, OPTIONAL\r
   OUT CHAR8   *Ascii OPTIONAL\r
-  );\r
+  )\r
+{\r
+  UNICODE_TO_CHAR *Table;\r
+\r
+  //\r
+  // Unicode drawing code charts are all in the 0x25xx range, arrows are 0x21xx.\r
+  // So first filter out values not in these 2 ranges.\r
+  //\r
+  if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Search UnicodeToPcAnsiOrAscii table for matching entry.\r
+  //\r
+  for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) {\r
+    if (Graphic == Table->Unicode) {\r
+      if (PcAnsi != NULL) {\r
+        *PcAnsi = Table->PcAnsi;\r
+      }\r
+\r
+      if (Ascii != NULL) {\r
+        *Ascii = Table->Ascii;\r
+      }\r
+\r
+      return TRUE;\r
+    }\r
+  }\r
+\r
+  //\r
+  // If value is not found in UnicodeToPcAnsiOrAscii table, then return FALSE.\r
+  //\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Internal worker function to check whether input value is an ASCII char.\r
+  \r
+  @param  Char     Character to check.\r
+\r
+  @retval TRUE     Input value is an ASCII char.\r
+  @retval FALSE    Input value is not an ASCII char.\r
 \r
+**/\r
 BOOLEAN\r
 IsValidAscii (\r
-  IN  CHAR16  Ascii\r
-  );\r
+  IN  CHAR16  Char\r
+  )\r
+{\r
+  if ((Char >= 0x20) && (Char <= 0x7f)) {\r
+    return TRUE;\r
+  }\r
 \r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Internal worker function to check whether input value is a unicode control char.\r
+  \r
+  @param  Char    Character to check.\r
+\r
+  @retval TRUE     Input value is a unicode control char.\r
+  @retval FALSE    Input value is not a unicode control char.\r
+\r
+**/\r
 BOOLEAN\r
 IsValidEfiCntlChar (\r
-  IN  CHAR16  c\r
-  );\r
+  IN  CHAR16  Char\r
+  )\r
+{\r
+  if (Char == CHAR_NULL || Char == CHAR_BACKSPACE || Char == CHAR_LINEFEED || Char == CHAR_CARRIAGE_RETURN) {\r
+    return TRUE;\r
+  }\r
+\r
+  return FALSE;\r
+}\r
 \r
 /**\r
-  Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
-  than contains a VgaMiniPort and PciIo protocol can be supported.\r
+  Tests to see if this driver supports a given controller.\r
 \r
-  @param  This                Protocol instance pointer.\r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Supported().\r
+  It Checks if this driver supports the controller specified. Any Controller\r
+  with VgaMiniPort Protocol and Pci I/O protocol can be supported.\r
+\r
+  @param  This                A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
   @param  ControllerHandle    Handle of device to test\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child\r
                               device to start.\r
 \r
-  @retval EFI_SUCCESS         This driver supports this device\r
-  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
-  @retval other               This driver does not support this device\r
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+  @retval EFI_UNSUPPORTED     This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -398,19 +523,18 @@ EFIAPI
 VgaClassDriverBindingSupported (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                  Status;\r
-  EFI_VGA_MINI_PORT_PROTOCOL  *VgaMiniPort;\r
 \r
   //\r
-  // Open the IO Abstraction(s) needed to perform the supported test\r
+  // Checks if Abstraction(s) needed to perform the supported test\r
   //\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiVgaMiniPortProtocolGuid,\r
-                  (VOID **) &VgaMiniPort,\r
+                  NULL,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
@@ -437,18 +561,19 @@ VgaClassDriverBindingSupported (
 }\r
 \r
 /**\r
-  Start this driver on ControllerHandle by opening a PciIo and VgaMiniPort\r
-  protocol, creating VGA_CLASS_DEV device and install gEfiSimpleTextOutProtocolGuid\r
-  finnally.\r
+  Starts the device controller.\r
 \r
-  @param  This                 Protocol instance pointer.\r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Start().\r
+  It starts the device specified by Controller with the driver based on PCI I/O Protocol\r
+  and VgaMiniPort Protocol. It creates context for device instance and install EFI_SIMPLE_TEXT_OUT_PROTOCOL.\r
+\r
+  @param  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
   @param  ControllerHandle     Handle of device to bind driver to\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
                                device to start.\r
 \r
-  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
-  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
-  @retval other                This driver does not support this device\r
+  @retval EFI_SUCCESS          The device was started.\r
+  @retval other                Fail to start the device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -456,7 +581,7 @@ EFIAPI
 VgaClassDriverBindingStart (\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                  Status;\r
@@ -483,7 +608,7 @@ VgaClassDriverBindingStart (
     );\r
 \r
   //\r
-  // Open the IO Abstraction(s) needed\r
+  // Open the PCI I/O Protocol\r
   //\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
@@ -496,7 +621,9 @@ VgaClassDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-\r
+  //\r
+  // Open the VGA Mini Port Protocol\r
+  //\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiVgaMiniPortProtocolGuid,\r
@@ -511,49 +638,37 @@ VgaClassDriverBindingStart (
   //\r
   // Allocate the private device structure\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (VGA_CLASS_DEV),\r
-                  (VOID **) &VgaClassPrivate\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiVgaMiniPortProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  ZeroMem (VgaClassPrivate, sizeof (VGA_CLASS_DEV));\r
+  VgaClassPrivate = AllocateZeroPool (sizeof (VGA_CLASS_DEV));\r
+  ASSERT (VgaClassPrivate != NULL);\r
 \r
   //\r
   // Initialize the private device structure\r
   //\r
-  VgaClassPrivate->Signature                        = VGA_CLASS_DEV_SIGNATURE;\r
-  VgaClassPrivate->Handle = Controller;\r
+  VgaClassPrivate->Signature   = VGA_CLASS_DEV_SIGNATURE;\r
+  VgaClassPrivate->Handle      = Controller;\r
   VgaClassPrivate->VgaMiniPort = VgaMiniPort;\r
-  VgaClassPrivate->PciIo = PciIo;\r
+  VgaClassPrivate->PciIo       = PciIo;\r
 \r
-  VgaClassPrivate->SimpleTextOut.Reset = VgaClassReset;\r
-  VgaClassPrivate->SimpleTextOut.OutputString = VgaClassOutputString;\r
-  VgaClassPrivate->SimpleTextOut.TestString = VgaClassTestString;\r
-  VgaClassPrivate->SimpleTextOut.ClearScreen = VgaClassClearScreen;\r
-  VgaClassPrivate->SimpleTextOut.SetAttribute = VgaClassSetAttribute;\r
+  VgaClassPrivate->SimpleTextOut.Reset             = VgaClassReset;\r
+  VgaClassPrivate->SimpleTextOut.OutputString      = VgaClassOutputString;\r
+  VgaClassPrivate->SimpleTextOut.TestString        = VgaClassTestString;\r
+  VgaClassPrivate->SimpleTextOut.ClearScreen       = VgaClassClearScreen;\r
+  VgaClassPrivate->SimpleTextOut.SetAttribute      = VgaClassSetAttribute;\r
   VgaClassPrivate->SimpleTextOut.SetCursorPosition = VgaClassSetCursorPosition;\r
-  VgaClassPrivate->SimpleTextOut.EnableCursor = VgaClassEnableCursor;\r
-  VgaClassPrivate->SimpleTextOut.QueryMode = VgaClassQueryMode;\r
-  VgaClassPrivate->SimpleTextOut.SetMode = VgaClassSetMode;\r
+  VgaClassPrivate->SimpleTextOut.EnableCursor      = VgaClassEnableCursor;\r
+  VgaClassPrivate->SimpleTextOut.QueryMode         = VgaClassQueryMode;\r
+  VgaClassPrivate->SimpleTextOut.SetMode           = VgaClassSetMode;\r
 \r
-  VgaClassPrivate->SimpleTextOut.Mode = &VgaClassPrivate->SimpleTextOutputMode;\r
-  VgaClassPrivate->SimpleTextOutputMode.MaxMode = VgaMiniPort->MaxMode;\r
-  VgaClassPrivate->DevicePath = DevicePath;\r
+  VgaClassPrivate->SimpleTextOut.Mode              = &VgaClassPrivate->SimpleTextOutputMode;\r
+  VgaClassPrivate->SimpleTextOutputMode.MaxMode    = VgaMiniPort->MaxMode;\r
+  VgaClassPrivate->DevicePath                      = DevicePath;\r
 \r
+  //\r
+  // Initialize the VGA device.\r
+  //\r
   Status = VgaClassPrivate->SimpleTextOut.SetAttribute (\r
                                             &VgaClassPrivate->SimpleTextOut,\r
-                                            EFI_TEXT_ATTR (EFI_WHITE,\r
-    EFI_BLACK)\r
+                                            EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK)\r
                                             );\r
   if (EFI_ERROR (Status)) {\r
     goto ErrorExit;\r
@@ -596,14 +711,16 @@ ErrorExit:
 }\r
 \r
 /**\r
-  Stop this driver on ControllerHandle. Support stoping any child handles\r
+  Starts the device controller.\r
+  \r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Stop().\r
+  It stops this driver on Controller. Support stoping any child handles\r
   created by this driver.\r
 \r
-  @param  This              Protocol instance pointer.\r
-  @param  ControllerHandle  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
+  @param  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle  A handle to the device being stopped.\r
+  @param  NumberOfChildren  The number of child device handles in ChildHandleBuffer.\r
+  @param  ChildHandleBuffer An array of child handles to be freed.\r
 \r
   @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
   @retval other             This driver was not removed from this device\r
@@ -615,7 +732,7 @@ VgaClassDriverBindingStop (
   IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
   IN  EFI_HANDLE                      Controller,\r
   IN  UINTN                           NumberOfChildren,\r
-  IN  EFI_HANDLE                      *ChildHandleBuffer\r
+  IN  EFI_HANDLE                      *ChildHandleBuffer OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
@@ -657,34 +774,43 @@ VgaClassDriverBindingStop (
   // Release PCI I/O and VGA Mini Port Protocols on the controller handle.\r
   //\r
   gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiPciIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
+         Controller,\r
+         &gEfiPciIoProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         Controller\r
+         );\r
 \r
   gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiVgaMiniPortProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
+         Controller,\r
+         &gEfiVgaMiniPortProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         Controller\r
+         );\r
 \r
-  gBS->FreePool (VgaClassPrivate);\r
+  FreePool (VgaClassPrivate);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  Reset VgaClass device and clear output.\r
+  Resets the text output device hardware.\r
+\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
+  It resets the text output device hardware. The cursor position is set to (0, 0),\r
+  and the screen is cleared to the default background color for the output device.\r
   \r
-  @param This                 Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.\r
-  @param ExtendedVerification Whether need additional judgement\r
+  @param  This                 Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ExtendedVerification Indicates that the driver may perform a more exhaustive\r
+                               verification operation of the device during reset.\r
+\r
+  @retval EFI_SUCCESS          The text output device was reset.\r
+  @retval EFI_DEVICE_ERROR     The text output device is not functioning correctly and could not be reset.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassReset (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *This,\r
   IN  BOOLEAN                             ExtendedVerification\r
   )\r
 {\r
@@ -710,16 +836,27 @@ VgaClassReset (
 }\r
 \r
 /**\r
-  Output a string to VgaClass device.\r
+  Writes a Unicode string to the output device.\r
   \r
-  @param This                 Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.\r
-  @param WString              wide chars.\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
+  It writes a Unicode string to the output device. This is the most basic output mechanism\r
+  on an output device.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  String                 The Null-terminated Unicode string to be displayed on the output device(s).\r
+\r
+  @retval EFI_SUCCESS            The string was output to the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to output the text.\r
+  @retval EFI_UNSUPPORTED        The output device\92s mode is not currently in a defined text mode.\r
+  @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the characters in\r
+                                 the Unicode string could not be rendered and were skipped.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassOutputString (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
-  IN  CHAR16                          *WString\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
+  IN  CHAR16                          *String\r
   )\r
 {\r
   EFI_STATUS                  Status;\r
@@ -731,22 +868,24 @@ VgaClassOutputString (
   CHAR8                       GraphicChar;\r
 \r
   VgaClassDev = VGA_CLASS_DEV_FROM_THIS (This);\r
-\r
   Mode        = This->Mode;\r
 \r
   Status = This->QueryMode (\r
-                  This,\r
-                  Mode->Mode,\r
-                  &MaxColumn,\r
-                  &MaxRow\r
-                  );\r
+                   This,\r
+                   Mode->Mode,\r
+                   &MaxColumn,\r
+                   &MaxRow\r
+                   );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  for (; *WString != CHAR_NULL; WString++) {\r
+  //\r
+  // Parse each character of the string to output\r
+  //\r
+  for (; *String != CHAR_NULL; String++) {\r
 \r
-    switch (*WString) {\r
+    switch (*String) {\r
     case CHAR_BACKSPACE:\r
       if (Mode->CursorColumn > 0) {\r
         Mode->CursorColumn--;\r
@@ -794,14 +933,14 @@ VgaClassOutputString (
       break;\r
 \r
     default:\r
-      if (!LibIsValidTextGraphics (*WString, &GraphicChar, NULL)) {\r
+      if (!LibIsValidTextGraphics (*String, &GraphicChar, NULL)) {\r
         //\r
-        // Just convert to ASCII\r
+        // If this character is not ,Box Drawing text graphics, then convert it to ASCII.\r
         //\r
-        GraphicChar = (CHAR8) *WString;\r
+        GraphicChar = (CHAR8) *String;\r
         if (!IsValidAscii (GraphicChar)) {\r
           //\r
-          // Keep the API from supporting PCANSI Graphics chars\r
+          // If not valid ASCII char, convert it to "?"\r
           //\r
           GraphicChar = '?';\r
         }\r
@@ -837,38 +976,50 @@ VgaClassOutputString (
 }\r
 \r
 /**\r
-  Detects if a Unicode char is for Box Drawing text graphics.\r
-  \r
-  @param This     Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
-  @param WString  Unicode chars\r
+  Verifies that all characters in a Unicode string can be output to the target device.\r
   \r
-  @return if a Unicode char is for Box Drawing text graphics.\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
+  It verifies that all characters in a Unicode string can be output to the target device.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  String                 The Null-terminated Unicode string to be examined for the output device(s).\r
+\r
+  @retval EFI_SUCCESS            The device(s) are capable of rendering the output string.\r
+  @retval EFI_UNSUPPORTED        Some of the characters in the Unicode string cannot be rendered by\r
+                                 one or more of the output devices mapped by the EFI handle.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassTestString (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
-  IN  CHAR16                          *WString\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
+  IN  CHAR16                          *String\r
   )\r
 {\r
-  while (*WString != 0x0000) {\r
-    if (!(IsValidAscii (*WString) || IsValidEfiCntlChar (*WString) || LibIsValidTextGraphics (*WString, NULL, NULL))) {\r
+  while (*String != CHAR_NULL) {\r
+    if (!(IsValidAscii (*String) || IsValidEfiCntlChar (*String) || LibIsValidTextGraphics (*String, NULL, NULL))) {\r
       return EFI_UNSUPPORTED;\r
     }\r
 \r
-    WString++;\r
+    String++;\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  Clear Screen via VgaClass device\r
+  Clears the output device(s) display to the currently selected background color.\r
   \r
-  @param This     Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
+  The ClearScreen() function clears the output device(s) display to the currently\r
+  selected background color. The cursor position is set to (0, 0).\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
   \r
-  @retval EFI_SUCESS Success to clear screen\r
-  @retval Others     Wrong displaying mode.\r
+  @retval EFI_SUCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The output device is not in a valid text mode.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -885,11 +1036,11 @@ VgaClassClearScreen (
   VgaClassDev = VGA_CLASS_DEV_FROM_THIS (This);\r
 \r
   Status = This->QueryMode (\r
-                  This,\r
-                  This->Mode->Mode,\r
-                  &MaxColumn,\r
-                  &MaxRow\r
-                  );\r
+                   This,\r
+                   This->Mode->Mode,\r
+                   &MaxColumn,\r
+                   &MaxRow\r
+                   );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -911,18 +1062,27 @@ VgaClassClearScreen (
 }\r
 \r
 /**\r
-  Set displaying mode's attribute\r
+  Sets the background and foreground colors for theOutputString() and ClearScreen() functions.\r
   \r
-  @param This      Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL \r
-  @param Attribute Mode's attribute\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
+  It sets the background and foreground colors for the OutputString() and ClearScreen() functions.\r
+  The color mask can be set even when the device is in an invalid text mode.\r
+  Devices supporting a different number of text colors are required to emulate the above colors\r
+  to the best of the device\92s capabilities.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Attribute              The attribute to set.\r
+                                 Bits 0..3 are the foreground color,\r
+                                 and bits 4..6 are the background color.\r
   \r
-  @param EFI_SUCCESS      Success to set attribute\r
-  @param EFI_UNSUPPORTED  Wrong mode's attribute wanted to be set\r
+  @retval EFI_SUCCESS            The requested attributes were set.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetAttribute (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
   IN  UINTN                           Attribute\r
   )\r
 {\r
@@ -935,19 +1095,26 @@ VgaClassSetAttribute (
 }\r
 \r
 /**\r
-  Set cursor position.\r
+  Sets the current coordinates of the cursor position.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
+  It sets the current coordinates of the cursor position.\r
+  The upper left corner of the screen is defined as coordinate (0, 0).\r
   \r
-  @param This      Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL \r
-  @param Column    Column of new cursor position.\r
-  @param Row       Row of new cursor position.\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Column                 Column of position to set the cursor to.\r
+  @param  Row                    Row of position to set the cursor to.\r
   \r
-  @retval EFI_SUCCESS Sucess to set cursor's position.\r
-  @retval Others      Wrong current displaying mode.\r
+  @retval EFI_SUCCESS            The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The output device is not in a valid text mode, or the cursor\r
+                                 position is invalid for the current mode.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetCursorPosition (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
   IN  UINTN                           Column,\r
   IN  UINTN                           Row\r
   )\r
@@ -960,11 +1127,11 @@ VgaClassSetCursorPosition (
   VgaClassDev = VGA_CLASS_DEV_FROM_THIS (This);\r
 \r
   Status = This->QueryMode (\r
-                  This,\r
-                  This->Mode->Mode,\r
-                  &MaxColumn,\r
-                  &MaxRow\r
-                  );\r
+                   This,\r
+                   This->Mode->Mode,\r
+                   &MaxColumn,\r
+                   &MaxRow\r
+                   );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -982,17 +1149,25 @@ VgaClassSetCursorPosition (
 }\r
 \r
 /**\r
-  Enable cursor to display or not.\r
+  Makes the cursor visible or invisible.\r
   \r
-  @param This      Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL \r
-  @param Visible   Display cursor or not.\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.EnableCursor().\r
+  It makes the cursor visible or invisible.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Visible                If TRUE, the cursor is set to be visible.\r
+                                 If FALSE, the cursor is set to be invisible.\r
   \r
-  @retval EFI_SUCESS Success to display the cursor or not.\r
+  @retval EFI_SUCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request or the\r
+                                 device does not support changing the cursor mode.\r
+  @retval EFI_UNSUPPORTED        The output device does not support visibility control of the cursor.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassEnableCursor (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
   IN  BOOLEAN                         Visible\r
   )\r
 {\r
@@ -1000,16 +1175,18 @@ VgaClassEnableCursor (
 \r
   VgaClassDev = VGA_CLASS_DEV_FROM_THIS (This);\r
   if (Visible) {\r
-    switch (This->Mode->Mode) {\r
-    case 1:\r
+    if (This->Mode->Mode == 1) {\r
+      //\r
+      // 80 * 50\r
+      //\r
       WriteCrtc (VgaClassDev, CRTC_CURSOR_START, 0x06);\r
       WriteCrtc (VgaClassDev, CRTC_CURSOR_END, 0x07);\r
-      break;\r
-\r
-    default:\r
+    } else {\r
+      //\r
+      // 80 * 25\r
+      //\r
       WriteCrtc (VgaClassDev, CRTC_CURSOR_START, 0x0e);\r
       WriteCrtc (VgaClassDev, CRTC_CURSOR_END, 0x0f);\r
-      break;\r
     }\r
   } else {\r
     WriteCrtc (VgaClassDev, CRTC_CURSOR_START, 0x20);\r
@@ -1020,23 +1197,27 @@ VgaClassEnableCursor (
 }\r
 \r
 /**\r
-  Query colum and row according displaying mode number\r
-  The mode:\r
-  0: 80 * 25\r
-  1: 80 * 50\r
-  \r
-  @param This       Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
-  @param ModeNumber Mode number\r
-  @param Columns    return the columen in current mode number\r
-  @param Rows       return the row in current mode number.\r
+  Returns information for an available text mode that the output device(s) supports.\r
+\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+  It returns information for an available text mode that the output device(s) supports.\r
+  It is required that all output devices support at least 80x25 text mode. This mode is defined to be mode 0.\r
+  If the output devices support 80x50, that is defined to be mode 1.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber             The mode number to return information on.\r
+  @param  Columns                Columen in current mode number\r
+  @param  Rows                   Row in current mode number.\r
   \r
-  @return EFI_SUCCESS     Sucess to get columns and rows according to mode number\r
-  @return EFI_UNSUPPORTED Unsupported mode number\r
+  @retval EFI_SUCCESS            The requested mode information was returned.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The mode number was not valid.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassQueryMode (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
   IN  UINTN                           ModeNumber,\r
   OUT UINTN                           *Columns,\r
   OUT UINTN                           *Rows\r
@@ -1069,22 +1250,28 @@ VgaClassQueryMode (
 }\r
 \r
 /**\r
-  Set displaying mode number\r
+  Sets the output device(s) to a specified mode.\r
   \r
-  @param This       Pointer of EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
-  @param ModeNumber mode number\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+  It sets the output device(s) to the requested mode.\r
+  On success the device is in the geometry for the requested mode,\r
+  and the device has been cleared to the current background color with the cursor at (0,0).\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber             The text mode to set.\r
   \r
-  @retval EFI_UNSUPPORTED Unsupported mode number in parameter\r
-  @retval EFI_SUCCESS     Success to set the mode number.\r
+  @retval EFI_SUCCESS            The requested text mode was set.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The mode number was not valid.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetMode (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
   IN  UINTN                           ModeNumber\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
   VGA_CLASS_DEV *VgaClassDev;\r
 \r
   VgaClassDev = VGA_CLASS_DEV_FROM_THIS (This);\r
@@ -1097,153 +1284,5 @@ VgaClassSetMode (
 \r
   This->Mode->Mode  = (INT32) ModeNumber;\r
 \r
-  Status            = VgaClassDev->VgaMiniPort->SetMode (VgaClassDev->VgaMiniPort, ModeNumber);\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Set logic cursor's position to VgaClass device\r
-  \r
-  @param VgaClassDev device instance object\r
-  @param Column      cursor logic position.\r
-  @param Row         cursor logic position.\r
-  @param MaxColumn   max logic column\r
-  \r
-**/\r
-VOID\r
-SetVideoCursorPosition (\r
-  IN  VGA_CLASS_DEV  *VgaClassDev,\r
-  IN  UINTN          Column,\r
-  IN  UINTN          Row,\r
-  IN  UINTN          MaxColumn\r
-  )\r
-{\r
-  Column    = Column & 0xff;\r
-  Row       = Row & 0xff;\r
-  MaxColumn = MaxColumn & 0xff;\r
-  WriteCrtc (\r
-    VgaClassDev,\r
-    CRTC_CURSOR_LOCATION_HIGH,\r
-    (UINT8) ((Row * MaxColumn + Column) >> 8)\r
-    );\r
-  WriteCrtc (\r
-    VgaClassDev,\r
-    CRTC_CURSOR_LOCATION_LOW,\r
-    (UINT8) ((Row * MaxColumn + Column) & 0xff)\r
-    );\r
-}\r
-\r
-/**\r
-  Program CRTC register via PCI IO.\r
-  \r
-  @param VgaClassDev  device instance object\r
-  @param Address      address\r
-  @param Data         data\r
-**/\r
-VOID\r
-WriteCrtc (\r
-  IN  VGA_CLASS_DEV  *VgaClassDev,\r
-  IN  UINT16         Address,\r
-  IN  UINT8          Data\r
-  )\r
-{\r
-  VgaClassDev->PciIo->Io.Write (\r
-                          VgaClassDev->PciIo,\r
-                          EfiPciIoWidthUint8,\r
-                          VgaClassDev->VgaMiniPort->CrtcAddressRegisterBar,\r
-                          VgaClassDev->VgaMiniPort->CrtcAddressRegisterOffset,\r
-                          1,\r
-                          &Address\r
-                          );\r
-\r
-  VgaClassDev->PciIo->Io.Write (\r
-                          VgaClassDev->PciIo,\r
-                          EfiPciIoWidthUint8,\r
-                          VgaClassDev->VgaMiniPort->CrtcDataRegisterBar,\r
-                          VgaClassDev->VgaMiniPort->CrtcDataRegisterOffset,\r
-                          1,\r
-                          &Data\r
-                          );\r
-}\r
-\r
-/**\r
-  Detects if a Unicode char is for Box Drawing text graphics.\r
-\r
-  @param Grphic   Unicode char to test.\r
-  @param PcAnsi   Optional pointer to return PCANSI equivalent of Graphic.\r
-  @param Asci     Optional pointer to return Ascii equivalent of Graphic.\r
-\r
-  @return TRUE if Gpaphic is a supported Unicode Box Drawing character.\r
-\r
-**/\r
-BOOLEAN\r
-LibIsValidTextGraphics (\r
-  IN  CHAR16  Graphic,\r
-  OUT CHAR8   *PcAnsi, OPTIONAL\r
-  OUT CHAR8   *Ascii OPTIONAL\r
-  )\r
-{\r
-  UNICODE_TO_CHAR *Table;\r
-\r
-  if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {\r
-    //\r
-    // Unicode drawing code charts are all in the 0x25xx range,\r
-    //  arrows are 0x21xx\r
-    //\r
-    return FALSE;\r
-  }\r
-\r
-  for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) {\r
-    if (Graphic == Table->Unicode) {\r
-      if (PcAnsi) {\r
-        *PcAnsi = Table->PcAnsi;\r
-      }\r
-\r
-      if (Ascii) {\r
-        *Ascii = Table->Ascii;\r
-      }\r
-\r
-      return TRUE;\r
-    }\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-/**\r
-  Judge whether is an ASCII char.\r
-  \r
-  @param Ascii character\r
-  @return whether is an ASCII char.\r
-**/\r
-BOOLEAN\r
-IsValidAscii (\r
-  IN  CHAR16  Ascii\r
-  )\r
-{\r
-  if ((Ascii >= 0x20) && (Ascii <= 0x7f)) {\r
-    return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-/**\r
-  Judge whether is diplaying control character.\r
-  \r
-  @param c character\r
-  @return whether is diplaying control character.\r
-**/\r
-BOOLEAN\r
-IsValidEfiCntlChar (\r
-  IN  CHAR16  c\r
-  )\r
-{\r
-  if (c == CHAR_NULL || c == CHAR_BACKSPACE || c == CHAR_LINEFEED || c == CHAR_CARRIAGE_RETURN) {\r
-    return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
+  return VgaClassDev->VgaMiniPort->SetMode (VgaClassDev->VgaMiniPort, ModeNumber);\r
 }\r
-\r
index 33d870fc709c39de480881cfcab91b057023e358..27c32ef531ba0e215ebb2d7834361e7ea6a0b854 100644 (file)
@@ -1,6 +1,7 @@
-/**@file\r
+/** @file\r
+  Internal include file of the VGA Class Driver.\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -12,13 +13,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
-#ifndef _VGA_CLASS_H\r
-#define _VGA_CLASS_H\r
+#ifndef _VGA_CLASS_H__\r
+#define _VGA_CLASS_H__\r
 \r
 #include <PiDxe.h>\r
 #include <FrameworkDxe.h>\r
 \r
-#include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/PciIo.h>\r
 #include <Protocol/VgaMiniPort.h>\r
@@ -26,17 +26,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/BaseLib.h>\r
 #include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
 \r
-\r
 #include <IndustryStandard/Pci22.h>\r
-#include "ComponentName.h"\r
-#include <Protocol/VgaMiniPort.h>\r
+\r
+//\r
+// Structure for tuple containing mapping among uniocde, PC Ansi and ASCII code.\r
+//\r
+typedef struct {\r
+  CHAR16  Unicode;\r
+  CHAR8   PcAnsi;\r
+  CHAR8   Ascii;\r
+} UNICODE_TO_CHAR;\r
 \r
 //\r
 // VGA specific registers\r
@@ -55,13 +59,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define VGA_CLASS_DEV_SIGNATURE SIGNATURE_32 ('V', 'G', 'A', 'C')\r
 \r
 typedef struct {\r
-  UINTN                         Signature;\r
-  EFI_HANDLE                    Handle;\r
+  UINTN                            Signature;\r
+  EFI_HANDLE                       Handle;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  SimpleTextOut;\r
-  EFI_SIMPLE_TEXT_OUTPUT_MODE   SimpleTextOutputMode;\r
-  EFI_VGA_MINI_PORT_PROTOCOL    *VgaMiniPort;\r
-  EFI_PCI_IO_PROTOCOL           *PciIo;\r
-  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;\r
+  EFI_SIMPLE_TEXT_OUTPUT_MODE      SimpleTextOutputMode;\r
+  EFI_VGA_MINI_PORT_PROTOCOL       *VgaMiniPort;\r
+  EFI_PCI_IO_PROTOCOL              *PciIo;\r
+  EFI_DEVICE_PATH_PROTOCOL         *DevicePath;\r
 } VGA_CLASS_DEV;\r
 \r
 #define VGA_CLASS_DEV_FROM_THIS(a)  CR (a, VGA_CLASS_DEV, SimpleTextOut, VGA_CLASS_DEV_SIGNATURE)\r
@@ -69,312 +73,412 @@ typedef struct {
 //\r
 // Global Variables\r
 //\r
-extern EFI_DRIVER_BINDING_PROTOCOL  gVgaClassDriverBinding;\r
+extern EFI_DRIVER_BINDING_PROTOCOL   gVgaClassDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gVgaClassComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gVgaClassComponentName2;\r
 \r
 //\r
 // Driver Binding Protocol functions\r
 //\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassDriverBindingSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  IN EFI_HANDLE                    Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath\r
-  )\r
-/**\r
-\r
-Routine Description:\r
 \r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+/**\r
+  Tests to see if this driver supports a given controller.\r
 \r
-  This                - GC_TODO: add argument description\r
-  Controller          - GC_TODO: add argument description\r
-  RemainingDevicePath - GC_TODO: add argument description\r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Supported().\r
+  It Checks if this driver supports the controller specified. Any Controller\r
+  with VgaMiniPort Protocol and Pci I/O protocol can be supported.\r
 \r
-Returns:\r
+  @param  This                A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
 \r
-  GC_TODO: add return values\r
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+  @retval EFI_UNSUPPORTED     This driver does not support this device.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
-VgaClassDriverBindingStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  IN EFI_HANDLE                    Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath\r
-  )\r
+VgaClassDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
+  );\r
+\r
 /**\r
+  Starts the device controller.\r
+\r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Start().\r
+  It starts the device specified by Controller with the driver based on PCI I/O Protocol\r
+  and VgaMiniPort Protocol. It creates context for device instance and install EFI_SIMPLE_TEXT_OUT_PROTOCOL.\r
 \r
-Routine Description:\r
+  @param  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
 \r
-  GC_TODO: Add function description\r
+  @retval EFI_SUCCESS          The device was started.\r
+  @retval other                Fail to start the device.\r
 \r
-Arguments:\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VgaClassDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
+  );\r
 \r
-  This                - GC_TODO: add argument description\r
-  Controller          - GC_TODO: add argument description\r
-  RemainingDevicePath - GC_TODO: add argument description\r
+/**\r
+  Starts the device controller.\r
+  \r
+  This function implments EFI_DRIVER_BINDING_PROTOCOL.Stop().\r
+  It stops this driver on Controller. Support stoping any child handles\r
+  created by this driver.\r
 \r
-Returns:\r
+  @param  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle  A handle to the device being stopped.\r
+  @param  NumberOfChildren  The number of child device handles in ChildHandleBuffer.\r
+  @param  ChildHandleBuffer An array of child handles to be freed.\r
 \r
-  GC_TODO: add return values\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassDriverBindingStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN  EFI_HANDLE                   Controller,\r
-  IN  UINTN                        NumberOfChildren,\r
-  IN  EFI_HANDLE                   *ChildHandleBuffer\r
-  )\r
-/**\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
+  IN  EFI_HANDLE                      Controller,\r
+  IN  UINTN                           NumberOfChildren,\r
+  IN  EFI_HANDLE                      *ChildHandleBuffer OPTIONAL\r
+  );\r
 \r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+//\r
+// EFI Component Name Functions\r
+//\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
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
-Returns:\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VgaClassComponentNameGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  );\r
 \r
-  GC_TODO: add return values\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
 **/\r
-;\r
+EFI_STATUS\r
+EFIAPI\r
+VgaClassComponentNameGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  );\r
 \r
 //\r
 // Simple Text Output Protocol functions\r
 //\r
-EFI_STATUS\r
-EFIAPI\r
-VgaClassReset (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  BOOLEAN                      ExtendedVerification\r
-  )\r
 /**\r
+  Resets the text output device hardware.\r
 \r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
+  It resets the text output device hardware. The cursor position is set to (0, 0),\r
+  and the screen is cleared to the default background color for the output device.\r
+  \r
+  @param  This                 Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ExtendedVerification Indicates that the driver may perform a more exhaustive\r
+                               verification operation of the device during reset.\r
 \r
-  This                  - GC_TODO: add argument description\r
-  ExtendedVerification  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+  @retval EFI_SUCCESS          The text output device was reset.\r
+  @retval EFI_DEVICE_ERROR     The text output device is not functioning correctly and could not be reset.\r
 \r
 **/\r
-;\r
+EFI_STATUS\r
+EFIAPI\r
+VgaClassReset (\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *This,\r
+  IN  BOOLEAN                             ExtendedVerification\r
+  );\r
 \r
+/**\r
+  Writes a Unicode string to the output device.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
+  It writes a Unicode string to the output device. This is the most basic output mechanism\r
+  on an output device.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  String                 The Null-terminated Unicode string to be displayed on the output device(s).\r
+\r
+  @retval EFI_SUCCESS            The string was output to the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to output the text.\r
+  @retval EFI_UNSUPPORTED        The output device\92s mode is not currently in a defined text mode.\r
+  @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the characters in\r
+                                 the Unicode string could not be rendered and were skipped.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassOutputString (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  CHAR16                       *WString\r
-  )\r
-/**\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  IN  CHAR16                          *String\r
+  );\r
 \r
-  This    - GC_TODO: add argument description\r
-  WString - GC_TODO: add argument description\r
+/**\r
+  Verifies that all characters in a Unicode string can be output to the target device.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
+  It verifies that all characters in a Unicode string can be output to the target device.\r
 \r
-Returns:\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  String                 The Null-terminated Unicode string to be examined for the output device(s).\r
 \r
-  GC_TODO: add return values\r
+  @retval EFI_SUCCESS            The device(s) are capable of rendering the output string.\r
+  @retval EFI_UNSUPPORTED        Some of the characters in the Unicode string cannot be rendered by\r
+                                 one or more of the output devices mapped by the EFI handle.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassTestString (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  CHAR16                       *WString\r
-  )\r
-/**\r
+  IN  CHAR16                          *String\r
+  );\r
 \r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  This    - GC_TODO: add argument description\r
-  WString - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Clears the output device(s) display to the currently selected background color.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
+  The ClearScreen() function clears the output device(s) display to the currently\r
+  selected background color. The cursor position is set to (0, 0).\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  \r
+  @retval EFI_SUCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The output device is not in a valid text mode.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassClearScreen (\r
-  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
-  )\r
-/**\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *This\r
+  );\r
 \r
-  This  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Sets the background and foreground colors for theOutputString() and ClearScreen() functions.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
+  It sets the background and foreground colors for the OutputString() and ClearScreen() functions.\r
+  The color mask can be set even when the device is in an invalid text mode.\r
+  Devices supporting a different number of text colors are required to emulate the above colors\r
+  to the best of the device\92s capabilities.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Attribute              The attribute to set.\r
+                                 Bits 0..3 are the foreground color,\r
+                                 and bits 4..6 are the background color.\r
+  \r
+  @retval EFI_SUCCESS            The requested attributes were set.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetAttribute (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  UINTN                        Attribute\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
-  Attribute - GC_TODO: add argument description\r
-\r
-Returns:\r
+  IN  UINTN                           Attribute\r
+  );\r
 \r
-  GC_TODO: add return values\r
+/**\r
+  Sets the current coordinates of the cursor position.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
+  It sets the current coordinates of the cursor position.\r
+  The upper left corner of the screen is defined as coordinate (0, 0).\r
+  \r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Column                 Column of position to set the cursor to.\r
+  @param  Row                    Row of position to set the cursor to.\r
+  \r
+  @retval EFI_SUCCESS            The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The output device is not in a valid text mode, or the cursor\r
+                                 position is invalid for the current mode.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetCursorPosition (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  UINTN                        Column,\r
-  IN  UINTN                        Row\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
-  Column  - GC_TODO: add argument description\r
-  Row     - GC_TODO: add argument description\r
+  IN  UINTN                           Column,\r
+  IN  UINTN                           Row\r
+  );\r
 \r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Makes the cursor visible or invisible.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.EnableCursor().\r
+  It makes the cursor visible or invisible.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  Visible                If TRUE, the cursor is set to be visible.\r
+                                 If FALSE, the cursor is set to be invisible.\r
+  \r
+  @retval EFI_SUCESS             The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request or the\r
+                                 device does not support changing the cursor mode.\r
+  @retval EFI_UNSUPPORTED        The output device does not support visibility control of the cursor.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassEnableCursor (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  BOOLEAN                      Visible\r
-  )\r
-/**\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  IN  BOOLEAN                         Visible\r
+  );\r
 \r
-  This    - GC_TODO: add argument description\r
-  Visible - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Returns information for an available text mode that the output device(s) supports.\r
+\r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+  It returns information for an available text mode that the output device(s) supports.\r
+  It is required that all output devices support at least 80x25 text mode. This mode is defined to be mode 0.\r
+  If the output devices support 80x50, that is defined to be mode 1.\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber             The mode number to return information on.\r
+  @param  Columns                Columen in current mode number\r
+  @param  Rows                   Row in current mode number.\r
+  \r
+  @retval EFI_SUCCESS            The requested mode information was returned.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The mode number was not valid.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassQueryMode (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  UINTN                        ModeNumber,\r
-  OUT UINTN                        *Columns,\r
-  OUT UINTN                        *Rows\r
-  )\r
-/**\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
+  IN  UINTN                           ModeNumber,\r
+  OUT UINTN                           *Columns,\r
+  OUT UINTN                           *Rows\r
+  );\r
 \r
-Arguments:\r
-\r
-  This        - GC_TODO: add argument description\r
-  ModeNumber  - GC_TODO: add argument description\r
-  Columns     - GC_TODO: add argument description\r
-  Rows        - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Sets the output device(s) to a specified mode.\r
+  \r
+  This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+  It sets the output device(s) to the requested mode.\r
+  On success the device is in the geometry for the requested mode,\r
+  and the device has been cleared to the current background color with the cursor at (0,0).\r
+\r
+  @param  This                   Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber             The text mode to set.\r
+  \r
+  @retval EFI_SUCCESS            The requested text mode was set.\r
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED        The mode number was not valid.\r
 \r
 **/\r
-;\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VgaClassSetMode (\r
   IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
-  IN  UINTN                        ModeNumber\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
-  ModeNumber  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
-**/\r
-;\r
+  IN  UINTN                           ModeNumber\r
+  );\r
 \r
 #endif\r
index d278730a853efdb89ad09f0ccb25f6a6517f37f1..cd10db94c2a92f1957adfab6958060ff5ba0f047 100644 (file)
@@ -1,8 +1,7 @@
 #/** @file\r
-#  Component description file for VgaClass module.\r
+#  VGA Class Driver that managers VGA devices and produces Simple Text Output Protocol.\r
 #\r
-#  This driver produces a VGA console.\r
-#  Copyright (c) 2006, Intel Corporation.\r
+#  Copyright (c) 2006 - 2009, Intel Corporation.\r
 #\r
 #  All rights reserved. This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 \r
 [Sources.common]\r
   ComponentName.c\r
-  ComponentName.h\r
   VgaClass.h\r
   VgaClass.c\r
 \r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
-  MdeModulePkg/MdeModulePkg.dec\r
   IntelFrameworkPkg/IntelFrameworkPkg.dec\r
   IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
 \r
   ReportStatusCodeLib\r
   UefiBootServicesTableLib\r
   MemoryAllocationLib\r
-  BaseMemoryLib\r
   UefiLib\r
-  BaseLib\r
   UefiDriverEntryPoint\r
   DebugLib\r
 \r
 \r
 [Protocols]\r
-  gEfiSimpleTextOutProtocolGuid                 # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiSimpleTextInProtocolGuid                  # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiVgaMiniPortProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiPciIoProtocolGuid                         # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiSimpleTextOutProtocolGuid                 # PROTOCOL BY_START\r
+  gEfiVgaMiniPortProtocolGuid                   # PROTOCOL TO_START\r
+  gEfiPciIoProtocolGuid                         # PROTOCOL TO_START\r
+  gEfiDevicePathProtocolGuid                    # PROTOCOL TO_START\r
 \r
 \r