ArmPlatformPkg/Bds: Fix when the default console variables are empty (or null)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12640 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2011-11-01 23:43:12 +00:00
parent 031f52ce0f
commit 483bc3d330

View File

@ -41,6 +41,12 @@ GetConsoleDevicePathFromVariable (
Status = GetEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances); Status = GetEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
// In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)
if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
*DevicePaths = NULL;
return EFI_SUCCESS;
}
Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
@ -89,7 +95,7 @@ GetConsoleDevicePathFromVariable (
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
*DevicePaths = DevicePathInstances; *DevicePaths = DevicePathInstances;
} }
return EFI_SUCCESS; return Status;
} }
STATIC STATIC
@ -108,7 +114,7 @@ InitializeConsolePipe (
EFI_DEVICE_PATH_PROTOCOL* DevicePath; EFI_DEVICE_PATH_PROTOCOL* DevicePath;
// Connect all the Device Path Consoles // Connect all the Device Path Consoles
do { while (ConsoleDevicePaths != NULL) {
DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size); DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
Status = BdsConnectDevicePath (DevicePath, Handle, NULL); Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
@ -135,7 +141,7 @@ InitializeConsolePipe (
if (!EFI_ERROR(Status) && (*Interface == NULL)) { if (!EFI_ERROR(Status) && (*Interface == NULL)) {
Status = gBS->HandleProtocol (*Handle, Protocol, Interface); Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
} }
} while (ConsoleDevicePaths != NULL); }
// No Device Path has been defined for this console interface. We take the first protocol implementation // No Device Path has been defined for this console interface. We take the first protocol implementation
if (*Interface == NULL) { if (*Interface == NULL) {