]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. retried PrimaryConsoleInDeviceGuid, PrimaryConsoleOutDeviceGuid and PrimaryStandar...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 10 Mar 2009 03:10:15 +0000 (03:10 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 10 Mar 2009 03:10:15 +0000 (03:10 +0000)
Consplitter will not install these protocols any more.

2. added logic in Bds to check console handles in System table, if no console handle assigned. Bds module will fill these handles in system table accordingly.

3. fixed one bug before call ConsoleControl->SetMode in FrontPage.c.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7841 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
MdeModulePkg/Include/Guid/PrimaryConsoleInDevice.h [deleted file]
MdeModulePkg/Include/Guid/PrimaryConsoleOutDevice.h [deleted file]
MdeModulePkg/Include/Guid/PrimaryStandardErrorDevice.h [deleted file]
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf

index f9860a24777101c86681c1ac1d5a24a7ef1b0da6..1e34c03e2073fb35c04293b36ff19cf393cc3997 100644 (file)
@@ -48,6 +48,117 @@ IsNvNeed (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  Fill console handle in System Table if there are no valid console handle in.\r
+\r
+  Firstly, check the validation of console handle in System Table. If it is invalid,\r
+  update it by the first console device handle from EFI console variable. \r
+\r
+  @param  VarName            The name of the EFI console variable.\r
+  @param  ConsoleGuid        Specified Console protocol GUID.\r
+  @param  ConsoleHandle      On IN,  console handle in System Table to be checked. \r
+                             On OUT, new console hanlde in system table.\r
+  @param  ProtocolInterface  On IN,  console protocol on console handle in System Table to be checked. \r
+                             On OUT, new console protocol on new console hanlde in system table.\r
+**/\r
+VOID \r
+UpdateSystemTableConsole (\r
+  IN     CHAR16                          *VarName,\r
+  IN     EFI_GUID                        *ConsoleGuid,\r
+  IN OUT EFI_HANDLE                      *ConsoleHandle,\r
+  IN OUT VOID                            **ProtocolInterface\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  UINTN                     DevicePathSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *FullDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *VarConsole;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Instance;\r
+  VOID                      *Interface;\r
+  EFI_HANDLE                NewHandle;\r
+\r
+  ASSERT (VarName != NULL);\r
+  ASSERT (ConsoleHandle != NULL);\r
+  ASSERT (ConsoleGuid != NULL);\r
+  ASSERT (ProtocolInterface != NULL);\r
+\r
+  if (*ConsoleHandle != NULL) {\r
+    Status = gBS->HandleProtocol (\r
+                   *ConsoleHandle,\r
+                   ConsoleGuid,\r
+                   &Interface\r
+                   );\r
+    if (Status == EFI_SUCCESS && Interface == *ProtocolInterface) {\r
+      //\r
+      // If ConsoleHandle is valid and console protocol on this handle also\r
+      // also matched, just return.\r
+      //\r
+      return;\r
+    }\r
+  }\r
+  \r
+  //\r
+  // Get all possible consoles device path from EFI variable\r
+  //\r
+  VarConsole = BdsLibGetVariableAndSize (\r
+                VarName,\r
+                &gEfiGlobalVariableGuid,\r
+                &DevicePathSize\r
+                );\r
+  if (VarConsole == NULL) {\r
+    //\r
+    // If there is no any console device, just return.\r
+    //\r
+    return ;\r
+  }\r
+\r
+  FullDevicePath = VarConsole;\r
+\r
+  do {\r
+    //\r
+    // Check every instance of the console variable\r
+    //\r
+    Instance  = GetNextDevicePathInstance (&VarConsole, &DevicePathSize);\r
+    if (Instance == NULL) {\r
+      FreePool (FullDevicePath);\r
+      ASSERT (FALSE);\r
+    }\r
+    \r
+    //\r
+    // Find console device handle by device path instance\r
+    //\r
+    Status = gBS->LocateDevicePath (\r
+                   ConsoleGuid,\r
+                   &Instance,\r
+                   &NewHandle\r
+                   );\r
+    if (!EFI_ERROR (Status)) {\r
+      //\r
+      // Get the console protocol on this console device handle\r
+      //\r
+      Status = gBS->HandleProtocol (\r
+                     NewHandle,\r
+                     ConsoleGuid,\r
+                     &Interface\r
+                     );\r
+      if (!EFI_ERROR (Status)) {\r
+        //\r
+        // Update new console handle in System Table.\r
+        //\r
+        *ConsoleHandle     = NewHandle;\r
+        *ProtocolInterface = Interface;\r
+        return ;\r
+      }\r
+    }\r
+\r
+  } while (Instance != NULL);\r
+\r
+  //\r
+  // No any available console devcie found.\r
+  //\r
+  ASSERT (FALSE);  \r
+}\r
+\r
 /**\r
   This function update console variable based on ConVarName, it can\r
   add or remove one specific console device path from the variable\r
 /**\r
   This function update console variable based on ConVarName, it can\r
   add or remove one specific console device path from the variable\r
@@ -406,6 +517,13 @@ BdsLibConnectAllDefaultConsoles (
   //\r
   BdsLibConnectConsoleVariable (L"ErrOut");\r
 \r
   //\r
   BdsLibConnectConsoleVariable (L"ErrOut");\r
 \r
+  //\r
+  // Fill console handles in System Table if no console device assignd.\r
+  //\r
+  UpdateSystemTableConsole (L"ConIn", &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **) &gST->ConIn);\r
+  UpdateSystemTableConsole (L"ConOut", &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **) &gST->ConOut);\r
+  UpdateSystemTableConsole (L"ErrOut", &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **) &gST->StdErr);\r
+\r
   return EFI_SUCCESS;\r
 \r
 }\r
   return EFI_SUCCESS;\r
 \r
 }\r
index 44a1e0868932ac6b7d0d830cbf5c0142b255ff76..c1b4eff1cd7eef849f581d86a5bd1d8ec718d747 100644 (file)
@@ -971,6 +971,7 @@ Exit:
   //\r
   PERF_END (0, "BdsTimeOut", "BDS", 0);\r
   Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
   //\r
   PERF_END (0, "BdsTimeOut", "BDS", 0);\r
   Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
-  ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
-\r
+  if (Status == EFI_SUCCESS) {\r
+    ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
+  }\r
 }\r
 }\r
diff --git a/MdeModulePkg/Include/Guid/PrimaryConsoleInDevice.h b/MdeModulePkg/Include/Guid/PrimaryConsoleInDevice.h
deleted file mode 100644 (file)
index 1d60bb5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file\r
-  This guid is used to specify the primary console in device.\r
-  It will be installed as the protocol guid into the virtual device handle for ConIn Splitter.\r
-\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
-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 __PRIMARY_CONSOLE_IN_DEVICE_H__\r
-#define __PRIMARY_CONSOLE_IN_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_CONSOLE_IN_DEVICE_GUID    \\r
-  { 0xe451dcbe, 0x96a1, 0x4729, {0xa5, 0xcf, 0x6b, 0x9c, 0x2c, 0xff, 0x47, 0xfd } }\r
-\r
-extern EFI_GUID gEfiPrimaryConsoleInDeviceGuid;\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Include/Guid/PrimaryConsoleOutDevice.h b/MdeModulePkg/Include/Guid/PrimaryConsoleOutDevice.h
deleted file mode 100644 (file)
index 3ea238b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file\r
-  This guid is used to specify the primary console out device.\r
-  It will be installed as the protocol guid into the virtual device handle for ConOut Splitter.\r
-\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
-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 __PRIMARY_CONSOLE_OUT_DEVICE_H__\r
-#define __PRIMARY_CONSOLE_OUT_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_CONSOLE_OUT_DEVICE_GUID    \\r
-  { 0x62bdf38a, 0xe3d5, 0x492c, {0x95, 0xc, 0x23, 0xa7, 0xf6, 0x6e, 0x67, 0x2e } }\r
-\r
-extern EFI_GUID gEfiPrimaryConsoleOutDeviceGuid;\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Include/Guid/PrimaryStandardErrorDevice.h b/MdeModulePkg/Include/Guid/PrimaryStandardErrorDevice.h
deleted file mode 100644 (file)
index b53f86b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file\r
-  This guid is used to specify the primary StdErr device.\r
-  It will be installed as the protocol guid into the virtual device handle for StdErr Splitter.\r
-\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
-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 __PRIMARY_STANDARD_ERROR_DEVICE_H__\r
-#define __PRIMARY_STANDARD_ERROR_DEVICE_H__\r
-\r
-#define EFI_PRIMARY_STANDARD_ERROR_DEVICE_GUID    \\r
-  { 0x5a68191b, 0x9b97, 0x4752, {0x99, 0x46, 0xe3, 0x6a, 0x5d, 0xa9, 0x42, 0xb1 } }\r
-\r
-extern EFI_GUID gEfiPrimaryStandardErrorDeviceGuid;\r
-\r
-#endif\r
index 9db9d4a0ba6246a7748e15bf2c6b96c73fdaa884..f056046c88251853c6b588fa8b86ba64fb4afde6 100644 (file)
   ## Include/Guid/ConsoleInDevice.h\r
   gEfiConsoleInDeviceGuid        = { 0xD3B36F2B, 0xD551, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}\r
   \r
   ## Include/Guid/ConsoleInDevice.h\r
   gEfiConsoleInDeviceGuid        = { 0xD3B36F2B, 0xD551, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}\r
   \r
-  ## Guid specify the primary console out device.\r
-  ## Include/Guid/PrimaryConsoleOutDevice.h\r
-  gEfiPrimaryConsoleOutDeviceGuid = { 0x62BDF38A, 0xE3D5, 0x492C, { 0x95, 0x0C, 0x23, 0xA7, 0xF6, 0x6E, 0x67, 0x2E }}\r
-  \r
-  ## Guid specify the primary console in device.\r
-  ## Include/Guid/PrimaryConsoleInDevice.h\r
-  gEfiPrimaryConsoleInDeviceGuid = { 0xE451DCBE, 0x96A1, 0x4729, { 0xA5, 0xCF, 0x6B, 0x9C, 0x2C, 0xFF, 0x47, 0xFD }}\r
-  \r
-  ## Guid specify the primary StdErr device.\r
-  ## Include/Guid/PrimaryStandardErrorDevice.h\r
-  gEfiPrimaryStandardErrorDeviceGuid = { 0x5A68191B, 0x9B97, 0x4752, { 0x99, 0x46, 0xE3, 0x6A, 0x5D, 0xA9, 0x42, 0xB1 }}\r
-  \r
   ## Hob and Variable guid specify the platform memory type information.\r
   ## Include/Guid/MemoryTypeInformation.h\r
   gEfiMemoryTypeInformationGuid  = { 0x4C19049F, 0x4137, 0x4DD3, { 0x9C, 0x10, 0x8B, 0x97, 0xA8, 0x3F, 0xFD, 0xFA }}\r
   ## Hob and Variable guid specify the platform memory type information.\r
   ## Include/Guid/MemoryTypeInformation.h\r
   gEfiMemoryTypeInformationGuid  = { 0x4C19049F, 0x4137, 0x4DD3, { 0x9C, 0x10, 0x8B, 0x97, 0xA8, 0x3F, 0xFD, 0xFA }}\r
index 7650ce4b6d4dbf1ab94a563b8de8540944693595..04ea719e59b121c3f7e5b3d54c184b6e03d53de8 100644 (file)
@@ -429,8 +429,6 @@ ConSplitterDriverEntry(
                     &mStdErr.VirtualHandle,\r
                     &gEfiSimpleTextOutProtocolGuid,\r
                     &mStdErr.TextOut,\r
                     &mStdErr.VirtualHandle,\r
                     &gEfiSimpleTextOutProtocolGuid,\r
                     &mStdErr.TextOut,\r
-                    &gEfiPrimaryStandardErrorDeviceGuid,\r
-                    NULL,\r
                     NULL\r
                     );\r
   }\r
                     NULL\r
                     );\r
   }\r
@@ -449,8 +447,6 @@ ConSplitterDriverEntry(
                     &mConIn.SimplePointer,\r
                     &gEfiAbsolutePointerProtocolGuid,\r
                     &mConIn.AbsolutePointer,\r
                     &mConIn.SimplePointer,\r
                     &gEfiAbsolutePointerProtocolGuid,\r
                     &mConIn.AbsolutePointer,\r
-                    &gEfiPrimaryConsoleInDeviceGuid,\r
-                    NULL,\r
                     NULL\r
                     );\r
     if (!EFI_ERROR (Status)) {\r
                     NULL\r
                     );\r
     if (!EFI_ERROR (Status)) {\r
@@ -480,8 +476,6 @@ ConSplitterDriverEntry(
                       &mConOut.UgaDraw,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
                       &mConOut.UgaDraw,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
-                      &gEfiPrimaryConsoleOutDeviceGuid,\r
-                      NULL,\r
                       NULL\r
                       );\r
     } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
                       NULL\r
                       );\r
     } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
@@ -497,8 +491,6 @@ ConSplitterDriverEntry(
                       &mConOut.GraphicsOutput,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
                       &mConOut.GraphicsOutput,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
-                      &gEfiPrimaryConsoleOutDeviceGuid,\r
-                      NULL,\r
                       NULL\r
                       );\r
     } else {\r
                       NULL\r
                       );\r
     } else {\r
@@ -516,8 +508,6 @@ ConSplitterDriverEntry(
                       &mConOut.UgaDraw,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
                       &mConOut.UgaDraw,\r
                       &gEfiConsoleControlProtocolGuid,\r
                       &mConOut.ConsoleControl,\r
-                      &gEfiPrimaryConsoleOutDeviceGuid,\r
-                      NULL,\r
                       NULL\r
                       );\r
     }\r
                       NULL\r
                       );\r
     }\r
index 8c505740c3ca365376c1dd402ddf74f32b948732..00694052428aa4f90d9dffa715ffb7a7026764c0 100644 (file)
@@ -29,9 +29,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/UgaDraw.h>\r
 \r
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/UgaDraw.h>\r
 \r
-#include <Guid/PrimaryStandardErrorDevice.h>\r
-#include <Guid/PrimaryConsoleOutDevice.h>\r
-#include <Guid/PrimaryConsoleInDevice.h>\r
 #include <Guid/ConsoleInDevice.h>\r
 #include <Guid/StandardErrorDevice.h>\r
 #include <Guid/ConsoleOutDevice.h>\r
 #include <Guid/ConsoleInDevice.h>\r
 #include <Guid/StandardErrorDevice.h>\r
 #include <Guid/ConsoleOutDevice.h>\r
index 730149d6c09b17e2388a0bf74788cbc6cefadfdf..fcb42475f1b399d6161d7792526a6b3fa6efce50 100644 (file)
@@ -73,9 +73,7 @@
   gEfiConsoleInDeviceGuid                       ## SOMETIMES_CONSUMES\r
   gEfiStandardErrorDeviceGuid                   ## SOMETIMES_CONSUMES\r
   gEfiConsoleOutDeviceGuid                      ## SOMETIMES_CONSUMES\r
   gEfiConsoleInDeviceGuid                       ## SOMETIMES_CONSUMES\r
   gEfiStandardErrorDeviceGuid                   ## SOMETIMES_CONSUMES\r
   gEfiConsoleOutDeviceGuid                      ## SOMETIMES_CONSUMES\r
-  gEfiPrimaryConsoleOutDeviceGuid               ## PRODUCES\r
-  gEfiPrimaryConsoleInDeviceGuid                ## PRODUCES\r
-  gEfiPrimaryStandardErrorDeviceGuid            ## PRODUCES\r
+\r
 \r
 [Protocols]\r
   gEfiConsoleControlProtocolGuid                ## PRODUCES\r
 \r
 [Protocols]\r
   gEfiConsoleControlProtocolGuid                ## PRODUCES\r