]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
ArmPlatformPkg: Use EfiEventGroupSignal from UefiLib
[mirror_edk2.git] / ArmPlatformPkg / Library / PlatformIntelBdsLib / IntelBdsPlatform.c
index c07fc0f607d72472726fe0b3fa70136046d62b94..8858668543294830a193985847043f2dc6de018f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -45,6 +45,10 @@ PlatformBdsInit (
   VOID\r
   )\r
 {\r
+  //\r
+  // Signal EndOfDxe PI Event\r
+  //\r
+  EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);\r
 }\r
 \r
 STATIC\r
@@ -63,8 +67,11 @@ GetConsoleDevicePathFromVariable (
   CHAR16*                   NextDevicePathStr;\r
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;\r
 \r
-  Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);\r
-  if (EFI_ERROR(Status)) {\r
+  Status = EFI_SUCCESS;\r
+  Size = 0;\r
+\r
+  DevicePathInstances = BdsLibGetVariableAndSize (ConsoleVarName, &gEfiGlobalVariableGuid, &Size);\r
+  if (DevicePathInstances == NULL) {\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
@@ -74,8 +81,6 @@ GetConsoleDevicePathFromVariable (
     Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);\r
     ASSERT_EFI_ERROR(Status);\r
 \r
-    DevicePathInstances = NULL;\r
-\r
     // Extract the Device Path instances from the multi-device path string\r
     while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'\0')) {\r
       NextDevicePathStr = StrStr (DefaultConsolePaths, L";");\r
@@ -141,16 +146,24 @@ InitializeConsolePipe (
   while (ConsoleDevicePaths != NULL) {\r
     DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);\r
 \r
-    Status = BdsConnectDevicePath (DevicePath, Handle, NULL);\r
+    Status = BdsLibConnectDevicePath (DevicePath);\r
+    if (!EFI_ERROR (Status)) {\r
+      //\r
+      // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL\r
+      // value. So ASSERT that this is the case.\r
+      //\r
+      gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle);\r
+      ASSERT (*Handle != NULL);\r
+    }\r
     DEBUG_CODE_BEGIN();\r
       if (EFI_ERROR(Status)) {\r
         // We convert back to the text representation of the device Path\r
-        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
-        CHAR16* DevicePathTxt;\r
-        EFI_STATUS Status;\r
+        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL  *DevicePathToTextProtocol;\r
+        CHAR16                            *DevicePathTxt;\r
 \r
-        Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);\r
-        if (!EFI_ERROR(Status)) {\r
+        DevicePathToTextProtocol = NULL;\r
+        gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **) &DevicePathToTextProtocol);\r
+        if (DevicePathToTextProtocol != NULL) {\r
           DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);\r
 \r
           DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));\r
@@ -171,7 +184,7 @@ InitializeConsolePipe (
   if (*Interface == NULL) {\r
     Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);\r
     if (EFI_ERROR (Status)) {\r
-      BdsConnectAllDrivers ();\r
+      BdsLibConnectAll ();\r
       Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);\r
     }\r
 \r
@@ -179,8 +192,8 @@ InitializeConsolePipe (
       *Handle = Buffer[0];\r
       Status = gBS->HandleProtocol (*Handle, Protocol, Interface);\r
       ASSERT_EFI_ERROR (Status);\r
+      FreePool (Buffer);\r
     }\r
-    FreePool (Buffer);\r
   } else {\r
     Status = EFI_SUCCESS;\r
   }\r
@@ -302,6 +315,18 @@ PlatformBdsPolicyBehavior (
 \r
   Status = PlatformBdsConnectConsole ();\r
   ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Show the splash screen.\r
+  //\r
+  EnableQuietBoot (PcdGetPtr (PcdLogoFile));\r
+\r
+  //\r
+  // Connect _all_ devices, to pick up plug-in and removable devices\r
+  // TODO: do this more cleanly, permitting faster boot times when boot config\r
+  //       is known\r
+  //\r
+  BdsLibConnectAll ();\r
 }\r
 \r
 /**\r