Ryzen 7000 Testing

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269
When I fix my dumb moment yeah I will commit it to my repo.

The following compiles and I am just about to test it. This is not ideal, but I want to start with something basic, then clean it up.

C:
  //
  // Perform TSC and FSB calculations. This is traditionally done in tsc.c in XNU.
  //
  // For AMD Family H and ExtFamily A
  if (CpuInfo->Family == 0xF && CpuInfo->ExtFamily == 0xA) {
        busFreqValue    = CpuInfo->FSBFrequency;
        busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
        busFCvtn2tValue = DivU64x64Remainder(((1000000000ULL) << 32), busFCvtt2nValue, NULL);

        tscFreqValue    = CpuInfo->CPUFrequency;
        tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
        tscFCvtn2tValue = DivU64x64Remainder(((1000000000ULL)  << 32), tscFCvtt2nValue, NULL);
  }
  else {
        busFreqValue    = CpuInfo->FSBFrequency;
        busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
        busFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, busFCvtt2nValue, NULL);

        tscFreqValue    = CpuInfo->CPUFrequency;
        tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
        tscFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, tscFCvtt2nValue, NULL);
  }

Update:
  • This works on AM5
  • This also works on Intel i5-12600K (Z690)
  • Added some debug logs -- will capture the logs now
 
Last edited:

fabiosun

Guru
Guru
AMD OS X Member
Joined
Oct 9, 2022
Messages
470
The new calculation is inspired by Clover, but not identical to it. We also see in the table posted by CaseySJ that some TSC-related values, which I suppose derive from secondary calculations, have values which match neither those derived from Clover nor those derived from regular OpenCore.


What is this system which "does not need it"? Zen2/3 without iGPU (as in your Threadripper)? Intel?
check cpp file posted by Shanneee
Only zen4 need and may someone could test on AMD laptop ;)
 

fabiosun

Guru
Guru
AMD OS X Member
Joined
Oct 9, 2022
Messages
470
Clovers AMD source is basically from the old XNU kernels from Bronya :D
In those time..opencore was not either a project or an idea I think :)
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
I changed the motherboard for a Hero to run UNRAID, because the previous motherboard the second PCIe was only x4, in the Hero it has two X16 that when used both work at x8-x8..

And if now everything works in Ventura... and that I have the bios quite modified, that I like to have control of the CPU and ram, but all the hardware works wonderfully

If you want to look at anything (ioreg, logs...) tell me I'll give it to you (y)
Could you save your settings and try with the vanilla BIOS? Do new ASUS official BIOSes allow disabling iGPU?
check cpp file posted by Shanneee
Only zen4 need and may someone could test on AMD laptop ;)
I'll test the final version on my AMD laptop with a Ryzen 3 5300U CPU.
 

PoMpIs

Well-known member
AMD OS X Member
Joined
Jul 8, 2021
Messages
292
Could you save your settings and try with the vanilla BIOS? Do new ASUS official BIOSes allow disabling iGPU?

I'll test the final version on my AMD laptop with a Ryzen 3 5300U CPU.

Yes, I have already tested, it works fine in all ways, no matter what I do in the bios, overclock, undervolt, I even have different frequencies per chiplet, it works perfectly.

And yes, the hero with the latest official bios has the option to disable the iGPU, really this board has many more options in bios than the previous asus x670e-f and it is also much better for overclocking, and the audio chip is the ALC4082
 

fabiosun

Guru
Guru
AMD OS X Member
Joined
Oct 9, 2022
Messages
470
@ExtremeXT
about MMIO
I think everything that could be said has been said.
Over time it has been shown (and now zen 4 confirms it) that depending on the "chipset" and bios we have certain MMIO areas in identical numbers per chipset

I am talking about numerical value and number of pages within the area.
Example:
TRX40 has 19 MMIOs visible with debugging
all manufacturers have the same areas numerically, may' differ the Hexadecimal value of some , but , Asus, gigabyte or others have 19 MMIO area or group
Zen 4 has 5 MMIO areas or group

Important to specify for the inexperienced user is that these areas should be taken from their debug log and not missed by other users

Another fact that is clear is that the skip 1 scheme to have the pc start is the same for every manufacturer
for example on TRX40 it is possible to reassign 16 areas to the firmware (BIOS) and only the last three actually remain devirtualized....

the real challenge is this in my opinion

Those areas with skip 0, in what situations could they be useful to OSX and create problems by having them devirtualized?

Those who understand ACPI, can find within the various SysReports the zones of influence of each area
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269
If anyone would like to test the RELEASE-Mode (i.e. not debug mode) version of OpenCore.efi with the conditional statement for separating AMD Family F / ExtFamily A from other CPU families, please try the attached file. Just need to backup your existing OpenCore.efi and replace it with attached version, then reboot and check for any issues, particularly garbled audio.
 

