Skip to content

Commit

Permalink
Allow 2nd and 3rd table refresh for Zen 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Falcosc authored and FlyGoat committed Apr 1, 2021
1 parent cb52770 commit 36fa8f0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/api.c
Expand Up @@ -5,6 +5,14 @@
#include "ryzenadj.h"
#include "math.h"

#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(x) usleep((x)*1000)
#endif


EXP ryzen_access CALL init_ryzenadj()
{
ryzen_access ry;
Expand Down Expand Up @@ -199,7 +207,7 @@ int request_table_addr(ryzen_access ry)
//transfer, transfer, wait, wait longer; don't work
//transfer, wait, wait longer; don't work
//transfer, wait, transfer; does work
refresh_pm_table(ry);
refresh_table(ry);
}

return 0;
Expand Down Expand Up @@ -227,6 +235,18 @@ int request_transfer_table(ryzen_access ry)
}

resp = smu_service_req(ry->psmu, transfer_table_msg, &args);
if (resp == REP_MSG_CmdRejectedPrereq) {
//2nd try is needed for 2 usecase: if SMU got interrupted or first call after boot on Zen2
//we need to wait because if we don't wait 2nd call will fail, too: similar to Raven and Picasso issue but with real reject instead of 0 data response
//but because we don't have to check any physical memory values, don't waste CPU cycles and use sleep instead
Sleep(10);
resp = smu_service_req(ry->psmu, transfer_table_msg, &args);
if(resp == REP_MSG_CmdRejectedPrereq){
printf("request_transfer_table was rejected twice\n");
Sleep(100);
resp = smu_service_req(ry->psmu, transfer_table_msg, &args);
}
}
if(resp != REP_MSG_OK){
_return_translated_smu_error(resp);
}
Expand Down

0 comments on commit 36fa8f0

Please sign in to comment.