Skip to content

Commit

Permalink
Fix SMU Send Message With Parameter pattern for Monterey
Browse files Browse the repository at this point in the history
Signed-off-by: Visual Ehrmanntraut <[email protected]>
  • Loading branch information
VisualEhrmanntraut committed Oct 2, 2023
1 parent b8e3eba commit 7d372ae
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 37 deletions.
64 changes: 32 additions & 32 deletions NootRX/AMDCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,37 +259,37 @@ static const CAILIPGoldenRegister goldenSettingsNavi22[] = {
};

static const CAILIPGoldenRegister goldenSettingsNavi24[] = {
GOLDEN_REGISTER(mmCGTT_SPI_CS_CLK_CTRL, 0x78000000, 0x78000100),
GOLDEN_REGISTER(mmCGTT_SPI_RA0_CLK_CTRL, 0xb0000ff0, 0x30000100),
GOLDEN_REGISTER(mmCGTT_SPI_RA1_CLK_CTRL, 0xff000000, 0x7e000100),
GOLDEN_REGISTER(mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c000),
GOLDEN_REGISTER(mmDB_DEBUG3, 0xffffffff, 0x00000280),
GOLDEN_REGISTER(mmDB_DEBUG4, 0xffffffff, 0x00800000),
GOLDEN_REGISTER(mmGCR_GENERAL_CNTL_Sienna_Cichlid, 0x1ff1ffff, 0x00000500),
GOLDEN_REGISTER(mmGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
GOLDEN_REGISTER(mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
GOLDEN_REGISTER(mmGL2C_CM_CTRL1, 0xff8fff0f, 0x580f1008),
GOLDEN_REGISTER(mmGL2C_CTRL3, 0xf7ffffff, 0x00f80988),
GOLDEN_REGISTER(mmLDS_CONFIG, 0x000001ff, 0x00000020),
GOLDEN_REGISTER(mmPA_CL_ENHANCE, 0xf17fffff, 0x01200007),
GOLDEN_REGISTER(mmSQ_CONFIG, 0xe07df47f, 0x00180070),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER0_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER1_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER10_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER11_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER12_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER13_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER14_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER15_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER2_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER3_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER4_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER5_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER6_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
GOLDEN_REGISTER(mmUTCL1_CTRL, 0xffbfffff, 0x00a00000),
GOLDEN_REGISTER(mmCGTT_SPI_CS_CLK_CTRL, 0x78000000, 0x78000100),
GOLDEN_REGISTER(mmCGTT_SPI_RA0_CLK_CTRL, 0xb0000ff0, 0x30000100),
GOLDEN_REGISTER(mmCGTT_SPI_RA1_CLK_CTRL, 0xff000000, 0x7e000100),
GOLDEN_REGISTER(mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c000),
GOLDEN_REGISTER(mmDB_DEBUG3, 0xffffffff, 0x00000280),
GOLDEN_REGISTER(mmDB_DEBUG4, 0xffffffff, 0x00800000),
GOLDEN_REGISTER(mmGCR_GENERAL_CNTL_Sienna_Cichlid, 0x1ff1ffff, 0x00000500),
GOLDEN_REGISTER(mmGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
GOLDEN_REGISTER(mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
GOLDEN_REGISTER(mmGL2C_CM_CTRL1, 0xff8fff0f, 0x580f1008),
GOLDEN_REGISTER(mmGL2C_CTRL3, 0xf7ffffff, 0x00f80988),
GOLDEN_REGISTER(mmLDS_CONFIG, 0x000001ff, 0x00000020),
GOLDEN_REGISTER(mmPA_CL_ENHANCE, 0xf17fffff, 0x01200007),
GOLDEN_REGISTER(mmSQ_CONFIG, 0xe07df47f, 0x00180070),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER0_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER1_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER10_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER11_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER12_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER13_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER14_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER15_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER2_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER3_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER4_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER5_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER6_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000),
GOLDEN_REGISTER(mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
GOLDEN_REGISTER(mmUTCL1_CTRL, 0xffbfffff, 0x00a00000),
GOLDEN_REGISTER_TERMINATOR,
};
3 changes: 2 additions & 1 deletion NootRX/HWLibs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ bool HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_address_t sl
{"_psp_cmd_km_submit", wrapPspCmdKmSubmit, this->orgPspCmdKmSubmit, kPspCmdKmSubmitPattern,
kPspCmdKmSubmitMask},
{"_smu_11_0_7_send_message_with_parameter", wrapSmu1107SendMessageWithParameter,
this->orgSmu1107SendMessageWithParameter, kSmu1107SendMessageWithParameterPattern},
this->orgSmu1107SendMessageWithParameter, kSmu1107SendMessageWithParameterPattern,
kSmu1107SendMessageWithParameterPatternMask},
};
PANIC_COND(!RouteRequestPlus::routeAll(patcher, id, requests, slide, size), "HWLibs",
"Failed to route Navi 22 routes");
Expand Down
6 changes: 5 additions & 1 deletion NootRX/HWLibs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ static const UInt8 kPspCmdKmSubmitMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00};

static const UInt8 kSmu1107SendMessageWithParameterPattern[] = {0x55, 0x48, 0x89, 0xE5, 0x41, 0x57, 0x41, 0x56, 0x41,
0x54, 0x53, 0x41, 0x89, 0xD6, 0x41, 0x89, 0xF7, 0x48, 0x89, 0xFB, 0x8B, 0x8F, 0x10, 0x03, 0x00, 0x00};
0x54, 0x53, 0x41, 0x89, 0xD6, 0x41, 0x89, 0xF7, 0x48, 0x89, 0xFB, 0x8B, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8D,
0x35};
static const UInt8 kSmu1107SendMessageWithParameterPatternMask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0xFF};

//------ Patches ------//

Expand Down
6 changes: 6 additions & 0 deletions NootRX/NootRX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ void NootRXMain::processPatcher(KernelPatcher &patcher) {
case 0x73C4:
[[fallthrough]];
case 0x73DF:
PANIC_COND(getKernelVersion() < KernelVersion::Monterey, "NootRX",
"Unsupported macOS version; Navi 22 requires macOS Monterey or newer");
this->chipType = ChipType::Navi22;
this->enumRevision = 0x32;
break;
Expand All @@ -109,6 +111,8 @@ void NootRXMain::processPatcher(KernelPatcher &patcher) {
case 0x73E4:
[[fallthrough]];
case 0x73EF:
PANIC_COND(getKernelVersion() < KernelVersion::Monterey, "NootRX",
"Unsupported macOS version; Navi 23 requires macOS Monterey or newer");
this->chipType = ChipType::Navi23;
this->enumRevision = 0x3C;
break;
Expand All @@ -123,6 +127,8 @@ void NootRXMain::processPatcher(KernelPatcher &patcher) {
case 0x7424:
[[fallthrough]];
case 0x743F:
PANIC_COND(getKernelVersion() < KernelVersion::Monterey, "NootRX",
"Unsupported macOS version; Navi 24 requires macOS Monterey or newer");
this->chipType = ChipType::Navi24;
this->enumRevision = 0x46;
break;
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Navi dGPU patch kext. Also adds support for unsupported cards.

Currently supports:

- Navi 21
- Navi 22 (Yup)
- Navi 23
- Navi 21, on macOS Big Sur and newer
- Navi 22, on macOS Monterey and newer (Yup)
- Navi 23, on macOS Monterey and newer

Navi 24 support soon™

Expand Down

0 comments on commit 7d372ae

Please sign in to comment.