提交 3a3955d8 编写于 作者: V vit9696

OcBootManagementLib: Skip self entry

上级 096bb8fa
......@@ -122,6 +122,7 @@ OcFillBootEntry (
@param[out] BootEntries List of boot entries (allocated from pool).
@param[out] Count Number of boot entries.
@param[out] AllocCount Number of allocated boot entries.
@param[in] LoadHandle Load handle to skip.
@param[in] Describe Automatically fill description fields
@retval EFI_SUCCESS Executed successfully and found entries.
......@@ -133,6 +134,7 @@ OcScanForBootEntries (
OUT OC_BOOT_ENTRY **BootEntries,
OUT UINTN *Count,
OUT UINTN *AllocCount OPTIONAL,
IN EFI_HANDLE LoadHandle OPTIONAL,
IN BOOLEAN Describe
);
......@@ -257,6 +259,7 @@ EFI_STATUS
@param[in] TimeOutSeconds Default entry selection timeout (pass 0 to ignore).
@param[in] StartImage Image starting routine used.
@param[in] ShowPicker Show boot menu or just boot the default option.
@param[in] LoadHandle Load handle, skips main handle on this handle.
@retval does not return unless a fatal error happened.
**/
......@@ -266,7 +269,8 @@ OcRunSimpleBootPicker (
IN UINT32 BootPolicy,
IN UINT32 TimeoutSeconds,
IN OC_IMAGE_START StartImage,
IN BOOLEAN ShowPicker
IN BOOLEAN ShowPicker,
IN EFI_HANDLE LoadHandle OPTIONAL
);
#endif // OC_BOOT_MANAGEMENT_LIB_H
......@@ -774,6 +774,7 @@ OcScanForBootEntries (
OUT OC_BOOT_ENTRY **BootEntries,
OUT UINTN *Count,
OUT UINTN *AllocCount OPTIONAL,
IN EFI_HANDLE LoadHandle OPTIONAL,
IN BOOLEAN Describe
)
{
......@@ -784,6 +785,7 @@ OcScanForBootEntries (
OC_BOOT_ENTRY *Entries;
UINTN EntryIndex;
CHAR16 *DevicePath;
UINTN EntryCount;
Status = gBS->LocateHandleBuffer (
ByProtocol,
......@@ -811,13 +813,25 @@ OcScanForBootEntries (
EntryIndex = 0;
for (Index = 0; Index < NoHandles; ++Index) {
EntryIndex += OcFillBootEntry (
EntryCount = OcFillBootEntry (
BootPolicy,
Policy,
Handles[Index],
&Entries[EntryIndex],
&Entries[EntryIndex+1]
);
if (LoadHandle == Handles[Index] && EntryCount > 0) {
DEBUG ((DEBUG_INFO, "Skipping self load handle entry %p\n", LoadHandle));
--EntryCount;
CopyMem (
&Entries[EntryIndex+1],
&Entries[EntryIndex],
sizeof (Entries[EntryIndex]) * EntryCount
);
}
EntryIndex += EntryCount;
}
FreePool (Handles);
......@@ -971,7 +985,8 @@ OcRunSimpleBootPicker (
IN UINT32 BootPolicy,
IN UINT32 TimeoutSeconds,
IN OC_IMAGE_START StartImage,
IN BOOLEAN ShowPicker
IN BOOLEAN ShowPicker,
IN EFI_HANDLE LoadHandle OPTIONAL
)
{
EFI_STATUS Status;
......@@ -1007,6 +1022,7 @@ OcRunSimpleBootPicker (
&Entries,
&EntryCount,
NULL,
LoadHandle,
TRUE
);
......
......@@ -86,6 +86,7 @@ TestBless (
&Entries,
&EntryCount,
NULL,
NULL,
TRUE
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册