36
36
#include "navi10_ppt.h"
37
37
#include "smu_v11_0_pptable.h"
38
38
#include "smu_v11_0_ppsmc.h"
39
+ #include "nbio/nbio_7_4_sh_mask.h"
39
40
40
41
#include "asic_reg/mp/mp_11_0_sh_mask.h"
41
42
@@ -599,6 +600,7 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)
599
600
struct smu_table_context * table_context = & smu -> smu_table ;
600
601
struct smu_11_0_dpm_context * dpm_context = smu_dpm -> dpm_context ;
601
602
PPTable_t * driver_ppt = NULL ;
603
+ int i ;
602
604
603
605
driver_ppt = table_context -> driver_pptable ;
604
606
@@ -629,6 +631,11 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)
629
631
dpm_context -> dpm_tables .phy_table .min = driver_ppt -> FreqTablePhyclk [0 ];
630
632
dpm_context -> dpm_tables .phy_table .max = driver_ppt -> FreqTablePhyclk [NUM_PHYCLK_DPM_LEVELS - 1 ];
631
633
634
+ for (i = 0 ; i < MAX_PCIE_CONF ; i ++ ) {
635
+ dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] = driver_ppt -> PcieGenSpeed [i ];
636
+ dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] = driver_ppt -> PcieLaneCount [i ];
637
+ }
638
+
632
639
return 0 ;
633
640
}
634
641
@@ -700,16 +707,20 @@ static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_tabl
700
707
static int navi10_print_clk_levels (struct smu_context * smu ,
701
708
enum smu_clk_type clk_type , char * buf )
702
709
{
703
- OverDriveTable_t * od_table ;
704
- struct smu_11_0_overdrive_table * od_settings ;
705
710
uint16_t * curve_settings ;
706
711
int i , size = 0 , ret = 0 ;
707
712
uint32_t cur_value = 0 , value = 0 , count = 0 ;
708
713
uint32_t freq_values [3 ] = {0 };
709
714
uint32_t mark_index = 0 ;
710
715
struct smu_table_context * table_context = & smu -> smu_table ;
711
- od_table = (OverDriveTable_t * )table_context -> overdrive_table ;
712
- od_settings = smu -> od_settings ;
716
+ uint32_t gen_speed , lane_width ;
717
+ struct smu_dpm_context * smu_dpm = & smu -> smu_dpm ;
718
+ struct smu_11_0_dpm_context * dpm_context = smu_dpm -> dpm_context ;
719
+ struct amdgpu_device * adev = smu -> adev ;
720
+ PPTable_t * pptable = (PPTable_t * )table_context -> driver_pptable ;
721
+ OverDriveTable_t * od_table =
722
+ (OverDriveTable_t * )table_context -> overdrive_table ;
723
+ struct smu_11_0_overdrive_table * od_settings = smu -> od_settings ;
713
724
714
725
switch (clk_type ) {
715
726
case SMU_GFXCLK :
@@ -760,6 +771,30 @@ static int navi10_print_clk_levels(struct smu_context *smu,
760
771
761
772
}
762
773
break ;
774
+ case SMU_PCIE :
775
+ gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL ) &
776
+ PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK )
777
+ >> PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT ;
778
+ lane_width = (RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL ) &
779
+ PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK )
780
+ >> PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT ;
781
+ for (i = 0 ; i < NUM_LINK_LEVELS ; i ++ )
782
+ size += sprintf (buf + size , "%d: %s %s %dMhz %s\n" , i ,
783
+ (dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] == 0 ) ? "2.5GT/s," :
784
+ (dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] == 1 ) ? "5.0GT/s," :
785
+ (dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] == 2 ) ? "8.0GT/s," :
786
+ (dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] == 3 ) ? "16.0GT/s," : "" ,
787
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 1 ) ? "x1" :
788
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 2 ) ? "x2" :
789
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 3 ) ? "x4" :
790
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 4 ) ? "x8" :
791
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 5 ) ? "x12" :
792
+ (dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] == 6 ) ? "x16" : "" ,
793
+ pptable -> LclkFreq [i ],
794
+ (gen_speed == dpm_context -> dpm_tables .pcie_table .pcie_gen [i ]) &&
795
+ (lane_width == dpm_context -> dpm_tables .pcie_table .pcie_lane [i ]) ?
796
+ "*" : "" );
797
+ break ;
763
798
case SMU_OD_SCLK :
764
799
if (!smu -> od_enabled || !od_table || !od_settings )
765
800
break ;
@@ -1690,6 +1725,9 @@ static int navi10_update_pcie_parameters(struct smu_context *smu,
1690
1725
int ret , i ;
1691
1726
uint32_t smu_pcie_arg ;
1692
1727
1728
+ struct smu_dpm_context * smu_dpm = & smu -> smu_dpm ;
1729
+ struct smu_11_0_dpm_context * dpm_context = smu_dpm -> dpm_context ;
1730
+
1693
1731
for (i = 0 ; i < NUM_LINK_LEVELS ; i ++ ) {
1694
1732
smu_pcie_arg = (i << 16 ) |
1695
1733
((pptable -> PcieGenSpeed [i ] <= pcie_gen_cap ) ? (pptable -> PcieGenSpeed [i ] << 8 ) :
@@ -1698,8 +1736,17 @@ static int navi10_update_pcie_parameters(struct smu_context *smu,
1698
1736
ret = smu_send_smc_msg_with_param (smu ,
1699
1737
SMU_MSG_OverridePcieParameters ,
1700
1738
smu_pcie_arg );
1739
+
1740
+ if (ret )
1741
+ return ret ;
1742
+
1743
+ if (pptable -> PcieGenSpeed [i ] > pcie_gen_cap )
1744
+ dpm_context -> dpm_tables .pcie_table .pcie_gen [i ] = pcie_gen_cap ;
1745
+ if (pptable -> PcieLaneCount [i ] > pcie_width_cap )
1746
+ dpm_context -> dpm_tables .pcie_table .pcie_lane [i ] = pcie_width_cap ;
1701
1747
}
1702
- return ret ;
1748
+
1749
+ return 0 ;
1703
1750
}
1704
1751
1705
1752
static inline void navi10_dump_od_table (OverDriveTable_t * od_table ) {
0 commit comments