From 375245f142cc548e4202dbcd9b79535d8d722038 Mon Sep 17 00:00:00 2001 From: Download-Fritz Date: Sun, 28 Apr 2019 14:03:05 +0200 Subject: [PATCH] OcBootManagementLib: Print all boot Device Paths --- .../OcBootManagementLib/OcBootManagementLib.c | 53 +++++++++++++++++-- .../OcBootManagementLib.inf | 1 + 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/Library/OcBootManagementLib/OcBootManagementLib.c b/Library/OcBootManagementLib/OcBootManagementLib.c index d8690b7d..c8503b58 100644 --- a/Library/OcBootManagementLib/OcBootManagementLib.c +++ b/Library/OcBootManagementLib/OcBootManagementLib.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -652,7 +653,7 @@ InternalGetDefaultBootEntry ( EFI_DEVICE_PATH_PROTOCOL *OcRemainingDevicePath; UINT32 OptionalDataSize; VOID *OptionalData; - CHAR16 *DefaultDevicePathText; + CHAR16 *DevicePathText; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_HANDLE DeviceHandle; @@ -694,6 +695,48 @@ InternalGetDefaultBootEntry ( return NULL; } + Status = GetVariable2 ( + L"efi-boot-device-data", + &gAppleBootVariableGuid, + (VOID **)&UefiDevicePath, + &RootDevicePathSize + ); + if (!EFI_ERROR (Status)) { + DevicePathText = ConvertDevicePathToText (UefiDevicePath, FALSE, FALSE); + if (DevicePathText != NULL) { + DEBUG ((DEBUG_INFO, "OCB: efi-boot-device-data = %s\n", DevicePathText)); + FreePool (DevicePathText); + } + } + + DEBUG_CODE ( + for (Index = 0; Index < (BootOrderSize / sizeof (*BootOrder)); ++Index) { + UefiDevicePath = InternalGetBootOptionData ( + BootOrder[Index], + NULL, + NULL, + NULL + ); + if (UefiDevicePath == NULL) { + continue; + } + + DevicePathText = ConvertDevicePathToText (UefiDevicePath, FALSE, FALSE); + DEBUG (( + DEBUG_INFO, + "OCB: %d -> Boot%04x = %s\n", + Index, + BootOrder[Index], + DevicePathText + )); + if (DevicePathText != NULL) { + FreePool (DevicePathText); + } + + FreePool (UefiDevicePath); + } + ); + UefiDevicePath = InternalGetBootOptionData ( BootOrder[0], NULL, @@ -767,10 +810,10 @@ InternalGetDefaultBootEntry ( OcFixAppleBootDevicePath (UefiDevicePath); DEBUG_CODE ( - DefaultDevicePathText = ConvertDevicePathToText (UefiDevicePath, FALSE, FALSE); - if (DefaultDevicePathText != NULL) { - DEBUG ((DEBUG_INFO, "OCB: Default boot Device Path: %s\n", DefaultDevicePathText)); - FreePool (DefaultDevicePathText); + DevicePathText = ConvertDevicePathToText (UefiDevicePath, FALSE, FALSE); + if (DevicePathText != NULL) { + DEBUG ((DEBUG_INFO, "OCB: Default boot Device Path: %s\n", DevicePathText)); + FreePool (DevicePathText); } ); diff --git a/Library/OcBootManagementLib/OcBootManagementLib.inf b/Library/OcBootManagementLib/OcBootManagementLib.inf index 56d45d8c..8126ab21 100644 --- a/Library/OcBootManagementLib/OcBootManagementLib.inf +++ b/Library/OcBootManagementLib/OcBootManagementLib.inf @@ -46,6 +46,7 @@ gAppleBlessedOsxFolderInfoGuid ## SOMETIMES_CONSUMES gEfiFileInfoGuid ## SOMETIMES_CONSUMES gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES + gAppleBootVariableGuid ## SOMETIMES_CONSUMES [Protocols] gAppleBootPolicyProtocolGuid ## PRODUCES