Skip to content

Commit

Permalink
fix: Add RenoirE DDI caps
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualEhrmanntraut committed Nov 28, 2024
1 parent de46a12 commit f3cfd97
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NootedRed/NRed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion NootedRed/PrivateHeaders/NRedAttributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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; }
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions NootedRed/PrivateHeaders/iVega/ASICCaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
4 changes: 4 additions & 0 deletions NootedRed/iVega/HWLibs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <PrivateHeaders/GPUDriversAMD/PSP.hpp>
#include <PrivateHeaders/NRed.hpp>
#include <PrivateHeaders/PatcherPlus.hpp>
#include <PrivateHeaders/iVega/ASICCaps.hpp>
#include <PrivateHeaders/iVega/GoldenSettings.hpp>
#include <PrivateHeaders/iVega/HWLibs.hpp>
#include <PrivateHeaders/iVega/IPOffset.hpp>
Expand Down Expand Up @@ -448,6 +449,9 @@ void iVega::X5000HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_
orgCapsInitTable->extRevision =
static_cast<UInt64>(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(),
Expand Down
4 changes: 3 additions & 1 deletion NootedRed/iVega/X6000FB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit f3cfd97

Please sign in to comment.