Attachments

  • OpenCore.efi.zip
    267.4 KB · Views: 78
Last edited:

fabiosun

Guru
Guru
AMD OS X Member
Joined
Oct 9, 2022
Messages
470
@CaseySJ 086 release or 087 release?
Opencore devs call release also "Nor released ones"
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269

PoMpIs

Well-known member
AMD OS X Member
Joined
Jul 8, 2021
Messages
292
If anyone would like to test the RELEASE-Mode (i.e. not debug mode) version of OpenCore.efi with the conditional statement for separating AMD Family F / ExtFamily A from other CPU families, please try the attached file. Just need to backup your existing OpenCore.efi and replace it with attached version, then reboot and check for any issues, particularly garbled audio.

It is working perfectly on the Hero (y)
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269
It is working perfectly on the Hero (y)
After adding debug statements, I see that the behavior is correct:

On Intel i5-12600K: (Family = 6)

24:832 00:020 OCAK: Setting FSB and TSC for processors other than Family F and ExtFamily A, Brand = 0
24:842 00:010 OCAK: BusFreq = 99632432Hz, BusFCvtt2n = 43108124631, BusFCvtn2t = 427918037
24:852 00:009 OCAK: TscFreq = 3686400000Hz, TscFCvtt2n = 1165084444, TscFCvtn2t = 15832967446


On AMD AM5: (Family = F)

26:181 00:018 OCAK: Setting FSB and TSC for Family F and ExtFamily A, Brand = 0
26:190 00:009 OCAK: BusFreq = 102272563Hz, BusFCvtt2n = 41995303236, BusFCvtn2t = 102272563
26:199 00:009 OCAK: TscFreq = 4499992814Hz, TscFCvtt2n = 954438701, TscFCvtn2t = 4499992814
 
Last edited:

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
After adding debug statements, I see that the behavior is correct:

On Intel i5-12600K:

24:832 00:020 OCAK: Setting FSB and TSC for processors other than Family F and ExtFamily A, Brand = 0
24:842 00:010 OCAK: BusFreq = 99632432Hz, BusFCvtt2n = 43108124631, BusFCvtn2t = 427918037
24:852 00:009 OCAK: TscFreq = 3686400000Hz, TscFCvtt2n = 1165084444, TscFCvtn2t = 15832967446


On AMD AM5:

26:181 00:018 OCAK: Setting FSB and TSC for Family F and ExtFamily A, Brand = 0
26:190 00:009 OCAK: BusFreq = 102272563Hz, BusFCvtt2n = 41995303236, BusFCvtn2t = 102272563
26:199 00:009 OCAK: TscFreq = 4499992814Hz, TscFCvtt2n = 954438701, TscFCvtn2t = 4499992814
Is it using the new code only for AM5 or all AMD CPUs?
 

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269
** BETA TESTERS WANTED **


  • Please try the debug version attached of OpenCore.efi along with Debug Target = 0x67
  • WARNING: Time from startup to display of OpenCore boot picker will be considerably longer, but the boot picker will appear
  • This build of OpenCore is based on latest unreleased 0.8.7 code
  • Post the OpenCore log file from EFI partition
  • We would like to see what values of Family and ExtFamily we find
  • This code applies @Shaneee's changes only to Family=F and ExtFamily=A
Screen Shot 2022-11-19 at 4.14.35 AM.png
Here's the modified code:
C:
  //
  // Perform TSC and FSB calculations. This is traditionally done in tsc.c in XNU.
  //
  // For AMD Family F and ExtFamily A
  if (CpuInfo->Family == 0xF && CpuInfo->ExtFamily == 0xA) {
        DEBUG ((DEBUG_INFO, "OCAK: Setting FSB and TSC for Family F and ExtFamily A\n"));

        busFreqValue    = CpuInfo->FSBFrequency;
        busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
        busFCvtn2tValue = DivU64x64Remainder(((1000000000ULL) << 32), busFCvtt2nValue, NULL);

        tscFreqValue    = CpuInfo->CPUFrequency;
        tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
        tscFCvtn2tValue = DivU64x64Remainder(((1000000000ULL)  << 32), tscFCvtt2nValue, NULL);
  }
  // For all other processors
  else {
        DEBUG ((DEBUG_INFO, "OCAK: Setting FSB and TSC for processors other than Family F and ExtFamily A\n"));

        busFreqValue    = CpuInfo->FSBFrequency;
        busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
        busFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, busFCvtt2nValue, NULL);

        tscFreqValue    = CpuInfo->CPUFrequency;
        tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
        tscFCvtn2tValue = DivU64x64Remainder (0xFFFFFFFFFFFFFFFFULL, tscFCvtt2nValue, NULL);
    }
 

