From be9ced4a7be09b0e0d088be3d6f251af2fd91e72 Mon Sep 17 00:00:00 2001 From: Mike Beaton Date: Mon, 2 Sep 2024 20:55:45 +0100 Subject: [PATCH] OcBootManagementLib: Convert naming from External System Boot to Unmanaged Boot --- .../Acidanthera/Library/OcBootManagementLib.h | 30 +++++++------- .../OcBootManagementLib/BootEntryManagement.c | 30 +++++++------- .../OcBootManagementLib/DefaultEntryChoice.c | 40 +++++++++---------- Platform/OpenCanopy/Views/BootPicker.c | 2 +- Platform/OpenLegacyBoot/OpenLegacyBoot.c | 26 ++++++------ 5 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Include/Acidanthera/Library/OcBootManagementLib.h b/Include/Acidanthera/Library/OcBootManagementLib.h index ccbf447ebce..9c49cec5129 100644 --- a/Include/Acidanthera/Library/OcBootManagementLib.h +++ b/Include/Acidanthera/Library/OcBootManagementLib.h @@ -157,7 +157,7 @@ typedef UINT32 OC_BOOT_ENTRY_TYPE; #define OC_BOOT_EXTERNAL_OS BIT6 #define OC_BOOT_EXTERNAL_TOOL BIT7 #define OC_BOOT_SYSTEM BIT8 -#define OC_BOOT_EXTERNAL_SYSTEM BIT9 +#define OC_BOOT_UNMANAGED BIT9 /** Picker mode. @@ -200,21 +200,21 @@ EFI_STATUS ); /** - Action to perform as part of executing an external boot system boot entry. + Action to perform as part of executing an unmanaged boot entry. **/ typedef EFI_STATUS -(*OC_BOOT_EXTERNAL_SYSTEM_ACTION) ( +(*OC_BOOT_UNMANAGED_ACTION) ( IN OUT OC_PICKER_CONTEXT *PickerContext, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ); /** - Gets Device Path for external boot system boot entry. + Get Device Path for unmanaged boot entry. **/ typedef EFI_STATUS -(*OC_BOOT_EXTERNAL_SYSTEM_GET_DP) ( +(*OC_BOOT_UNMANAGED_GET_FINAL_DP) ( IN OUT OC_PICKER_CONTEXT *PickerContext, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath ); @@ -238,13 +238,13 @@ typedef struct OC_BOOT_ENTRY_ { // OC_BOOT_SYSTEM_ACTION SystemAction; // - // Action to perform on execution. Only valid for external boot system entries. + // Action to perform on execution. Only valid for unmanaged boot entries. // - OC_BOOT_EXTERNAL_SYSTEM_ACTION ExternalSystemAction; + OC_BOOT_UNMANAGED_ACTION UnmanagedBootAction; // - // Gets Device Path for external boot system boot entry. Only valid for external boot system entries. + // Get final Device Path for boot entry. Only valid for unmanaged boot entries. // - OC_BOOT_EXTERNAL_SYSTEM_GET_DP ExternalSystemGetDevicePath; + OC_BOOT_UNMANAGED_GET_FINAL_DP UnmanagedBootGetFinalDevicePath; // // Id under which to save entry as default. // @@ -642,17 +642,17 @@ typedef struct { // CHAR8 *AudioBaseType; // - // External boot system action. Boot Entry Protocol only. Optional. + // Unmanaged boot action. Boot Entry Protocol unmanaged boot entries only. // - OC_BOOT_EXTERNAL_SYSTEM_ACTION ExternalSystemAction; + OC_BOOT_UNMANAGED_ACTION UnmanagedBootAction; // - // Gets Device Path for external boot system boot entry. Boot Entry Protocol only. Optional. + // Get final Device Path for unmanaged boot entry. Boot Entry Protocol unmanaged boot entries only. // - OC_BOOT_EXTERNAL_SYSTEM_GET_DP ExternalSystemGetDevicePath; + OC_BOOT_UNMANAGED_GET_FINAL_DP UnmanagedBootGetFinalDevicePath; // - // External boot system Device Path. Boot Entry Protocol only. Optional. + // Unmanaged boot Device Path. Boot Entry Protocol unmanaged boot entries only. // - EFI_DEVICE_PATH_PROTOCOL *ExternalSystemDevicePath; + EFI_DEVICE_PATH_PROTOCOL *UnmanagedBootDevicePath; // // Whether this entry should be labeled as external to the system. Boot Entry Protocol only. Optional. // diff --git a/Library/OcBootManagementLib/BootEntryManagement.c b/Library/OcBootManagementLib/BootEntryManagement.c index 57cfb51880c..1f1bd2359a8 100644 --- a/Library/OcBootManagementLib/BootEntryManagement.c +++ b/Library/OcBootManagementLib/BootEntryManagement.c @@ -692,7 +692,7 @@ InternalAddBootEntryFromCustomEntry ( return EFI_OUT_OF_RESOURCES; } - if (!CustomEntry->ExternalSystemAction && !CustomEntry->SystemAction) { + if (!CustomEntry->UnmanagedBootAction && !CustomEntry->SystemAction) { ASSERT (CustomEntry->Path != NULL); PathName = AsciiStrCopyToUnicode (CustomEntry->Path, 0); if (PathName == NULL) { @@ -715,19 +715,19 @@ InternalAddBootEntryFromCustomEntry ( DEBUG_INFO, "OCB: Adding custom entry %s (%a|B:%d) -> %a\n", BootEntry->Name, - CustomEntry->ExternalSystemAction != NULL ? "ext-action" : (CustomEntry->SystemAction != NULL ? "action" : (CustomEntry->Tool ? "tool" : "os")), + CustomEntry->UnmanagedBootAction != NULL ? "unmanaged" : (CustomEntry->SystemAction != NULL ? "action" : (CustomEntry->Tool ? "tool" : "os")), IsBootEntryProtocol, CustomEntry->Path )); - if (CustomEntry->ExternalSystemAction) { - BootEntry->Type = OC_BOOT_EXTERNAL_SYSTEM; - BootEntry->ExternalSystemAction = CustomEntry->ExternalSystemAction; - BootEntry->ExternalSystemGetDevicePath = CustomEntry->ExternalSystemGetDevicePath; - BootEntry->AudioBasePath = CustomEntry->AudioBasePath; - BootEntry->AudioBaseType = CustomEntry->AudioBaseType; - BootEntry->IsExternal = CustomEntry->External; - BootEntry->DevicePath = DuplicateDevicePath (CustomEntry->ExternalSystemDevicePath); + if (CustomEntry->UnmanagedBootAction) { + BootEntry->Type = OC_BOOT_UNMANAGED; + BootEntry->UnmanagedBootAction = CustomEntry->UnmanagedBootAction; + BootEntry->UnmanagedBootGetFinalDevicePath = CustomEntry->UnmanagedBootGetFinalDevicePath; + BootEntry->AudioBasePath = CustomEntry->AudioBasePath; + BootEntry->AudioBaseType = CustomEntry->AudioBaseType; + BootEntry->IsExternal = CustomEntry->External; + BootEntry->DevicePath = DuplicateDevicePath (CustomEntry->UnmanagedBootDevicePath); if (BootEntry->DevicePath == NULL) { FreeBootEntry (BootEntry); @@ -843,7 +843,7 @@ InternalAddBootEntryFromCustomEntry ( BootEntry->ExposeDevicePath = CustomEntry->RealPath; BootEntry->FullNvramAccess = CustomEntry->FullNvramAccess; - if ((BootEntry->ExternalSystemAction != NULL) || (BootEntry->SystemAction != NULL)) { + if ((BootEntry->UnmanagedBootAction != NULL) || (BootEntry->SystemAction != NULL)) { ASSERT (CustomEntry->Arguments == NULL); } else { ASSERT (CustomEntry->Arguments != NULL); @@ -861,7 +861,7 @@ InternalAddBootEntryFromCustomEntry ( BootEntry->IsCustom = TRUE; BootEntry->IsBootEntryProtocol = IsBootEntryProtocol; - if (IsBootEntryProtocol && (BootEntry->ExternalSystemAction == NULL) && (BootEntry->SystemAction == NULL)) { + if (IsBootEntryProtocol && (BootEntry->UnmanagedBootAction == NULL) && (BootEntry->SystemAction == NULL)) { PartitionEntry = OcGetGptPartitionEntry (FileSystem->Handle); if (PartitionEntry == NULL) { CopyGuid (&BootEntry->UniquePartitionGUID, &gEfiPartTypeUnusedGuid); @@ -2511,9 +2511,9 @@ OcLoadBootEntry ( EFI_HANDLE EntryHandle; INTERNAL_DMG_LOAD_CONTEXT DmgLoadContext; - if ((BootEntry->Type & OC_BOOT_EXTERNAL_SYSTEM) != 0) { - ASSERT (BootEntry->ExternalSystemAction != NULL); - return BootEntry->ExternalSystemAction (Context, BootEntry->DevicePath); + if ((BootEntry->Type & OC_BOOT_UNMANAGED) != 0) { + ASSERT (BootEntry->UnmanagedBootAction != NULL); + return BootEntry->UnmanagedBootAction (Context, BootEntry->DevicePath); } if ((BootEntry->Type & OC_BOOT_SYSTEM) != 0) { diff --git a/Library/OcBootManagementLib/DefaultEntryChoice.c b/Library/OcBootManagementLib/DefaultEntryChoice.c index 94b36c93759..d45c9b4c248 100644 --- a/Library/OcBootManagementLib/DefaultEntryChoice.c +++ b/Library/OcBootManagementLib/DefaultEntryChoice.c @@ -795,7 +795,7 @@ OcSetDefaultBootEntry ( UINTN BootChosenIndex; UINTN Index; UINTN DevicePathSize; - UINTN ExtSystemDevPathSize; + UINTN UnmanagedBootDevPathSize; UINTN LoadOptionSize; UINTN LoadOptionIdSize; UINTN LoadOptionNameSize; @@ -805,7 +805,7 @@ OcSetDefaultBootEntry ( CONST OC_CUSTOM_BOOT_DEVICE_PATH *CustomDevPath; CONST OC_ENTRY_PROTOCOL_DEVICE_PATH *EntryProtocolDevPath; - EFI_DEVICE_PATH_PROTOCOL *ExtSystemDevPath; + EFI_DEVICE_PATH_PROTOCOL *UnmanagedBootDevPath; VENDOR_DEVICE_PATH *DestCustomDevPath; FILEPATH_DEVICE_PATH *DestCustomEntryName; EFI_DEVICE_PATH_PROTOCOL *DestCustomEndNode; @@ -825,16 +825,16 @@ OcSetDefaultBootEntry ( } // - // Get final device path for external boot system entries. + // Get final device path for unmanaged boot entries. // - ExtSystemDevPath = NULL; - if ((Entry->Type == OC_BOOT_EXTERNAL_SYSTEM) && (Entry->ExternalSystemGetDevicePath != NULL)) { - ExtSystemDevPath = Entry->DevicePath; - Status = Entry->ExternalSystemGetDevicePath (Context, &ExtSystemDevPath); + UnmanagedBootDevPath = NULL; + if ((Entry->Type == OC_BOOT_UNMANAGED) && (Entry->UnmanagedBootGetFinalDevicePath != NULL)) { + UnmanagedBootDevPath = Entry->DevicePath; + Status = Entry->UnmanagedBootGetFinalDevicePath (Context, &UnmanagedBootDevPath); if (EFI_ERROR (Status)) { - ExtSystemDevPath = NULL; + UnmanagedBootDevPath = NULL; } else { - ExtSystemDevPathSize = GetDevicePathSize (ExtSystemDevPath); + UnmanagedBootDevPathSize = GetDevicePathSize (UnmanagedBootDevPath); } } @@ -890,10 +890,10 @@ OcSetDefaultBootEntry ( continue; } - if (ExtSystemDevPath != NULL) { + if (UnmanagedBootDevPath != NULL) { DevicePathSize = GetDevicePathSize (BootOptionDevicePath); - if (DevicePathSize >= ExtSystemDevPathSize) { - MatchedEntry = CompareMem (BootOptionDevicePath, ExtSystemDevPath, ExtSystemDevPathSize) == 0; + if (DevicePathSize >= UnmanagedBootDevPathSize) { + MatchedEntry = CompareMem (BootOptionDevicePath, UnmanagedBootDevPath, UnmanagedBootDevPathSize) == 0; } } else { BootOptionRemainingDevicePath = BootOptionDevicePath; @@ -973,8 +973,8 @@ OcSetDefaultBootEntry ( } } - if (ExtSystemDevPath != NULL) { - DevicePathSize = ExtSystemDevPathSize; + if (UnmanagedBootDevPath != NULL) { + DevicePathSize = UnmanagedBootDevPathSize; } else if (!Entry->IsCustom) { DevicePathSize = GetDevicePathSize (Entry->DevicePath); } else { @@ -1021,8 +1021,8 @@ OcSetDefaultBootEntry ( CopyMem (LoadOption + 1, LoadOptionName, LoadOptionNameSize); } - if (ExtSystemDevPath != NULL) { - CopyMem ((UINT8 *)(LoadOption + 1) + LoadOptionNameSize, ExtSystemDevPath, DevicePathSize); + if (UnmanagedBootDevPath != NULL) { + CopyMem ((UINT8 *)(LoadOption + 1) + LoadOptionNameSize, UnmanagedBootDevPath, DevicePathSize); } else if (!Entry->IsCustom) { CopyMem ((UINT8 *)(LoadOption + 1) + LoadOptionNameSize, Entry->DevicePath, DevicePathSize); } else { @@ -1084,9 +1084,9 @@ OcSetDefaultBootEntry ( FreePool (LoadOption); - if (ExtSystemDevPath != NULL) { - FreePool (ExtSystemDevPath); - ExtSystemDevPath = NULL; + if (UnmanagedBootDevPath != NULL) { + FreePool (UnmanagedBootDevPath); + UnmanagedBootDevPath = NULL; } if (EFI_ERROR (Status)) { @@ -1547,7 +1547,7 @@ InternalLoadBootEntry ( // // System entries are not loaded but called directly. // - ASSERT ((BootEntry->Type & OC_BOOT_EXTERNAL_SYSTEM) == 0); + ASSERT ((BootEntry->Type & OC_BOOT_UNMANAGED) == 0); ASSERT ((BootEntry->Type & OC_BOOT_SYSTEM) == 0); ASSERT (Context != NULL); ASSERT (DmgLoadContext != NULL); diff --git a/Platform/OpenCanopy/Views/BootPicker.c b/Platform/OpenCanopy/Views/BootPicker.c index 30ffe5b36d5..ba714682cf0 100644 --- a/Platform/OpenCanopy/Views/BootPicker.c +++ b/Platform/OpenCanopy/Views/BootPicker.c @@ -1495,7 +1495,7 @@ BootPickerEntriesSet ( } break; - case OC_BOOT_EXTERNAL_SYSTEM: + case OC_BOOT_UNMANAGED: if (OcAsciiStriStr (Entry->Flavour, OC_FLAVOUR_WINDOWS) != NULL) { Status = CopyLabel (&VolumeEntry->Label, &GuiContext->Labels[LABEL_WINDOWS]); } else { diff --git a/Platform/OpenLegacyBoot/OpenLegacyBoot.c b/Platform/OpenLegacyBoot/OpenLegacyBoot.c index 1a157a2f2e2..f18577f434d 100644 --- a/Platform/OpenLegacyBoot/OpenLegacyBoot.c +++ b/Platform/OpenLegacyBoot/OpenLegacyBoot.c @@ -110,7 +110,7 @@ FreePickerEntry ( STATIC EFI_STATUS -ExternalSystemActionDoLegacyBoot ( +UnmanagedBootActionDoLegacyBoot ( IN OUT OC_PICKER_CONTEXT *PickerContext, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ) @@ -211,7 +211,7 @@ ExternalSystemActionDoLegacyBoot ( STATIC EFI_STATUS -ExternalSystemGetDevicePath ( +UnmanagedBootGetFinalDevicePath ( IN OUT OC_PICKER_CONTEXT *PickerContext, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath ) @@ -416,17 +416,17 @@ OcGetLegacyBootEntries ( PickerEntry->Name = GetLegacyEntryName (LegacyOsType); } - PickerEntry->Id = AsciiDevicePath; - PickerEntry->Path = NULL; - PickerEntry->Arguments = NULL; - PickerEntry->Flavour = GetLegacyEntryFlavour (LegacyOsType); - PickerEntry->Tool = FALSE; - PickerEntry->TextMode = FALSE; - PickerEntry->RealPath = FALSE; - PickerEntry->External = IsExternal; - PickerEntry->ExternalSystemAction = ExternalSystemActionDoLegacyBoot; - PickerEntry->ExternalSystemGetDevicePath = ExternalSystemGetDevicePath; - PickerEntry->ExternalSystemDevicePath = BlockDevicePath; + PickerEntry->Id = AsciiDevicePath; + PickerEntry->Path = NULL; + PickerEntry->Arguments = NULL; + PickerEntry->Flavour = GetLegacyEntryFlavour (LegacyOsType); + PickerEntry->Tool = FALSE; + PickerEntry->TextMode = FALSE; + PickerEntry->RealPath = FALSE; + PickerEntry->External = IsExternal; + PickerEntry->UnmanagedBootAction = UnmanagedBootActionDoLegacyBoot; + PickerEntry->UnmanagedBootGetFinalDevicePath = UnmanagedBootGetFinalDevicePath; + PickerEntry->UnmanagedBootDevicePath = BlockDevicePath; if ((PickerEntry->Name == NULL) || (PickerEntry->Flavour == NULL)) { OcFlexArrayFree (&FlexPickerEntries);