]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Connect all drivers if the SimpleTextIO is not available
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 Mar 2011 12:28:01 +0000 (12:28 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 Mar 2011 12:28:01 +0000 (12:28 +0000)
If none of the Simple Text Input/Output Protocol implementations were started
before starting BDS then an exception error occured.
This fix forces to connect all the drivers if no SimpleText IO protocols are
found.

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

ArmPlatformPkg/Bds/BdsEntry.c

index 8a7a357b0ffb2a6335ab718ca9ec8c43678e5857..62e8236e844ab6337af37a213e1f90963f4cb1fb 100644 (file)
@@ -83,13 +83,17 @@ EFI_STATUS GetEnvironmentVariable (
     return EFI_SUCCESS;
 }
 
     return EFI_SUCCESS;
 }
 
-VOID InitializeConsole (
+EFI_STATUS
+InitializeConsole (
   VOID                   
   )
 {
   EFI_STATUS                Status;
   UINTN                     NoHandles;
   EFI_HANDLE                *Buffer;
   VOID                   
   )
 {
   EFI_STATUS                Status;
   UINTN                     NoHandles;
   EFI_HANDLE                *Buffer;
+  BOOLEAN                   AllDriversConnected;
+
+  AllDriversConnected = FALSE;
 
   //
   // Now we need to setup the EFI System Table with information about the console devices.
 
   //
   // Now we need to setup the EFI System Table with information about the console devices.
@@ -97,6 +101,12 @@ VOID InitializeConsole (
   // consoles at the same time
   //
   Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer);
   // consoles at the same time
   //
   Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer);
+  if (EFI_ERROR (Status)) {
+    BdsConnectAllDrivers();
+    AllDriversConnected = TRUE;
+    Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer);
+  }
+
   if (!EFI_ERROR (Status)) {
     // Use the first SimpleTextOut we find and update the EFI System Table
     gST->ConsoleOutHandle = Buffer[0];
   if (!EFI_ERROR (Status)) {
     // Use the first SimpleTextOut we find and update the EFI System Table
     gST->ConsoleOutHandle = Buffer[0];
@@ -107,9 +117,16 @@ VOID InitializeConsole (
     gST->StdErr = gST->ConOut;
     
     FreePool (Buffer);
     gST->StdErr = gST->ConOut;
     
     FreePool (Buffer);
-  } 
+  } else {
+    return Status;
+  }
   
   Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer);
   
   Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer);
+  if (EFI_ERROR (Status) && !AllDriversConnected) {
+    BdsConnectAllDrivers();
+    Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer);
+  }
+
   if (!EFI_ERROR (Status)) {
     // Use the first SimpleTextIn we find and update the EFI System Table
     gST->ConsoleInHandle = Buffer[0];
   if (!EFI_ERROR (Status)) {
     // Use the first SimpleTextIn we find and update the EFI System Table
     gST->ConsoleInHandle = Buffer[0];
@@ -117,7 +134,11 @@ VOID InitializeConsole (
     ASSERT_EFI_ERROR (Status);
     
     FreePool (Buffer);
     ASSERT_EFI_ERROR (Status);
     
     FreePool (Buffer);
+  } else {
+    return Status;
   }
   }
+
+  return EFI_SUCCESS;
 }
 
 EFI_STATUS
 }
 
 EFI_STATUS
@@ -238,7 +259,8 @@ BdsEntry (
     PERF_END   (NULL, "DXE", NULL, 0);
     PERF_START (NULL, "BDS", NULL, 0);
 
     PERF_END   (NULL, "DXE", NULL, 0);
     PERF_START (NULL, "BDS", NULL, 0);
 
-    InitializeConsole();
+    Status = InitializeConsole();
+    ASSERT_EFI_ERROR(Status);
 
     while (1) {
       // Get the Linux Kernel Device Path from Environment Variable
 
     while (1) {
       // Get the Linux Kernel Device Path from Environment Variable