提交 9f59339e 编写于 作者: V vit9696

OcAfterCompatLib: Added 11.0 support for `AvoidRuntimeDefrag`

上级 bb12f5fe
......@@ -17,6 +17,7 @@ OpenCore Changelog
- Fixed assertions caused by unaligned file path access in DEBUG builds
- Renamed `ConfigValidity` utility to `ocvalidate` for consistency
- Added `GlobalConnect` for APFS loading to workaround older firmware issues
- Added 11.0 support for `AvoidRuntimeDefrag` Booter quirk
#### v0.5.9
- Added full HiDPI support in OpenCanopy
......
......@@ -1035,14 +1035,15 @@ OcGetAppleBootLoadedImage (
by other libraries, so values are often pointers to original fields.
**/
typedef struct OC_BOOT_ARGUMENTS_ {
UINT32 *MemoryMap;
UINT32 *MemoryMapSize;
UINT32 *MemoryMapDescriptorSize;
UINT32 *MemoryMapDescriptorVersion;
CHAR8 *CommandLine;
UINT32 *DeviceTreeP;
UINT32 *DeviceTreeLength;
UINT32 *CsrActiveConfig;
UINT32 *MemoryMap;
UINT32 *MemoryMapSize;
UINT32 *MemoryMapDescriptorSize;
UINT32 *MemoryMapDescriptorVersion;
CHAR8 *CommandLine;
UINT32 *DeviceTreeP;
UINT32 *DeviceTreeLength;
UINT32 *CsrActiveConfig;
EFI_SYSTEM_TABLE *SystemTable;
} OC_BOOT_ARGUMENTS;
/**
......
......@@ -256,6 +256,10 @@ typedef struct KERNEL_SUPPORT_STATE_ {
///
UINTN SysTableRtAreaSize;
///
/// Physical configuration table location.
///
EFI_CONFIGURATION_TABLE *ConfigurationTable;
///
/// Virtual memory mapper context.
///
OC_VMEM_CONTEXT VmContext;
......
......@@ -381,6 +381,25 @@ AppleMapPrepareForBooting (
DescriptorSize,
MemoryMap
);
//
// On native Macs due to EfiBoot defragmentation it is guaranteed that
// VADDR % BASE_1GB == PADDR. macOS 11 started to rely on this in
// acpi_count_enabled_logical_processors, which needs to access MADT (APIC)
// ACPI table, and does that through ConfigurationTables.
//
// The simplest approach is to just copy the table, so that it is accessible
// at both actual mapping and 1:1 defragmented mapping. This should be safe,
// as the memory for 1:1 defragmented mapping is reserved by EfiBoot in the
// first place and is otherwise stolen anyway.
//
if (BootCompat->KernelState.ConfigurationTable != NULL) {
CopyMem (
(VOID*) ((UINTN) BA.SystemTable->ConfigurationTable & (BASE_1GB - 1)),
BootCompat->KernelState.ConfigurationTable,
sizeof (*BootCompat->KernelState.ConfigurationTable) * BA.SystemTable->NumberOfTableEntries
);
}
}
}
......@@ -545,6 +564,10 @@ AppleMapPrepareBooterState (
gST,
gST->Hdr.HeaderSize
);
//
// Remember physical configuration table location.
//
BootCompat->KernelState.ConfigurationTable = gST->ConfigurationTable;
}
//
......
......@@ -45,6 +45,7 @@ OcParseBootArgs (
Arguments->DeviceTreeP = &BA1->deviceTreeP;
Arguments->DeviceTreeLength = &BA1->deviceTreeLength;
Arguments->SystemTable = (EFI_SYSTEM_TABLE*)(UINTN) BA1->efiSystemTable;
} else {
//
// Lion and newer
......@@ -58,6 +59,7 @@ OcParseBootArgs (
Arguments->DeviceTreeP = &BA2->deviceTreeP;
Arguments->DeviceTreeLength = &BA2->deviceTreeLength;
Arguments->SystemTable = (EFI_SYSTEM_TABLE*)(UINTN) BA2->efiSystemTable;
if (BA2->flags & kBootArgsFlagCSRActiveConfig) {
Arguments->CsrActiveConfig = &BA2->csrActiveConfig;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册