mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcAppleKernelLib: Disable trim using new method
closes https://github.com/acidanthera/bugtracker/issues/1950
This commit is contained in:
parent
b80c8ec3ba
commit
9e76d91905
@ -3,6 +3,8 @@ OpenCore Changelog
|
||||
#### v0.7.9
|
||||
- Added auto-detect `macOS Installer` volume name for use when `.disk_label` file cannot be displayed
|
||||
- Added `--restore-nosnoop` flag to AudioDxe, making v0.7.7 fix for Windows sound opt-in
|
||||
- Added new method to disable trim when `SetApfsTrimTimeout` is set to zero
|
||||
- Fixed `SetApfsTrimTimeout` on macOS 12 (only works when set to zero)
|
||||
|
||||
#### v0.7.8
|
||||
- Updated ocvalidate to warn about insecure `DmgLoading` with secure `SecureBootModel` (already disallowed in runtime)
|
||||
|
||||
@ -1 +1 @@
|
||||
8fe92652e6b6bf444b97fb743cae2a52
|
||||
63ebe375542ad0f079cc7071555dd405
|
||||
|
||||
Binary file not shown.
@ -2748,6 +2748,9 @@ blocking.
|
||||
\href{https://interface31.ru/tech_it/2015/04/mozhno-li-effektivno-ispolzovat-ssd-bez-podderzhki-trim.html}{article}
|
||||
for details.
|
||||
|
||||
As of macOS 12.0, it is no longer possible to set trim timeout for APFS filesystems.
|
||||
However, trim can be disabled when the timeout value is set to \texttt{0}.
|
||||
|
||||
\item
|
||||
\texttt{ThirdPartyDrives}\\
|
||||
\textbf{Type}: \texttt{plist\ boolean}\\
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
\documentclass[]{article}
|
||||
%DIF LATEXDIFF DIFFERENCE FILE
|
||||
%DIF DEL PreviousConfiguration.tex Wed Feb 9 09:37:10 2022
|
||||
%DIF ADD ../Configuration.tex Wed Feb 9 23:42:58 2022
|
||||
%DIF DEL PreviousConfiguration.tex Thu Feb 10 15:29:05 2022
|
||||
%DIF ADD ../Configuration.tex Thu Feb 10 19:56:56 2022
|
||||
|
||||
\usepackage{lmodern}
|
||||
\usepackage{amssymb,amsmath}
|
||||
@ -118,7 +118,7 @@
|
||||
%DIF HYPERREF PREAMBLE %DIF PREAMBLE
|
||||
\providecommand{\DIFadd}[1]{\texorpdfstring{\DIFaddtex{#1}}{#1}} %DIF PREAMBLE
|
||||
\providecommand{\DIFdel}[1]{\texorpdfstring{\DIFdeltex{#1}}{}} %DIF PREAMBLE
|
||||
%DIF LISTINGS PREAMBLE %DIF PREAMBLE
|
||||
%DIF COLORLISTINGS PREAMBLE %DIF PREAMBLE
|
||||
\RequirePackage{listings} %DIF PREAMBLE
|
||||
\RequirePackage{color} %DIF PREAMBLE
|
||||
\lstdefinelanguage{DIFcode}{ %DIF PREAMBLE
|
||||
@ -2808,7 +2808,11 @@ blocking.
|
||||
\href{https://interface31.ru/tech_it/2015/04/mozhno-li-effektivno-ispolzovat-ssd-bez-podderzhki-trim.html}{article}
|
||||
for details.
|
||||
|
||||
\item
|
||||
\DIFaddbegin \DIFadd{As of macOS 12.0, it is no longer possible to set trim timeout for APFS filesystems.
|
||||
However, trim can be disabled when the timeout value is set to }\texttt{\DIFadd{0}}\DIFadd{.
|
||||
}
|
||||
|
||||
\DIFaddend \item
|
||||
\texttt{ThirdPartyDrives}\\
|
||||
\textbf{Type}: \texttt{plist\ boolean}\\
|
||||
\textbf{Failsafe}: \texttt{false}\\
|
||||
|
||||
Binary file not shown.
@ -1979,34 +1979,6 @@ mApfsTimeoutPatch = {
|
||||
.Limit = 0
|
||||
};
|
||||
|
||||
STATIC
|
||||
UINT8
|
||||
mApfsTimeoutV2Find[] = {
|
||||
0x40, 0x42, 0x0F, 0x00
|
||||
};
|
||||
|
||||
STATIC
|
||||
UINT8
|
||||
mApfsTimeoutV2Replace[] = {
|
||||
0x00, 0x02, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
STATIC
|
||||
PATCHER_GENERIC_PATCH
|
||||
mApfsTimeoutV2Patch = {
|
||||
.Comment = DEBUG_POINTER ("ApfsTimeout V2"),
|
||||
.Base = "_spaceman_scan_free_blocks",
|
||||
.Find = mApfsTimeoutV2Find,
|
||||
.Mask = NULL,
|
||||
.Replace = mApfsTimeoutV2Replace,
|
||||
.ReplaceMask = NULL,
|
||||
.Size = sizeof (mApfsTimeoutV2Find),
|
||||
.Count = 2,
|
||||
.Skip = 0,
|
||||
.Limit = 4096
|
||||
};
|
||||
|
||||
VOID
|
||||
PatchSetApfsTimeout (
|
||||
IN UINT32 Timeout
|
||||
@ -2015,9 +1987,30 @@ PatchSetApfsTimeout (
|
||||
// FIXME: This is really ugly, make quirks take a context param.
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Registering %u APFS timeout\n", Timeout));
|
||||
CopyMem (&mApfsTimeoutReplace[2], &Timeout, sizeof (Timeout));
|
||||
CopyMem (&mApfsTimeoutV2Replace[0], &Timeout, sizeof (Timeout));
|
||||
}
|
||||
|
||||
STATIC
|
||||
UINT8
|
||||
mApfsDisableTrimReplace[] = {
|
||||
0x31, 0xC0, ///< xor eax, eax
|
||||
0xC3 ///< ret
|
||||
};
|
||||
|
||||
STATIC
|
||||
PATCHER_GENERIC_PATCH
|
||||
mApfsDisableTrimPatch = {
|
||||
.Comment = DEBUG_POINTER ("ApfsTimeout disable trim"),
|
||||
.Base = "_spaceman_iterate_free_extents_internal",
|
||||
.Find = NULL,
|
||||
.Mask = NULL,
|
||||
.Replace = mApfsDisableTrimReplace,
|
||||
.ReplaceMask = NULL,
|
||||
.Size = sizeof (mApfsDisableTrimReplace),
|
||||
.Count = 1,
|
||||
.Skip = 0,
|
||||
.Limit = 0
|
||||
};
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
PatchSetApfsTrimTimeout (
|
||||
@ -2036,23 +2029,33 @@ PatchSetApfsTrimTimeout (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (KernelVersion >= KERNEL_VERSION_MONTEREY_MIN) {
|
||||
Status = PatcherApplyGenericPatch (Patcher, &mApfsTimeoutV2Patch);
|
||||
//
|
||||
// Disable trim using another patch when timeout is 0.
|
||||
//
|
||||
if (mApfsTimeoutReplace[2] == 0) {
|
||||
Status = PatcherApplyGenericPatch (Patcher, &mApfsDisableTrimPatch);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Failed to apply patch SetApfsTrimTimeoutV2 - %r\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Failed to apply patch ApfsDisableTrim - %r\n", Status));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Patch success SetApfsTrimTimeoutV2\n"));
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Patch success ApfsDisableTrim\n"));
|
||||
}
|
||||
} else {
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (KernelVersion < KERNEL_VERSION_MONTEREY_MIN) {
|
||||
Status = PatcherApplyGenericPatch (Patcher, &mApfsTimeoutPatch);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Failed to apply patch SetApfsTrimTimeout - %r\n", Status));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Patch success SetApfsTrimTimeout\n"));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
DEBUG ((DEBUG_INFO, "OCAK: Skipping patch SetApfsTrimTimeout on macOS 12.0+\n"));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user