提交 745acbaa 编写于 作者: V vit9696

OcBootManagementLib: Try working around missing handle for Tools

上级 b2b0fa3c
......@@ -235,7 +235,8 @@ EFI_STATUS
IN VOID *Context,
IN OC_BOOT_ENTRY *ChosenEntry,
OUT VOID **Data,
OUT UINT32 *DataSize
OUT UINT32 *DataSize,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL
);
/**
......
......@@ -72,6 +72,14 @@ typedef struct {
///
EFI_FILE_PROTOCOL *StorageRoot;
///
/// Device handle with storage (dummy) device path for loading.
///
EFI_HANDLE StorageHandle;
///
/// Dummy file path for file storage.
///
EFI_DEVICE_PATH_PROTOCOL *DummyDevicePath;
///
/// Vault context.
///
OC_STORAGE_VAULT Vault;
......
......@@ -29,12 +29,7 @@
#define DMG_FILE_PATH_LEN (L_STR_LEN (L"DMG_.dmg") + 16 + 1)
#pragma pack(1)
typedef PACKED struct {
VENDOR_DEVICE_PATH Vendor;
UINT32 Key;
} DMG_CONTROLLER_DEVICE_PATH;
#pragma pack(push, 1)
typedef PACKED struct {
VENDOR_DEFINED_DEVICE_PATH Vendor;
......@@ -56,7 +51,7 @@ typedef PACKED struct {
EFI_DEVICE_PATH_PROTOCOL End;
} DMG_DEVICE_PATH;
#pragma pack()
#pragma pack(pop)
#define OC_APPLE_DISK_IMAGE_MOUNTED_DATA_SIGNATURE \
SIGNATURE_32('D','m','g','I')
......
......@@ -77,7 +77,7 @@ InternalLoadBootEntry (
if (UnicodeDevicePath != NULL) {
DEBUG ((
DEBUG_INFO,
"Dmg boot %s to dp %s\n",
"OCB: Dmg boot %s to dp %s\n",
BootEntry->Name,
UnicodeDevicePath
));
......@@ -96,11 +96,19 @@ InternalLoadBootEntry (
Context->CustomEntryContext,
BootEntry,
&EntryData,
&EntryDataSize
&EntryDataSize,
&DevicePath
);
if (!EFI_ERROR (Status)) {
Status = gBS->LoadImage (FALSE, ParentHandle, NULL, EntryData, EntryDataSize, EntryHandle);
Status = gBS->LoadImage (
FALSE,
ParentHandle,
DevicePath,
EntryData,
EntryDataSize,
EntryHandle
);
FreePool (EntryData);
}
} else {
......@@ -116,6 +124,15 @@ InternalLoadBootEntry (
if (!EFI_ERROR (OptionalStatus)) {
LoadedImage->LoadOptionsSize = BootEntry->LoadOptionsSize;
LoadedImage->LoadOptions = BootEntry->LoadOptions;
if (BootEntry->IsCustom) {
DEBUG ((
DEBUG_INFO,
"OCB: Custom DeviceHandle %p FilePath %p\n",
LoadedImage->DeviceHandle,
LoadedImage->FilePath
));
}
}
} else {
InternalUnloadDmg (DmgLoadContext);
......@@ -198,7 +215,7 @@ OcDescribeBootEntry (
if (!EFI_ERROR (Status)) {
BootEntry->IsWindows = TRUE;
if (BootEntry->Name == NULL) {
BootEntry->Name = AllocateCopyPool(sizeof (L"BOOTCAMP Windows"), L"BOOTCAMP Windows");
BootEntry->Name = AllocateCopyPool (sizeof (L"BOOTCAMP Windows"), L"BOOTCAMP Windows");
}
}
......
......@@ -19,6 +19,7 @@
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcStorageLib.h>
......@@ -28,6 +29,74 @@ OC_STRUCTORS (OC_STORAGE_VAULT_HASH, ())
OC_MAP_STRUCTORS (OC_STORAGE_VAULT_FILES)
OC_STRUCTORS (OC_STORAGE_VAULT, ())
#pragma pack(push, 1)
typedef PACKED struct {
VENDOR_DEFINED_DEVICE_PATH Vendor;
EFI_DEVICE_PATH_PROTOCOL End;
} DUMMY_BOOT_DEVICE_PATH;
typedef PACKED struct {
VENDOR_DEFINED_DEVICE_PATH Vendor;
VENDOR_DEFINED_DEVICE_PATH VendorFile;
EFI_DEVICE_PATH_PROTOCOL End;
} DUMMY_BOOT_DEVICE_FILE_PATH;
#pragma pack(pop)
//
// We do not want to expose these for the time being!.
//
#define INTERNAL_STORAGE_GUID \
{ 0x33B5C65A, 0x5B82, 0x403D, {0x87, 0xA5, 0xD4, 0x67, 0x62, 0x50, 0xEC, 0x59} }
#define INTERNAL_STORAGE_FILE_GUID \
{ 0x1237EC17, 0xD3CE, 0x401D, {0xA8, 0x41, 0xB1, 0xD8, 0x18, 0xF8, 0xAF, 0x1A} }
STATIC
DUMMY_BOOT_DEVICE_PATH
mDummyBootDevicePath = {
.Vendor = {
.Header = {
.Type = HARDWARE_DEVICE_PATH,
.SubType = HW_VENDOR_DP,
.Length = {sizeof (VENDOR_DEFINED_DEVICE_PATH), 0}
},
.Guid = INTERNAL_STORAGE_GUID
},
.End = {
.Type = END_DEVICE_PATH_TYPE,
.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE,
.Length = {END_DEVICE_PATH_LENGTH, 0}
}
};
STATIC
DUMMY_BOOT_DEVICE_FILE_PATH
mDummyBootDeviceFilePath = {
.Vendor = {
.Header = {
.Type = HARDWARE_DEVICE_PATH,
.SubType = HW_VENDOR_DP,
.Length = {sizeof (VENDOR_DEFINED_DEVICE_PATH), 0}
},
.Guid = INTERNAL_STORAGE_GUID
},
.VendorFile = {
.Header = {
.Type = HARDWARE_DEVICE_PATH,
.SubType = HW_VENDOR_DP,
.Length = {sizeof (VENDOR_DEFINED_DEVICE_PATH), 0}
},
.Guid = INTERNAL_STORAGE_FILE_GUID
},
.End = {
.Type = END_DEVICE_PATH_TYPE,
.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE,
.Length = {END_DEVICE_PATH_LENGTH, 0}
}
};
STATIC
OC_SCHEMA
......@@ -101,6 +170,15 @@ OcStorageInitializeVault (
return EFI_UNSUPPORTED;
}
Context->StorageHandle = NULL;
gBS->InstallProtocolInterface (
&Context->StorageHandle,
&gEfiDevicePathProtocolGuid,
EFI_NATIVE_INTERFACE,
&mDummyBootDevicePath
);
Context->DummyDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &mDummyBootDeviceFilePath;
Context->HasVault = TRUE;
return EFI_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册