]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
ArmPlatformPkg/PlatformIntelBdsLib: remove ARM BDS dependency
[mirror_edk2.git] / ArmPlatformPkg / Library / PlatformIntelBdsLib / IntelBdsPlatform.c
index c82f27fb4edd4c279609251f708810ad22437788..7397047279452d75e12f79a49ee854beb6e20192 100644 (file)
@@ -63,8 +63,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 +77,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,7 +142,15 @@ 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
@@ -171,7 +180,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