]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Fix when the default console variables are empty (or null)
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Nov 2011 23:43:12 +0000 (23:43 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Nov 2011 23:43:12 +0000 (23:43 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12640 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/Bds.c

index 609a6f6f76d4069d3e50cc85d543824a4ea36566..176311e8a28b48dd445caf5ea602f299e23f8375 100644 (file)
@@ -41,6 +41,12 @@ GetConsoleDevicePathFromVariable (
 \r
   Status = GetEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);\r
   if (EFI_ERROR(Status)) {\r
+    // In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)\r
+    if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {\r
+      *DevicePaths = NULL;\r
+      return EFI_SUCCESS;\r
+    }\r
+\r
     Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);\r
     ASSERT_EFI_ERROR(Status);\r
 \r
@@ -89,7 +95,7 @@ GetConsoleDevicePathFromVariable (
   if (!EFI_ERROR(Status)) {\r
     *DevicePaths = DevicePathInstances;\r
   }\r
-  return EFI_SUCCESS;\r
+  return Status;\r
 }\r
 \r
 STATIC\r
@@ -108,7 +114,7 @@ InitializeConsolePipe (
   EFI_DEVICE_PATH_PROTOCOL* DevicePath;\r
 \r
   // Connect all the Device Path Consoles\r
-  do {\r
+  while (ConsoleDevicePaths != NULL) {\r
     DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);\r
 \r
     Status = BdsConnectDevicePath (DevicePath, Handle, NULL);\r
@@ -135,7 +141,7 @@ InitializeConsolePipe (
     if (!EFI_ERROR(Status) && (*Interface == NULL)) {\r
       Status = gBS->HandleProtocol (*Handle, Protocol, Interface);\r
     }\r
-  } while (ConsoleDevicePaths != NULL);\r
+  }\r
 \r
   // No Device Path has been defined for this console interface. We take the first protocol implementation\r
   if (*Interface == NULL) {\r
@@ -171,11 +177,11 @@ InitializeConsole (
   // By getting the Console Device Paths from the environment variables before initializing the console pipe, we\r
   // create the 3 environment variables (ConIn, ConOut, ConErr) that allows to initialize all the console interface\r
   // of newly installed console drivers\r
-  Status = GetConsoleDevicePathFromVariable (L"ConOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths),&ConOutDevicePaths);\r
+  Status = GetConsoleDevicePathFromVariable (L"ConOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConOutDevicePaths);\r
   ASSERT_EFI_ERROR (Status);\r
-  Status = GetConsoleDevicePathFromVariable (L"ConIn", (CHAR16*)PcdGetPtr(PcdDefaultConInPaths),&ConInDevicePaths);\r
+  Status = GetConsoleDevicePathFromVariable (L"ConIn", (CHAR16*)PcdGetPtr(PcdDefaultConInPaths), &ConInDevicePaths);\r
   ASSERT_EFI_ERROR (Status);\r
-  Status = GetConsoleDevicePathFromVariable (L"ConErr", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths),&ConErrDevicePaths);\r
+  Status = GetConsoleDevicePathFromVariable (L"ConErr", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConErrDevicePaths);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   // Initialize the Consoles\r