Attachments

  • OpenCore.efi.zip
    416.5 KB · Views: 7
Last edited:

PoMpIs

Well-known member
AMD OS X Member
Joined
Jul 8, 2021
Messages
292
@CaseySJ

It does not generate the sysreport.. 😅

I don't know if I have the EFI right, I've taken the one I used at the beginning with the x670e-f and I've modified and updated it... and it works fine, but it doesn't generate the SysReport

I attach the EFI and an IOREG
 

Attachments

  • OC.zip
    5.8 MB · Views: 18
  • Mac Pro de PoMpIs.zip
    1 MB · Views: 7

CaseySJ

Guru
Guru
Donator
Joined
May 10, 2020
Messages
1,269
@CaseySJ

It does not generate the sysreport.. 😅

I don't know if I have the EFI right, I've taken the one I used at the beginning with the x670e-f and I've modified and updated it... and it works fine, but it doesn't generate the SysReport

I attach the EFI and an IOREG
Hi @PoMpIs,

The OpenCore log file will be in root folder of EFI partition (not SysReport).

Screenshot 2022-11-19 at 4.55.00 AM.png
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
@CaseySJ

It does not generate the sysreport.. 😅

I don't know if I have the EFI right, I've taken the one I used at the beginning with the x670e-f and I've modified and updated it... and it works fine, but it doesn't generate the SysReport

I attach the EFI and an IOREG
If you can disable the iGPU in the BIOS, why do you have SSDT-IGPU-DISABLE? Also, you can probably remove HPET and XOSI. For kexts, remove CpuTscSync.
In your plist, you shouldn't need anything under ACPI > Patch. For MmioWhitelist try everything set to True instead of the last entry. In DeviceProperties, remove the AAPL,slot-name, device_type and model values unless you have a specific reason to use them. For the GPU, you only need @0,name, not the other as well. Disable DisableIoMapper and update your kernel patches. If you want to, I can send you a revised EFI with all of these tweaks.
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
@CaseySJ The patch is not applied on my AM4 system. Here is the snippet.
09:957 00:024 OCAK: Setting FSB and TSC for processors other than Family F and ExtFamily A
09:965 00:008 OCAK: BusFreq = 99812584Hz, BusFCvtt2n = 43030318662, BusFCvtn2t = 428691784
09:973 00:008 OCAK: TscFreq = 3593253025Hz, TscFCvtt2n = 1195286629, TscFCvtn2t = 15432904230
Looks like my ExtFamily is 8 instead of A.
00:057 00:007 OCCPU: Signature 870F10 Stepping 0 Model 71 Family F Type 0 ExtModel 7 ExtFamily 8 uCode 0 CPUID MAX (10/80000020)
Waiting for someone to test it on an APU.
 

PoMpIs

Well-known member
AMD OS X Member
Joined
Jul 8, 2021
Messages
292
If you can disable the iGPU in the BIOS, why do you have SSDT-IGPU-DISABLE? Also, you can probably remove HPET and XOSI. For kexts, remove CpuTscSync.
In your plist, you shouldn't need anything under ACPI > Patch. For MmioWhitelist try everything set to True instead of the last entry. In DeviceProperties, remove the AAPL,slot-name, device_type and model values unless you have a specific reason to use them. For the GPU, you only need @0,name, not the other as well. Disable DisableIoMapper and update your kernel patches. If you want to, I can send you a revised EFI with all of these tweaks.

The SSDTs are in the EFI, but they are not active...

I use the properties of devices in the GPU because with Belknap the fans are not turned off, it disables the Zero-RPM, but the GPU is always at 60 degrees, even in windows if I do not remove the Zero-RPM it is always at almost 60 degrees ... and so without Zero-RPM it is at 35 degrees

In ACPI, if until now I have been testing it without any patch, it works fine anyway 😄 .....but "Replace DP68 with DP60 in AMDTable" is yours, you put it in one of the EFIs from the beginning..

CpuTscSync no longer use it

But I would be very grateful if you modify the EFI to your liking and as you see it will work 👌
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
AMD Ryzen 5 3400G APU also has ExtFamily 8.
00:164 00:022 OCCPU: Signature 810F81 Stepping 1 Model 18 Family F Type 0 ExtModel 1 ExtFamily 8 uCode 0 CPUID MAX (D/8000001F)
Their audio is the same as the patch isn't being applied. Can you only add an AMD check? I'll check if it breaks anything on my AM4 non-APU system.
 
Back
Top Bottom
  AdBlock Detected
Sure, ad-blocking software does a great job at blocking ads, but it also blocks some useful and important features of our website. For the best possible site experience please take a moment to disable your AdBlocker.