]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
Fix component name bugs when input Controller Name is invalid
[mirror_edk2.git] / EdkModulePkg / Universal / Console / GraphicsConsole / Dxe / GraphicsConsole.c
index 6cea2e11b60def5cecdf8996a12a1152fc82e243..25b0429b1bc23ef47b3ecc1660fa41f502e21c9c 100644 (file)
@@ -1,6 +1,12 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
+/**@file\r
+  This is the main routine for initializing the Graphics Console support routines.\r
+Remaining Tasks\r
+  Add all standard Glyphs from EFI 1.02 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 Intel Corporation. <BR>\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
@@ -9,23 +15,7 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-  GraphicsConsole.c\r
-  \r
-Abstract:\r
-\r
-  This is the main routine for initializing the Graphics Console support routines.\r
-\r
-Revision History\r
-\r
-Remaining Tasks\r
-  Add all standard Glyphs from EFI 1.02 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
---*/\r
+**/\r
 \r
 #include "GraphicsConsole.h"\r
 \r
@@ -111,7 +101,7 @@ GRAPHICS_CONSOLE_DEV        mGraphicsConsoleDevTemplate = {
   },\r
   {\r
     { 80, 25, 0, 0, 0, 0 },  // Mode 0\r
-    { 80, 50, 0, 0, 0, 0 },  // Mode 1\r
+    { 80, 50, 0, 0, 0, 0 },  // Mode 1 \r
     {  0,  0, 0, 0, 0, 0 }   // Mode 2\r
   },\r
   (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,\r
@@ -126,22 +116,22 @@ static EFI_GRAPHICS_OUTPUT_BLT_PIXEL        mEfiColors[16] = {
   //\r
   // B     G     R\r
   //\r
-  0x00, 0x00, 0x00, 0x00,  // BLACK\r
-  0x98, 0x00, 0x00, 0x00,  // BLUE\r
-  0x00, 0x98, 0x00, 0x00,  // GREEN\r
-  0x98, 0x98, 0x00, 0x00,  // CYAN\r
-  0x00, 0x00, 0x98, 0x00,  // RED\r
-  0x98, 0x00, 0x98, 0x00,  // MAGENTA\r
-  0x00, 0x98, 0x98, 0x00,  // BROWN\r
-  0x98, 0x98, 0x98, 0x00,  // LIGHTGRAY\r
-  0x30, 0x30, 0x30, 0x00,  // DARKGRAY - BRIGHT BLACK\r
-  0xff, 0x00, 0x00, 0x00,  // LIGHTBLUE - ?\r
-  0x00, 0xff, 0x00, 0x00,  // LIGHTGREEN - ?\r
-  0xff, 0xff, 0x00, 0x00,  // LIGHTCYAN\r
-  0x00, 0x00, 0xff, 0x00,  // LIGHTRED\r
-  0xff, 0x00, 0xff, 0x00,  // LIGHTMAGENTA\r
-  0x00, 0xff, 0xff, 0x00,  // LIGHTBROWN\r
-  0xff, 0xff, 0xff, 0x00,  // WHITE\r
+  {0x00, 0x00, 0x00, 0x00},  // BLACK\r
+  {0x98, 0x00, 0x00, 0x00},  // BLUE\r
+  {0x00, 0x98, 0x00, 0x00},  // GREEN\r
+  {0x98, 0x98, 0x00, 0x00},  // CYAN\r
+  {0x00, 0x00, 0x98, 0x00},  // RED\r
+  {0x98, 0x00, 0x98, 0x00},  // MAGENTA\r
+  {0x00, 0x98, 0x98, 0x00},  // BROWN\r
+  {0x98, 0x98, 0x98, 0x00},  // LIGHTGRAY\r
+  {0x30, 0x30, 0x30, 0x00},  // DARKGRAY - BRIGHT BLACK\r
+  {0xff, 0x00, 0x00, 0x00},  // LIGHTBLUE - ?\r
+  {0x00, 0xff, 0x00, 0x00},  // LIGHTGREEN - ?\r
+  {0xff, 0xff, 0x00, 0x00},  // LIGHTCYAN\r
+  {0x00, 0x00, 0xff, 0x00},  // LIGHTRED\r
+  {0xff, 0x00, 0xff, 0x00},  // LIGHTMAGENTA\r
+  {0x00, 0xff, 0xff, 0x00},  // LIGHTBROWN\r
+  {0xff, 0xff, 0xff, 0x00}  // WHITE\r
 };\r
 \r
 static EFI_NARROW_GLYPH     mCursorGlyph = {\r
@@ -154,7 +144,7 @@ EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
   GraphicsConsoleControllerDriverSupported,\r
   GraphicsConsoleControllerDriverStart,\r
   GraphicsConsoleControllerDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
@@ -388,9 +378,7 @@ GraphicsConsoleControllerDriverStart (
                          );\r
       if (!EFI_ERROR (Status)) {\r
         if ((Info->HorizontalResolution == 800) &&\r
-            (Info->VerticalResolution == 600) &&\r
-            ((Info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor) ||\r
-             (Info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor))) {\r
+            (Info->VerticalResolution == 600)) {\r
           Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);\r
           if (!EFI_ERROR (Status)) {\r
             gBS->FreePool (Info);\r
@@ -1174,6 +1162,10 @@ GraphicsConsoleConOutSetMode (
   UgaDraw   = Private->UgaDraw;\r
   ModeData  = &(Private->ModeData[ModeNumber]);\r
 \r
+  if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Make sure the requested mode number is supported\r
   //\r