]> git.proxmox.com Git - mirror_edk2.git/commitdiff
code scrub for check list.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Jul 2008 07:26:57 +0000 (07:26 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Jul 2008 07:26:57 +0000 (07:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5549 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/LaffStd.c

index 13486a0462255b6d03cf86429658df6d211118e4..b4ed7b91fdddf9785574b432b72d032741c790b7 100644 (file)
@@ -1,10 +1,5 @@
 /** @file\r
   This is the main routine for initializing the Graphics Console support routines.\r
-Remaining Tasks\r
-  Add all standard Glyphs from UEFI 2.0 Specification\r
-  Implement optimal automatic Mode creation algorithm\r
-  Solve palette issues for mixed graphics and text\r
-  When does this protocol reset the palette?\r
 \r
 Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -80,7 +75,7 @@ EraseCursor (
   @param  VerticalResolution    User defined vertical resolution.\r
   @param  CurrentModeNumber     Current specific mode to be check.\r
 \r
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle.\r
+  @retval EFI_SUCCESS       The mode is supported.\r
   @retval EFI_UNSUPPORTED   The specific mode is out of range of graphics \r
                             devcie supported.\r
   @retval other             The specific mode does not support user defined \r
@@ -97,9 +92,9 @@ CheckModeSupported (
   );\r
 \r
 //\r
-// Globals\r
+// Graphics Console Devcie Private Data template\r
 //\r
-GRAPHICS_CONSOLE_DEV        mGraphicsConsoleDevTemplate = {\r
+STATIC GRAPHICS_CONSOLE_DEV    mGraphicsConsoleDevTemplate = {\r
   GRAPHICS_CONSOLE_DEV_SIGNATURE,\r
   (EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,\r
   (EFI_UGA_DRAW_PROTOCOL *) NULL,\r
@@ -182,19 +177,19 @@ EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
 \r
 \r
 /**\r
-  Test to see if Graphics Console could be supported on the ControllerHandle.\r
+  Test to see if Graphics Console could be supported on the Controller.\r
 \r
   Graphics Console could be supported if Graphics Output Protocol or UGA Draw\r
-  Protocol exists on the ControllerHandle. (UGA Draw Protocol could be shipped\r
+  Protocol exists on the Controller. (UGA Draw Protocol could be skipped\r
   if PcdUgaConsumeSupport is set to FALSE.)\r
 \r
   @param  This                Protocol instance pointer.\r
-  @param  ControllerHandle    Handle of device to test.\r
+  @param  Controller          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 other               This driver does not support this device\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
@@ -294,17 +289,17 @@ Error:
 \r
 \r
 /**\r
-  Start this driver on ControllerHandle by opening Graphics Output protocol or \r
-  UGA Draw protocol, and installing Simple Text Out protocol on ControllerHandle.\r
+  Start this driver on Controller by opening Graphics Output protocol or \r
+  UGA Draw protocol, and installing Simple Text Out protocol on Controller.\r
   (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
   \r
   @param  This                 Protocol instance pointer.\r
-  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  Controller           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 other                This driver does not support this device\r
+  @retval EFI_SUCCESS          This driver is added to Controller.\r
+  @retval other                This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -390,7 +385,7 @@ GraphicsConsoleControllerDriverStart (
     SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));\r
 \r
     Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);\r
-    CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);\r
+    CopyMem (Location, gUsStdNarrowGlyphData, NarrowFontSize);\r
 \r
     //\r
     // Add this simplified font package to a package list then install it.\r
@@ -509,22 +504,22 @@ GraphicsConsoleControllerDriverStart (
   // Add Mode #0 that must be 80x25\r
   //\r
   MaxMode = 0;\r
-  Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
-  Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
+  Private->ModeData[MaxMode].GopWidth      = HorizontalResolution;\r
+  Private->ModeData[MaxMode].GopHeight     = VerticalResolution;\r
   Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
-  Private->ModeData[MaxMode].DeltaX     = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
-  Private->ModeData[MaxMode].DeltaY     = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;\r
+  Private->ModeData[MaxMode].DeltaX        = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
+  Private->ModeData[MaxMode].DeltaY        = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;\r
   MaxMode++;\r
 \r
   //\r
   // If it is possible to support Mode #1 - 80x50, than add it as an active mode\r
   //\r
   if (Rows >= 50) {\r
-    Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
-    Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
+    Private->ModeData[MaxMode].GopWidth      = HorizontalResolution;\r
+    Private->ModeData[MaxMode].GopHeight     = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
-    Private->ModeData[MaxMode].DeltaX     = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
-    Private->ModeData[MaxMode].DeltaY     = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;\r
+    Private->ModeData[MaxMode].DeltaX        = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
+    Private->ModeData[MaxMode].DeltaY        = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;\r
     MaxMode++;\r
   }\r
 \r
@@ -532,13 +527,13 @@ GraphicsConsoleControllerDriverStart (
   // If it is not to support Mode #1 - 80x50, then skip it\r
   //\r
   if (MaxMode < 2) {\r
-    Private->ModeData[MaxMode].Columns    = 0;\r
-    Private->ModeData[MaxMode].Rows       = 0;\r
-    Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
-    Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
+    Private->ModeData[MaxMode].Columns       = 0;\r
+    Private->ModeData[MaxMode].Rows          = 0;\r
+    Private->ModeData[MaxMode].GopWidth      = HorizontalResolution;\r
+    Private->ModeData[MaxMode].GopHeight     = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
-    Private->ModeData[MaxMode].DeltaX     = 0;\r
-    Private->ModeData[MaxMode].DeltaY     = 0;\r
+    Private->ModeData[MaxMode].DeltaX        = 0;\r
+    Private->ModeData[MaxMode].DeltaY        = 0;\r
     MaxMode++;\r
   }\r
 \r
@@ -546,11 +541,11 @@ GraphicsConsoleControllerDriverStart (
   // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)\r
   //\r
   if (Columns >= 100 && Rows >= 31) {\r
-    Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
-    Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
+    Private->ModeData[MaxMode].GopWidth      = HorizontalResolution;\r
+    Private->ModeData[MaxMode].GopHeight     = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
-    Private->ModeData[MaxMode].DeltaX     = (HorizontalResolution - (100 * EFI_GLYPH_WIDTH)) >> 1;\r
-    Private->ModeData[MaxMode].DeltaY     = (VerticalResolution - (31 * EFI_GLYPH_HEIGHT)) >> 1;\r
+    Private->ModeData[MaxMode].DeltaX        = (HorizontalResolution - (100 * EFI_GLYPH_WIDTH)) >> 1;\r
+    Private->ModeData[MaxMode].DeltaY        = (VerticalResolution - (31 * EFI_GLYPH_HEIGHT)) >> 1;\r
     MaxMode++;\r
   }\r
 \r
@@ -558,13 +553,13 @@ GraphicsConsoleControllerDriverStart (
   // Add Mode #3 that uses the entire display for user-defined mode\r
   //\r
   if (HorizontalResolution > 800 && VerticalResolution > 600) {\r
-    Private->ModeData[MaxMode].Columns    = HorizontalResolution/EFI_GLYPH_WIDTH;\r
-    Private->ModeData[MaxMode].Rows       = VerticalResolution/EFI_GLYPH_HEIGHT;\r
-    Private->ModeData[MaxMode].GopWidth   = HorizontalResolution;\r
-    Private->ModeData[MaxMode].GopHeight  = VerticalResolution;\r
+    Private->ModeData[MaxMode].Columns       = HorizontalResolution/EFI_GLYPH_WIDTH;\r
+    Private->ModeData[MaxMode].Rows          = VerticalResolution/EFI_GLYPH_HEIGHT;\r
+    Private->ModeData[MaxMode].GopWidth      = HorizontalResolution;\r
+    Private->ModeData[MaxMode].GopHeight     = VerticalResolution;\r
     Private->ModeData[MaxMode].GopModeNumber = ModeNumber;\r
-    Private->ModeData[MaxMode].DeltaX     = (HorizontalResolution % EFI_GLYPH_WIDTH) >> 1;\r
-    Private->ModeData[MaxMode].DeltaY     = (VerticalResolution % EFI_GLYPH_HEIGHT) >> 1;\r
+    Private->ModeData[MaxMode].DeltaX        = (HorizontalResolution % EFI_GLYPH_WIDTH) >> 1;\r
+    Private->ModeData[MaxMode].DeltaY        = (VerticalResolution % EFI_GLYPH_HEIGHT) >> 1;\r
     MaxMode++;\r
   }\r
 \r
@@ -598,7 +593,7 @@ GraphicsConsoleControllerDriverStart (
 Error:\r
   if (EFI_ERROR (Status)) {\r
     //\r
-    // Close the GOP or UGA IO Protocol\r
+    // Close the GOP and UGA Draw Protocol\r
     //\r
     if (Private->GraphicsOutput != NULL) {\r
       gBS->CloseProtocol (\r
@@ -631,20 +626,20 @@ Error:
 }\r
 \r
 /**\r
-  Stop this driver on ControllerHandle by removing Simple Text Out protocol \r
-  and closing the Graphics Output Protocol or UGA Draw protocol on ControllerHandle.\r
+  Stop this driver on Controller by removing Simple Text Out protocol \r
+  and closing the Graphics Output Protocol or UGA Draw protocol on Controller.\r
   (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
   \r
 \r
   @param  This              Protocol instance pointer.\r
-  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  Controller        Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
   @param  ChildHandleBuffer List of Child Handles to Stop.\r
 \r
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle.\r
+  @retval EFI_SUCCESS       This driver is removed Controller.\r
   @retval EFI_NOT_STARTED   Simple Text Out protocol could not be found the \r
-                            ControllerHandle.\r
+                            Controller.\r
   @retval other             This driver was not removed from this device.\r
 \r
 **/\r
@@ -732,7 +727,7 @@ GraphicsConsoleControllerDriverStop (
   @param  VerticalResolution    User defined vertical resolution.\r
   @param  CurrentModeNumber     Current specific mode to be check.\r
 \r
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle.\r
+  @retval EFI_SUCCESS       The mode is supported.\r
   @retval EFI_UNSUPPORTED   The specific mode is out of range of graphics \r
                             devcie supported.\r
   @retval other             The specific mode does not support user defined \r
@@ -1640,7 +1635,7 @@ GraphicsConsoleConOutSetCursorPosition (
     goto Done;\r
   }\r
 \r
-  if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {\r
+  if ((This->Mode->CursorColumn == (INT32) Column) && (This->Mode->CursorRow == (INT32) Row)) {\r
     Status = EFI_SUCCESS;\r
     goto Done;\r
   }\r
@@ -1762,7 +1757,10 @@ DrawUnicodeWeightAtCursorN (
     SafeFreePool (Blt);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  *(String + Count) = 0;\r
+  //\r
+  // Set the end character\r
+  //\r
+  *(String + Count) = L'\0';\r
 \r
   FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));\r
   if (FontInfo == NULL) {\r
@@ -1770,9 +1768,15 @@ DrawUnicodeWeightAtCursorN (
     SafeFreePool (String);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+  //\r
+  // Get current foreground and background colors.\r
+  //\r
   GetTextColors (This, &FontInfo->ForegroundColor, &FontInfo->BackgroundColor);\r
 \r
   if (Private->GraphicsOutput != NULL) {\r
+    //\r
+    // If Graphcis Output protocol exists, using HII Font protocol to draw. \r
+    //\r
     Blt->Image.Screen = Private->GraphicsOutput;\r
 \r
     Status = mHiiFont->StringToImage (\r
@@ -1789,6 +1793,10 @@ DrawUnicodeWeightAtCursorN (
                          );\r
 \r
   } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    //\r
+    // If Graphics Output protocol cannot be found and PcdUgaConsumeSupport enabled, \r
+    // using UGA Draw protocol to draw.\r
+    //\r
     ASSERT (Private->UgaDraw!= NULL);\r
 \r
     UgaDraw = Private->UgaDraw;\r
index 1b7ad6cff4817fed3651400e2b0188e247eb7a24..8f0bf697a53a38c8842e802dc41939b7f963ebff 100644 (file)
@@ -181,8 +181,7 @@ typedef union {
   EFI_WIDE_GLYPH    WideGlyph;\r
 } GLYPH_UNION;\r
 \r
-extern EFI_NARROW_GLYPH  UsStdNarrowGlyphData[];\r
-extern EFI_WIDE_GLYPH    UsStdWideGlyphData[];\r
+extern EFI_NARROW_GLYPH  gUsStdNarrowGlyphData[];\r
 \r
 //\r
 // Device Structure\r
@@ -440,19 +439,19 @@ GraphicsConsoleConOutEnableCursor (
   );\r
 \r
 /**\r
-  Test to see if Graphics Console could be supported on the ControllerHandle.\r
+  Test to see if Graphics Console could be supported on the Controller.\r
 \r
   Graphics Console could be supported if Graphics Output Protocol or UGA Draw\r
-  Protocol exists on the ControllerHandle. (UGA Draw Protocol could be shipped\r
+  Protocol exists on the Controller. (UGA Draw Protocol could be skipped\r
   if PcdUgaConsumeSupport is set to FALSE.)\r
 \r
   @param  This                Protocol instance pointer.\r
-  @param  ControllerHandle    Handle of device to test.\r
+  @param  Controller          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 other               This driver does not support this device\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
@@ -463,18 +462,19 @@ GraphicsConsoleControllerDriverSupported (
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   );\r
 \r
+\r
 /**\r
-  Start this driver on ControllerHandle by opening Graphics Output protocol or \r
-  UGA Draw protocol, and installing Simple Text Out protocol on ControllerHandle.\r
+  Start this driver on Controller by opening Graphics Output protocol or \r
+  UGA Draw protocol, and installing Simple Text Out protocol on Controller.\r
   (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
   \r
   @param  This                 Protocol instance pointer.\r
-  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  Controller           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 other                This driver does not support this device\r
+  @retval EFI_SUCCESS          This driver is added to Controller.\r
+  @retval other                This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -486,20 +486,20 @@ GraphicsConsoleControllerDriverStart (
   );\r
 \r
 /**\r
-  Stop this driver on ControllerHandle by removing Simple Text Out protocol \r
-  and closing the Graphics Output Protocol or UGA Draw protocol on ControllerHandle.\r
+  Stop this driver on Controller by removing Simple Text Out protocol \r
+  and closing the Graphics Output Protocol or UGA Draw protocol on Controller.\r
   (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
   \r
 \r
   @param  This              Protocol instance pointer.\r
-  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  Controller        Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
   @param  ChildHandleBuffer List of Child Handles to Stop.\r
 \r
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle.\r
+  @retval EFI_SUCCESS       This driver is removed Controller.\r
   @retval EFI_NOT_STARTED   Simple Text Out protocol could not be found the \r
-                            ControllerHandle.\r
+                            Controller.\r
   @retval other             This driver was not removed from this device.\r
 \r
 **/\r
index 8444def66f4eb886088c916ce239a1ad91af229f..0caaf98523384d27682eabd0eb5c46394c8e6a8b 100644 (file)
@@ -2,7 +2,7 @@
 # Component description file for GraphicsConsole module\r
 #\r
 # This is the main routine for initializing the Graphics Console support routines.\r
-# Copyright (c) 2006 - 2007, Intel Corporation\r
+# Copyright (c) 2006 - 2008, 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
@@ -42,7 +42,6 @@
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
-  # currently use Hii for glyph lookup, need to change to UEFI scheme\r
   MdeModulePkg/MdeModulePkg.dec\r
 \r
 [LibraryClasses]\r
@@ -59,8 +58,8 @@
   gEfiSimpleTextOutProtocolGuid                 # PROTOCOL BY_START\r
   gEfiGraphicsOutputProtocolGuid                # PROTOCOL TO_START\r
   gEfiUgaDrawProtocolGuid                       # PROTOCOL TO_START\r
-  gEfiHiiFontProtocolGuid\r
-  gEfiHiiDatabaseProtocolGuid\r
+  gEfiHiiFontProtocolGuid                       # PROTOCOL TO_START\r
+  gEfiHiiDatabaseProtocolGuid                   # PROTOCOL TO_START   \r
 \r
 [FeaturePcd.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file
index 6520f241d04d08fab1adee00e31b41458321d395..dd7b02bb482041cef70789659c8a741fbc87a8a5 100644 (file)
@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "GraphicsConsole.h"\r
 \r
-EFI_NARROW_GLYPH  UsStdNarrowGlyphData[] = {\r
+EFI_NARROW_GLYPH  gUsStdNarrowGlyphData[] = {\r
   //\r
   // Unicode glyphs from 0x20 to 0x7e are the same as ASCII characters 0x20 to 0x7e\r
   //\r
@@ -284,5 +284,5 @@ ReturnNarrowFontSize (
   //\r
   // I need the size of this outside of this file, so here is a stub function to do that for me\r
   //\r
-  return sizeof (UsStdNarrowGlyphData);\r
+  return sizeof (gUsStdNarrowGlyphData);\r
 }\r