Skip to content

Commit

Permalink
Merge branch 'FlyGoat:master' into cmakeup
Browse files Browse the repository at this point in the history
  • Loading branch information
kylon authored Sep 7, 2024
2 parents b61fe26 + ffc0bcc commit 0d1f0af
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
53 changes: 53 additions & 0 deletions lib/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ static int request_table_ver_and_size(ryzen_access ry)
case FAM_REMBRANDT:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
get_table_ver_msg = 0x6;
break;
default:
Expand Down Expand Up @@ -208,6 +209,7 @@ static int request_table_addr(ryzen_access ry)
case FAM_REMBRANDT:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
get_table_addr_msg = 0x66;
break;
default:
Expand All @@ -222,6 +224,7 @@ static int request_table_addr(ryzen_access ry)
case FAM_REMBRANDT:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
ry->table_addr = (uint64_t) args.arg1 << 32 | args.arg0;
break;
default:
Expand Down Expand Up @@ -257,6 +260,7 @@ static int request_transfer_table(ryzen_access ry)
case FAM_REMBRANDT:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
transfer_table_msg = 0x65;
break;
default:
Expand Down Expand Up @@ -430,6 +434,8 @@ do { \
EXP int CALL set_stapm_limit(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x05, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -445,6 +451,7 @@ EXP int CALL set_stapm_limit(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x14);
if (err) {
printf("%s: Retry with PSMU\n", __func__);
Expand All @@ -459,6 +466,7 @@ EXP int CALL set_stapm_limit(ryzen_access ry, uint32_t value){
EXP int CALL set_fast_limit(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x06, val]) */
switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -474,6 +482,7 @@ EXP int CALL set_fast_limit(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x15);
default:
break;
Expand All @@ -484,6 +493,8 @@ EXP int CALL set_fast_limit(ryzen_access ry, uint32_t value){
EXP int CALL set_slow_limit(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x07, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -499,6 +510,7 @@ EXP int CALL set_slow_limit(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x16);
default:
break;
Expand All @@ -509,6 +521,8 @@ EXP int CALL set_slow_limit(ryzen_access ry, uint32_t value){
EXP int CALL set_slow_time(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x08, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -524,6 +538,7 @@ EXP int CALL set_slow_time(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x17);
default:
break;
Expand All @@ -534,6 +549,8 @@ EXP int CALL set_slow_time(ryzen_access ry, uint32_t value){
EXP int CALL set_stapm_time(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x01, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -549,6 +566,7 @@ EXP int CALL set_stapm_time(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x18);
default:
break;
Expand All @@ -559,6 +577,8 @@ EXP int CALL set_stapm_time(ryzen_access ry, uint32_t value){
EXP int CALL set_tctl_temp(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x03, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -574,6 +594,7 @@ EXP int CALL set_tctl_temp(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x19);
default:
break;
Expand All @@ -584,6 +605,8 @@ EXP int CALL set_tctl_temp(ryzen_access ry, uint32_t value){
EXP int CALL set_vrm_current(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x0b, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -599,6 +622,7 @@ EXP int CALL set_vrm_current(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x1a);
default:
break;
Expand All @@ -609,6 +633,8 @@ EXP int CALL set_vrm_current(ryzen_access ry, uint32_t value){
EXP int CALL set_vrmsoc_current(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x0e, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -624,6 +650,7 @@ EXP int CALL set_vrmsoc_current(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x1b);
default:
break;
Expand Down Expand Up @@ -660,6 +687,8 @@ EXP int CALL set_vrmcvip_current(ryzen_access ry, uint32_t value){
EXP int CALL set_vrmmax_current(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x0c, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -674,6 +703,7 @@ EXP int CALL set_vrmmax_current(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x1c);
break;
case FAM_VANGOGH:
Expand All @@ -700,6 +730,8 @@ EXP int CALL set_vrmgfxmax_current(ryzen_access ry, uint32_t value){
EXP int CALL set_vrmsocmax_current(ryzen_access ry, uint32_t value){
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x11, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -714,6 +746,7 @@ EXP int CALL set_vrmsocmax_current(ryzen_access ry, uint32_t value){
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x1d);
default:
break;
Expand Down Expand Up @@ -950,6 +983,8 @@ EXP int CALL set_min_lclk(ryzen_access ry, uint32_t value){
EXP int CALL set_prochot_deassertion_ramp(ryzen_access ry, uint32_t value) {
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x09, val]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -969,6 +1004,7 @@ EXP int CALL set_prochot_deassertion_ramp(ryzen_access ry, uint32_t value) {
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x1f);
default:
break;
Expand All @@ -979,6 +1015,8 @@ EXP int CALL set_prochot_deassertion_ramp(ryzen_access ry, uint32_t value) {
EXP int CALL set_apu_skin_temp_limit(ryzen_access ry, uint32_t value) {
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x22, val]) */

value *= 256;
switch (ry->family)
{
Expand All @@ -1003,6 +1041,8 @@ EXP int CALL set_apu_skin_temp_limit(ryzen_access ry, uint32_t value) {
EXP int CALL set_dgpu_skin_temp_limit(ryzen_access ry, uint32_t value) {
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x23, val]) */

value *= 256;
switch (ry->family)
{
Expand All @@ -1016,6 +1056,7 @@ EXP int CALL set_dgpu_skin_temp_limit(ryzen_access ry, uint32_t value) {
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x34);
break;
default:
Expand All @@ -1027,6 +1068,8 @@ EXP int CALL set_dgpu_skin_temp_limit(ryzen_access ry, uint32_t value) {
EXP int CALL set_apu_slow_limit(ryzen_access ry, uint32_t value) {
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x13, val]) */

switch (ry->family)
{
case FAM_RENOIR:
Expand All @@ -1037,6 +1080,7 @@ EXP int CALL set_apu_slow_limit(ryzen_access ry, uint32_t value) {
case FAM_REMBRANDT:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x23);
break;
default:
Expand All @@ -1048,6 +1092,8 @@ EXP int CALL set_apu_slow_limit(ryzen_access ry, uint32_t value) {
EXP int CALL set_skin_temp_power_limit(ryzen_access ry, uint32_t value) {
int err = ADJ_ERR_FAM_UNSUPPORTED;

/* \_SB.ALIB (0x0c, [size, 0x2e, val]) */

switch (ry->family)
{
case FAM_RENOIR:
Expand All @@ -1060,6 +1106,7 @@ EXP int CALL set_skin_temp_power_limit(ryzen_access ry, uint32_t value) {
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x4a);
break;
default:
Expand Down Expand Up @@ -1093,6 +1140,8 @@ EXP int CALL set_power_saving(ryzen_access ry) {
int err = ADJ_ERR_FAM_UNSUPPORTED;
uint32_t value = 0;

/* \_SB.ALIB (0x01, [size, 0x1]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -1108,6 +1157,7 @@ EXP int CALL set_power_saving(ryzen_access ry) {
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x12);
break;
default:
Expand All @@ -1120,6 +1170,8 @@ EXP int CALL set_max_performance(ryzen_access ry) {
int err = ADJ_ERR_FAM_UNSUPPORTED;
uint32_t value = 0;

/* \_SB.ALIB (0x01, [size, 0x0]) */

switch (ry->family)
{
case FAM_RAVEN:
Expand All @@ -1135,6 +1187,7 @@ EXP int CALL set_max_performance(ryzen_access ry) {
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
case FAM_STRIXPOINT:
_do_adjust(0x11);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions lib/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static enum ryzen_family cpuid_load_family()
case 0x1A: /* Zen5, Zen6 */
switch (model) {
case 32:
case 36:
return FAM_STRIXPOINT;
default:
printf("Fam%xh: unsupported model %d\n", family, model);
Expand Down
18 changes: 15 additions & 3 deletions lib/nb_smu_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,26 @@ smu_t get_smu(nb_t nb, int smu_type) {
/* Fill SMU information */
switch(smu_type){
case TYPE_MP1:
if (family == FAM_REMBRANDT || family == FAM_VANGOGH || family == FAM_MENDOCINO || family == FAM_PHOENIX || family == FAM_HAWKPOINT) {
switch (family) {
case FAM_REMBRANDT:
case FAM_VANGOGH:
case FAM_MENDOCINO:
case FAM_PHOENIX:
case FAM_HAWKPOINT:
smu->msg = MP1_C2PMSG_MESSAGE_ADDR_2;
smu->rep = MP1_C2PMSG_RESPONSE_ADDR_2;
smu->arg_base = MP1_C2PMSG_ARG_BASE_2;
} else {
break;
case FAM_STRIXPOINT:
smu->msg = MP1_C2PMSG_MESSAGE_ADDR_3;
smu->rep = MP1_C2PMSG_RESPONSE_ADDR_3;
smu->arg_base = MP1_C2PMSG_ARG_BASE_3;
break;
default:
smu->msg = MP1_C2PMSG_MESSAGE_ADDR_1;
smu->rep = MP1_C2PMSG_RESPONSE_ADDR_1;
smu->arg_base = MP1_C2PMSG_ARG_BASE_1;
break;
}
break;
case TYPE_PSMU:
Expand All @@ -108,4 +120,4 @@ smu_t get_smu(nb_t nb, int smu_type) {

void free_smu(smu_t smu) {
free((void *)smu);
}
}
5 changes: 5 additions & 0 deletions lib/nb_smu_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ enum SMU_TYPE{
#define MP1_C2PMSG_RESPONSE_ADDR_2 0x3B10578
#define MP1_C2PMSG_ARG_BASE_2 0x3B10998

/* For Strix Point */
#define MP1_C2PMSG_MESSAGE_ADDR_3 0x3b10928
#define MP1_C2PMSG_RESPONSE_ADDR_3 0x3b10978
#define MP1_C2PMSG_ARG_BASE_3 0x3b10998

#define PSMU_C2PMSG_MESSAGE_ADDR 0x3B10a20
#define PSMU_C2PMSG_RESPONSE_ADDR 0x3B10a80
#define PSMU_C2PMSG_ARG_BASE 0x3B10a88
Expand Down

0 comments on commit 0d1f0af

Please sign in to comment.