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

OcAfterCompatLib: Added 11.0 support for `AvoidRuntimeDefrag`

上级 bb12f5fe
...@@ -17,6 +17,7 @@ OpenCore Changelog ...@@ -17,6 +17,7 @@ OpenCore Changelog
- Fixed assertions caused by unaligned file path access in DEBUG builds - Fixed assertions caused by unaligned file path access in DEBUG builds
- Renamed `ConfigValidity` utility to `ocvalidate` for consistency - Renamed `ConfigValidity` utility to `ocvalidate` for consistency
- Added `GlobalConnect` for APFS loading to workaround older firmware issues - Added `GlobalConnect` for APFS loading to workaround older firmware issues
- Added 11.0 support for `AvoidRuntimeDefrag` Booter quirk
#### v0.5.9 #### v0.5.9
- Added full HiDPI support in OpenCanopy - Added full HiDPI support in OpenCanopy
......
...@@ -1035,14 +1035,15 @@ OcGetAppleBootLoadedImage ( ...@@ -1035,14 +1035,15 @@ OcGetAppleBootLoadedImage (
by other libraries, so values are often pointers to original fields. by other libraries, so values are often pointers to original fields.
**/ **/
typedef struct OC_BOOT_ARGUMENTS_ { typedef struct OC_BOOT_ARGUMENTS_ {
UINT32 *MemoryMap; UINT32 *MemoryMap;
UINT32 *MemoryMapSize; UINT32 *MemoryMapSize;
UINT32 *MemoryMapDescriptorSize; UINT32 *MemoryMapDescriptorSize;
UINT32 *MemoryMapDescriptorVersion; UINT32 *MemoryMapDescriptorVersion;
CHAR8 *CommandLine; CHAR8 *CommandLine;
UINT32 *DeviceTreeP; UINT32 *DeviceTreeP;
UINT32 *DeviceTreeLength; UINT32 *DeviceTreeLength;
UINT32 *CsrActiveConfig; UINT32 *CsrActiveConfig;
EFI_SYSTEM_TABLE *SystemTable;
} OC_BOOT_ARGUMENTS; } OC_BOOT_ARGUMENTS;
/** /**
......
...@@ -256,6 +256,10 @@ typedef struct KERNEL_SUPPORT_STATE_ { ...@@ -256,6 +256,10 @@ typedef struct KERNEL_SUPPORT_STATE_ {
/// ///
UINTN SysTableRtAreaSize; UINTN SysTableRtAreaSize;
/// ///
/// Physical configuration table location.
///
EFI_CONFIGURATION_TABLE *ConfigurationTable;
///
/// Virtual memory mapper context. /// Virtual memory mapper context.
/// ///
OC_VMEM_CONTEXT VmContext; OC_VMEM_CONTEXT VmContext;
......
...@@ -381,6 +381,25 @@ AppleMapPrepareForBooting ( ...@@ -381,6 +381,25 @@ AppleMapPrepareForBooting (
DescriptorSize, DescriptorSize,
MemoryMap 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 ( ...@@ -545,6 +564,10 @@ AppleMapPrepareBooterState (
gST, gST,
gST->Hdr.HeaderSize gST->Hdr.HeaderSize
); );
//
// Remember physical configuration table location.
//
BootCompat->KernelState.ConfigurationTable = gST->ConfigurationTable;
} }
// //
......
...@@ -45,6 +45,7 @@ OcParseBootArgs ( ...@@ -45,6 +45,7 @@ OcParseBootArgs (
Arguments->DeviceTreeP = &BA1->deviceTreeP; Arguments->DeviceTreeP = &BA1->deviceTreeP;
Arguments->DeviceTreeLength = &BA1->deviceTreeLength; Arguments->DeviceTreeLength = &BA1->deviceTreeLength;
Arguments->SystemTable = (EFI_SYSTEM_TABLE*)(UINTN) BA1->efiSystemTable;
} else { } else {
// //
// Lion and newer // Lion and newer
...@@ -58,6 +59,7 @@ OcParseBootArgs ( ...@@ -58,6 +59,7 @@ OcParseBootArgs (
Arguments->DeviceTreeP = &BA2->deviceTreeP; Arguments->DeviceTreeP = &BA2->deviceTreeP;
Arguments->DeviceTreeLength = &BA2->deviceTreeLength; Arguments->DeviceTreeLength = &BA2->deviceTreeLength;
Arguments->SystemTable = (EFI_SYSTEM_TABLE*)(UINTN) BA2->efiSystemTable;
if (BA2->flags & kBootArgsFlagCSRActiveConfig) { if (BA2->flags & kBootArgsFlagCSRActiveConfig) {
Arguments->CsrActiveConfig = &BA2->csrActiveConfig; Arguments->CsrActiveConfig = &BA2->csrActiveConfig;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册