From f3cfd97991c9e5af88e0bcce75726c31613da167 Mon Sep 17 00:00:00 2001 From: Visual Ehrmanntraut <30368284+VisualEhrmanntraut@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:45:27 +0200 Subject: [PATCH] fix: Add RenoirE DDI caps --- NootedRed/NRed.cpp | 3 +++ NootedRed/PrivateHeaders/NRedAttributes.hpp | 5 ++++- NootedRed/PrivateHeaders/iVega/ASICCaps.hpp | 2 ++ NootedRed/iVega/HWLibs.cpp | 4 ++++ NootedRed/iVega/X6000FB.cpp | 4 +++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NootedRed/NRed.cpp b/NootedRed/NRed.cpp index ef0291f5..9172cdec 100644 --- a/NootedRed/NRed.cpp +++ b/NootedRed/NRed.cpp @@ -139,6 +139,9 @@ void NRed::hwLateInit() { } else { this->enumRevision = 0x1; } + } else if (this->attributes.isRenoir() && !this->attributes.isGreenSardine() && this->devRevision == 0 && + this->pciRevision >= 0x80 && this->pciRevision <= 0x84) { + this->attributes.setRenoirE(); } DBGLOG("NRed", "deviceID = 0x%X", this->deviceID); diff --git a/NootedRed/PrivateHeaders/NRedAttributes.hpp b/NootedRed/PrivateHeaders/NRedAttributes.hpp index 9429886f..815d8780 100644 --- a/NootedRed/PrivateHeaders/NRedAttributes.hpp +++ b/NootedRed/PrivateHeaders/NRedAttributes.hpp @@ -19,7 +19,8 @@ class NRedAttributes { static constexpr UInt16 IsPicasso = (1U << 10); static constexpr UInt16 IsRaven2 = (1U << 11); static constexpr UInt16 IsRenoir = (1U << 12); - static constexpr UInt16 IsGreenSardine = (1U << 13); + static constexpr UInt16 IsRenoirE = (1U << 13); + static constexpr UInt16 IsGreenSardine = (1U << 14); UInt16 value {0}; @@ -37,6 +38,7 @@ class NRedAttributes { inline const bool isPicasso() const { return (this->value & IsPicasso) != 0; } inline const bool isRaven2() const { return (this->value & IsRaven2) != 0; } inline const bool isRenoir() const { return (this->value & IsRenoir) != 0; } + inline const bool isRenoirE() const { return (this->value & IsRenoirE) != 0; } inline const bool isGreenSardine() const { return (this->value & IsGreenSardine) != 0; } inline void setCatalina() { this->value |= IsCatalina; } @@ -52,6 +54,7 @@ class NRedAttributes { inline void setPicasso() { this->value |= IsPicasso; } inline void setRaven2() { this->value |= IsRaven2; } inline void setRenoir() { this->value |= IsRenoir; } + inline void setRenoirE() { this->value |= IsRenoirE; } inline void setGreenSardine() { this->value |= IsGreenSardine; } inline const char *getChipName() const { diff --git a/NootedRed/PrivateHeaders/iVega/ASICCaps.hpp b/NootedRed/PrivateHeaders/iVega/ASICCaps.hpp index ea156638..7c7a8af8 100644 --- a/NootedRed/PrivateHeaders/iVega/ASICCaps.hpp +++ b/NootedRed/PrivateHeaders/iVega/ASICCaps.hpp @@ -8,3 +8,5 @@ static const UInt32 ddiCapsRaven[16] = {0x800005, 0x500011FE, 0x80000, 0x1100100 0x4002, 0x22420001, 0x9E20E10, 0x2000120, 0x0, 0x0, 0x0, 0x0, 0x0}; static const UInt32 ddiCapsRenoir[16] = {0x800005, 0x500011FE, 0x80000, 0x11001000, 0x200, 0x68000001, 0x20000000, 0x4002, 0x22420001, 0x9E20E18, 0x2000120, 0x0, 0x0, 0x0, 0x0, 0x0}; +static const UInt32 ddiCapsRenoirE[16] = {0x800005, 0x500011FE, 0x80000, 0x11001000, 0x200, 0x68000001, 0x20000000, + 0x4002, 0x22420001, 0x9E60E18, 0x2000120, 0x0, 0x0, 0x0, 0x0, 0x0}; diff --git a/NootedRed/iVega/HWLibs.cpp b/NootedRed/iVega/HWLibs.cpp index 446c73e1..69987dc6 100644 --- a/NootedRed/iVega/HWLibs.cpp +++ b/NootedRed/iVega/HWLibs.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -448,6 +449,9 @@ void iVega::X5000HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_ orgCapsInitTable->extRevision = static_cast(NRed::singleton().getEnumRevision()) + NRed::singleton().getDevRevision(); orgCapsInitTable->pciRevision = NRed::singleton().getPciRevision(); + orgCapsInitTable->ddiCaps = NRed::singleton().getAttributes().isRenoirE() ? ddiCapsRenoirE : + NRed::singleton().getAttributes().isRenoir() ? ddiCapsRenoir : + ddiCapsRaven; *orgCapsTable = { .familyId = AMD_FAMILY_RAVEN, .deviceId = NRed::singleton().getDeviceID(), diff --git a/NootedRed/iVega/X6000FB.cpp b/NootedRed/iVega/X6000FB.cpp index b3f8b07d..0ad8f5f5 100644 --- a/NootedRed/iVega/X6000FB.cpp +++ b/NootedRed/iVega/X6000FB.cpp @@ -337,7 +337,9 @@ void iVega::X6000FB::processKext(KernelPatcher &patcher, size_t id, mach_vm_addr PANIC_COND(MachInfo::setKernelWriting(true, KernelPatcher::kernelWriteLock) != KERN_SUCCESS, "X6000FB", "Failed to enable kernel writing"); orgAsicCapsTable->familyId = AMD_FAMILY_RAVEN; - orgAsicCapsTable->ddiCaps = NRed::singleton().getAttributes().isRenoir() ? ddiCapsRenoir : ddiCapsRaven; + orgAsicCapsTable->ddiCaps = NRed::singleton().getAttributes().isRenoirE() ? ddiCapsRenoirE : + NRed::singleton().getAttributes().isRenoir() ? ddiCapsRenoir : + ddiCapsRaven; orgAsicCapsTable->deviceId = NRed::singleton().getDeviceID(); orgAsicCapsTable->revision = NRed::singleton().getDevRevision(); orgAsicCapsTable->extRevision =