Created
May 17, 2020 03:55
-
-
Save pmdevita/2c8293ae8f0a7b17b98cc01cf7cee3ad to your computer and use it in GitHub Desktop.
Rehabman DSDT Debugging Tool CloverEFI Hotpatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DefinitionBlock ("", "SSDT", 2, "hack", "RMDT", 0x00000000) | |
{ | |
// Copy these External references to the SSDT you want to debug in | |
External (RMDT, DeviceObj) | |
External (RMDT.PUSH, MethodObj) | |
External (RMDT.P1, MethodObj) | |
External (RMDT.P2, MethodObj) | |
External (RMDT.P3, MethodObj) | |
External (RMDT.P4, MethodObj) | |
External (RMDT.P5, MethodObj) | |
External (RMDT.P6, MethodObj) | |
External (RMDT.P7, MethodObj) | |
Device (RMDT) | |
{ | |
Name (_HID, "RMD0000") | |
Name (RING, Package(256) { }) | |
Mutex (RTMX, 0) | |
Name (HEAD, 0) | |
Name (TAIL, 0) | |
// PUSH: Use to push a trace item into RING for ACPIDebug.kext | |
Method (PUSH, 1, NotSerialized) | |
{ | |
Acquire(RTMX, 0xFFFF) | |
// push new item at HEAD | |
Add(HEAD, 1, Local0) | |
If (LGreaterEqual(Local0, SizeOf(RING))) { Store(0, Local0) } | |
if (LNotEqual(Local0, TAIL)) | |
{ | |
Store(Arg0, Index(RING, HEAD)) | |
Store(Local0, HEAD) | |
} | |
Release(RTMX) | |
Notify(RMDT, 0x80) | |
} | |
// FTCH: Used by ACPIDebug.kext to fetch an item from RING | |
Method (FTCH, 0, NotSerialized) | |
{ | |
Acquire(RTMX, 0xFFFF) | |
// pull item from TAIL and return it | |
Store(0, Local0) | |
if (LNotEqual(HEAD, TAIL)) | |
{ | |
Store(DerefOf(Index(RING, TAIL)), Local0) | |
Increment(TAIL) | |
If (LGreaterEqual(TAIL, SizeOf(RING))) { Store(0, TAIL) } | |
} | |
Release(RTMX) | |
Return(Local0) | |
} | |
// COUN: Used by ACPIDebug.kext to determine number of items in RING | |
Method (COUN, 0, NotSerialized) | |
{ | |
Acquire(RTMX, 0xFFFF) | |
// return count of items in RING | |
Subtract(HEAD, TAIL, Local0) | |
if (LLess(Local0, 0)) { Add(Local0, SizeOf(RING), Local0) } | |
Release(RTMX) | |
Return(Local0) | |
} | |
// Helper functions for multiple params at one time | |
Method (P1, 1, NotSerialized) { PUSH(Arg0) } | |
Method (P2, 2, Serialized) | |
{ | |
Name (TEMP, Package(2) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
PUSH(TEMP) | |
} | |
Method (P3, 3, Serialized) | |
{ | |
Name (TEMP, Package(3) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
Store(Arg2, Index(TEMP, 2)) | |
PUSH(TEMP) | |
} | |
Method (P4, 4, Serialized) | |
{ | |
Name (TEMP, Package(4) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
Store(Arg2, Index(TEMP, 2)) | |
Store(Arg3, Index(TEMP, 3)) | |
PUSH(TEMP) | |
} | |
Method (P5, 5, Serialized) | |
{ | |
Name (TEMP, Package(5) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
Store(Arg2, Index(TEMP, 2)) | |
Store(Arg3, Index(TEMP, 3)) | |
Store(Arg4, Index(TEMP, 4)) | |
PUSH(TEMP) | |
} | |
Method (P6, 6, Serialized) | |
{ | |
Name (TEMP, Package(6) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
Store(Arg2, Index(TEMP, 2)) | |
Store(Arg3, Index(TEMP, 3)) | |
Store(Arg4, Index(TEMP, 4)) | |
Store(Arg5, Index(TEMP, 5)) | |
PUSH(TEMP) | |
} | |
Method (P7, 7, Serialized) | |
{ | |
Name (TEMP, Package(7) { }) | |
Store(Arg0, Index(TEMP, 0)) | |
Store(Arg1, Index(TEMP, 1)) | |
Store(Arg2, Index(TEMP, 2)) | |
Store(Arg3, Index(TEMP, 3)) | |
Store(Arg4, Index(TEMP, 4)) | |
Store(Arg5, Index(TEMP, 5)) | |
Store(Arg6, Index(TEMP, 6)) | |
PUSH(TEMP) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to
External()
methods for the commands you want to use and place them at the beginning inside the DefinitionBlock you are debugging inlog show --last "10m" | grep ACPIDebug
in the terminal to read the output