Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: change ELM/BAF to Polaris10/Polaris11

Adjust to preferred code names.

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Flora Cui and committed by
Alex Deucher
2cc0c0b5 a3ad7a9a

+1485 -1300
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
··· 681 681 result = AMDGPU_UCODE_ID_CP_MEC1; 682 682 break; 683 683 case CGS_UCODE_ID_CP_MEC_JT2: 684 - if (adev->asic_type == CHIP_TONGA || adev->asic_type == CHIP_BAFFIN 685 - || adev->asic_type == CHIP_ELLESMERE) 684 + if (adev->asic_type == CHIP_TONGA || adev->asic_type == CHIP_POLARIS11 685 + || adev->asic_type == CHIP_POLARIS10) 686 686 result = AMDGPU_UCODE_ID_CP_MEC2; 687 687 else 688 688 result = AMDGPU_UCODE_ID_CP_MEC1; ··· 742 742 case CHIP_FIJI: 743 743 strcpy(fw_name, "amdgpu/fiji_smc.bin"); 744 744 break; 745 - case CHIP_BAFFIN: 745 + case CHIP_POLARIS11: 746 746 if (type == CGS_UCODE_ID_SMU) 747 - strcpy(fw_name, "amdgpu/baffin_smc.bin"); 747 + strcpy(fw_name, "amdgpu/polaris11_smc.bin"); 748 748 else if (type == CGS_UCODE_ID_SMU_SK) 749 - strcpy(fw_name, "amdgpu/baffin_smc_sk.bin"); 749 + strcpy(fw_name, "amdgpu/polaris11_smc_sk.bin"); 750 750 break; 751 - case CHIP_ELLESMERE: 751 + case CHIP_POLARIS10: 752 752 if (type == CGS_UCODE_ID_SMU) 753 - strcpy(fw_name, "amdgpu/ellesmere_smc.bin"); 753 + strcpy(fw_name, "amdgpu/polaris10_smc.bin"); 754 754 else if (type == CGS_UCODE_ID_SMU_SK) 755 - strcpy(fw_name, "amdgpu/ellesmere_smc_sk.bin"); 755 + strcpy(fw_name, "amdgpu/polaris10_smc_sk.bin"); 756 756 break; 757 757 default: 758 758 DRM_ERROR("SMC firmware not supported\n");
+4 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 59 59 "FIJI", 60 60 "CARRIZO", 61 61 "STONEY", 62 - "ELLESMERE", 63 - "BAFFIN", 62 + "POLARIS10", 63 + "POLARIS11", 64 64 "LAST", 65 65 }; 66 66 ··· 1148 1148 case CHIP_TOPAZ: 1149 1149 case CHIP_TONGA: 1150 1150 case CHIP_FIJI: 1151 - case CHIP_BAFFIN: 1152 - case CHIP_ELLESMERE: 1151 + case CHIP_POLARIS11: 1152 + case CHIP_POLARIS10: 1153 1153 case CHIP_CARRIZO: 1154 1154 case CHIP_STONEY: 1155 1155 if (adev->asic_type == CHIP_CARRIZO || adev->asic_type == CHIP_STONEY)
+10 -10
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 277 277 {0x1002, 0x9877, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CARRIZO|AMD_IS_APU}, 278 278 /* stoney */ 279 279 {0x1002, 0x98E4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_STONEY|AMD_IS_APU}, 280 - /* Baffin */ 281 - {0x1002, 0x67E0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 282 - {0x1002, 0x67E1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 283 - {0x1002, 0x67E8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 284 - {0x1002, 0x67E9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 285 - {0x1002, 0x67EB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 286 - {0x1002, 0x67FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BAFFIN}, 287 - /* Ellesmere */ 288 - {0x1002, 0x67C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ELLESMERE}, 289 - {0x1002, 0x67DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ELLESMERE}, 280 + /* Polaris11 */ 281 + {0x1002, 0x67E0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 282 + {0x1002, 0x67E1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 283 + {0x1002, 0x67E8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 284 + {0x1002, 0x67E9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 285 + {0x1002, 0x67EB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 286 + {0x1002, 0x67FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11}, 287 + /* Polaris10 */ 288 + {0x1002, 0x67C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10}, 289 + {0x1002, 0x67DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10}, 290 290 291 291 {0, 0, 0} 292 292 };
+4 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
··· 99 99 100 100 #ifdef CONFIG_DRM_AMD_POWERPLAY 101 101 switch (adev->asic_type) { 102 + case CHIP_POLARIS11: 103 + case CHIP_POLARIS10: 104 + adev->pp_enabled = true; 105 + break; 102 106 case CHIP_TONGA: 103 107 case CHIP_FIJI: 104 - case CHIP_BAFFIN: 105 - case CHIP_ELLESMERE: 106 108 adev->pp_enabled = (amdgpu_powerplay == 0) ? false : true; 107 109 break; 108 110 case CHIP_CARRIZO:
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 54 54 #define FIRMWARE_CARRIZO "amdgpu/carrizo_uvd.bin" 55 55 #define FIRMWARE_FIJI "amdgpu/fiji_uvd.bin" 56 56 #define FIRMWARE_STONEY "amdgpu/stoney_uvd.bin" 57 - #define FIRMWARE_ELLESMERE "amdgpu/ellesmere_uvd.bin" 58 - #define FIRMWARE_BAFFIN "amdgpu/baffin_uvd.bin" 57 + #define FIRMWARE_POLARIS10 "amdgpu/polaris10_uvd.bin" 58 + #define FIRMWARE_POLARIS11 "amdgpu/polaris11_uvd.bin" 59 59 60 60 /** 61 61 * amdgpu_uvd_cs_ctx - Command submission parser context ··· 87 87 MODULE_FIRMWARE(FIRMWARE_CARRIZO); 88 88 MODULE_FIRMWARE(FIRMWARE_FIJI); 89 89 MODULE_FIRMWARE(FIRMWARE_STONEY); 90 - MODULE_FIRMWARE(FIRMWARE_ELLESMERE); 91 - MODULE_FIRMWARE(FIRMWARE_BAFFIN); 90 + MODULE_FIRMWARE(FIRMWARE_POLARIS10); 91 + MODULE_FIRMWARE(FIRMWARE_POLARIS11); 92 92 93 93 static void amdgpu_uvd_note_usage(struct amdgpu_device *adev); 94 94 static void amdgpu_uvd_idle_work_handler(struct work_struct *work); ··· 135 135 case CHIP_STONEY: 136 136 fw_name = FIRMWARE_STONEY; 137 137 break; 138 - case CHIP_ELLESMERE: 139 - fw_name = FIRMWARE_ELLESMERE; 138 + case CHIP_POLARIS10: 139 + fw_name = FIRMWARE_POLARIS10; 140 140 break; 141 - case CHIP_BAFFIN: 142 - fw_name = FIRMWARE_BAFFIN; 141 + case CHIP_POLARIS11: 142 + fw_name = FIRMWARE_POLARIS11; 143 143 break; 144 144 default: 145 145 return -EINVAL;
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
··· 50 50 #define FIRMWARE_CARRIZO "amdgpu/carrizo_vce.bin" 51 51 #define FIRMWARE_FIJI "amdgpu/fiji_vce.bin" 52 52 #define FIRMWARE_STONEY "amdgpu/stoney_vce.bin" 53 - #define FIRMWARE_ELLESMERE "amdgpu/ellesmere_vce.bin" 54 - #define FIRMWARE_BAFFIN "amdgpu/baffin_vce.bin" 53 + #define FIRMWARE_POLARIS10 "amdgpu/polaris10_vce.bin" 54 + #define FIRMWARE_POLARIS11 "amdgpu/polaris11_vce.bin" 55 55 56 56 #ifdef CONFIG_DRM_AMDGPU_CIK 57 57 MODULE_FIRMWARE(FIRMWARE_BONAIRE); ··· 64 64 MODULE_FIRMWARE(FIRMWARE_CARRIZO); 65 65 MODULE_FIRMWARE(FIRMWARE_FIJI); 66 66 MODULE_FIRMWARE(FIRMWARE_STONEY); 67 - MODULE_FIRMWARE(FIRMWARE_ELLESMERE); 68 - MODULE_FIRMWARE(FIRMWARE_BAFFIN); 67 + MODULE_FIRMWARE(FIRMWARE_POLARIS10); 68 + MODULE_FIRMWARE(FIRMWARE_POLARIS11); 69 69 70 70 static void amdgpu_vce_idle_work_handler(struct work_struct *work); 71 71 ··· 117 117 case CHIP_STONEY: 118 118 fw_name = FIRMWARE_STONEY; 119 119 break; 120 - case CHIP_ELLESMERE: 121 - fw_name = FIRMWARE_ELLESMERE; 120 + case CHIP_POLARIS10: 121 + fw_name = FIRMWARE_POLARIS10; 122 122 break; 123 - case CHIP_BAFFIN: 124 - fw_name = FIRMWARE_BAFFIN; 123 + case CHIP_POLARIS11: 124 + fw_name = FIRMWARE_POLARIS11; 125 125 break; 126 126 127 127 default:
+18 -18
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
··· 132 132 mmFBC_MISC, 0x1f311fff, 0x14302000, 133 133 }; 134 134 135 - static const u32 baffin_golden_settings_a11[] = 135 + static const u32 polaris11_golden_settings_a11[] = 136 136 { 137 137 mmDCI_CLK_CNTL, 0x00000080, 0x00000000, 138 138 mmFBC_DEBUG_COMP, 0x000000f0, 0x00000070, ··· 141 141 mmHDMI_CONTROL, 0x313f031f, 0x00000011, 142 142 }; 143 143 144 - static const u32 ellesmere_golden_settings_a11[] = 144 + static const u32 polaris10_golden_settings_a11[] = 145 145 { 146 146 mmDCI_CLK_CNTL, 0x00000080, 0x00000000, 147 147 mmFBC_DEBUG_COMP, 0x000000f0, 0x00000070, ··· 165 165 stoney_golden_settings_a11, 166 166 (const u32)ARRAY_SIZE(stoney_golden_settings_a11)); 167 167 break; 168 - case CHIP_BAFFIN: 168 + case CHIP_POLARIS11: 169 169 amdgpu_program_register_sequence(adev, 170 - baffin_golden_settings_a11, 171 - (const u32)ARRAY_SIZE(baffin_golden_settings_a11)); 170 + polaris11_golden_settings_a11, 171 + (const u32)ARRAY_SIZE(polaris11_golden_settings_a11)); 172 172 break; 173 - case CHIP_ELLESMERE: 173 + case CHIP_POLARIS10: 174 174 amdgpu_program_register_sequence(adev, 175 - ellesmere_golden_settings_a11, 176 - (const u32)ARRAY_SIZE(ellesmere_golden_settings_a11)); 175 + polaris10_golden_settings_a11, 176 + (const u32)ARRAY_SIZE(polaris10_golden_settings_a11)); 177 177 break; 178 178 default: 179 179 break; ··· 1611 1611 case CHIP_STONEY: 1612 1612 adev->mode_info.audio.num_pins = 7; 1613 1613 break; 1614 - case CHIP_ELLESMERE: 1614 + case CHIP_POLARIS10: 1615 1615 adev->mode_info.audio.num_pins = 8; 1616 1616 break; 1617 - case CHIP_BAFFIN: 1617 + case CHIP_POLARIS11: 1618 1618 adev->mode_info.audio.num_pins = 6; 1619 1619 break; 1620 1620 default: ··· 2411 2411 u32 pll_in_use; 2412 2412 int pll; 2413 2413 2414 - if ((adev->asic_type == CHIP_ELLESMERE) || 2415 - (adev->asic_type == CHIP_BAFFIN)) { 2414 + if ((adev->asic_type == CHIP_POLARIS10) || 2415 + (adev->asic_type == CHIP_POLARIS11)) { 2416 2416 struct amdgpu_encoder *amdgpu_encoder = 2417 2417 to_amdgpu_encoder(amdgpu_crtc->encoder); 2418 2418 struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; ··· 2838 2838 if (!amdgpu_crtc->adjusted_clock) 2839 2839 return -EINVAL; 2840 2840 2841 - if ((adev->asic_type == CHIP_ELLESMERE) || 2842 - (adev->asic_type == CHIP_BAFFIN)) { 2841 + if ((adev->asic_type == CHIP_POLARIS10) || 2842 + (adev->asic_type == CHIP_POLARIS11)) { 2843 2843 struct amdgpu_encoder *amdgpu_encoder = 2844 2844 to_amdgpu_encoder(amdgpu_crtc->encoder); 2845 2845 int encoder_mode = ··· 3004 3004 adev->mode_info.num_hpd = 6; 3005 3005 adev->mode_info.num_dig = 9; 3006 3006 break; 3007 - case CHIP_ELLESMERE: 3007 + case CHIP_POLARIS10: 3008 3008 adev->mode_info.num_crtc = 6; 3009 3009 adev->mode_info.num_hpd = 6; 3010 3010 adev->mode_info.num_dig = 6; 3011 3011 break; 3012 - case CHIP_BAFFIN: 3012 + case CHIP_POLARIS11: 3013 3013 adev->mode_info.num_crtc = 5; 3014 3014 adev->mode_info.num_hpd = 5; 3015 3015 adev->mode_info.num_dig = 5; ··· 3116 3116 /* init dig PHYs, disp eng pll */ 3117 3117 amdgpu_atombios_crtc_powergate_init(adev); 3118 3118 amdgpu_atombios_encoder_init_dig(adev); 3119 - if ((adev->asic_type == CHIP_ELLESMERE) || 3120 - (adev->asic_type == CHIP_BAFFIN)) { 3119 + if ((adev->asic_type == CHIP_POLARIS10) || 3120 + (adev->asic_type == CHIP_POLARIS11)) { 3121 3121 amdgpu_atombios_crtc_set_dce_clock(adev, adev->clock.default_dispclk, 3122 3122 DCE_CLOCK_TYPE_DISPCLK, ATOM_GCK_DFS); 3123 3123 amdgpu_atombios_crtc_set_dce_clock(adev, 0,
+58 -58
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 52 52 53 53 #define TOPAZ_GB_ADDR_CONFIG_GOLDEN 0x22010001 54 54 #define CARRIZO_GB_ADDR_CONFIG_GOLDEN 0x22010001 55 - #define BAFFIN_GB_ADDR_CONFIG_GOLDEN 0x22011002 55 + #define POLARIS11_GB_ADDR_CONFIG_GOLDEN 0x22011002 56 56 #define TONGA_GB_ADDR_CONFIG_GOLDEN 0x22011003 57 57 58 58 #define ARRAY_MODE(x) ((x) << GB_TILE_MODE0__ARRAY_MODE__SHIFT) ··· 121 121 MODULE_FIRMWARE("amdgpu/fiji_mec2.bin"); 122 122 MODULE_FIRMWARE("amdgpu/fiji_rlc.bin"); 123 123 124 - MODULE_FIRMWARE("amdgpu/baffin_ce.bin"); 125 - MODULE_FIRMWARE("amdgpu/baffin_pfp.bin"); 126 - MODULE_FIRMWARE("amdgpu/baffin_me.bin"); 127 - MODULE_FIRMWARE("amdgpu/baffin_mec.bin"); 128 - MODULE_FIRMWARE("amdgpu/baffin_mec2.bin"); 129 - MODULE_FIRMWARE("amdgpu/baffin_rlc.bin"); 124 + MODULE_FIRMWARE("amdgpu/polaris11_ce.bin"); 125 + MODULE_FIRMWARE("amdgpu/polaris11_pfp.bin"); 126 + MODULE_FIRMWARE("amdgpu/polaris11_me.bin"); 127 + MODULE_FIRMWARE("amdgpu/polaris11_mec.bin"); 128 + MODULE_FIRMWARE("amdgpu/polaris11_mec2.bin"); 129 + MODULE_FIRMWARE("amdgpu/polaris11_rlc.bin"); 130 130 131 - MODULE_FIRMWARE("amdgpu/ellesmere_ce.bin"); 132 - MODULE_FIRMWARE("amdgpu/ellesmere_pfp.bin"); 133 - MODULE_FIRMWARE("amdgpu/ellesmere_me.bin"); 134 - MODULE_FIRMWARE("amdgpu/ellesmere_mec.bin"); 135 - MODULE_FIRMWARE("amdgpu/ellesmere_mec2.bin"); 136 - MODULE_FIRMWARE("amdgpu/ellesmere_rlc.bin"); 131 + MODULE_FIRMWARE("amdgpu/polaris10_ce.bin"); 132 + MODULE_FIRMWARE("amdgpu/polaris10_pfp.bin"); 133 + MODULE_FIRMWARE("amdgpu/polaris10_me.bin"); 134 + MODULE_FIRMWARE("amdgpu/polaris10_mec.bin"); 135 + MODULE_FIRMWARE("amdgpu/polaris10_mec2.bin"); 136 + MODULE_FIRMWARE("amdgpu/polaris10_rlc.bin"); 137 137 138 138 static const struct amdgpu_gds_reg_offset amdgpu_gds_reg_offset[] = 139 139 { ··· 265 265 mmCP_MEM_SLP_CNTL, 0x00000001, 0x00000001, 266 266 }; 267 267 268 - static const u32 golden_settings_baffin_a11[] = 268 + static const u32 golden_settings_polaris11_a11[] = 269 269 { 270 270 mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040, 271 271 mmDB_DEBUG2, 0xf00fffff, 0x00000400, ··· 281 281 mmTCP_CHAN_STEER_LO, 0xffffffff, 0x00003210, 282 282 }; 283 283 284 - static const u32 baffin_golden_common_all[] = 284 + static const u32 polaris11_golden_common_all[] = 285 285 { 286 286 mmGRBM_GFX_INDEX, 0xffffffff, 0xe0000000, 287 287 mmPA_SC_RASTER_CONFIG, 0xffffffff, 0x16000012, ··· 293 293 mmSPI_RESOURCE_RESERVE_EN_CU_1, 0xffffffff, 0x00007FAF, 294 294 }; 295 295 296 - static const u32 golden_settings_ellesmere_a11[] = 296 + static const u32 golden_settings_polaris10_a11[] = 297 297 { 298 298 mmATC_MISC_CG, 0x000c0fc0, 0x000c0200, 299 299 mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040, ··· 311 311 mmTCP_CHAN_STEER_HI, 0xffffffff, 0x00000000, 312 312 }; 313 313 314 - static const u32 ellesmere_golden_common_all[] = 314 + static const u32 polaris10_golden_common_all[] = 315 315 { 316 316 mmGRBM_GFX_INDEX, 0xffffffff, 0xe0000000, 317 317 mmPA_SC_RASTER_CONFIG, 0xffffffff, 0x16000012, ··· 674 674 tonga_golden_common_all, 675 675 (const u32)ARRAY_SIZE(tonga_golden_common_all)); 676 676 break; 677 - case CHIP_BAFFIN: 677 + case CHIP_POLARIS11: 678 678 amdgpu_program_register_sequence(adev, 679 - golden_settings_baffin_a11, 680 - (const u32)ARRAY_SIZE(golden_settings_baffin_a11)); 679 + golden_settings_polaris11_a11, 680 + (const u32)ARRAY_SIZE(golden_settings_polaris11_a11)); 681 681 amdgpu_program_register_sequence(adev, 682 - baffin_golden_common_all, 683 - (const u32)ARRAY_SIZE(baffin_golden_common_all)); 682 + polaris11_golden_common_all, 683 + (const u32)ARRAY_SIZE(polaris11_golden_common_all)); 684 684 break; 685 - case CHIP_ELLESMERE: 685 + case CHIP_POLARIS10: 686 686 amdgpu_program_register_sequence(adev, 687 - golden_settings_ellesmere_a11, 688 - (const u32)ARRAY_SIZE(golden_settings_ellesmere_a11)); 687 + golden_settings_polaris10_a11, 688 + (const u32)ARRAY_SIZE(golden_settings_polaris10_a11)); 689 689 amdgpu_program_register_sequence(adev, 690 - ellesmere_golden_common_all, 691 - (const u32)ARRAY_SIZE(ellesmere_golden_common_all)); 690 + polaris10_golden_common_all, 691 + (const u32)ARRAY_SIZE(polaris10_golden_common_all)); 692 692 break; 693 693 case CHIP_CARRIZO: 694 694 amdgpu_program_register_sequence(adev, ··· 859 859 case CHIP_FIJI: 860 860 chip_name = "fiji"; 861 861 break; 862 - case CHIP_BAFFIN: 863 - chip_name = "baffin"; 862 + case CHIP_POLARIS11: 863 + chip_name = "polaris11"; 864 864 break; 865 - case CHIP_ELLESMERE: 866 - chip_name = "ellesmere"; 865 + case CHIP_POLARIS10: 866 + chip_name = "polaris10"; 867 867 break; 868 868 case CHIP_STONEY: 869 869 chip_name = "stoney"; ··· 1092 1092 PACKET3_SET_CONTEXT_REG_START); 1093 1093 switch (adev->asic_type) { 1094 1094 case CHIP_TONGA: 1095 - case CHIP_ELLESMERE: 1095 + case CHIP_POLARIS10: 1096 1096 buffer[count++] = cpu_to_le32(0x16000012); 1097 1097 buffer[count++] = cpu_to_le32(0x0000002A); 1098 1098 break; 1099 - case CHIP_BAFFIN: 1099 + case CHIP_POLARIS11: 1100 1100 buffer[count++] = cpu_to_le32(0x16000012); 1101 1101 buffer[count++] = cpu_to_le32(0x00000000); 1102 1102 break; ··· 1628 1628 adev->gfx.config.sc_earlyz_tile_fifo_size = 0x130; 1629 1629 gb_addr_config = TONGA_GB_ADDR_CONFIG_GOLDEN; 1630 1630 break; 1631 - case CHIP_BAFFIN: 1631 + case CHIP_POLARIS11: 1632 1632 ret = amdgpu_atombios_get_gfx_info(adev); 1633 1633 if (ret) 1634 1634 return ret; ··· 1640 1640 adev->gfx.config.sc_prim_fifo_size_backend = 0x100; 1641 1641 adev->gfx.config.sc_hiz_tile_fifo_size = 0x30; 1642 1642 adev->gfx.config.sc_earlyz_tile_fifo_size = 0x130; 1643 - gb_addr_config = BAFFIN_GB_ADDR_CONFIG_GOLDEN; 1643 + gb_addr_config = POLARIS11_GB_ADDR_CONFIG_GOLDEN; 1644 1644 break; 1645 - case CHIP_ELLESMERE: 1645 + case CHIP_POLARIS10: 1646 1646 ret = amdgpu_atombios_get_gfx_info(adev); 1647 1647 if (ret) 1648 1648 return ret; ··· 2551 2551 WREG32(mmGB_MACROTILE_MODE0 + reg_offset, mod2array[reg_offset]); 2552 2552 2553 2553 break; 2554 - case CHIP_BAFFIN: 2554 + case CHIP_POLARIS11: 2555 2555 modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | 2556 2556 PIPE_CONFIG(ADDR_SURF_P4_16x16) | 2557 2557 TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | ··· 2753 2753 WREG32(mmGB_MACROTILE_MODE0 + reg_offset, mod2array[reg_offset]); 2754 2754 2755 2755 break; 2756 - case CHIP_ELLESMERE: 2756 + case CHIP_POLARIS10: 2757 2757 modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | 2758 2758 PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | 2759 2759 TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | ··· 3658 3658 WREG32(mmRLC_SRM_CNTL, data); 3659 3659 } 3660 3660 3661 - static void baffin_init_power_gating(struct amdgpu_device *adev) 3661 + static void polaris11_init_power_gating(struct amdgpu_device *adev) 3662 3662 { 3663 3663 uint32_t data; 3664 3664 ··· 3701 3701 gfx_v8_0_init_save_restore_list(adev); 3702 3702 gfx_v8_0_enable_save_restore_machine(adev); 3703 3703 3704 - if (adev->asic_type == CHIP_BAFFIN) 3705 - baffin_init_power_gating(adev); 3704 + if (adev->asic_type == CHIP_POLARIS11) 3705 + polaris11_init_power_gating(adev); 3706 3706 } 3707 3707 } 3708 3708 ··· 3776 3776 3777 3777 /* disable CG */ 3778 3778 WREG32(mmRLC_CGCG_CGLS_CTRL, 0); 3779 - if (adev->asic_type == CHIP_BAFFIN || 3780 - adev->asic_type == CHIP_ELLESMERE) 3779 + if (adev->asic_type == CHIP_POLARIS11 || 3780 + adev->asic_type == CHIP_POLARIS10) 3781 3781 WREG32(mmRLC_CGCG_CGLS_CTRL_3D, 0); 3782 3782 3783 3783 /* disable PG */ ··· 3958 3958 amdgpu_ring_write(ring, mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START); 3959 3959 switch (adev->asic_type) { 3960 3960 case CHIP_TONGA: 3961 - case CHIP_ELLESMERE: 3961 + case CHIP_POLARIS10: 3962 3962 amdgpu_ring_write(ring, 0x16000012); 3963 3963 amdgpu_ring_write(ring, 0x0000002A); 3964 3964 break; 3965 - case CHIP_BAFFIN: 3965 + case CHIP_POLARIS11: 3966 3966 amdgpu_ring_write(ring, 0x16000012); 3967 3967 amdgpu_ring_write(ring, 0x00000000); 3968 3968 break; ··· 4610 4610 if ((adev->asic_type == CHIP_CARRIZO) || 4611 4611 (adev->asic_type == CHIP_FIJI) || 4612 4612 (adev->asic_type == CHIP_STONEY) || 4613 - (adev->asic_type == CHIP_BAFFIN) || 4614 - (adev->asic_type == CHIP_ELLESMERE)) { 4613 + (adev->asic_type == CHIP_POLARIS11) || 4614 + (adev->asic_type == CHIP_POLARIS10)) { 4615 4615 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, 4616 4616 AMDGPU_DOORBELL_KIQ << 2); 4617 4617 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, ··· 4646 4646 WREG32(mmCP_HQD_PERSISTENT_STATE, tmp); 4647 4647 mqd->cp_hqd_persistent_state = tmp; 4648 4648 if (adev->asic_type == CHIP_STONEY || 4649 - adev->asic_type == CHIP_BAFFIN || 4650 - adev->asic_type == CHIP_ELLESMERE) { 4649 + adev->asic_type == CHIP_POLARIS11 || 4650 + adev->asic_type == CHIP_POLARIS10) { 4651 4651 tmp = RREG32(mmCP_ME1_PIPE3_INT_CNTL); 4652 4652 tmp = REG_SET_FIELD(tmp, CP_ME1_PIPE3_INT_CNTL, GENERIC2_INT_ENABLE, 1); 4653 4653 WREG32(mmCP_ME1_PIPE3_INT_CNTL, tmp); ··· 5216 5216 return 0; 5217 5217 } 5218 5218 5219 - static void baffin_enable_gfx_static_mg_power_gating(struct amdgpu_device *adev, 5219 + static void polaris11_enable_gfx_static_mg_power_gating(struct amdgpu_device *adev, 5220 5220 bool enable) 5221 5221 { 5222 5222 uint32_t data, temp; ··· 5242 5242 } 5243 5243 } 5244 5244 5245 - static void baffin_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *adev, 5245 + static void polaris11_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *adev, 5246 5246 bool enable) 5247 5247 { 5248 5248 uint32_t data, temp; ··· 5263 5263 } 5264 5264 } 5265 5265 5266 - static void baffin_enable_gfx_quick_mg_power_gating(struct amdgpu_device *adev, 5266 + static void polaris11_enable_gfx_quick_mg_power_gating(struct amdgpu_device *adev, 5267 5267 bool enable) 5268 5268 { 5269 5269 uint32_t data, temp; ··· 5293 5293 return 0; 5294 5294 5295 5295 switch (adev->asic_type) { 5296 - case CHIP_BAFFIN: 5297 - if (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_SMG) 5298 - baffin_enable_gfx_static_mg_power_gating(adev, 5296 + case CHIP_POLARIS11: 5297 + if (adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) 5298 + polaris11_enable_gfx_static_mg_power_gating(adev, 5299 5299 state == AMD_PG_STATE_GATE ? true : false); 5300 - else if (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_DMG) 5301 - baffin_enable_gfx_dynamic_mg_power_gating(adev, 5300 + else if (adev->pg_flags & AMD_PG_SUPPORT_GFX_DMG) 5301 + polaris11_enable_gfx_dynamic_mg_power_gating(adev, 5302 5302 state == AMD_PG_STATE_GATE ? true : false); 5303 5303 else 5304 - baffin_enable_gfx_quick_mg_power_gating(adev, 5304 + polaris11_enable_gfx_quick_mg_power_gating(adev, 5305 5305 state == AMD_PG_STATE_GATE ? true : false); 5306 5306 break; 5307 5307 default:
+14 -14
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
··· 43 43 static void gmc_v8_0_set_irq_funcs(struct amdgpu_device *adev); 44 44 45 45 MODULE_FIRMWARE("amdgpu/tonga_mc.bin"); 46 - MODULE_FIRMWARE("amdgpu/baffin_mc.bin"); 47 - MODULE_FIRMWARE("amdgpu/ellesmere_mc.bin"); 46 + MODULE_FIRMWARE("amdgpu/polaris11_mc.bin"); 47 + MODULE_FIRMWARE("amdgpu/polaris10_mc.bin"); 48 48 49 49 static const u32 golden_settings_tonga_a11[] = 50 50 { ··· 75 75 mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104 76 76 }; 77 77 78 - static const u32 golden_settings_baffin_a11[] = 78 + static const u32 golden_settings_polaris11_a11[] = 79 79 { 80 80 mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff, 81 81 mmVM_PRT_APERTURE1_LOW_ADDR, 0x0fffffff, 0x0fffffff, ··· 83 83 mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff 84 84 }; 85 85 86 - static const u32 golden_settings_ellesmere_a11[] = 86 + static const u32 golden_settings_polaris10_a11[] = 87 87 { 88 88 mmMC_ARB_WTM_GRPWT_RD, 0x00000003, 0x00000000, 89 89 mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff, ··· 122 122 golden_settings_tonga_a11, 123 123 (const u32)ARRAY_SIZE(golden_settings_tonga_a11)); 124 124 break; 125 - case CHIP_BAFFIN: 125 + case CHIP_POLARIS11: 126 126 amdgpu_program_register_sequence(adev, 127 - golden_settings_baffin_a11, 128 - (const u32)ARRAY_SIZE(golden_settings_baffin_a11)); 127 + golden_settings_polaris11_a11, 128 + (const u32)ARRAY_SIZE(golden_settings_polaris11_a11)); 129 129 break; 130 - case CHIP_ELLESMERE: 130 + case CHIP_POLARIS10: 131 131 amdgpu_program_register_sequence(adev, 132 - golden_settings_ellesmere_a11, 133 - (const u32)ARRAY_SIZE(golden_settings_ellesmere_a11)); 132 + golden_settings_polaris10_a11, 133 + (const u32)ARRAY_SIZE(golden_settings_polaris10_a11)); 134 134 break; 135 135 case CHIP_CARRIZO: 136 136 amdgpu_program_register_sequence(adev, ··· 238 238 case CHIP_TONGA: 239 239 chip_name = "tonga"; 240 240 break; 241 - case CHIP_BAFFIN: 242 - chip_name = "baffin"; 241 + case CHIP_POLARIS11: 242 + chip_name = "polaris11"; 243 243 break; 244 - case CHIP_ELLESMERE: 245 - chip_name = "ellesmere"; 244 + case CHIP_POLARIS10: 245 + chip_name = "polaris10"; 246 246 break; 247 247 case CHIP_FIJI: 248 248 case CHIP_CARRIZO:
+16 -16
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
··· 56 56 MODULE_FIRMWARE("amdgpu/fiji_sdma.bin"); 57 57 MODULE_FIRMWARE("amdgpu/fiji_sdma1.bin"); 58 58 MODULE_FIRMWARE("amdgpu/stoney_sdma.bin"); 59 - MODULE_FIRMWARE("amdgpu/ellesmere_sdma.bin"); 60 - MODULE_FIRMWARE("amdgpu/ellesmere_sdma1.bin"); 61 - MODULE_FIRMWARE("amdgpu/baffin_sdma.bin"); 62 - MODULE_FIRMWARE("amdgpu/baffin_sdma1.bin"); 59 + MODULE_FIRMWARE("amdgpu/polaris10_sdma.bin"); 60 + MODULE_FIRMWARE("amdgpu/polaris10_sdma1.bin"); 61 + MODULE_FIRMWARE("amdgpu/polaris11_sdma.bin"); 62 + MODULE_FIRMWARE("amdgpu/polaris11_sdma1.bin"); 63 63 64 64 65 65 static const u32 sdma_offsets[SDMA_MAX_INSTANCE] = ··· 106 106 mmSDMA1_CLK_CTRL, 0xff000ff0, 0x00000100 107 107 }; 108 108 109 - static const u32 golden_settings_baffin_a11[] = 109 + static const u32 golden_settings_polaris11_a11[] = 110 110 { 111 111 mmSDMA0_CHICKEN_BITS, 0xfc910007, 0x00810007, 112 112 mmSDMA0_GFX_IB_CNTL, 0x800f0111, 0x00000100, ··· 118 118 mmSDMA1_RLC1_IB_CNTL, 0x800f0111, 0x00000100, 119 119 }; 120 120 121 - static const u32 golden_settings_ellesmere_a11[] = 121 + static const u32 golden_settings_polaris10_a11[] = 122 122 { 123 123 mmSDMA0_CHICKEN_BITS, 0xfc910007, 0x00810007, 124 124 mmSDMA0_CLK_CTRL, 0xff000fff, 0x00000000, ··· 203 203 golden_settings_tonga_a11, 204 204 (const u32)ARRAY_SIZE(golden_settings_tonga_a11)); 205 205 break; 206 - case CHIP_BAFFIN: 206 + case CHIP_POLARIS11: 207 207 amdgpu_program_register_sequence(adev, 208 - golden_settings_baffin_a11, 209 - (const u32)ARRAY_SIZE(golden_settings_baffin_a11)); 208 + golden_settings_polaris11_a11, 209 + (const u32)ARRAY_SIZE(golden_settings_polaris11_a11)); 210 210 break; 211 - case CHIP_ELLESMERE: 211 + case CHIP_POLARIS10: 212 212 amdgpu_program_register_sequence(adev, 213 - golden_settings_ellesmere_a11, 214 - (const u32)ARRAY_SIZE(golden_settings_ellesmere_a11)); 213 + golden_settings_polaris10_a11, 214 + (const u32)ARRAY_SIZE(golden_settings_polaris10_a11)); 215 215 break; 216 216 case CHIP_CARRIZO: 217 217 amdgpu_program_register_sequence(adev, ··· 261 261 case CHIP_FIJI: 262 262 chip_name = "fiji"; 263 263 break; 264 - case CHIP_BAFFIN: 265 - chip_name = "baffin"; 264 + case CHIP_POLARIS11: 265 + chip_name = "polaris11"; 266 266 break; 267 - case CHIP_ELLESMERE: 268 - chip_name = "ellesmere"; 267 + case CHIP_POLARIS10: 268 + chip_name = "polaris10"; 269 269 break; 270 270 case CHIP_CARRIZO: 271 271 chip_name = "carrizo";
+3 -3
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
··· 315 315 { 316 316 u32 tmp; 317 317 318 - /* Fiji, Stoney, Ellesmere, Baffin are single pipe */ 318 + /* Fiji, Stoney, Polaris10, Polaris11 are single pipe */ 319 319 if ((adev->asic_type == CHIP_FIJI) || 320 320 (adev->asic_type == CHIP_STONEY) || 321 - (adev->asic_type == CHIP_ELLESMERE) || 322 - (adev->asic_type == CHIP_BAFFIN)) 321 + (adev->asic_type == CHIP_POLARIS10) || 322 + (adev->asic_type == CHIP_POLARIS11)) 323 323 return AMDGPU_VCE_HARVEST_VCE1; 324 324 325 325 /* Tonga and CZ are dual or single pipe */
+11 -11
drivers/gpu/drm/amd/amdgpu/vi.c
··· 276 276 stoney_mgcg_cgcg_init, 277 277 (const u32)ARRAY_SIZE(stoney_mgcg_cgcg_init)); 278 278 break; 279 - case CHIP_BAFFIN: 280 - case CHIP_ELLESMERE: 279 + case CHIP_POLARIS11: 280 + case CHIP_POLARIS10: 281 281 default: 282 282 break; 283 283 } ··· 539 539 break; 540 540 case CHIP_FIJI: 541 541 case CHIP_TONGA: 542 - case CHIP_BAFFIN: 543 - case CHIP_ELLESMERE: 542 + case CHIP_POLARIS11: 543 + case CHIP_POLARIS10: 544 544 case CHIP_CARRIZO: 545 545 case CHIP_STONEY: 546 546 asic_register_table = cz_allowed_read_registers; ··· 911 911 }, 912 912 }; 913 913 914 - static const struct amdgpu_ip_block_version baffin_ip_blocks[] = 914 + static const struct amdgpu_ip_block_version polaris11_ip_blocks[] = 915 915 { 916 916 /* ORDER MATTERS! */ 917 917 { ··· 1071 1071 adev->ip_blocks = tonga_ip_blocks; 1072 1072 adev->num_ip_blocks = ARRAY_SIZE(tonga_ip_blocks); 1073 1073 break; 1074 - case CHIP_BAFFIN: 1075 - case CHIP_ELLESMERE: 1076 - adev->ip_blocks = baffin_ip_blocks; 1077 - adev->num_ip_blocks = ARRAY_SIZE(baffin_ip_blocks); 1074 + case CHIP_POLARIS11: 1075 + case CHIP_POLARIS10: 1076 + adev->ip_blocks = polaris11_ip_blocks; 1077 + adev->num_ip_blocks = ARRAY_SIZE(polaris11_ip_blocks); 1078 1078 break; 1079 1079 case CHIP_CARRIZO: 1080 1080 case CHIP_STONEY: ··· 1177 1177 adev->pg_flags = 0; 1178 1178 adev->external_rev_id = adev->rev_id + 0x14; 1179 1179 break; 1180 - case CHIP_BAFFIN: 1180 + case CHIP_POLARIS11: 1181 1181 adev->cg_flags = 0; 1182 1182 adev->pg_flags = 0; 1183 1183 adev->external_rev_id = adev->rev_id + 0x5A; 1184 1184 break; 1185 - case CHIP_ELLESMERE: 1185 + case CHIP_POLARIS10: 1186 1186 adev->cg_flags = 0; 1187 1187 adev->pg_flags = 0; 1188 1188 adev->external_rev_id = adev->rev_id + 0x50;
+2 -2
drivers/gpu/drm/amd/include/amd_shared.h
··· 48 48 CHIP_FIJI, 49 49 CHIP_CARRIZO, 50 50 CHIP_STONEY, 51 - CHIP_ELLESMERE, 52 - CHIP_BAFFIN, 51 + CHIP_POLARIS10, 52 + CHIP_POLARIS11, 53 53 CHIP_LAST, 54 54 }; 55 55
+3 -3
drivers/gpu/drm/amd/include/atombios.h
··· 2061 2061 #define SET_DCE_CLOCK_FLAG_DPREFCLK_BYPASS 0x01 2062 2062 #define SET_DCE_CLOCK_FLAG_ENABLE_PIXCLK 0x02 2063 2063 2064 - // SetDCEClockTable input parameter for DCE11.2( ELM and BF ) and above 2064 + // SetDCEClockTable input parameter for DCE11.2( POLARIS10 and POLARIS11 ) and above 2065 2065 typedef struct _SET_DCE_CLOCK_PARAMETERS_V2_1 2066 2066 { 2067 2067 ULONG ulDCEClkFreq; // target DCE frequency in unit of 10KHZ, return real DISPCLK/DPREFCLK frequency. ··· 5494 5494 ULONG ulReserved[8]; // Reserved for future ASIC 5495 5495 }ATOM_ASIC_PROFILING_INFO_V3_4; 5496 5496 5497 - // for Ellemser/Baffin speed EVV algorithm 5497 + // for Polaris10/Polaris11 speed EVV algorithm 5498 5498 typedef struct _ATOM_ASIC_PROFILING_INFO_V3_5 5499 5499 { 5500 5500 ATOM_COMMON_TABLE_HEADER asHeader; ··· 5549 5549 }ATOM_SCLK_FCW_RANGE_ENTRY_V1; 5550 5550 5551 5551 5552 - // SMU_InfoTable for Ellesmere/Baffin 5552 + // SMU_InfoTable for Polaris10/Polaris11 5553 5553 typedef struct _ATOM_SMU_INFO_V2_1 5554 5554 { 5555 5555 ATOM_COMMON_TABLE_HEADER asHeader;
+2 -2
drivers/gpu/drm/amd/powerplay/hwmgr/Makefile
··· 9 9 tonga_hwmgr.o pppcielanes.o tonga_thermal.o\ 10 10 fiji_powertune.o fiji_hwmgr.o tonga_clockpowergating.o \ 11 11 fiji_clockpowergating.o fiji_thermal.o \ 12 - ellesmere_hwmgr.o ellesmere_powertune.o ellesmere_thermal.o \ 13 - ellesmere_clockpowergating.o 12 + polaris10_hwmgr.o polaris10_powertune.o polaris10_thermal.o \ 13 + polaris10_clockpowergating.o 14 14 15 15 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR)) 16 16
+31 -31
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_clockpowergating.c drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c
··· 21 21 * 22 22 */ 23 23 24 - #include "ellesmere_clockpowergating.h" 24 + #include "polaris10_clockpowergating.h" 25 25 26 - int ellesmere_phm_powerdown_uvd(struct pp_hwmgr *hwmgr) 26 + int polaris10_phm_powerdown_uvd(struct pp_hwmgr *hwmgr) 27 27 { 28 28 if (phm_cf_want_uvd_power_gating(hwmgr)) 29 29 return smum_send_msg_to_smc(hwmgr->smumgr, ··· 31 31 return 0; 32 32 } 33 33 34 - int ellesmere_phm_powerup_uvd(struct pp_hwmgr *hwmgr) 34 + int polaris10_phm_powerup_uvd(struct pp_hwmgr *hwmgr) 35 35 { 36 36 if (phm_cf_want_uvd_power_gating(hwmgr)) { 37 37 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, ··· 47 47 return 0; 48 48 } 49 49 50 - int ellesmere_phm_powerdown_vce(struct pp_hwmgr *hwmgr) 50 + int polaris10_phm_powerdown_vce(struct pp_hwmgr *hwmgr) 51 51 { 52 52 if (phm_cf_want_vce_power_gating(hwmgr)) 53 53 return smum_send_msg_to_smc(hwmgr->smumgr, ··· 55 55 return 0; 56 56 } 57 57 58 - int ellesmere_phm_powerup_vce(struct pp_hwmgr *hwmgr) 58 + int polaris10_phm_powerup_vce(struct pp_hwmgr *hwmgr) 59 59 { 60 60 if (phm_cf_want_vce_power_gating(hwmgr)) 61 61 return smum_send_msg_to_smc(hwmgr->smumgr, ··· 63 63 return 0; 64 64 } 65 65 66 - int ellesmere_phm_powerdown_samu(struct pp_hwmgr *hwmgr) 66 + int polaris10_phm_powerdown_samu(struct pp_hwmgr *hwmgr) 67 67 { 68 68 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 69 69 PHM_PlatformCaps_SamuPowerGating)) ··· 72 72 return 0; 73 73 } 74 74 75 - int ellesmere_phm_powerup_samu(struct pp_hwmgr *hwmgr) 75 + int polaris10_phm_powerup_samu(struct pp_hwmgr *hwmgr) 76 76 { 77 77 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 78 78 PHM_PlatformCaps_SamuPowerGating)) ··· 81 81 return 0; 82 82 } 83 83 84 - int ellesmere_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr) 84 + int polaris10_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr) 85 85 { 86 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 86 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 87 87 88 88 data->uvd_power_gated = false; 89 89 data->vce_power_gated = false; 90 90 data->samu_power_gated = false; 91 91 92 - ellesmere_phm_powerup_uvd(hwmgr); 93 - ellesmere_phm_powerup_vce(hwmgr); 94 - ellesmere_phm_powerup_samu(hwmgr); 92 + polaris10_phm_powerup_uvd(hwmgr); 93 + polaris10_phm_powerup_vce(hwmgr); 94 + polaris10_phm_powerup_samu(hwmgr); 95 95 96 96 return 0; 97 97 } 98 98 99 - int ellesmere_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate) 99 + int polaris10_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate) 100 100 { 101 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 101 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 102 102 103 103 if (data->uvd_power_gated == bgate) 104 104 return 0; ··· 106 106 data->uvd_power_gated = bgate; 107 107 108 108 if (bgate) { 109 - ellesmere_update_uvd_dpm(hwmgr, true); 110 - ellesmere_phm_powerdown_uvd(hwmgr); 109 + polaris10_update_uvd_dpm(hwmgr, true); 110 + polaris10_phm_powerdown_uvd(hwmgr); 111 111 } else { 112 - ellesmere_phm_powerup_uvd(hwmgr); 113 - ellesmere_update_uvd_dpm(hwmgr, false); 112 + polaris10_phm_powerup_uvd(hwmgr); 113 + polaris10_update_uvd_dpm(hwmgr, false); 114 114 } 115 115 116 116 return 0; 117 117 } 118 118 119 - int ellesmere_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate) 119 + int polaris10_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate) 120 120 { 121 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 121 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 122 122 123 123 if (data->vce_power_gated == bgate) 124 124 return 0; 125 125 126 126 if (bgate) 127 - ellesmere_phm_powerdown_vce(hwmgr); 127 + polaris10_phm_powerdown_vce(hwmgr); 128 128 else 129 - ellesmere_phm_powerup_vce(hwmgr); 129 + polaris10_phm_powerup_vce(hwmgr); 130 130 131 131 return 0; 132 132 } 133 133 134 - int ellesmere_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate) 134 + int polaris10_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate) 135 135 { 136 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 136 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 137 137 138 138 if (data->samu_power_gated == bgate) 139 139 return 0; ··· 141 141 data->samu_power_gated = bgate; 142 142 143 143 if (bgate) { 144 - ellesmere_update_samu_dpm(hwmgr, true); 145 - ellesmere_phm_powerdown_samu(hwmgr); 144 + polaris10_update_samu_dpm(hwmgr, true); 145 + polaris10_phm_powerdown_samu(hwmgr); 146 146 } else { 147 - ellesmere_phm_powerup_samu(hwmgr); 148 - ellesmere_update_samu_dpm(hwmgr, false); 147 + polaris10_phm_powerup_samu(hwmgr); 148 + polaris10_update_samu_dpm(hwmgr, false); 149 149 } 150 150 151 151 return 0; 152 152 } 153 153 154 - int ellesmere_phm_update_clock_gatings(struct pp_hwmgr *hwmgr, 154 + int polaris10_phm_update_clock_gatings(struct pp_hwmgr *hwmgr, 155 155 const uint32_t *msg_id) 156 156 { 157 157 PPSMC_Msg msg; ··· 399 399 return 0; 400 400 } 401 401 402 - /* This function is for Baffin only for now, 402 + /* This function is for Polaris11 only for now, 403 403 * Powerplay will only control the static per CU Power Gating. 404 404 * Dynamic per CU Power Gating will be done in gfx. 405 405 */ 406 - int ellesmere_phm_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable) 406 + int polaris10_phm_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable) 407 407 { 408 408 struct cgs_system_info sys_info = {0}; 409 409 uint32_t active_cus;
+12 -12
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_clockpowergating.h drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.h
··· 21 21 * 22 22 */ 23 23 24 - #ifndef _ELLESMERE_CLOCK_POWER_GATING_H_ 25 - #define _ELLESMERE_CLOCK_POWER_GATING_H_ 24 + #ifndef _POLARIS10_CLOCK_POWER_GATING_H_ 25 + #define _POLARIS10_CLOCK_POWER_GATING_H_ 26 26 27 - #include "ellesmere_hwmgr.h" 27 + #include "polaris10_hwmgr.h" 28 28 #include "pp_asicblocks.h" 29 29 30 - int ellesmere_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate); 31 - int ellesmere_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate); 32 - int ellesmere_phm_powerdown_uvd(struct pp_hwmgr *hwmgr); 33 - int ellesmere_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate); 34 - int ellesmere_phm_powergate_acp(struct pp_hwmgr *hwmgr, bool bgate); 35 - int ellesmere_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr); 36 - int ellesmere_phm_update_clock_gatings(struct pp_hwmgr *hwmgr, 30 + int polaris10_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate); 31 + int polaris10_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate); 32 + int polaris10_phm_powerdown_uvd(struct pp_hwmgr *hwmgr); 33 + int polaris10_phm_powergate_samu(struct pp_hwmgr *hwmgr, bool bgate); 34 + int polaris10_phm_powergate_acp(struct pp_hwmgr *hwmgr, bool bgate); 35 + int polaris10_phm_disable_clock_power_gating(struct pp_hwmgr *hwmgr); 36 + int polaris10_phm_update_clock_gatings(struct pp_hwmgr *hwmgr, 37 37 const uint32_t *msg_id); 38 - int ellesmere_phm_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable); 38 + int polaris10_phm_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable); 39 39 40 - #endif /* _ELLESMERE_CLOCK_POWER_GATING_H_ */ 40 + #endif /* _POLARIS10_CLOCK_POWER_GATING_H_ */
-62
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_dyn_defaults.h
··· 1 - /* 2 - * Copyright 2015 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - */ 23 - 24 - #ifndef ELLESMERE_DYN_DEFAULTS_H 25 - #define ELLESMERE_DYN_DEFAULTS_H 26 - 27 - 28 - enum Ellesmeredpm_TrendDetection { 29 - EllesmereAdpm_TrendDetection_AUTO, 30 - EllesmereAdpm_TrendDetection_UP, 31 - EllesmereAdpm_TrendDetection_DOWN 32 - }; 33 - typedef enum Ellesmeredpm_TrendDetection Ellesmeredpm_TrendDetection; 34 - 35 - /* We need to fill in the default values */ 36 - 37 - 38 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT0 0x3FFFC102 39 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT1 0x000400 40 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT2 0xC00080 41 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT3 0xC00200 42 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT4 0xC01680 43 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT5 0xC00033 44 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT6 0xC00033 45 - #define PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT7 0x3FFFC000 46 - 47 - 48 - #define PPELLESMERE_THERMALPROTECTCOUNTER_DFLT 0x200 49 - #define PPELLESMERE_STATICSCREENTHRESHOLDUNIT_DFLT 0 50 - #define PPELLESMERE_STATICSCREENTHRESHOLD_DFLT 0x00C8 51 - #define PPELLESMERE_GFXIDLECLOCKSTOPTHRESHOLD_DFLT 0x200 52 - #define PPELLESMERE_REFERENCEDIVIDER_DFLT 4 53 - 54 - #define PPELLESMERE_ULVVOLTAGECHANGEDELAY_DFLT 1687 55 - 56 - #define PPELLESMERE_CGULVPARAMETER_DFLT 0x00040035 57 - #define PPELLESMERE_CGULVCONTROL_DFLT 0x00007450 58 - #define PPELLESMERE_TARGETACTIVITY_DFLT 50 59 - #define PPELLESMERE_MCLK_TARGETACTIVITY_DFLT 10 60 - 61 - #endif 62 -
+713 -580
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_hwmgr.c drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
··· 26 26 #include "linux/delay.h" 27 27 #include "pp_acpi.h" 28 28 #include "hwmgr.h" 29 - #include "ellesmere_hwmgr.h" 30 - #include "ellesmere_powertune.h" 31 - #include "ellesmere_dyn_defaults.h" 32 - #include "ellesmere_smumgr.h" 29 + #include "polaris10_hwmgr.h" 30 + #include "polaris10_powertune.h" 31 + #include "polaris10_dyn_defaults.h" 32 + #include "polaris10_smumgr.h" 33 33 #include "pp_debug.h" 34 34 #include "ppatomctrl.h" 35 35 #include "atombios.h" ··· 57 57 #include "dce/dce_10_0_d.h" 58 58 #include "dce/dce_10_0_sh_mask.h" 59 59 60 - #include "ellesmere_thermal.h" 61 - #include "ellesmere_clockpowergating.h" 60 + #include "polaris10_thermal.h" 61 + #include "polaris10_clockpowergating.h" 62 62 63 63 #define MC_CG_ARB_FREQ_F0 0x0a 64 64 #define MC_CG_ARB_FREQ_F1 0x0b ··· 98 98 #define TCLK (PCIE_BUS_CLK / 10) 99 99 100 100 101 - uint16_t ellesmere_clock_stretcher_lookup_table[2][4] = { {600, 1050, 3, 0}, 101 + uint16_t polaris10_clock_stretcher_lookup_table[2][4] = { {600, 1050, 3, 0}, 102 102 {600, 1050, 6, 1} }; 103 103 104 104 /* [FF, SS] type, [] 4 voltage ranges, and [Floor Freq, Boundary Freq, VID min , VID max] */ 105 - uint32_t ellesmere_clock_stretcher_ddt_table[2][4][4] = { { {265, 529, 120, 128}, {325, 650, 96, 119}, {430, 860, 32, 95}, {0, 0, 0, 31} }, 105 + uint32_t polaris10_clock_stretcher_ddt_table[2][4][4] = { { {265, 529, 120, 128}, {325, 650, 96, 119}, {430, 860, 32, 95}, {0, 0, 0, 31} }, 106 106 { {275, 550, 104, 112}, {319, 638, 96, 103}, {360, 720, 64, 95}, {384, 768, 32, 63} } }; 107 107 108 108 /* [Use_For_Low_freq] value, [0%, 5%, 10%, 7.14%, 14.28%, 20%] (coming from PWR_CKS_CNTL.stretch_amount reg spec) */ 109 - uint8_t ellesmere_clock_stretch_amount_conversion[2][6] = { {0, 1, 3, 2, 4, 5}, 109 + uint8_t polaris10_clock_stretch_amount_conversion[2][6] = { {0, 1, 3, 2, 4, 5}, 110 110 {0, 2, 4, 5, 6, 5} }; 111 111 112 112 /** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */ ··· 118 118 DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4 119 119 }; 120 120 121 - const unsigned long PhwEllesmere_Magic = (unsigned long)(PHM_VIslands_Magic); 121 + const unsigned long PhwPolaris10_Magic = (unsigned long)(PHM_VIslands_Magic); 122 122 123 - struct ellesmere_power_state *cast_phw_ellesmere_power_state( 123 + struct polaris10_power_state *cast_phw_polaris10_power_state( 124 124 struct pp_hw_power_state *hw_ps) 125 125 { 126 - PP_ASSERT_WITH_CODE((PhwEllesmere_Magic == hw_ps->magic), 126 + PP_ASSERT_WITH_CODE((PhwPolaris10_Magic == hw_ps->magic), 127 127 "Invalid Powerstate Type!", 128 128 return NULL); 129 129 130 - return (struct ellesmere_power_state *)hw_ps; 130 + return (struct polaris10_power_state *)hw_ps; 131 131 } 132 132 133 - const struct ellesmere_power_state *cast_const_phw_ellesmere_power_state( 133 + const struct polaris10_power_state *cast_const_phw_polaris10_power_state( 134 134 const struct pp_hw_power_state *hw_ps) 135 135 { 136 - PP_ASSERT_WITH_CODE((PhwEllesmere_Magic == hw_ps->magic), 136 + PP_ASSERT_WITH_CODE((PhwPolaris10_Magic == hw_ps->magic), 137 137 "Invalid Powerstate Type!", 138 138 return NULL); 139 139 140 - return (const struct ellesmere_power_state *)hw_ps; 140 + return (const struct polaris10_power_state *)hw_ps; 141 141 } 142 142 143 - static bool ellesmere_is_dpm_running(struct pp_hwmgr *hwmgr) 143 + static bool polaris10_is_dpm_running(struct pp_hwmgr *hwmgr) 144 144 { 145 145 return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device, 146 146 CGS_IND_REG__SMC, FEATURE_STATUS, VOLTAGE_CONTROLLER_ON)) ··· 228 228 * @param pHwMgr the address of the powerplay hardware manager. 229 229 * @return always PP_Result_OK 230 230 */ 231 - int ellesmere_enable_smc_voltage_controller(struct pp_hwmgr *hwmgr) 231 + int polaris10_enable_smc_voltage_controller(struct pp_hwmgr *hwmgr) 232 232 { 233 233 PP_ASSERT_WITH_CODE( 234 234 (hwmgr->smumgr->smumgr_funcs->send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_Voltage_Cntl_Enable) == 0), ··· 244 244 * 245 245 * @param hwmgr the address of the powerplay hardware manager. 246 246 */ 247 - static bool ellesmere_voltage_control(const struct pp_hwmgr *hwmgr) 247 + static bool polaris10_voltage_control(const struct pp_hwmgr *hwmgr) 248 248 { 249 - const struct ellesmere_hwmgr *data = 250 - (const struct ellesmere_hwmgr *)(hwmgr->backend); 249 + const struct polaris10_hwmgr *data = 250 + (const struct polaris10_hwmgr *)(hwmgr->backend); 251 251 252 - return (ELLESMERE_VOLTAGE_CONTROL_NONE != data->voltage_control); 252 + return (POLARIS10_VOLTAGE_CONTROL_NONE != data->voltage_control); 253 253 } 254 254 255 255 /** ··· 258 258 * @param hwmgr the address of the powerplay hardware manager. 259 259 * @return always 0 260 260 */ 261 - static int ellesmere_enable_voltage_control(struct pp_hwmgr *hwmgr) 261 + static int polaris10_enable_voltage_control(struct pp_hwmgr *hwmgr) 262 262 { 263 263 /* enable voltage control */ 264 264 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, ··· 273 273 * @param hwmgr the address of the powerplay hardware manager. 274 274 * @return always 0 275 275 */ 276 - static int ellesmere_construct_voltage_tables(struct pp_hwmgr *hwmgr) 276 + static int polaris10_construct_voltage_tables(struct pp_hwmgr *hwmgr) 277 277 { 278 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 278 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 279 279 struct phm_ppt_v1_information *table_info = 280 280 (struct phm_ppt_v1_information *)hwmgr->pptable; 281 281 int result; 282 282 283 - if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 283 + if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 284 284 result = atomctrl_get_voltage_table_v3(hwmgr, 285 285 VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_GPIO_LUT, 286 286 &(data->mvdd_voltage_table)); 287 287 PP_ASSERT_WITH_CODE((0 == result), 288 288 "Failed to retrieve MVDD table.", 289 289 return result); 290 - } else if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->mvdd_control) { 290 + } else if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->mvdd_control) { 291 291 result = phm_get_svi2_mvdd_voltage_table(&(data->mvdd_voltage_table), 292 292 table_info->vdd_dep_on_mclk); 293 293 PP_ASSERT_WITH_CODE((0 == result), ··· 295 295 return result;); 296 296 } 297 297 298 - if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 298 + if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 299 299 result = atomctrl_get_voltage_table_v3(hwmgr, 300 300 VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_GPIO_LUT, 301 301 &(data->vddci_voltage_table)); 302 302 PP_ASSERT_WITH_CODE((0 == result), 303 303 "Failed to retrieve VDDCI table.", 304 304 return result); 305 - } else if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) { 305 + } else if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) { 306 306 result = phm_get_svi2_vddci_voltage_table(&(data->vddci_voltage_table), 307 307 table_info->vdd_dep_on_mclk); 308 308 PP_ASSERT_WITH_CODE((0 == result), ··· 310 310 return result); 311 311 } 312 312 313 - if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { 313 + if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { 314 314 result = phm_get_svi2_vdd_voltage_table(&(data->vddc_voltage_table), 315 315 table_info->vddc_lookup_table); 316 316 PP_ASSERT_WITH_CODE((0 == result), ··· 345 345 * @param hwmgr the address of the powerplay hardware manager. 346 346 * @return always 0 347 347 */ 348 - static int ellesmere_program_static_screen_threshold_parameters( 348 + static int polaris10_program_static_screen_threshold_parameters( 349 349 struct pp_hwmgr *hwmgr) 350 350 { 351 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 351 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 352 352 353 353 /* Set static screen threshold unit */ 354 354 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, ··· 368 368 * @param hwmgr the address of the powerplay hardware manager. 369 369 * @return always 0 370 370 */ 371 - static int ellesmere_enable_display_gap(struct pp_hwmgr *hwmgr) 371 + static int polaris10_enable_display_gap(struct pp_hwmgr *hwmgr) 372 372 { 373 373 uint32_t display_gap = 374 374 cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ··· 392 392 * @param hwmgr the address of the powerplay hardware manager. 393 393 * @return always 0 394 394 */ 395 - static int ellesmere_program_voting_clients(struct pp_hwmgr *hwmgr) 395 + static int polaris10_program_voting_clients(struct pp_hwmgr *hwmgr) 396 396 { 397 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 397 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 398 398 399 399 /* Clear reset for voting clients before enabling DPM */ 400 400 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, ··· 428 428 * @param hwmgr the address of the powerplay hardware manager. 429 429 * @return always 0 430 430 */ 431 - static int ellesmere_process_firmware_header(struct pp_hwmgr *hwmgr) 431 + static int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr) 432 432 { 433 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 434 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(hwmgr->smumgr->backend); 433 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 434 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smumgr->backend); 435 435 uint32_t tmp; 436 436 int result; 437 437 bool error = false; 438 438 439 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 439 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 440 440 SMU7_FIRMWARE_HEADER_LOCATION + 441 441 offsetof(SMU74_Firmware_Header, DpmTable), 442 442 &tmp, data->sram_end); ··· 446 446 447 447 error |= (0 != result); 448 448 449 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 449 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 450 450 SMU7_FIRMWARE_HEADER_LOCATION + 451 451 offsetof(SMU74_Firmware_Header, SoftRegisters), 452 452 &tmp, data->sram_end); ··· 458 458 459 459 error |= (0 != result); 460 460 461 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 461 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 462 462 SMU7_FIRMWARE_HEADER_LOCATION + 463 463 offsetof(SMU74_Firmware_Header, mcRegisterTable), 464 464 &tmp, data->sram_end); ··· 466 466 if (!result) 467 467 data->mc_reg_table_start = tmp; 468 468 469 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 469 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 470 470 SMU7_FIRMWARE_HEADER_LOCATION + 471 471 offsetof(SMU74_Firmware_Header, FanTable), 472 472 &tmp, data->sram_end); ··· 476 476 477 477 error |= (0 != result); 478 478 479 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 479 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 480 480 SMU7_FIRMWARE_HEADER_LOCATION + 481 481 offsetof(SMU74_Firmware_Header, mcArbDramTimingTable), 482 482 &tmp, data->sram_end); ··· 486 486 487 487 error |= (0 != result); 488 488 489 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 489 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 490 490 SMU7_FIRMWARE_HEADER_LOCATION + 491 491 offsetof(SMU74_Firmware_Header, Version), 492 492 &tmp, data->sram_end); ··· 502 502 /* Copy one arb setting to another and then switch the active set. 503 503 * arb_src and arb_dest is one of the MC_CG_ARB_FREQ_Fx constants. 504 504 */ 505 - static int ellesmere_copy_and_switch_arb_sets(struct pp_hwmgr *hwmgr, 505 + static int polaris10_copy_and_switch_arb_sets(struct pp_hwmgr *hwmgr, 506 506 uint32_t arb_src, uint32_t arb_dest) 507 507 { 508 508 uint32_t mc_arb_dram_timing; ··· 555 555 * @return always 0 556 556 * This function is to be called from the SetPowerState table. 557 557 */ 558 - static int ellesmere_initial_switch_from_arbf0_to_f1(struct pp_hwmgr *hwmgr) 558 + static int polaris10_initial_switch_from_arbf0_to_f1(struct pp_hwmgr *hwmgr) 559 559 { 560 - return ellesmere_copy_and_switch_arb_sets(hwmgr, 560 + return polaris10_copy_and_switch_arb_sets(hwmgr, 561 561 MC_CG_ARB_FREQ_F0, MC_CG_ARB_FREQ_F1); 562 562 } 563 563 564 - static int ellesmere_setup_default_pcie_table(struct pp_hwmgr *hwmgr) 564 + static int polaris10_setup_default_pcie_table(struct pp_hwmgr *hwmgr) 565 565 { 566 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 566 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 567 567 struct phm_ppt_v1_information *table_info = 568 568 (struct phm_ppt_v1_information *)(hwmgr->pptable); 569 569 struct phm_ppt_v1_pcie_table *pcie_table = table_info->pcie_table; ··· 660 660 * on the power policy or external client requests, 661 661 * such as UVD request, etc. 662 662 */ 663 - int ellesmere_setup_default_dpm_tables(struct pp_hwmgr *hwmgr) 663 + int polaris10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr) 664 664 { 665 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 665 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 666 666 struct phm_ppt_v1_information *table_info = 667 667 (struct phm_ppt_v1_information *)(hwmgr->pptable); 668 668 uint32_t i; ··· 725 725 } 726 726 727 727 /* setup PCIE gen speed levels */ 728 - ellesmere_setup_default_pcie_table(hwmgr); 728 + polaris10_setup_default_pcie_table(hwmgr); 729 729 730 730 /* save a copy of the default DPM table */ 731 731 memcpy(&(data->golden_dpm_table), &(data->dpm_table), 732 - sizeof(struct ellesmere_dpm_table)); 732 + sizeof(struct polaris10_dpm_table)); 733 733 734 734 return 0; 735 735 } ··· 746 746 * @param *table The SMC DPM table structure to be populated. 747 747 * @return 0 748 748 */ 749 - static int ellesmere_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, 749 + static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, 750 750 SMU74_Discrete_DpmTable *table) 751 751 { 752 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 752 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 753 753 uint32_t count, level; 754 754 755 - if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 755 + if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 756 756 count = data->mvdd_voltage_table.count; 757 757 if (count > SMU_MAX_SMIO_LEVELS) 758 758 count = SMU_MAX_SMIO_LEVELS; ··· 773 773 return 0; 774 774 } 775 775 776 - static int ellesmere_populate_smc_vddci_table(struct pp_hwmgr *hwmgr, 776 + static int polaris10_populate_smc_vddci_table(struct pp_hwmgr *hwmgr, 777 777 struct SMU74_Discrete_DpmTable *table) 778 778 { 779 779 uint32_t count, level; 780 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 780 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 781 781 782 782 count = data->vddci_voltage_table.count; 783 783 784 - if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 784 + if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 785 785 if (count > SMU_MAX_SMIO_LEVELS) 786 786 count = SMU_MAX_SMIO_LEVELS; 787 787 for (level = 0; level < count; ++level) { ··· 805 805 * @param table the SMC DPM table structure to be populated 806 806 * @return always 0 807 807 */ 808 - static int ellesmere_populate_cac_table(struct pp_hwmgr *hwmgr, 808 + static int polaris10_populate_cac_table(struct pp_hwmgr *hwmgr, 809 809 struct SMU74_Discrete_DpmTable *table) 810 810 { 811 811 uint32_t count; 812 812 uint8_t index; 813 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 813 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 814 814 struct phm_ppt_v1_information *table_info = 815 815 (struct phm_ppt_v1_information *)(hwmgr->pptable); 816 816 struct phm_ppt_v1_voltage_lookup_table *lookup_table = ··· 839 839 * @return always 0 840 840 */ 841 841 842 - int ellesmere_populate_smc_voltage_tables(struct pp_hwmgr *hwmgr, 842 + int polaris10_populate_smc_voltage_tables(struct pp_hwmgr *hwmgr, 843 843 struct SMU74_Discrete_DpmTable *table) 844 844 { 845 - ellesmere_populate_smc_vddci_table(hwmgr, table); 846 - ellesmere_populate_smc_mvdd_table(hwmgr, table); 847 - ellesmere_populate_cac_table(hwmgr, table); 845 + polaris10_populate_smc_vddci_table(hwmgr, table); 846 + polaris10_populate_smc_mvdd_table(hwmgr, table); 847 + polaris10_populate_cac_table(hwmgr, table); 848 848 849 849 return 0; 850 850 } 851 851 852 - static int ellesmere_populate_ulv_level(struct pp_hwmgr *hwmgr, 852 + static int polaris10_populate_ulv_level(struct pp_hwmgr *hwmgr, 853 853 struct SMU74_Discrete_Ulv *state) 854 854 { 855 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 855 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 856 856 struct phm_ppt_v1_information *table_info = 857 857 (struct phm_ppt_v1_information *)(hwmgr->pptable); 858 858 ··· 872 872 return 0; 873 873 } 874 874 875 - static int ellesmere_populate_ulv_state(struct pp_hwmgr *hwmgr, 875 + static int polaris10_populate_ulv_state(struct pp_hwmgr *hwmgr, 876 876 struct SMU74_Discrete_DpmTable *table) 877 877 { 878 - return ellesmere_populate_ulv_level(hwmgr, &table->Ulv); 878 + return polaris10_populate_ulv_level(hwmgr, &table->Ulv); 879 879 } 880 880 881 - static int ellesmere_populate_smc_link_level(struct pp_hwmgr *hwmgr, 881 + static int polaris10_populate_smc_link_level(struct pp_hwmgr *hwmgr, 882 882 struct SMU74_Discrete_DpmTable *table) 883 883 { 884 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 885 - struct ellesmere_dpm_table *dpm_table = &data->dpm_table; 884 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 885 + struct polaris10_dpm_table *dpm_table = &data->dpm_table; 886 886 int i; 887 887 888 888 /* Index (dpm_table->pcie_speed_table.count) ··· 906 906 return 0; 907 907 } 908 908 909 - static uint32_t ellesemere_get_xclk(struct pp_hwmgr *hwmgr) 909 + static uint32_t polaris10_get_xclk(struct pp_hwmgr *hwmgr) 910 910 { 911 911 uint32_t reference_clock, tmp; 912 912 struct cgs_display_info info = {0}; ··· 937 937 * @param clock the engine clock to use to populate the structure 938 938 * @param sclk the SMC SCLK structure to be populated 939 939 */ 940 - static int ellesmere_calculate_sclk_params(struct pp_hwmgr *hwmgr, 940 + static int polaris10_calculate_sclk_params(struct pp_hwmgr *hwmgr, 941 941 uint32_t clock, SMU_SclkSetting *sclk_setting) 942 942 { 943 - const struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 943 + const struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 944 944 const SMU74_Discrete_DpmTable *table = &(data->smc_state_table); 945 945 struct pp_atomctrl_clock_dividers_ai dividers; 946 946 ··· 968 968 return result; 969 969 } 970 970 971 - ref_clock = ellesemere_get_xclk(hwmgr); 971 + ref_clock = polaris10_get_xclk(hwmgr); 972 972 973 973 for (i = 0; i < NUM_SCLK_RANGE; i++) { 974 974 if (clock > data->range_table[i].trans_lower_frequency ··· 1001 1001 return 0; 1002 1002 } 1003 1003 1004 - static int ellesmere_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, 1004 + static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, 1005 1005 struct phm_ppt_v1_clock_voltage_dependency_table *dep_table, 1006 1006 uint32_t clock, SMU_VoltageLevel *voltage, uint32_t *mvdd) 1007 1007 { 1008 1008 uint32_t i; 1009 1009 uint16_t vddci; 1010 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1010 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1011 1011 1012 1012 *voltage = *mvdd = 0; 1013 1013 ··· 1020 1020 if (dep_table->entries[i].clk >= clock) { 1021 1021 *voltage |= (dep_table->entries[i].vddc * 1022 1022 VOLTAGE_SCALE) << VDDC_SHIFT; 1023 - if (ELLESMERE_VOLTAGE_CONTROL_NONE == data->vddci_control) 1023 + if (POLARIS10_VOLTAGE_CONTROL_NONE == data->vddci_control) 1024 1024 *voltage |= (data->vbios_boot_state.vddci_bootup_value * 1025 1025 VOLTAGE_SCALE) << VDDCI_SHIFT; 1026 1026 else if (dep_table->entries[i].vddci) ··· 1033 1033 *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; 1034 1034 } 1035 1035 1036 - if (ELLESMERE_VOLTAGE_CONTROL_NONE == data->mvdd_control) 1036 + if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) 1037 1037 *mvdd = data->vbios_boot_state.mvdd_bootup_value * 1038 1038 VOLTAGE_SCALE; 1039 1039 else if (dep_table->entries[i].mvdd) ··· 1048 1048 /* sclk is bigger than max sclk in the dependence table */ 1049 1049 *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT; 1050 1050 1051 - if (ELLESMERE_VOLTAGE_CONTROL_NONE == data->vddci_control) 1051 + if (POLARIS10_VOLTAGE_CONTROL_NONE == data->vddci_control) 1052 1052 *voltage |= (data->vbios_boot_state.vddci_bootup_value * 1053 1053 VOLTAGE_SCALE) << VDDCI_SHIFT; 1054 1054 else if (dep_table->entries[i-1].vddci) { ··· 1058 1058 *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; 1059 1059 } 1060 1060 1061 - if (ELLESMERE_VOLTAGE_CONTROL_NONE == data->mvdd_control) 1061 + if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) 1062 1062 *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE; 1063 1063 else if (dep_table->entries[i].mvdd) 1064 1064 *mvdd = (uint32_t) dep_table->entries[i - 1].mvdd * VOLTAGE_SCALE; ··· 1075 1075 {VCO_2_4, POSTDIV_DIV_BY_2, 75, 160, 108}, 1076 1076 {VCO_3_6, POSTDIV_DIV_BY_2, 112, 216, 160} }; 1077 1077 1078 - static void ellesmere_get_sclk_range_table(struct pp_hwmgr *hwmgr) 1078 + static void polaris10_get_sclk_range_table(struct pp_hwmgr *hwmgr) 1079 1079 { 1080 1080 uint32_t i, ref_clk; 1081 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1081 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1082 1082 SMU74_Discrete_DpmTable *table = &(data->smc_state_table); 1083 1083 struct pp_atom_ctrl_sclk_range_table range_table_from_vbios = { { {0} } }; 1084 1084 1085 - ref_clk = ellesemere_get_xclk(hwmgr); 1085 + ref_clk = polaris10_get_xclk(hwmgr); 1086 1086 1087 1087 if (0 == atomctrl_get_smc_sclk_range_table(hwmgr, &range_table_from_vbios)) { 1088 1088 for (i = 0; i < NUM_SCLK_RANGE; i++) { ··· 1126 1126 * @param sclk the SMC SCLK structure to be populated 1127 1127 */ 1128 1128 1129 - static int ellesmere_populate_single_graphic_level(struct pp_hwmgr *hwmgr, 1129 + static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr, 1130 1130 uint32_t clock, uint16_t sclk_al_threshold, 1131 1131 struct SMU74_Discrete_GraphicsLevel *level) 1132 1132 { 1133 1133 int result, i, temp; 1134 1134 /* PP_Clocks minClocks; */ 1135 1135 uint32_t mvdd; 1136 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1136 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1137 1137 struct phm_ppt_v1_information *table_info = 1138 1138 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1139 1139 SMU_SclkSetting curr_sclk_setting = { 0 }; 1140 1140 1141 - result = ellesmere_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting); 1141 + result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting); 1142 1142 1143 1143 /* populate graphics levels */ 1144 - result = ellesmere_get_dependency_volt_by_clk(hwmgr, 1144 + result = polaris10_get_dependency_volt_by_clk(hwmgr, 1145 1145 table_info->vdd_dep_on_sclk, clock, 1146 1146 &level->MinVoltage, &mvdd); 1147 1147 ··· 1171 1171 level->DeepSleepDivId = PhwFiji_GetSleepDividerIdFromClock(hwmgr, clock, minClocks.engineClockInSR); 1172 1172 */ 1173 1173 PP_ASSERT_WITH_CODE((clock >= 2500), "Engine clock can't satisfy stutter requirement!", return 0); 1174 - for (i = ELLESMERE_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { 1174 + for (i = POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { 1175 1175 temp = clock / (1UL << i); 1176 1176 1177 1177 if (temp >= 2500 || i == 0) ··· 1212 1212 * 1213 1213 * @param hwmgr the address of the hardware manager 1214 1214 */ 1215 - static int ellesmere_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) 1215 + static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) 1216 1216 { 1217 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1218 - struct ellesmere_dpm_table *dpm_table = &data->dpm_table; 1217 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1218 + struct polaris10_dpm_table *dpm_table = &data->dpm_table; 1219 1219 struct phm_ppt_v1_information *table_info = 1220 1220 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1221 1221 struct phm_ppt_v1_pcie_table *pcie_table = table_info->pcie_table; ··· 1233 1233 mid_pcie_level_enabled = 0, 1234 1234 count = 0; 1235 1235 1236 - ellesmere_get_sclk_range_table(hwmgr); 1236 + polaris10_get_sclk_range_table(hwmgr); 1237 1237 1238 1238 for (i = 0; i < dpm_table->sclk_table.count; i++) { 1239 1239 1240 - result = ellesmere_populate_single_graphic_level(hwmgr, 1240 + result = polaris10_populate_single_graphic_level(hwmgr, 1241 1241 dpm_table->sclk_table.dpm_levels[i].value, 1242 1242 (uint16_t)data->activity_target[i], 1243 1243 &(data->smc_state_table.GraphicsLevel[i])); ··· 1296 1296 levels[1].pcieDpmLevel = mid_pcie_level_enabled; 1297 1297 } 1298 1298 /* level count will send to smc once at init smc table and never change */ 1299 - result = ellesmere_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels, 1299 + result = polaris10_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels, 1300 1300 (uint32_t)array_size, data->sram_end); 1301 1301 1302 1302 return result; 1303 1303 } 1304 1304 1305 - static int ellesmere_populate_single_memory_level(struct pp_hwmgr *hwmgr, 1305 + static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, 1306 1306 uint32_t clock, struct SMU74_Discrete_MemoryLevel *mem_level) 1307 1307 { 1308 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1308 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1309 1309 struct phm_ppt_v1_information *table_info = 1310 1310 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1311 1311 int result = 0; ··· 1314 1314 cgs_get_active_displays_info(hwmgr->device, &info); 1315 1315 1316 1316 if (table_info->vdd_dep_on_mclk) { 1317 - result = ellesmere_get_dependency_volt_by_clk(hwmgr, 1317 + result = polaris10_get_dependency_volt_by_clk(hwmgr, 1318 1318 table_info->vdd_dep_on_mclk, clock, 1319 1319 &mem_level->MinVoltage, &mem_level->MinMvdd); 1320 1320 PP_ASSERT_WITH_CODE((0 == result), ··· 1356 1356 * 1357 1357 * @param hwmgr the address of the hardware manager 1358 1358 */ 1359 - static int ellesmere_populate_all_memory_levels(struct pp_hwmgr *hwmgr) 1359 + static int polaris10_populate_all_memory_levels(struct pp_hwmgr *hwmgr) 1360 1360 { 1361 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1362 - struct ellesmere_dpm_table *dpm_table = &data->dpm_table; 1361 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1362 + struct polaris10_dpm_table *dpm_table = &data->dpm_table; 1363 1363 int result; 1364 1364 /* populate MCLK dpm table to SMU7 */ 1365 1365 uint32_t array = data->dpm_table_start + ··· 1374 1374 PP_ASSERT_WITH_CODE((0 != dpm_table->mclk_table.dpm_levels[i].value), 1375 1375 "can not populate memory level as memory clock is zero", 1376 1376 return -EINVAL); 1377 - result = ellesmere_populate_single_memory_level(hwmgr, 1377 + result = polaris10_populate_single_memory_level(hwmgr, 1378 1378 dpm_table->mclk_table.dpm_levels[i].value, 1379 1379 &levels[i]); 1380 1380 if (result) ··· 1401 1401 PPSMC_DISPLAY_WATERMARK_HIGH; 1402 1402 1403 1403 /* level count will send to smc once at init smc table and never change */ 1404 - result = ellesmere_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels, 1404 + result = polaris10_copy_bytes_to_smc(hwmgr->smumgr, array, (uint8_t *)levels, 1405 1405 (uint32_t)array_size, data->sram_end); 1406 1406 1407 1407 return result; ··· 1414 1414 * @param mclk the MCLK value to be used in the decision if MVDD should be high or low. 1415 1415 * @param voltage the SMC VOLTAGE structure to be populated 1416 1416 */ 1417 - int ellesmere_populate_mvdd_value(struct pp_hwmgr *hwmgr, 1417 + int polaris10_populate_mvdd_value(struct pp_hwmgr *hwmgr, 1418 1418 uint32_t mclk, SMIO_Pattern *smio_pat) 1419 1419 { 1420 - const struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1420 + const struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1421 1421 struct phm_ppt_v1_information *table_info = 1422 1422 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1423 1423 uint32_t i = 0; 1424 1424 1425 - if (ELLESMERE_VOLTAGE_CONTROL_NONE != data->mvdd_control) { 1425 + if (POLARIS10_VOLTAGE_CONTROL_NONE != data->mvdd_control) { 1426 1426 /* find mvdd value which clock is more than request */ 1427 1427 for (i = 0; i < table_info->vdd_dep_on_mclk->count; i++) { 1428 1428 if (mclk <= table_info->vdd_dep_on_mclk->entries[i].clk) { ··· 1439 1439 return 0; 1440 1440 } 1441 1441 1442 - static int ellesmere_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, 1442 + static int polaris10_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, 1443 1443 SMU74_Discrete_DpmTable *table) 1444 1444 { 1445 1445 int result = 0; 1446 1446 uint32_t sclk_frequency; 1447 - const struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1447 + const struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1448 1448 struct phm_ppt_v1_information *table_info = 1449 1449 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1450 1450 SMIO_Pattern vol_level; ··· 1457 1457 /* Get MinVoltage and Frequency from DPM0, 1458 1458 * already converted to SMC_UL */ 1459 1459 sclk_frequency = data->dpm_table.sclk_table.dpm_levels[0].value; 1460 - result = ellesmere_get_dependency_volt_by_clk(hwmgr, 1460 + result = polaris10_get_dependency_volt_by_clk(hwmgr, 1461 1461 table_info->vdd_dep_on_sclk, 1462 1462 table->ACPILevel.SclkFrequency, 1463 1463 &table->ACPILevel.MinVoltage, &mvdd); ··· 1470 1470 data->vbios_boot_state.vddc_bootup_value * VOLTAGE_SCALE; 1471 1471 } 1472 1472 1473 - result = ellesmere_calculate_sclk_params(hwmgr, sclk_frequency, &(table->ACPILevel.SclkSetting)); 1473 + result = polaris10_calculate_sclk_params(hwmgr, sclk_frequency, &(table->ACPILevel.SclkSetting)); 1474 1474 PP_ASSERT_WITH_CODE(result == 0, "Error retrieving Engine Clock dividers from VBIOS.", return result); 1475 1475 1476 1476 table->ACPILevel.DeepSleepDivId = 0; ··· 1497 1497 /* Get MinVoltage and Frequency from DPM0, already converted to SMC_UL */ 1498 1498 table->MemoryACPILevel.MclkFrequency = 1499 1499 data->dpm_table.mclk_table.dpm_levels[0].value; 1500 - result = ellesmere_get_dependency_volt_by_clk(hwmgr, 1500 + result = polaris10_get_dependency_volt_by_clk(hwmgr, 1501 1501 table_info->vdd_dep_on_mclk, 1502 1502 table->MemoryACPILevel.MclkFrequency, 1503 1503 &table->MemoryACPILevel.MinVoltage, &mvdd); ··· 1513 1513 } 1514 1514 1515 1515 us_mvdd = 0; 1516 - if ((ELLESMERE_VOLTAGE_CONTROL_NONE == data->mvdd_control) || 1516 + if ((POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) || 1517 1517 (data->mclk_dpm_key_disabled)) 1518 1518 us_mvdd = data->vbios_boot_state.mvdd_bootup_value; 1519 1519 else { 1520 - if (!ellesmere_populate_mvdd_value(hwmgr, 1520 + if (!polaris10_populate_mvdd_value(hwmgr, 1521 1521 data->dpm_table.mclk_table.dpm_levels[0].value, 1522 1522 &vol_level)) 1523 1523 us_mvdd = vol_level.Voltage; 1524 1524 } 1525 1525 1526 - if (0 == ellesmere_populate_mvdd_value(hwmgr, 0, &vol_level)) 1526 + if (0 == polaris10_populate_mvdd_value(hwmgr, 0, &vol_level)) 1527 1527 table->MemoryACPILevel.MinMvdd = PP_HOST_TO_SMC_UL(vol_level.Voltage); 1528 1528 else 1529 1529 table->MemoryACPILevel.MinMvdd = 0; ··· 1544 1544 return result; 1545 1545 } 1546 1546 1547 - static int ellesmere_populate_smc_vce_level(struct pp_hwmgr *hwmgr, 1547 + static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr, 1548 1548 SMU74_Discrete_DpmTable *table) 1549 1549 { 1550 1550 int result = -EINVAL; ··· 1554 1554 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1555 1555 struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = 1556 1556 table_info->mm_dep_table; 1557 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1557 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1558 1558 1559 1559 table->VceLevelCount = (uint8_t)(mm_table->count); 1560 1560 table->VceBootLevel = 0; ··· 1583 1583 return result; 1584 1584 } 1585 1585 1586 - static int ellesmere_populate_smc_samu_level(struct pp_hwmgr *hwmgr, 1586 + static int polaris10_populate_smc_samu_level(struct pp_hwmgr *hwmgr, 1587 1587 SMU74_Discrete_DpmTable *table) 1588 1588 { 1589 1589 int result = -EINVAL; ··· 1593 1593 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1594 1594 struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = 1595 1595 table_info->mm_dep_table; 1596 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1596 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1597 1597 1598 1598 table->SamuBootLevel = 0; 1599 1599 table->SamuLevelCount = (uint8_t)(mm_table->count); ··· 1621 1621 return result; 1622 1622 } 1623 1623 1624 - static int ellesmere_populate_memory_timing_parameters(struct pp_hwmgr *hwmgr, 1624 + static int polaris10_populate_memory_timing_parameters(struct pp_hwmgr *hwmgr, 1625 1625 int32_t eng_clock, int32_t mem_clock, 1626 1626 SMU74_Discrete_MCArbDramTimingTableEntry *arb_regs) 1627 1627 { ··· 1647 1647 return 0; 1648 1648 } 1649 1649 1650 - static int ellesmere_program_memory_timing_parameters(struct pp_hwmgr *hwmgr) 1650 + static int polaris10_program_memory_timing_parameters(struct pp_hwmgr *hwmgr) 1651 1651 { 1652 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1652 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1653 1653 struct SMU74_Discrete_MCArbDramTimingTable arb_regs; 1654 1654 uint32_t i, j; 1655 1655 int result = 0; 1656 1656 1657 1657 for (i = 0; i < data->dpm_table.sclk_table.count; i++) { 1658 1658 for (j = 0; j < data->dpm_table.mclk_table.count; j++) { 1659 - result = ellesmere_populate_memory_timing_parameters(hwmgr, 1659 + result = polaris10_populate_memory_timing_parameters(hwmgr, 1660 1660 data->dpm_table.sclk_table.dpm_levels[i].value, 1661 1661 data->dpm_table.mclk_table.dpm_levels[j].value, 1662 1662 &arb_regs.entries[i][j]); ··· 1667 1667 } 1668 1668 } 1669 1669 1670 - result = ellesmere_copy_bytes_to_smc( 1670 + result = polaris10_copy_bytes_to_smc( 1671 1671 hwmgr->smumgr, 1672 1672 data->arb_table_start, 1673 1673 (uint8_t *)&arb_regs, ··· 1676 1676 return result; 1677 1677 } 1678 1678 1679 - static int ellesmere_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, 1679 + static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, 1680 1680 struct SMU74_Discrete_DpmTable *table) 1681 1681 { 1682 1682 int result = -EINVAL; ··· 1686 1686 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1687 1687 struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = 1688 1688 table_info->mm_dep_table; 1689 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1689 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1690 1690 1691 1691 table->UvdLevelCount = (uint8_t)(mm_table->count); 1692 1692 table->UvdBootLevel = 0; ··· 1723 1723 return result; 1724 1724 } 1725 1725 1726 - static int ellesmere_populate_smc_boot_level(struct pp_hwmgr *hwmgr, 1726 + static int polaris10_populate_smc_boot_level(struct pp_hwmgr *hwmgr, 1727 1727 struct SMU74_Discrete_DpmTable *table) 1728 1728 { 1729 1729 int result = 0; 1730 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1730 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1731 1731 1732 1732 table->GraphicsBootLevel = 0; 1733 1733 table->MemoryBootLevel = 0; ··· 1756 1756 } 1757 1757 1758 1758 1759 - static int ellesmere_populate_smc_initailial_state(struct pp_hwmgr *hwmgr) 1759 + static int polaris10_populate_smc_initailial_state(struct pp_hwmgr *hwmgr) 1760 1760 { 1761 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1761 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1762 1762 struct phm_ppt_v1_information *table_info = 1763 1763 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1764 1764 uint8_t count, level; ··· 1785 1785 return 0; 1786 1786 } 1787 1787 1788 - static int ellesmere_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) 1788 + static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) 1789 1789 { 1790 1790 uint32_t ro, efuse, efuse2, clock_freq, volt_without_cks, 1791 1791 volt_with_cks, value; 1792 1792 uint16_t clock_freq_u16; 1793 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1793 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1794 1794 uint8_t type, i, j, cks_setting, stretch_amount, stretch_amount2, 1795 1795 volt_offset = 0; 1796 1796 struct phm_ppt_v1_information *table_info = ··· 1865 1865 ixPWR_CKS_CNTL); 1866 1866 value &= 0xFFC2FF87; 1867 1867 data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq = 1868 - ellesmere_clock_stretcher_lookup_table[stretch_amount2][0]; 1868 + polaris10_clock_stretcher_lookup_table[stretch_amount2][0]; 1869 1869 data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq = 1870 - ellesmere_clock_stretcher_lookup_table[stretch_amount2][1]; 1870 + polaris10_clock_stretcher_lookup_table[stretch_amount2][1]; 1871 1871 clock_freq_u16 = (uint16_t)(PP_SMC_TO_HOST_UL(data->smc_state_table. 1872 1872 GraphicsLevel[data->smc_state_table.GraphicsDpmLevelCount - 1].SclkSetting.SclkFrequency) / 100); 1873 - if (ellesmere_clock_stretcher_lookup_table[stretch_amount2][0] < clock_freq_u16 1874 - && ellesmere_clock_stretcher_lookup_table[stretch_amount2][1] > clock_freq_u16) { 1873 + if (polaris10_clock_stretcher_lookup_table[stretch_amount2][0] < clock_freq_u16 1874 + && polaris10_clock_stretcher_lookup_table[stretch_amount2][1] > clock_freq_u16) { 1875 1875 /* Program PWR_CKS_CNTL. CKS_USE_FOR_LOW_FREQ */ 1876 - value |= (ellesmere_clock_stretcher_lookup_table[stretch_amount2][3]) << 16; 1876 + value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 16; 1877 1877 /* Program PWR_CKS_CNTL. CKS_LDO_REFSEL */ 1878 - value |= (ellesmere_clock_stretcher_lookup_table[stretch_amount2][2]) << 18; 1878 + value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][2]) << 18; 1879 1879 /* Program PWR_CKS_CNTL. CKS_STRETCH_AMOUNT */ 1880 - value |= (ellesmere_clock_stretch_amount_conversion 1881 - [ellesmere_clock_stretcher_lookup_table[stretch_amount2][3]] 1880 + value |= (polaris10_clock_stretch_amount_conversion 1881 + [polaris10_clock_stretcher_lookup_table[stretch_amount2][3]] 1882 1882 [stretch_amount]) << 3; 1883 1883 } 1884 1884 CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq); 1885 1885 CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq); 1886 1886 data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting = 1887 - ellesmere_clock_stretcher_lookup_table[stretch_amount2][2] & 0x7F; 1887 + polaris10_clock_stretcher_lookup_table[stretch_amount2][2] & 0x7F; 1888 1888 data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting |= 1889 - (ellesmere_clock_stretcher_lookup_table[stretch_amount2][3]) << 7; 1889 + (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 7; 1890 1890 1891 1891 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, 1892 1892 ixPWR_CKS_CNTL, value); ··· 1897 1897 * in the last row of Clock Stretcher Voltage Table. 1898 1898 */ 1899 1899 data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].minVID = 1900 - (uint8_t) ellesmere_clock_stretcher_ddt_table[type][i][2]; 1900 + (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][2]; 1901 1901 data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].maxVID = 1902 - (uint8_t) ellesmere_clock_stretcher_ddt_table[type][i][3]; 1902 + (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][3]; 1903 1903 /* Loop through each SCLK and check the frequency 1904 1904 * to see if it lies within the frequency for clock stretcher. 1905 1905 */ ··· 1912 1912 * and it's in 10Khz unit, 1913 1913 * as opposed to Data table, which is in Mhz unit. 1914 1914 */ 1915 - if (clock_freq >= (ellesmere_clock_stretcher_ddt_table[type][i][0]) * 100) { 1915 + if (clock_freq >= (polaris10_clock_stretcher_ddt_table[type][i][0]) * 100) { 1916 1916 cks_setting |= 0x2; 1917 - if (clock_freq < (ellesmere_clock_stretcher_ddt_table[type][i][1]) * 100) 1917 + if (clock_freq < (polaris10_clock_stretcher_ddt_table[type][i][1]) * 100) 1918 1918 cks_setting |= 0x1; 1919 1919 } 1920 1920 data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].setting ··· 1938 1938 * @param table the SMC DPM table structure to be populated 1939 1939 * @return always 0 1940 1940 */ 1941 - static int ellesmere_populate_vr_config(struct pp_hwmgr *hwmgr, 1941 + static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr, 1942 1942 struct SMU74_Discrete_DpmTable *table) 1943 1943 { 1944 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1944 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1945 1945 uint16_t config; 1946 1946 1947 1947 config = VR_MERGED_WITH_VDDC; 1948 1948 table->VRConfig |= (config << VRCONF_VDDGFX_SHIFT); 1949 1949 1950 1950 /* Set Vddc Voltage Controller */ 1951 - if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { 1951 + if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { 1952 1952 config = VR_SVI2_PLANE_1; 1953 1953 table->VRConfig |= config; 1954 1954 } else { ··· 1957 1957 ); 1958 1958 } 1959 1959 /* Set Vddci Voltage Controller */ 1960 - if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) { 1960 + if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) { 1961 1961 config = VR_SVI2_PLANE_2; /* only in merged mode */ 1962 1962 table->VRConfig |= (config << VRCONF_VDDCI_SHIFT); 1963 - } else if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 1963 + } else if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) { 1964 1964 config = VR_SMIO_PATTERN_1; 1965 1965 table->VRConfig |= (config << VRCONF_VDDCI_SHIFT); 1966 1966 } else { ··· 1968 1968 table->VRConfig |= (config << VRCONF_VDDCI_SHIFT); 1969 1969 } 1970 1970 /* Set Mvdd Voltage Controller */ 1971 - if (ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 == data->mvdd_control) { 1971 + if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->mvdd_control) { 1972 1972 config = VR_SVI2_PLANE_2; 1973 1973 table->VRConfig |= (config << VRCONF_MVDD_SHIFT); 1974 - } else if (ELLESMERE_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 1974 + } else if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { 1975 1975 config = VR_SMIO_PATTERN_2; 1976 1976 table->VRConfig |= (config << VRCONF_MVDD_SHIFT); 1977 1977 } else { ··· 1988 1988 * @param hwmgr the address of the powerplay hardware manager. 1989 1989 * @return always 0 1990 1990 */ 1991 - static int ellesmere_init_smc_table(struct pp_hwmgr *hwmgr) 1991 + static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) 1992 1992 { 1993 1993 int result; 1994 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 1994 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1995 1995 struct phm_ppt_v1_information *table_info = 1996 1996 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1997 1997 struct SMU74_Discrete_DpmTable *table = &(data->smc_state_table); 1998 - const struct ellesmere_ulv_parm *ulv = &(data->ulv); 1998 + const struct polaris10_ulv_parm *ulv = &(data->ulv); 1999 1999 uint8_t i; 2000 2000 struct pp_atomctrl_gpio_pin_assignment gpio_pin; 2001 2001 pp_atomctrl_clock_dividers_vi dividers; 2002 2002 2003 - result = ellesmere_setup_default_dpm_tables(hwmgr); 2003 + result = polaris10_setup_default_dpm_tables(hwmgr); 2004 2004 PP_ASSERT_WITH_CODE(0 == result, 2005 2005 "Failed to setup default DPM tables!", return result); 2006 2006 2007 - if (ELLESMERE_VOLTAGE_CONTROL_NONE != data->voltage_control) 2008 - ellesmere_populate_smc_voltage_tables(hwmgr, table); 2007 + if (POLARIS10_VOLTAGE_CONTROL_NONE != data->voltage_control) 2008 + polaris10_populate_smc_voltage_tables(hwmgr, table); 2009 2009 2010 2010 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2011 2011 PHM_PlatformCaps_AutomaticDCTransition)) ··· 2019 2019 table->SystemFlags |= PPSMC_SYSTEMFLAG_GDDR5; 2020 2020 2021 2021 if (ulv->ulv_supported && table_info->us_ulv_voltage_offset) { 2022 - result = ellesmere_populate_ulv_state(hwmgr, table); 2022 + result = polaris10_populate_ulv_state(hwmgr, table); 2023 2023 PP_ASSERT_WITH_CODE(0 == result, 2024 2024 "Failed to initialize ULV state!", return result); 2025 2025 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, 2026 - ixCG_ULV_PARAMETER, PPELLESMERE_CGULVPARAMETER_DFLT); 2026 + ixCG_ULV_PARAMETER, PPPOLARIS10_CGULVPARAMETER_DFLT); 2027 2027 } 2028 2028 2029 - result = ellesmere_populate_smc_link_level(hwmgr, table); 2029 + result = polaris10_populate_smc_link_level(hwmgr, table); 2030 2030 PP_ASSERT_WITH_CODE(0 == result, 2031 2031 "Failed to initialize Link Level!", return result); 2032 2032 2033 - result = ellesmere_populate_all_graphic_levels(hwmgr); 2033 + result = polaris10_populate_all_graphic_levels(hwmgr); 2034 2034 PP_ASSERT_WITH_CODE(0 == result, 2035 2035 "Failed to initialize Graphics Level!", return result); 2036 2036 2037 - result = ellesmere_populate_all_memory_levels(hwmgr); 2037 + result = polaris10_populate_all_memory_levels(hwmgr); 2038 2038 PP_ASSERT_WITH_CODE(0 == result, 2039 2039 "Failed to initialize Memory Level!", return result); 2040 2040 2041 - result = ellesmere_populate_smc_acpi_level(hwmgr, table); 2041 + result = polaris10_populate_smc_acpi_level(hwmgr, table); 2042 2042 PP_ASSERT_WITH_CODE(0 == result, 2043 2043 "Failed to initialize ACPI Level!", return result); 2044 2044 2045 - result = ellesmere_populate_smc_vce_level(hwmgr, table); 2045 + result = polaris10_populate_smc_vce_level(hwmgr, table); 2046 2046 PP_ASSERT_WITH_CODE(0 == result, 2047 2047 "Failed to initialize VCE Level!", return result); 2048 2048 2049 - result = ellesmere_populate_smc_samu_level(hwmgr, table); 2049 + result = polaris10_populate_smc_samu_level(hwmgr, table); 2050 2050 PP_ASSERT_WITH_CODE(0 == result, 2051 2051 "Failed to initialize SAMU Level!", return result); 2052 2052 ··· 2054 2054 * (the other states are just copies of the boot state) we only 2055 2055 * need to populate the ARB settings for the initial state. 2056 2056 */ 2057 - result = ellesmere_program_memory_timing_parameters(hwmgr); 2057 + result = polaris10_program_memory_timing_parameters(hwmgr); 2058 2058 PP_ASSERT_WITH_CODE(0 == result, 2059 2059 "Failed to Write ARB settings for the initial state.", return result); 2060 2060 2061 - result = ellesmere_populate_smc_uvd_level(hwmgr, table); 2061 + result = polaris10_populate_smc_uvd_level(hwmgr, table); 2062 2062 PP_ASSERT_WITH_CODE(0 == result, 2063 2063 "Failed to initialize UVD Level!", return result); 2064 2064 2065 - result = ellesmere_populate_smc_boot_level(hwmgr, table); 2065 + result = polaris10_populate_smc_boot_level(hwmgr, table); 2066 2066 PP_ASSERT_WITH_CODE(0 == result, 2067 2067 "Failed to initialize Boot Level!", return result); 2068 2068 2069 - result = ellesmere_populate_smc_initailial_state(hwmgr); 2069 + result = polaris10_populate_smc_initailial_state(hwmgr); 2070 2070 PP_ASSERT_WITH_CODE(0 == result, 2071 2071 "Failed to initialize Boot State!", return result); 2072 2072 2073 - result = ellesmere_populate_bapm_parameters_in_dpm_table(hwmgr); 2073 + result = polaris10_populate_bapm_parameters_in_dpm_table(hwmgr); 2074 2074 PP_ASSERT_WITH_CODE(0 == result, 2075 2075 "Failed to populate BAPM Parameters!", return result); 2076 2076 2077 2077 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2078 2078 PHM_PlatformCaps_ClockStretcher)) { 2079 - result = ellesmere_populate_clock_stretcher_data_table(hwmgr); 2079 + result = polaris10_populate_clock_stretcher_data_table(hwmgr); 2080 2080 PP_ASSERT_WITH_CODE(0 == result, 2081 2081 "Failed to populate Clock Stretcher Data Table!", 2082 2082 return result); ··· 2089 2089 table->ThermalInterval = 1; 2090 2090 table->TemperatureLimitHigh = 2091 2091 table_info->cac_dtp_table->usTargetOperatingTemp * 2092 - ELLESMERE_Q88_FORMAT_CONVERSION_UNIT; 2092 + POLARIS10_Q88_FORMAT_CONVERSION_UNIT; 2093 2093 table->TemperatureLimitLow = 2094 2094 (table_info->cac_dtp_table->usTargetOperatingTemp - 1) * 2095 - ELLESMERE_Q88_FORMAT_CONVERSION_UNIT; 2095 + POLARIS10_Q88_FORMAT_CONVERSION_UNIT; 2096 2096 table->MemoryVoltageChangeEnable = 1; 2097 2097 table->MemoryInterval = 1; 2098 2098 table->VoltageResponseTime = 0; ··· 2101 2101 table->PCIeBootLinkLevel = 0; 2102 2102 table->PCIeGenInterval = 1; 2103 2103 2104 - result = ellesmere_populate_vr_config(hwmgr, table); 2104 + result = polaris10_populate_vr_config(hwmgr, table); 2105 2105 PP_ASSERT_WITH_CODE(0 == result, 2106 2106 "Failed to populate VRConfig setting!", return result); 2107 2107 ··· 2111 2111 if (atomctrl_get_pp_assign_pin(hwmgr, VDDC_VRHOT_GPIO_PINID, &gpio_pin)) { 2112 2112 table->VRHotGpio = gpio_pin.uc_gpio_pin_bit_shift; 2113 2113 } else { 2114 - table->VRHotGpio = ELLESMERE_UNUSED_GPIO_PIN; 2114 + table->VRHotGpio = POLARIS10_UNUSED_GPIO_PIN; 2115 2115 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2116 2116 PHM_PlatformCaps_RegulatorHot); 2117 2117 } ··· 2122 2122 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2123 2123 PHM_PlatformCaps_AutomaticDCTransition); 2124 2124 } else { 2125 - table->AcDcGpio = ELLESMERE_UNUSED_GPIO_PIN; 2125 + table->AcDcGpio = POLARIS10_UNUSED_GPIO_PIN; 2126 2126 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2127 2127 PHM_PlatformCaps_AutomaticDCTransition); 2128 2128 } ··· 2179 2179 CONVERT_FROM_HOST_TO_SMC_US(table->PhaseResponseTime); 2180 2180 2181 2181 /* Upload all dpm data to SMC memory.(dpm level, dpm level count etc) */ 2182 - result = ellesmere_copy_bytes_to_smc(hwmgr->smumgr, 2182 + result = polaris10_copy_bytes_to_smc(hwmgr->smumgr, 2183 2183 data->dpm_table_start + 2184 2184 offsetof(SMU74_Discrete_DpmTable, SystemFlags), 2185 2185 (uint8_t *)&(table->SystemFlags), ··· 2197 2197 * @param hwmgr the address of the powerplay hardware manager. 2198 2198 * @return always 0 2199 2199 */ 2200 - static int ellesmere_init_arb_table_index(struct pp_hwmgr *hwmgr) 2200 + static int polaris10_init_arb_table_index(struct pp_hwmgr *hwmgr) 2201 2201 { 2202 - const struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2202 + const struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2203 2203 uint32_t tmp; 2204 2204 int result; 2205 2205 ··· 2211 2211 * In reality this field should not be in that structure 2212 2212 * but in a soft register. 2213 2213 */ 2214 - result = ellesmere_read_smc_sram_dword(hwmgr->smumgr, 2214 + result = polaris10_read_smc_sram_dword(hwmgr->smumgr, 2215 2215 data->arb_table_start, &tmp, data->sram_end); 2216 2216 2217 2217 if (result) ··· 2220 2220 tmp &= 0x00FFFFFF; 2221 2221 tmp |= ((uint32_t)MC_CG_ARB_FREQ_F1) << 24; 2222 2222 2223 - return ellesmere_write_smc_sram_dword(hwmgr->smumgr, 2223 + return polaris10_write_smc_sram_dword(hwmgr->smumgr, 2224 2224 data->arb_table_start, tmp, data->sram_end); 2225 2225 } 2226 2226 2227 - static int ellesmere_enable_vrhot_gpio_interrupt(struct pp_hwmgr *hwmgr) 2227 + static int polaris10_enable_vrhot_gpio_interrupt(struct pp_hwmgr *hwmgr) 2228 2228 { 2229 2229 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2230 2230 PHM_PlatformCaps_RegulatorHot)) ··· 2234 2234 return 0; 2235 2235 } 2236 2236 2237 - static int ellesmere_enable_sclk_control(struct pp_hwmgr *hwmgr) 2237 + static int polaris10_enable_sclk_control(struct pp_hwmgr *hwmgr) 2238 2238 { 2239 2239 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, SCLK_PWRMGT_CNTL, 2240 2240 SCLK_PWRMGT_OFF, 0); 2241 2241 return 0; 2242 2242 } 2243 2243 2244 - static int ellesmere_enable_ulv(struct pp_hwmgr *hwmgr) 2244 + static int polaris10_enable_ulv(struct pp_hwmgr *hwmgr) 2245 2245 { 2246 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2247 - struct ellesmere_ulv_parm *ulv = &(data->ulv); 2246 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2247 + struct polaris10_ulv_parm *ulv = &(data->ulv); 2248 2248 2249 2249 if (ulv->ulv_supported) 2250 2250 return smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_EnableULV); ··· 2252 2252 return 0; 2253 2253 } 2254 2254 2255 - static int ellesmere_enable_deep_sleep_master_switch(struct pp_hwmgr *hwmgr) 2255 + static int polaris10_enable_deep_sleep_master_switch(struct pp_hwmgr *hwmgr) 2256 2256 { 2257 2257 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2258 2258 PHM_PlatformCaps_SclkDeepSleep)) { ··· 2272 2272 return 0; 2273 2273 } 2274 2274 2275 - static int ellesmere_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 2275 + static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 2276 2276 { 2277 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2277 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2278 2278 2279 2279 /* enable SCLK dpm */ 2280 2280 if (!data->sclk_dpm_key_disabled) ··· 2307 2307 return 0; 2308 2308 } 2309 2309 2310 - static int ellesmere_start_dpm(struct pp_hwmgr *hwmgr) 2310 + static int polaris10_start_dpm(struct pp_hwmgr *hwmgr) 2311 2311 { 2312 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2312 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2313 2313 2314 2314 /*enable general power management */ 2315 2315 ··· 2336 2336 return -1); 2337 2337 */ 2338 2338 2339 - if (ellesmere_enable_sclk_mclk_dpm(hwmgr)) { 2339 + if (polaris10_enable_sclk_mclk_dpm(hwmgr)) { 2340 2340 printk(KERN_ERR "Failed to enable Sclk DPM and Mclk DPM!"); 2341 2341 return -1; 2342 2342 } ··· 2358 2358 return 0; 2359 2359 } 2360 2360 2361 - static void ellesmere_set_dpm_event_sources(struct pp_hwmgr *hwmgr, uint32_t sources) 2361 + static void polaris10_set_dpm_event_sources(struct pp_hwmgr *hwmgr, uint32_t sources) 2362 2362 { 2363 2363 bool protection; 2364 2364 enum DPM_EVENT_SRC src; ··· 2398 2398 THERMAL_PROTECTION_DIS, 1); 2399 2399 } 2400 2400 2401 - static int ellesmere_enable_auto_throttle_source(struct pp_hwmgr *hwmgr, 2401 + static int polaris10_enable_auto_throttle_source(struct pp_hwmgr *hwmgr, 2402 2402 PHM_AutoThrottleSource source) 2403 2403 { 2404 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2404 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2405 2405 2406 2406 if (!(data->active_auto_throttle_sources & (1 << source))) { 2407 2407 data->active_auto_throttle_sources |= 1 << source; 2408 - ellesmere_set_dpm_event_sources(hwmgr, data->active_auto_throttle_sources); 2408 + polaris10_set_dpm_event_sources(hwmgr, data->active_auto_throttle_sources); 2409 2409 } 2410 2410 return 0; 2411 2411 } 2412 2412 2413 - static int ellesmere_enable_thermal_auto_throttle(struct pp_hwmgr *hwmgr) 2413 + static int polaris10_enable_thermal_auto_throttle(struct pp_hwmgr *hwmgr) 2414 2414 { 2415 - return ellesmere_enable_auto_throttle_source(hwmgr, PHM_AutoThrottleSource_Thermal); 2415 + return polaris10_enable_auto_throttle_source(hwmgr, PHM_AutoThrottleSource_Thermal); 2416 2416 } 2417 2417 2418 - int ellesmere_pcie_performance_request(struct pp_hwmgr *hwmgr) 2418 + int polaris10_pcie_performance_request(struct pp_hwmgr *hwmgr) 2419 2419 { 2420 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2420 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2421 2421 data->pcie_performance_request = true; 2422 2422 2423 2423 return 0; 2424 2424 } 2425 2425 2426 - int ellesmere_enable_dpm_tasks(struct pp_hwmgr *hwmgr) 2426 + int polaris10_enable_dpm_tasks(struct pp_hwmgr *hwmgr) 2427 2427 { 2428 2428 int tmp_result, result = 0; 2429 - tmp_result = (!ellesmere_is_dpm_running(hwmgr)) ? 0 : -1; 2429 + tmp_result = (!polaris10_is_dpm_running(hwmgr)) ? 0 : -1; 2430 2430 PP_ASSERT_WITH_CODE(result == 0, 2431 2431 "DPM is already running right now, no need to enable DPM!", 2432 2432 return 0); 2433 2433 2434 - if (ellesmere_voltage_control(hwmgr)) { 2435 - tmp_result = ellesmere_enable_voltage_control(hwmgr); 2434 + if (polaris10_voltage_control(hwmgr)) { 2435 + tmp_result = polaris10_enable_voltage_control(hwmgr); 2436 2436 PP_ASSERT_WITH_CODE(tmp_result == 0, 2437 2437 "Failed to enable voltage control!", 2438 2438 result = tmp_result); 2439 2439 2440 - tmp_result = ellesmere_construct_voltage_tables(hwmgr); 2440 + tmp_result = polaris10_construct_voltage_tables(hwmgr); 2441 2441 PP_ASSERT_WITH_CODE((0 == tmp_result), 2442 2442 "Failed to contruct voltage tables!", 2443 2443 result = tmp_result); ··· 2453 2453 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 2454 2454 GENERAL_PWRMGT, THERMAL_PROTECTION_DIS, 0); 2455 2455 2456 - tmp_result = ellesmere_program_static_screen_threshold_parameters(hwmgr); 2456 + tmp_result = polaris10_program_static_screen_threshold_parameters(hwmgr); 2457 2457 PP_ASSERT_WITH_CODE((0 == tmp_result), 2458 2458 "Failed to program static screen threshold parameters!", 2459 2459 result = tmp_result); 2460 2460 2461 - tmp_result = ellesmere_enable_display_gap(hwmgr); 2461 + tmp_result = polaris10_enable_display_gap(hwmgr); 2462 2462 PP_ASSERT_WITH_CODE((0 == tmp_result), 2463 2463 "Failed to enable display gap!", result = tmp_result); 2464 2464 2465 - tmp_result = ellesmere_program_voting_clients(hwmgr); 2465 + tmp_result = polaris10_program_voting_clients(hwmgr); 2466 2466 PP_ASSERT_WITH_CODE((0 == tmp_result), 2467 2467 "Failed to program voting clients!", result = tmp_result); 2468 2468 2469 - tmp_result = ellesmere_process_firmware_header(hwmgr); 2469 + tmp_result = polaris10_process_firmware_header(hwmgr); 2470 2470 PP_ASSERT_WITH_CODE((0 == tmp_result), 2471 2471 "Failed to process firmware header!", result = tmp_result); 2472 2472 2473 - tmp_result = ellesmere_initial_switch_from_arbf0_to_f1(hwmgr); 2473 + tmp_result = polaris10_initial_switch_from_arbf0_to_f1(hwmgr); 2474 2474 PP_ASSERT_WITH_CODE((0 == tmp_result), 2475 2475 "Failed to initialize switch from ArbF0 to F1!", 2476 2476 result = tmp_result); 2477 2477 2478 - tmp_result = ellesmere_init_smc_table(hwmgr); 2478 + tmp_result = polaris10_init_smc_table(hwmgr); 2479 2479 PP_ASSERT_WITH_CODE((0 == tmp_result), 2480 2480 "Failed to initialize SMC table!", result = tmp_result); 2481 2481 2482 - tmp_result = ellesmere_init_arb_table_index(hwmgr); 2482 + tmp_result = polaris10_init_arb_table_index(hwmgr); 2483 2483 PP_ASSERT_WITH_CODE((0 == tmp_result), 2484 2484 "Failed to initialize ARB table index!", result = tmp_result); 2485 2485 2486 - tmp_result = ellesmere_populate_pm_fuses(hwmgr); 2486 + tmp_result = polaris10_populate_pm_fuses(hwmgr); 2487 2487 PP_ASSERT_WITH_CODE((0 == tmp_result), 2488 2488 "Failed to populate PM fuses!", result = tmp_result); 2489 2489 2490 - tmp_result = ellesmere_enable_vrhot_gpio_interrupt(hwmgr); 2490 + tmp_result = polaris10_enable_vrhot_gpio_interrupt(hwmgr); 2491 2491 PP_ASSERT_WITH_CODE((0 == tmp_result), 2492 2492 "Failed to enable VR hot GPIO interrupt!", result = tmp_result); 2493 2493 2494 - tmp_result = ellesmere_enable_sclk_control(hwmgr); 2494 + tmp_result = polaris10_enable_sclk_control(hwmgr); 2495 2495 PP_ASSERT_WITH_CODE((0 == tmp_result), 2496 2496 "Failed to enable SCLK control!", result = tmp_result); 2497 2497 2498 - tmp_result = ellesmere_enable_smc_voltage_controller(hwmgr); 2498 + tmp_result = polaris10_enable_smc_voltage_controller(hwmgr); 2499 2499 PP_ASSERT_WITH_CODE((0 == tmp_result), 2500 2500 "Failed to enable voltage control!", result = tmp_result); 2501 2501 2502 - tmp_result = ellesmere_enable_ulv(hwmgr); 2502 + tmp_result = polaris10_enable_ulv(hwmgr); 2503 2503 PP_ASSERT_WITH_CODE((0 == tmp_result), 2504 2504 "Failed to enable ULV!", result = tmp_result); 2505 2505 2506 - tmp_result = ellesmere_enable_deep_sleep_master_switch(hwmgr); 2506 + tmp_result = polaris10_enable_deep_sleep_master_switch(hwmgr); 2507 2507 PP_ASSERT_WITH_CODE((0 == tmp_result), 2508 2508 "Failed to enable deep sleep master switch!", result = tmp_result); 2509 2509 2510 - tmp_result = ellesmere_start_dpm(hwmgr); 2510 + tmp_result = polaris10_start_dpm(hwmgr); 2511 2511 PP_ASSERT_WITH_CODE((0 == tmp_result), 2512 2512 "Failed to start DPM!", result = tmp_result); 2513 2513 2514 - tmp_result = ellesmere_enable_smc_cac(hwmgr); 2514 + tmp_result = polaris10_enable_smc_cac(hwmgr); 2515 2515 PP_ASSERT_WITH_CODE((0 == tmp_result), 2516 2516 "Failed to enable SMC CAC!", result = tmp_result); 2517 2517 2518 - tmp_result = ellesmere_enable_power_containment(hwmgr); 2518 + tmp_result = polaris10_enable_power_containment(hwmgr); 2519 2519 PP_ASSERT_WITH_CODE((0 == tmp_result), 2520 2520 "Failed to enable power containment!", result = tmp_result); 2521 2521 2522 - tmp_result = ellesmere_power_control_set_level(hwmgr); 2522 + tmp_result = polaris10_power_control_set_level(hwmgr); 2523 2523 PP_ASSERT_WITH_CODE((0 == tmp_result), 2524 2524 "Failed to power control set level!", result = tmp_result); 2525 2525 2526 - tmp_result = ellesmere_enable_thermal_auto_throttle(hwmgr); 2526 + tmp_result = polaris10_enable_thermal_auto_throttle(hwmgr); 2527 2527 PP_ASSERT_WITH_CODE((0 == tmp_result), 2528 2528 "Failed to enable thermal auto throttle!", result = tmp_result); 2529 2529 2530 - tmp_result = ellesmere_pcie_performance_request(hwmgr); 2530 + tmp_result = polaris10_pcie_performance_request(hwmgr); 2531 2531 PP_ASSERT_WITH_CODE((0 == tmp_result), 2532 2532 "Failed to enable thermal auto throttle!", result = tmp_result); 2533 2533 2534 2534 return result; 2535 2535 } 2536 2536 2537 - int ellesmere_disable_dpm_tasks(struct pp_hwmgr *hwmgr) 2537 + int polaris10_disable_dpm_tasks(struct pp_hwmgr *hwmgr) 2538 2538 { 2539 2539 2540 2540 return 0; 2541 2541 } 2542 2542 2543 - int ellesmere_reset_asic_tasks(struct pp_hwmgr *hwmgr) 2543 + int polaris10_reset_asic_tasks(struct pp_hwmgr *hwmgr) 2544 2544 { 2545 2545 2546 2546 return 0; 2547 2547 } 2548 2548 2549 - int ellesmere_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) 2549 + int polaris10_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) 2550 2550 { 2551 2551 return phm_hwmgr_backend_fini(hwmgr); 2552 2552 } 2553 2553 2554 - int ellesmere_set_features_platform_caps(struct pp_hwmgr *hwmgr) 2554 + int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr) 2555 2555 { 2556 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2556 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2557 2557 2558 2558 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2559 2559 PHM_PlatformCaps_SclkDeepSleep); 2560 2560 2561 - if (data->mvdd_control == ELLESMERE_VOLTAGE_CONTROL_NONE) 2561 + if (data->mvdd_control == POLARIS10_VOLTAGE_CONTROL_NONE) 2562 2562 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2563 2563 PHM_PlatformCaps_EnableMVDDControl); 2564 2564 2565 - if (data->vddci_control == ELLESMERE_VOLTAGE_CONTROL_NONE) 2565 + if (data->vddci_control == POLARIS10_VOLTAGE_CONTROL_NONE) 2566 2566 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2567 2567 PHM_PlatformCaps_ControlVDDCI); 2568 2568 ··· 2607 2607 return 0; 2608 2608 } 2609 2609 2610 - static void ellesmere_init_dpm_defaults(struct pp_hwmgr *hwmgr) 2610 + static void polaris10_init_dpm_defaults(struct pp_hwmgr *hwmgr) 2611 2611 { 2612 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2612 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2613 2613 2614 - ellesmere_initialize_power_tune_defaults(hwmgr); 2614 + polaris10_initialize_power_tune_defaults(hwmgr); 2615 2615 2616 2616 data->pcie_gen_performance.max = PP_PCIEGen1; 2617 2617 data->pcie_gen_performance.min = PP_PCIEGen3; ··· 2629 2629 * @param hwmgr the address of the powerplay hardware manager. 2630 2630 * @return always 0 2631 2631 */ 2632 - static int ellesmere_get_evv_voltages(struct pp_hwmgr *hwmgr) 2632 + static int polaris10_get_evv_voltages(struct pp_hwmgr *hwmgr) 2633 2633 { 2634 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2634 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2635 2635 uint16_t vv_id; 2636 2636 uint16_t vddc = 0; 2637 2637 uint16_t i, j; ··· 2642 2642 table_info->vdd_dep_on_sclk; 2643 2643 int result; 2644 2644 2645 - for (i = 0; i < ELLESMERE_MAX_LEAKAGE_COUNT; i++) { 2645 + for (i = 0; i < POLARIS10_MAX_LEAKAGE_COUNT; i++) { 2646 2646 vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; 2647 2647 if (!phm_get_sclk_for_voltage_evv(hwmgr, 2648 2648 table_info->vddc_lookup_table, vv_id, &sclk)) { ··· 2687 2687 * @param pointer to changing voltage 2688 2688 * @param pointer to leakage table 2689 2689 */ 2690 - static void ellesmere_patch_with_vdd_leakage(struct pp_hwmgr *hwmgr, 2691 - uint16_t *voltage, struct ellesmere_leakage_voltage *leakage_table) 2690 + static void polaris10_patch_with_vdd_leakage(struct pp_hwmgr *hwmgr, 2691 + uint16_t *voltage, struct polaris10_leakage_voltage *leakage_table) 2692 2692 { 2693 2693 uint32_t index; 2694 2694 ··· 2714 2714 * @param pointer to leakage table 2715 2715 * @return always 0 2716 2716 */ 2717 - static int ellesmere_patch_lookup_table_with_leakage(struct pp_hwmgr *hwmgr, 2717 + static int polaris10_patch_lookup_table_with_leakage(struct pp_hwmgr *hwmgr, 2718 2718 phm_ppt_v1_voltage_lookup_table *lookup_table, 2719 - struct ellesmere_leakage_voltage *leakage_table) 2719 + struct polaris10_leakage_voltage *leakage_table) 2720 2720 { 2721 2721 uint32_t i; 2722 2722 2723 2723 for (i = 0; i < lookup_table->count; i++) 2724 - ellesmere_patch_with_vdd_leakage(hwmgr, 2724 + polaris10_patch_with_vdd_leakage(hwmgr, 2725 2725 &lookup_table->entries[i].us_vdd, leakage_table); 2726 2726 2727 2727 return 0; 2728 2728 } 2729 2729 2730 - static int ellesmere_patch_clock_voltage_limits_with_vddc_leakage( 2731 - struct pp_hwmgr *hwmgr, struct ellesmere_leakage_voltage *leakage_table, 2730 + static int polaris10_patch_clock_voltage_limits_with_vddc_leakage( 2731 + struct pp_hwmgr *hwmgr, struct polaris10_leakage_voltage *leakage_table, 2732 2732 uint16_t *vddc) 2733 2733 { 2734 2734 struct phm_ppt_v1_information *table_info = 2735 2735 (struct phm_ppt_v1_information *)(hwmgr->pptable); 2736 - ellesmere_patch_with_vdd_leakage(hwmgr, (uint16_t *)vddc, leakage_table); 2736 + polaris10_patch_with_vdd_leakage(hwmgr, (uint16_t *)vddc, leakage_table); 2737 2737 hwmgr->dyn_state.max_clock_voltage_on_dc.vddc = 2738 2738 table_info->max_clock_voltage_on_dc.vddc; 2739 2739 return 0; 2740 2740 } 2741 2741 2742 - static int ellesmere_patch_voltage_dependency_tables_with_lookup_table( 2742 + static int polaris10_patch_voltage_dependency_tables_with_lookup_table( 2743 2743 struct pp_hwmgr *hwmgr) 2744 2744 { 2745 2745 uint8_t entryId; ··· 2776 2776 2777 2777 } 2778 2778 2779 - static int ellesmere_calc_voltage_dependency_tables(struct pp_hwmgr *hwmgr) 2779 + static int polaris10_calc_voltage_dependency_tables(struct pp_hwmgr *hwmgr) 2780 2780 { 2781 2781 /* Need to determine if we need calculated voltage. */ 2782 2782 return 0; 2783 2783 } 2784 2784 2785 - static int ellesmere_calc_mm_voltage_dependency_table(struct pp_hwmgr *hwmgr) 2785 + static int polaris10_calc_mm_voltage_dependency_table(struct pp_hwmgr *hwmgr) 2786 2786 { 2787 2787 /* Need to determine if we need calculated voltage from mm table. */ 2788 2788 return 0; 2789 2789 } 2790 2790 2791 - static int ellesmere_sort_lookup_table(struct pp_hwmgr *hwmgr, 2791 + static int polaris10_sort_lookup_table(struct pp_hwmgr *hwmgr, 2792 2792 struct phm_ppt_v1_voltage_lookup_table *lookup_table) 2793 2793 { 2794 2794 uint32_t table_size, i, j; ··· 2813 2813 return 0; 2814 2814 } 2815 2815 2816 - static int ellesmere_complete_dependency_tables(struct pp_hwmgr *hwmgr) 2816 + static int polaris10_complete_dependency_tables(struct pp_hwmgr *hwmgr) 2817 2817 { 2818 2818 int result = 0; 2819 2819 int tmp_result; 2820 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2820 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2821 2821 struct phm_ppt_v1_information *table_info = 2822 2822 (struct phm_ppt_v1_information *)(hwmgr->pptable); 2823 2823 2824 - tmp_result = ellesmere_patch_lookup_table_with_leakage(hwmgr, 2824 + tmp_result = polaris10_patch_lookup_table_with_leakage(hwmgr, 2825 2825 table_info->vddc_lookup_table, &(data->vddc_leakage)); 2826 2826 if (tmp_result) 2827 2827 result = tmp_result; 2828 2828 2829 - tmp_result = ellesmere_patch_clock_voltage_limits_with_vddc_leakage(hwmgr, 2829 + tmp_result = polaris10_patch_clock_voltage_limits_with_vddc_leakage(hwmgr, 2830 2830 &(data->vddc_leakage), &table_info->max_clock_voltage_on_dc.vddc); 2831 2831 if (tmp_result) 2832 2832 result = tmp_result; 2833 2833 2834 - tmp_result = ellesmere_patch_voltage_dependency_tables_with_lookup_table(hwmgr); 2834 + tmp_result = polaris10_patch_voltage_dependency_tables_with_lookup_table(hwmgr); 2835 2835 if (tmp_result) 2836 2836 result = tmp_result; 2837 2837 2838 - tmp_result = ellesmere_calc_voltage_dependency_tables(hwmgr); 2838 + tmp_result = polaris10_calc_voltage_dependency_tables(hwmgr); 2839 2839 if (tmp_result) 2840 2840 result = tmp_result; 2841 2841 2842 - tmp_result = ellesmere_calc_mm_voltage_dependency_table(hwmgr); 2842 + tmp_result = polaris10_calc_mm_voltage_dependency_table(hwmgr); 2843 2843 if (tmp_result) 2844 2844 result = tmp_result; 2845 2845 2846 - tmp_result = ellesmere_sort_lookup_table(hwmgr, table_info->vddc_lookup_table); 2846 + tmp_result = polaris10_sort_lookup_table(hwmgr, table_info->vddc_lookup_table); 2847 2847 if (tmp_result) 2848 2848 result = tmp_result; 2849 2849 2850 2850 return result; 2851 2851 } 2852 2852 2853 - static int ellesmere_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr) 2853 + static int polaris10_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr) 2854 2854 { 2855 2855 struct phm_ppt_v1_information *table_info = 2856 2856 (struct phm_ppt_v1_information *)(hwmgr->pptable); ··· 2886 2886 return 0; 2887 2887 } 2888 2888 2889 - int ellesmere_hwmgr_backend_init(struct pp_hwmgr *hwmgr) 2889 + int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) 2890 2890 { 2891 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 2891 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2892 2892 struct pp_atomctrl_gpio_pin_assignment gpio_pin_assignment; 2893 2893 uint32_t temp_reg; 2894 2894 int result; ··· 2897 2897 data->sram_end = SMC_RAM_END; 2898 2898 2899 2899 data->disable_dpm_mask = 0xFF; 2900 - data->static_screen_threshold = PPELLESMERE_STATICSCREENTHRESHOLD_DFLT; 2901 - data->static_screen_threshold_unit = PPELLESMERE_STATICSCREENTHRESHOLD_DFLT; 2902 - data->activity_target[0] = PPELLESMERE_TARGETACTIVITY_DFLT; 2903 - data->activity_target[1] = PPELLESMERE_TARGETACTIVITY_DFLT; 2904 - data->activity_target[2] = PPELLESMERE_TARGETACTIVITY_DFLT; 2905 - data->activity_target[3] = PPELLESMERE_TARGETACTIVITY_DFLT; 2906 - data->activity_target[4] = PPELLESMERE_TARGETACTIVITY_DFLT; 2907 - data->activity_target[5] = PPELLESMERE_TARGETACTIVITY_DFLT; 2908 - data->activity_target[6] = PPELLESMERE_TARGETACTIVITY_DFLT; 2909 - data->activity_target[7] = PPELLESMERE_TARGETACTIVITY_DFLT; 2900 + data->static_screen_threshold = PPPOLARIS10_STATICSCREENTHRESHOLD_DFLT; 2901 + data->static_screen_threshold_unit = PPPOLARIS10_STATICSCREENTHRESHOLD_DFLT; 2902 + data->activity_target[0] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2903 + data->activity_target[1] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2904 + data->activity_target[2] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2905 + data->activity_target[3] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2906 + data->activity_target[4] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2907 + data->activity_target[5] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2908 + data->activity_target[6] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2909 + data->activity_target[7] = PPPOLARIS10_TARGETACTIVITY_DFLT; 2910 2910 2911 - data->voting_rights_clients0 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT0; 2912 - data->voting_rights_clients1 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT1; 2913 - data->voting_rights_clients2 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT2; 2914 - data->voting_rights_clients3 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT3; 2915 - data->voting_rights_clients4 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT4; 2916 - data->voting_rights_clients5 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT5; 2917 - data->voting_rights_clients6 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT6; 2918 - data->voting_rights_clients7 = PPELLESMERE_VOTINGRIGHTSCLIENTS_DFLT7; 2911 + data->voting_rights_clients0 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT0; 2912 + data->voting_rights_clients1 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT1; 2913 + data->voting_rights_clients2 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT2; 2914 + data->voting_rights_clients3 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT3; 2915 + data->voting_rights_clients4 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT4; 2916 + data->voting_rights_clients5 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT5; 2917 + data->voting_rights_clients6 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT6; 2918 + data->voting_rights_clients7 = PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT7; 2919 2919 2920 2920 data->vddc_vddci_delta = VDDC_VDDCI_DELTA; 2921 2921 2922 - data->mclk_activity_target = PPELLESMERE_MCLK_TARGETACTIVITY_DFLT; 2922 + data->mclk_activity_target = PPPOLARIS10_MCLK_TARGETACTIVITY_DFLT; 2923 2923 2924 2924 /* need to set voltage control types before EVV patching */ 2925 - data->voltage_control = ELLESMERE_VOLTAGE_CONTROL_NONE; 2926 - data->vddci_control = ELLESMERE_VOLTAGE_CONTROL_NONE; 2927 - data->mvdd_control = ELLESMERE_VOLTAGE_CONTROL_NONE; 2925 + data->voltage_control = POLARIS10_VOLTAGE_CONTROL_NONE; 2926 + data->vddci_control = POLARIS10_VOLTAGE_CONTROL_NONE; 2927 + data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_NONE; 2928 2928 2929 2929 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2930 2930 VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) 2931 - data->voltage_control = ELLESMERE_VOLTAGE_CONTROL_BY_SVID2; 2931 + data->voltage_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; 2932 2932 2933 2933 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2934 2934 PHM_PlatformCaps_DynamicPatchPowerState); ··· 2937 2937 PHM_PlatformCaps_EnableMVDDControl)) { 2938 2938 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2939 2939 VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_GPIO_LUT)) 2940 - data->mvdd_control = ELLESMERE_VOLTAGE_CONTROL_BY_GPIO; 2940 + data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_BY_GPIO; 2941 2941 else if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2942 2942 VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_SVID2)) 2943 - data->mvdd_control = ELLESMERE_VOLTAGE_CONTROL_BY_SVID2; 2943 + data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; 2944 2944 } 2945 2945 2946 2946 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2947 2947 PHM_PlatformCaps_ControlVDDCI)) { 2948 2948 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2949 2949 VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_GPIO_LUT)) 2950 - data->vddci_control = ELLESMERE_VOLTAGE_CONTROL_BY_GPIO; 2950 + data->vddci_control = POLARIS10_VOLTAGE_CONTROL_BY_GPIO; 2951 2951 else if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2952 2952 VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_SVID2)) 2953 - data->vddci_control = ELLESMERE_VOLTAGE_CONTROL_BY_SVID2; 2953 + data->vddci_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; 2954 2954 } 2955 2955 2956 - ellesmere_set_features_platform_caps(hwmgr); 2956 + polaris10_set_features_platform_caps(hwmgr); 2957 2957 2958 - ellesmere_init_dpm_defaults(hwmgr); 2958 + polaris10_init_dpm_defaults(hwmgr); 2959 2959 2960 2960 /* Get leakage voltage based on leakage ID. */ 2961 - result = ellesmere_get_evv_voltages(hwmgr); 2961 + result = polaris10_get_evv_voltages(hwmgr); 2962 2962 2963 2963 if (result) { 2964 2964 printk("Get EVV Voltage Failed. Abort Driver loading!\n"); 2965 2965 return -1; 2966 2966 } 2967 2967 2968 - ellesmere_complete_dependency_tables(hwmgr); 2969 - ellesmere_set_private_data_based_on_pptable(hwmgr); 2968 + polaris10_complete_dependency_tables(hwmgr); 2969 + polaris10_set_private_data_based_on_pptable(hwmgr); 2970 2970 2971 2971 /* Initalize Dynamic State Adjustment Rule Settings */ 2972 2972 result = phm_initializa_dynamic_state_adjustment_rule_settings(hwmgr); ··· 2977 2977 data->is_tlu_enabled = 0; 2978 2978 2979 2979 hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = 2980 - ELLESMERE_MAX_HARDWARE_POWERLEVELS; 2980 + POLARIS10_MAX_HARDWARE_POWERLEVELS; 2981 2981 hwmgr->platform_descriptor.hardwarePerformanceLevels = 2; 2982 2982 hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50; 2983 2983 hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */ ··· 3030 3030 data->pcie_lane_cap = (uint32_t)sys_info.value; 3031 3031 } else { 3032 3032 /* Ignore return value in here, we are cleaning up a mess. */ 3033 - ellesmere_hwmgr_backend_fini(hwmgr); 3033 + polaris10_hwmgr_backend_fini(hwmgr); 3034 3034 } 3035 3035 3036 3036 return 0; 3037 3037 } 3038 3038 3039 - static int ellesmere_force_dpm_highest(struct pp_hwmgr *hwmgr) 3039 + static int polaris10_force_dpm_highest(struct pp_hwmgr *hwmgr) 3040 3040 { 3041 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3041 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3042 3042 uint32_t level, tmp; 3043 3043 3044 3044 if (!data->pcie_dpm_key_disabled) { ··· 3085 3085 return 0; 3086 3086 } 3087 3087 3088 - static int ellesmere_upload_dpm_level_enable_mask(struct pp_hwmgr *hwmgr) 3088 + static int polaris10_upload_dpm_level_enable_mask(struct pp_hwmgr *hwmgr) 3089 3089 { 3090 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3090 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3091 3091 3092 3092 phm_apply_dal_min_voltage_request(hwmgr); 3093 3093 ··· 3108 3108 return 0; 3109 3109 } 3110 3110 3111 - static int ellesmere_unforce_dpm_levels(struct pp_hwmgr *hwmgr) 3111 + static int polaris10_unforce_dpm_levels(struct pp_hwmgr *hwmgr) 3112 3112 { 3113 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3113 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3114 3114 3115 - if (!ellesmere_is_dpm_running(hwmgr)) 3115 + if (!polaris10_is_dpm_running(hwmgr)) 3116 3116 return -EINVAL; 3117 3117 3118 3118 if (!data->pcie_dpm_key_disabled) { ··· 3120 3120 PPSMC_MSG_PCIeDPM_UnForceLevel); 3121 3121 } 3122 3122 3123 - return ellesmere_upload_dpm_level_enable_mask(hwmgr); 3123 + return polaris10_upload_dpm_level_enable_mask(hwmgr); 3124 3124 } 3125 3125 3126 - static int ellesmere_force_dpm_lowest(struct pp_hwmgr *hwmgr) 3126 + static int polaris10_force_dpm_lowest(struct pp_hwmgr *hwmgr) 3127 3127 { 3128 - struct ellesmere_hwmgr *data = 3129 - (struct ellesmere_hwmgr *)(hwmgr->backend); 3128 + struct polaris10_hwmgr *data = 3129 + (struct polaris10_hwmgr *)(hwmgr->backend); 3130 3130 uint32_t level; 3131 3131 3132 3132 if (!data->sclk_dpm_key_disabled) ··· 3162 3162 return 0; 3163 3163 3164 3164 } 3165 - static int ellesmere_force_dpm_level(struct pp_hwmgr *hwmgr, 3165 + static int polaris10_force_dpm_level(struct pp_hwmgr *hwmgr, 3166 3166 enum amd_dpm_forced_level level) 3167 3167 { 3168 3168 int ret = 0; 3169 3169 3170 3170 switch (level) { 3171 3171 case AMD_DPM_FORCED_LEVEL_HIGH: 3172 - ret = ellesmere_force_dpm_highest(hwmgr); 3172 + ret = polaris10_force_dpm_highest(hwmgr); 3173 3173 if (ret) 3174 3174 return ret; 3175 3175 break; 3176 3176 case AMD_DPM_FORCED_LEVEL_LOW: 3177 - ret = ellesmere_force_dpm_lowest(hwmgr); 3177 + ret = polaris10_force_dpm_lowest(hwmgr); 3178 3178 if (ret) 3179 3179 return ret; 3180 3180 break; 3181 3181 case AMD_DPM_FORCED_LEVEL_AUTO: 3182 - ret = ellesmere_unforce_dpm_levels(hwmgr); 3182 + ret = polaris10_unforce_dpm_levels(hwmgr); 3183 3183 if (ret) 3184 3184 return ret; 3185 3185 break; ··· 3192 3192 return ret; 3193 3193 } 3194 3194 3195 - static int ellesmere_get_power_state_size(struct pp_hwmgr *hwmgr) 3195 + static int polaris10_get_power_state_size(struct pp_hwmgr *hwmgr) 3196 3196 { 3197 - return sizeof(struct ellesmere_power_state); 3197 + return sizeof(struct polaris10_power_state); 3198 3198 } 3199 3199 3200 3200 3201 - static int ellesmere_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, 3201 + static int polaris10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, 3202 3202 struct pp_power_state *request_ps, 3203 3203 const struct pp_power_state *current_ps) 3204 3204 { 3205 3205 3206 - struct ellesmere_power_state *ellesmere_ps = 3207 - cast_phw_ellesmere_power_state(&request_ps->hardware); 3206 + struct polaris10_power_state *polaris10_ps = 3207 + cast_phw_polaris10_power_state(&request_ps->hardware); 3208 3208 uint32_t sclk; 3209 3209 uint32_t mclk; 3210 3210 struct PP_Clocks minimum_clocks = {0}; ··· 3213 3213 struct cgs_display_info info = {0}; 3214 3214 const struct phm_clock_and_voltage_limits *max_limits; 3215 3215 uint32_t i; 3216 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3216 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3217 3217 struct phm_ppt_v1_information *table_info = 3218 3218 (struct phm_ppt_v1_information *)(hwmgr->pptable); 3219 3219 int32_t count; ··· 3222 3222 data->battery_state = (PP_StateUILabel_Battery == 3223 3223 request_ps->classification.ui_label); 3224 3224 3225 - PP_ASSERT_WITH_CODE(ellesmere_ps->performance_level_count == 2, 3225 + PP_ASSERT_WITH_CODE(polaris10_ps->performance_level_count == 2, 3226 3226 "VI should always have 2 performance levels", 3227 3227 ); 3228 3228 ··· 3232 3232 3233 3233 /* Cap clock DPM tables at DC MAX if it is in DC. */ 3234 3234 if (PP_PowerSource_DC == hwmgr->power_source) { 3235 - for (i = 0; i < ellesmere_ps->performance_level_count; i++) { 3236 - if (ellesmere_ps->performance_levels[i].memory_clock > max_limits->mclk) 3237 - ellesmere_ps->performance_levels[i].memory_clock = max_limits->mclk; 3238 - if (ellesmere_ps->performance_levels[i].engine_clock > max_limits->sclk) 3239 - ellesmere_ps->performance_levels[i].engine_clock = max_limits->sclk; 3235 + for (i = 0; i < polaris10_ps->performance_level_count; i++) { 3236 + if (polaris10_ps->performance_levels[i].memory_clock > max_limits->mclk) 3237 + polaris10_ps->performance_levels[i].memory_clock = max_limits->mclk; 3238 + if (polaris10_ps->performance_levels[i].engine_clock > max_limits->sclk) 3239 + polaris10_ps->performance_levels[i].engine_clock = max_limits->sclk; 3240 3240 } 3241 3241 } 3242 3242 3243 - ellesmere_ps->vce_clks.evclk = hwmgr->vce_arbiter.evclk; 3244 - ellesmere_ps->vce_clks.ecclk = hwmgr->vce_arbiter.ecclk; 3243 + polaris10_ps->vce_clks.evclk = hwmgr->vce_arbiter.evclk; 3244 + polaris10_ps->vce_clks.ecclk = hwmgr->vce_arbiter.ecclk; 3245 3245 3246 3246 cgs_get_active_displays_info(hwmgr->device, &info); 3247 3247 ··· 3279 3279 if (minimum_clocks.memoryClock < hwmgr->gfx_arbiter.mclk) 3280 3280 minimum_clocks.memoryClock = hwmgr->gfx_arbiter.mclk; 3281 3281 3282 - ellesmere_ps->sclk_threshold = hwmgr->gfx_arbiter.sclk_threshold; 3282 + polaris10_ps->sclk_threshold = hwmgr->gfx_arbiter.sclk_threshold; 3283 3283 3284 3284 if (0 != hwmgr->gfx_arbiter.sclk_over_drive) { 3285 3285 PP_ASSERT_WITH_CODE((hwmgr->gfx_arbiter.sclk_over_drive <= ··· 3289 3289 hwmgr->platform_descriptor.overdriveLimit.engineClock); 3290 3290 3291 3291 if (hwmgr->gfx_arbiter.sclk_over_drive >= hwmgr->gfx_arbiter.sclk) 3292 - ellesmere_ps->performance_levels[1].engine_clock = 3292 + polaris10_ps->performance_levels[1].engine_clock = 3293 3293 hwmgr->gfx_arbiter.sclk_over_drive; 3294 3294 } 3295 3295 ··· 3301 3301 hwmgr->platform_descriptor.overdriveLimit.memoryClock); 3302 3302 3303 3303 if (hwmgr->gfx_arbiter.mclk_over_drive >= hwmgr->gfx_arbiter.mclk) 3304 - ellesmere_ps->performance_levels[1].memory_clock = 3304 + polaris10_ps->performance_levels[1].memory_clock = 3305 3305 hwmgr->gfx_arbiter.mclk_over_drive; 3306 3306 } 3307 3307 ··· 3312 3312 disable_mclk_switching = (1 < info.display_count) || 3313 3313 disable_mclk_switching_for_frame_lock; 3314 3314 3315 - sclk = ellesmere_ps->performance_levels[0].engine_clock; 3316 - mclk = ellesmere_ps->performance_levels[0].memory_clock; 3315 + sclk = polaris10_ps->performance_levels[0].engine_clock; 3316 + mclk = polaris10_ps->performance_levels[0].memory_clock; 3317 3317 3318 3318 if (disable_mclk_switching) 3319 - mclk = ellesmere_ps->performance_levels 3320 - [ellesmere_ps->performance_level_count - 1].memory_clock; 3319 + mclk = polaris10_ps->performance_levels 3320 + [polaris10_ps->performance_level_count - 1].memory_clock; 3321 3321 3322 3322 if (sclk < minimum_clocks.engineClock) 3323 3323 sclk = (minimum_clocks.engineClock > max_limits->sclk) ? ··· 3327 3327 mclk = (minimum_clocks.memoryClock > max_limits->mclk) ? 3328 3328 max_limits->mclk : minimum_clocks.memoryClock; 3329 3329 3330 - ellesmere_ps->performance_levels[0].engine_clock = sclk; 3331 - ellesmere_ps->performance_levels[0].memory_clock = mclk; 3330 + polaris10_ps->performance_levels[0].engine_clock = sclk; 3331 + polaris10_ps->performance_levels[0].memory_clock = mclk; 3332 3332 3333 - ellesmere_ps->performance_levels[1].engine_clock = 3334 - (ellesmere_ps->performance_levels[1].engine_clock >= 3335 - ellesmere_ps->performance_levels[0].engine_clock) ? 3336 - ellesmere_ps->performance_levels[1].engine_clock : 3337 - ellesmere_ps->performance_levels[0].engine_clock; 3333 + polaris10_ps->performance_levels[1].engine_clock = 3334 + (polaris10_ps->performance_levels[1].engine_clock >= 3335 + polaris10_ps->performance_levels[0].engine_clock) ? 3336 + polaris10_ps->performance_levels[1].engine_clock : 3337 + polaris10_ps->performance_levels[0].engine_clock; 3338 3338 3339 3339 if (disable_mclk_switching) { 3340 - if (mclk < ellesmere_ps->performance_levels[1].memory_clock) 3341 - mclk = ellesmere_ps->performance_levels[1].memory_clock; 3340 + if (mclk < polaris10_ps->performance_levels[1].memory_clock) 3341 + mclk = polaris10_ps->performance_levels[1].memory_clock; 3342 3342 3343 - ellesmere_ps->performance_levels[0].memory_clock = mclk; 3344 - ellesmere_ps->performance_levels[1].memory_clock = mclk; 3343 + polaris10_ps->performance_levels[0].memory_clock = mclk; 3344 + polaris10_ps->performance_levels[1].memory_clock = mclk; 3345 3345 } else { 3346 - if (ellesmere_ps->performance_levels[1].memory_clock < 3347 - ellesmere_ps->performance_levels[0].memory_clock) 3348 - ellesmere_ps->performance_levels[1].memory_clock = 3349 - ellesmere_ps->performance_levels[0].memory_clock; 3346 + if (polaris10_ps->performance_levels[1].memory_clock < 3347 + polaris10_ps->performance_levels[0].memory_clock) 3348 + polaris10_ps->performance_levels[1].memory_clock = 3349 + polaris10_ps->performance_levels[0].memory_clock; 3350 3350 } 3351 3351 3352 3352 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 3353 3353 PHM_PlatformCaps_StablePState)) { 3354 - for (i = 0; i < ellesmere_ps->performance_level_count; i++) { 3355 - ellesmere_ps->performance_levels[i].engine_clock = stable_pstate_sclk; 3356 - ellesmere_ps->performance_levels[i].memory_clock = stable_pstate_mclk; 3357 - ellesmere_ps->performance_levels[i].pcie_gen = data->pcie_gen_performance.max; 3358 - ellesmere_ps->performance_levels[i].pcie_lane = data->pcie_gen_performance.max; 3354 + for (i = 0; i < polaris10_ps->performance_level_count; i++) { 3355 + polaris10_ps->performance_levels[i].engine_clock = stable_pstate_sclk; 3356 + polaris10_ps->performance_levels[i].memory_clock = stable_pstate_mclk; 3357 + polaris10_ps->performance_levels[i].pcie_gen = data->pcie_gen_performance.max; 3358 + polaris10_ps->performance_levels[i].pcie_lane = data->pcie_gen_performance.max; 3359 3359 } 3360 3360 } 3361 3361 return 0; 3362 3362 } 3363 3363 3364 3364 3365 - static int ellesmere_dpm_get_mclk(struct pp_hwmgr *hwmgr, bool low) 3365 + static int polaris10_dpm_get_mclk(struct pp_hwmgr *hwmgr, bool low) 3366 3366 { 3367 3367 struct pp_power_state *ps; 3368 - struct ellesmere_power_state *ellesmere_ps; 3368 + struct polaris10_power_state *polaris10_ps; 3369 3369 3370 3370 if (hwmgr == NULL) 3371 3371 return -EINVAL; ··· 3375 3375 if (ps == NULL) 3376 3376 return -EINVAL; 3377 3377 3378 - ellesmere_ps = cast_phw_ellesmere_power_state(&ps->hardware); 3378 + polaris10_ps = cast_phw_polaris10_power_state(&ps->hardware); 3379 3379 3380 3380 if (low) 3381 - return ellesmere_ps->performance_levels[0].memory_clock; 3381 + return polaris10_ps->performance_levels[0].memory_clock; 3382 3382 else 3383 - return ellesmere_ps->performance_levels 3384 - [ellesmere_ps->performance_level_count-1].memory_clock; 3383 + return polaris10_ps->performance_levels 3384 + [polaris10_ps->performance_level_count-1].memory_clock; 3385 3385 } 3386 3386 3387 - static int ellesmere_dpm_get_sclk(struct pp_hwmgr *hwmgr, bool low) 3387 + static int polaris10_dpm_get_sclk(struct pp_hwmgr *hwmgr, bool low) 3388 3388 { 3389 3389 struct pp_power_state *ps; 3390 - struct ellesmere_power_state *ellesmere_ps; 3390 + struct polaris10_power_state *polaris10_ps; 3391 3391 3392 3392 if (hwmgr == NULL) 3393 3393 return -EINVAL; ··· 3397 3397 if (ps == NULL) 3398 3398 return -EINVAL; 3399 3399 3400 - ellesmere_ps = cast_phw_ellesmere_power_state(&ps->hardware); 3400 + polaris10_ps = cast_phw_polaris10_power_state(&ps->hardware); 3401 3401 3402 3402 if (low) 3403 - return ellesmere_ps->performance_levels[0].engine_clock; 3403 + return polaris10_ps->performance_levels[0].engine_clock; 3404 3404 else 3405 - return ellesmere_ps->performance_levels 3406 - [ellesmere_ps->performance_level_count-1].engine_clock; 3405 + return polaris10_ps->performance_levels 3406 + [polaris10_ps->performance_level_count-1].engine_clock; 3407 3407 } 3408 3408 3409 - static int ellesmere_dpm_patch_boot_state(struct pp_hwmgr *hwmgr, 3409 + static int polaris10_dpm_patch_boot_state(struct pp_hwmgr *hwmgr, 3410 3410 struct pp_hw_power_state *hw_ps) 3411 3411 { 3412 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3413 - struct ellesmere_power_state *ps = (struct ellesmere_power_state *)hw_ps; 3412 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3413 + struct polaris10_power_state *ps = (struct polaris10_power_state *)hw_ps; 3414 3414 ATOM_FIRMWARE_INFO_V2_2 *fw_info; 3415 3415 uint16_t size; 3416 3416 uint8_t frev, crev; ··· 3452 3452 return 0; 3453 3453 } 3454 3454 3455 - static int ellesmere_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, 3455 + static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, 3456 3456 void *state, struct pp_power_state *power_state, 3457 3457 void *pp_table, uint32_t classification_flag) 3458 3458 { 3459 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3460 - struct ellesmere_power_state *ellesmere_power_state = 3461 - (struct ellesmere_power_state *)(&(power_state->hardware)); 3462 - struct ellesmere_performance_level *performance_level; 3459 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3460 + struct polaris10_power_state *polaris10_power_state = 3461 + (struct polaris10_power_state *)(&(power_state->hardware)); 3462 + struct polaris10_performance_level *performance_level; 3463 3463 ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state; 3464 3464 ATOM_Tonga_POWERPLAYTABLE *powerplay_table = 3465 3465 (ATOM_Tonga_POWERPLAYTABLE *)pp_table; ··· 3501 3501 power_state->temperatures.min = 0; 3502 3502 power_state->temperatures.max = 0; 3503 3503 3504 - performance_level = &(ellesmere_power_state->performance_levels 3505 - [ellesmere_power_state->performance_level_count++]); 3504 + performance_level = &(polaris10_power_state->performance_levels 3505 + [polaris10_power_state->performance_level_count++]); 3506 3506 3507 3507 PP_ASSERT_WITH_CODE( 3508 - (ellesmere_power_state->performance_level_count < SMU74_MAX_LEVELS_GRAPHICS), 3508 + (polaris10_power_state->performance_level_count < SMU74_MAX_LEVELS_GRAPHICS), 3509 3509 "Performance levels exceeds SMC limit!", 3510 3510 return -1); 3511 3511 3512 3512 PP_ASSERT_WITH_CODE( 3513 - (ellesmere_power_state->performance_level_count <= 3513 + (polaris10_power_state->performance_level_count <= 3514 3514 hwmgr->platform_descriptor.hardwareActivityPerformanceLevels), 3515 3515 "Performance levels exceeds Driver limit!", 3516 3516 return -1); ··· 3525 3525 performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap, 3526 3526 state_entry->ucPCIELaneHigh); 3527 3527 3528 - performance_level = &(ellesmere_power_state->performance_levels 3529 - [ellesmere_power_state->performance_level_count++]); 3528 + performance_level = &(polaris10_power_state->performance_levels 3529 + [polaris10_power_state->performance_level_count++]); 3530 3530 performance_level->memory_clock = mclk_dep_table->entries 3531 3531 [state_entry->ucMemoryClockIndexHigh].ulMclk; 3532 3532 performance_level->engine_clock = sclk_dep_table->entries ··· 3539 3539 return 0; 3540 3540 } 3541 3541 3542 - static int ellesmere_get_pp_table_entry(struct pp_hwmgr *hwmgr, 3542 + static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, 3543 3543 unsigned long entry_index, struct pp_power_state *state) 3544 3544 { 3545 3545 int result; 3546 - struct ellesmere_power_state *ps; 3547 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3546 + struct polaris10_power_state *ps; 3547 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3548 3548 struct phm_ppt_v1_information *table_info = 3549 3549 (struct phm_ppt_v1_information *)(hwmgr->pptable); 3550 3550 struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = ··· 3552 3552 3553 3553 state->hardware.magic = PHM_VIslands_Magic; 3554 3554 3555 - ps = (struct ellesmere_power_state *)(&state->hardware); 3555 + ps = (struct polaris10_power_state *)(&state->hardware); 3556 3556 3557 3557 result = tonga_get_powerplay_table_entry(hwmgr, entry_index, state, 3558 - ellesmere_get_pp_table_entry_callback_func); 3558 + polaris10_get_pp_table_entry_callback_func); 3559 3559 3560 3560 /* This is the earliest time we have all the dependency table and the VBIOS boot state 3561 3561 * as PP_Tables_GetPowerPlayTableEntry retrieves the VBIOS boot state ··· 3644 3644 } 3645 3645 3646 3646 static void 3647 - ellesmere_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) 3647 + polaris10_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) 3648 3648 { 3649 3649 uint32_t sclk, mclk; 3650 3650 ··· 3659 3659 mclk / 100, sclk / 100); 3660 3660 } 3661 3661 3662 - static int ellesmere_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, const void *input) 3662 + static int polaris10_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, const void *input) 3663 3663 { 3664 3664 const struct phm_set_power_state_input *states = 3665 3665 (const struct phm_set_power_state_input *)input; 3666 - const struct ellesmere_power_state *ellesmere_ps = 3667 - cast_const_phw_ellesmere_power_state(states->pnew_state); 3668 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3669 - struct ellesmere_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table); 3670 - uint32_t sclk = ellesmere_ps->performance_levels 3671 - [ellesmere_ps->performance_level_count - 1].engine_clock; 3672 - struct ellesmere_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table); 3673 - uint32_t mclk = ellesmere_ps->performance_levels 3674 - [ellesmere_ps->performance_level_count - 1].memory_clock; 3666 + const struct polaris10_power_state *polaris10_ps = 3667 + cast_const_phw_polaris10_power_state(states->pnew_state); 3668 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3669 + struct polaris10_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table); 3670 + uint32_t sclk = polaris10_ps->performance_levels 3671 + [polaris10_ps->performance_level_count - 1].engine_clock; 3672 + struct polaris10_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table); 3673 + uint32_t mclk = polaris10_ps->performance_levels 3674 + [polaris10_ps->performance_level_count - 1].memory_clock; 3675 3675 struct PP_Clocks min_clocks = {0}; 3676 3676 uint32_t i; 3677 3677 struct cgs_display_info info = {0}; ··· 3689 3689 /* TODO: Check SCLK in DAL's minimum clocks 3690 3690 * in case DeepSleep divider update is required. 3691 3691 */ 3692 - if (data->display_timing.min_clock_in_sr != min_clocks.engineClockInSR) 3692 + if (data->display_timing.min_clock_in_sr != min_clocks.engineClockInSR && 3693 + (min_clocks.engineClockInSR >= POLARIS10_MINIMUM_ENGINE_CLOCK || 3694 + data->display_timing.min_clock_in_sr >= POLARIS10_MINIMUM_ENGINE_CLOCK)) 3693 3695 data->need_update_smu7_dpm_table |= DPMTABLE_UPDATE_SCLK; 3694 3696 } 3695 3697 ··· 3711 3709 return 0; 3712 3710 } 3713 3711 3714 - static uint16_t ellesmere_get_maximum_link_speed(struct pp_hwmgr *hwmgr, 3715 - const struct ellesmere_power_state *ellesmere_ps) 3712 + static uint16_t polaris10_get_maximum_link_speed(struct pp_hwmgr *hwmgr, 3713 + const struct polaris10_power_state *polaris10_ps) 3716 3714 { 3717 3715 uint32_t i; 3718 3716 uint32_t sclk, max_sclk = 0; 3719 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3720 - struct ellesmere_dpm_table *dpm_table = &data->dpm_table; 3717 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3718 + struct polaris10_dpm_table *dpm_table = &data->dpm_table; 3721 3719 3722 - for (i = 0; i < ellesmere_ps->performance_level_count; i++) { 3723 - sclk = ellesmere_ps->performance_levels[i].engine_clock; 3720 + for (i = 0; i < polaris10_ps->performance_level_count; i++) { 3721 + sclk = polaris10_ps->performance_levels[i].engine_clock; 3724 3722 if (max_sclk < sclk) 3725 3723 max_sclk = sclk; 3726 3724 } ··· 3736 3734 return 0; 3737 3735 } 3738 3736 3739 - static int ellesmere_request_link_speed_change_before_state_change( 3737 + static int polaris10_request_link_speed_change_before_state_change( 3740 3738 struct pp_hwmgr *hwmgr, const void *input) 3741 3739 { 3742 3740 const struct phm_set_power_state_input *states = 3743 3741 (const struct phm_set_power_state_input *)input; 3744 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3745 - const struct ellesmere_power_state *ellesmere_nps = 3746 - cast_const_phw_ellesmere_power_state(states->pnew_state); 3747 - const struct ellesmere_power_state *ellesmere_cps = 3748 - cast_const_phw_ellesmere_power_state(states->pcurrent_state); 3742 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3743 + const struct polaris10_power_state *polaris10_nps = 3744 + cast_const_phw_polaris10_power_state(states->pnew_state); 3745 + const struct polaris10_power_state *polaris10_cps = 3746 + cast_const_phw_polaris10_power_state(states->pcurrent_state); 3749 3747 3750 - uint16_t target_link_speed = ellesmere_get_maximum_link_speed(hwmgr, ellesmere_nps); 3748 + uint16_t target_link_speed = polaris10_get_maximum_link_speed(hwmgr, polaris10_nps); 3751 3749 uint16_t current_link_speed; 3752 3750 3753 3751 if (data->force_pcie_gen == PP_PCIEGenInvalid) 3754 - current_link_speed = ellesmere_get_maximum_link_speed(hwmgr, ellesmere_cps); 3752 + current_link_speed = polaris10_get_maximum_link_speed(hwmgr, polaris10_cps); 3755 3753 else 3756 3754 current_link_speed = data->force_pcie_gen; 3757 3755 ··· 3781 3779 return 0; 3782 3780 } 3783 3781 3784 - static int ellesmere_freeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 3782 + static int polaris10_freeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 3785 3783 { 3786 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3784 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3787 3785 3788 3786 if (0 == data->need_update_smu7_dpm_table) 3789 3787 return 0; ··· 3791 3789 if ((0 == data->sclk_dpm_key_disabled) && 3792 3790 (data->need_update_smu7_dpm_table & 3793 3791 (DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK))) { 3794 - PP_ASSERT_WITH_CODE(true == ellesmere_is_dpm_running(hwmgr), 3792 + PP_ASSERT_WITH_CODE(true == polaris10_is_dpm_running(hwmgr), 3795 3793 "Trying to freeze SCLK DPM when DPM is disabled", 3796 3794 ); 3797 3795 PP_ASSERT_WITH_CODE(0 == smum_send_msg_to_smc(hwmgr->smumgr, ··· 3803 3801 if ((0 == data->mclk_dpm_key_disabled) && 3804 3802 (data->need_update_smu7_dpm_table & 3805 3803 DPMTABLE_OD_UPDATE_MCLK)) { 3806 - PP_ASSERT_WITH_CODE(true == ellesmere_is_dpm_running(hwmgr), 3804 + PP_ASSERT_WITH_CODE(true == polaris10_is_dpm_running(hwmgr), 3807 3805 "Trying to freeze MCLK DPM when DPM is disabled", 3808 3806 ); 3809 3807 PP_ASSERT_WITH_CODE(0 == smum_send_msg_to_smc(hwmgr->smumgr, ··· 3815 3813 return 0; 3816 3814 } 3817 3815 3818 - static int ellesmere_populate_and_upload_sclk_mclk_dpm_levels( 3816 + static int polaris10_populate_and_upload_sclk_mclk_dpm_levels( 3819 3817 struct pp_hwmgr *hwmgr, const void *input) 3820 3818 { 3821 3819 int result = 0; 3822 3820 const struct phm_set_power_state_input *states = 3823 3821 (const struct phm_set_power_state_input *)input; 3824 - const struct ellesmere_power_state *ellesmere_ps = 3825 - cast_const_phw_ellesmere_power_state(states->pnew_state); 3826 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3827 - uint32_t sclk = ellesmere_ps->performance_levels 3828 - [ellesmere_ps->performance_level_count - 1].engine_clock; 3829 - uint32_t mclk = ellesmere_ps->performance_levels 3830 - [ellesmere_ps->performance_level_count - 1].memory_clock; 3831 - struct ellesmere_dpm_table *dpm_table = &data->dpm_table; 3822 + const struct polaris10_power_state *polaris10_ps = 3823 + cast_const_phw_polaris10_power_state(states->pnew_state); 3824 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3825 + uint32_t sclk = polaris10_ps->performance_levels 3826 + [polaris10_ps->performance_level_count - 1].engine_clock; 3827 + uint32_t mclk = polaris10_ps->performance_levels 3828 + [polaris10_ps->performance_level_count - 1].memory_clock; 3829 + struct polaris10_dpm_table *dpm_table = &data->dpm_table; 3832 3830 3833 - struct ellesmere_dpm_table *golden_dpm_table = &data->golden_dpm_table; 3831 + struct polaris10_dpm_table *golden_dpm_table = &data->golden_dpm_table; 3834 3832 uint32_t dpm_count, clock_percent; 3835 3833 uint32_t i; 3836 3834 ··· 3926 3924 3927 3925 if (data->need_update_smu7_dpm_table & 3928 3926 (DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK)) { 3929 - result = ellesmere_populate_all_graphic_levels(hwmgr); 3927 + result = polaris10_populate_all_graphic_levels(hwmgr); 3930 3928 PP_ASSERT_WITH_CODE((0 == result), 3931 3929 "Failed to populate SCLK during PopulateNewDPMClocksStates Function!", 3932 3930 return result); ··· 3935 3933 if (data->need_update_smu7_dpm_table & 3936 3934 (DPMTABLE_OD_UPDATE_MCLK + DPMTABLE_UPDATE_MCLK)) { 3937 3935 /*populate MCLK dpm table to SMU7 */ 3938 - result = ellesmere_populate_all_memory_levels(hwmgr); 3936 + result = polaris10_populate_all_memory_levels(hwmgr); 3939 3937 PP_ASSERT_WITH_CODE((0 == result), 3940 3938 "Failed to populate MCLK during PopulateNewDPMClocksStates Function!", 3941 3939 return result); ··· 3944 3942 return result; 3945 3943 } 3946 3944 3947 - static int ellesmere_trim_single_dpm_states(struct pp_hwmgr *hwmgr, 3948 - struct ellesmere_single_dpm_table *dpm_table, 3945 + static int polaris10_trim_single_dpm_states(struct pp_hwmgr *hwmgr, 3946 + struct polaris10_single_dpm_table *dpm_table, 3949 3947 uint32_t low_limit, uint32_t high_limit) 3950 3948 { 3951 3949 uint32_t i; 3952 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3950 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3953 3951 3954 3952 for (i = 0; i < dpm_table->count; i++) { 3955 3953 if ((dpm_table->dpm_levels[i].value < low_limit) ··· 3964 3962 return 0; 3965 3963 } 3966 3964 3967 - static int ellesmere_trim_dpm_states(struct pp_hwmgr *hwmgr, 3968 - const struct ellesmere_power_state *ellesmere_ps) 3965 + static int polaris10_trim_dpm_states(struct pp_hwmgr *hwmgr, 3966 + const struct polaris10_power_state *polaris10_ps) 3969 3967 { 3970 3968 int result = 0; 3971 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 3969 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3972 3970 uint32_t high_limit_count; 3973 3971 3974 - PP_ASSERT_WITH_CODE((ellesmere_ps->performance_level_count >= 1), 3972 + PP_ASSERT_WITH_CODE((polaris10_ps->performance_level_count >= 1), 3975 3973 "power state did not have any performance level", 3976 3974 return -1); 3977 3975 3978 - high_limit_count = (1 == ellesmere_ps->performance_level_count) ? 0 : 1; 3976 + high_limit_count = (1 == polaris10_ps->performance_level_count) ? 0 : 1; 3979 3977 3980 - ellesmere_trim_single_dpm_states(hwmgr, 3978 + polaris10_trim_single_dpm_states(hwmgr, 3981 3979 &(data->dpm_table.sclk_table), 3982 - ellesmere_ps->performance_levels[0].engine_clock, 3983 - ellesmere_ps->performance_levels[high_limit_count].engine_clock); 3980 + polaris10_ps->performance_levels[0].engine_clock, 3981 + polaris10_ps->performance_levels[high_limit_count].engine_clock); 3984 3982 3985 - ellesmere_trim_single_dpm_states(hwmgr, 3983 + polaris10_trim_single_dpm_states(hwmgr, 3986 3984 &(data->dpm_table.mclk_table), 3987 - ellesmere_ps->performance_levels[0].memory_clock, 3988 - ellesmere_ps->performance_levels[high_limit_count].memory_clock); 3985 + polaris10_ps->performance_levels[0].memory_clock, 3986 + polaris10_ps->performance_levels[high_limit_count].memory_clock); 3989 3987 3990 3988 return result; 3991 3989 } 3992 3990 3993 - static int ellesmere_generate_dpm_level_enable_mask( 3991 + static int polaris10_generate_dpm_level_enable_mask( 3994 3992 struct pp_hwmgr *hwmgr, const void *input) 3995 3993 { 3996 3994 int result; 3997 3995 const struct phm_set_power_state_input *states = 3998 3996 (const struct phm_set_power_state_input *)input; 3999 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4000 - const struct ellesmere_power_state *ellesmere_ps = 4001 - cast_const_phw_ellesmere_power_state(states->pnew_state); 3997 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 3998 + const struct polaris10_power_state *polaris10_ps = 3999 + cast_const_phw_polaris10_power_state(states->pnew_state); 4002 4000 4003 - result = ellesmere_trim_dpm_states(hwmgr, ellesmere_ps); 4001 + result = polaris10_trim_dpm_states(hwmgr, polaris10_ps); 4004 4002 if (result) 4005 4003 return result; 4006 4004 ··· 4014 4012 return 0; 4015 4013 } 4016 4014 4017 - int ellesmere_enable_disable_uvd_dpm(struct pp_hwmgr *hwmgr, bool enable) 4015 + int polaris10_enable_disable_uvd_dpm(struct pp_hwmgr *hwmgr, bool enable) 4018 4016 { 4019 4017 return smum_send_msg_to_smc(hwmgr->smumgr, enable ? 4020 4018 PPSMC_MSG_UVDDPM_Enable : 4021 4019 PPSMC_MSG_UVDDPM_Disable); 4022 4020 } 4023 4021 4024 - int ellesmere_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable) 4022 + int polaris10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable) 4025 4023 { 4026 4024 return smum_send_msg_to_smc(hwmgr->smumgr, enable? 4027 4025 PPSMC_MSG_VCEDPM_Enable : 4028 4026 PPSMC_MSG_VCEDPM_Disable); 4029 4027 } 4030 4028 4031 - int ellesmere_enable_disable_samu_dpm(struct pp_hwmgr *hwmgr, bool enable) 4029 + int polaris10_enable_disable_samu_dpm(struct pp_hwmgr *hwmgr, bool enable) 4032 4030 { 4033 4031 return smum_send_msg_to_smc(hwmgr->smumgr, enable? 4034 4032 PPSMC_MSG_SAMUDPM_Enable : 4035 4033 PPSMC_MSG_SAMUDPM_Disable); 4036 4034 } 4037 4035 4038 - int ellesmere_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate) 4036 + int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate) 4039 4037 { 4040 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4038 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4041 4039 uint32_t mm_boot_level_offset, mm_boot_level_value; 4042 4040 struct phm_ppt_v1_information *table_info = 4043 4041 (struct phm_ppt_v1_information *)(hwmgr->pptable); ··· 4067 4065 (uint32_t)(1 << data->smc_state_table.UvdBootLevel)); 4068 4066 } 4069 4067 4070 - return ellesmere_enable_disable_uvd_dpm(hwmgr, !bgate); 4068 + return polaris10_enable_disable_uvd_dpm(hwmgr, !bgate); 4071 4069 } 4072 4070 4073 - static int ellesmere_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input) 4071 + static int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input) 4074 4072 { 4075 4073 const struct phm_set_power_state_input *states = 4076 4074 (const struct phm_set_power_state_input *)input; 4077 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4078 - const struct ellesmere_power_state *ellesmere_nps = 4079 - cast_const_phw_ellesmere_power_state(states->pnew_state); 4080 - const struct ellesmere_power_state *ellesmere_cps = 4081 - cast_const_phw_ellesmere_power_state(states->pcurrent_state); 4075 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4076 + const struct polaris10_power_state *polaris10_nps = 4077 + cast_const_phw_polaris10_power_state(states->pnew_state); 4078 + const struct polaris10_power_state *polaris10_cps = 4079 + cast_const_phw_polaris10_power_state(states->pcurrent_state); 4082 4080 4083 4081 uint32_t mm_boot_level_offset, mm_boot_level_value; 4084 4082 struct phm_ppt_v1_information *table_info = 4085 4083 (struct phm_ppt_v1_information *)(hwmgr->pptable); 4086 4084 4087 - if (ellesmere_nps->vce_clks.evclk > 0 && 4088 - (ellesmere_cps == NULL || ellesmere_cps->vce_clks.evclk == 0)) { 4085 + if (polaris10_nps->vce_clks.evclk > 0 && 4086 + (polaris10_cps == NULL || polaris10_cps->vce_clks.evclk == 0)) { 4089 4087 4090 4088 data->smc_state_table.VceBootLevel = 4091 4089 (uint8_t) (table_info->mm_dep_table->count - 1); ··· 4106 4104 PPSMC_MSG_VCEDPM_SetEnabledMask, 4107 4105 (uint32_t)1 << data->smc_state_table.VceBootLevel); 4108 4106 4109 - ellesmere_enable_disable_vce_dpm(hwmgr, true); 4110 - } else if (ellesmere_nps->vce_clks.evclk == 0 && 4111 - ellesmere_cps != NULL && 4112 - ellesmere_cps->vce_clks.evclk > 0) 4113 - ellesmere_enable_disable_vce_dpm(hwmgr, false); 4107 + polaris10_enable_disable_vce_dpm(hwmgr, true); 4108 + } else if (polaris10_nps->vce_clks.evclk == 0 && 4109 + polaris10_cps != NULL && 4110 + polaris10_cps->vce_clks.evclk > 0) 4111 + polaris10_enable_disable_vce_dpm(hwmgr, false); 4114 4112 } 4115 4113 4116 4114 return 0; 4117 4115 } 4118 4116 4119 - int ellesmere_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate) 4117 + int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate) 4120 4118 { 4121 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4119 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4122 4120 uint32_t mm_boot_level_offset, mm_boot_level_value; 4123 4121 struct phm_ppt_v1_information *table_info = 4124 4122 (struct phm_ppt_v1_information *)(hwmgr->pptable); ··· 4144 4142 (uint32_t)(1 << data->smc_state_table.SamuBootLevel)); 4145 4143 } 4146 4144 4147 - return ellesmere_enable_disable_samu_dpm(hwmgr, !bgate); 4145 + return polaris10_enable_disable_samu_dpm(hwmgr, !bgate); 4148 4146 } 4149 4147 4150 - static int ellesmere_update_sclk_threshold(struct pp_hwmgr *hwmgr) 4148 + static int polaris10_update_sclk_threshold(struct pp_hwmgr *hwmgr) 4151 4149 { 4152 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4150 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4153 4151 4154 4152 int result = 0; 4155 4153 uint32_t low_sclk_interrupt_threshold = 0; ··· 4165 4163 4166 4164 CONVERT_FROM_HOST_TO_SMC_UL(low_sclk_interrupt_threshold); 4167 4165 4168 - result = ellesmere_copy_bytes_to_smc( 4166 + result = polaris10_copy_bytes_to_smc( 4169 4167 hwmgr->smumgr, 4170 4168 data->dpm_table_start + 4171 4169 offsetof(SMU74_Discrete_DpmTable, ··· 4178 4176 return result; 4179 4177 } 4180 4178 4181 - static int ellesmere_program_mem_timing_parameters(struct pp_hwmgr *hwmgr) 4179 + static int polaris10_program_mem_timing_parameters(struct pp_hwmgr *hwmgr) 4182 4180 { 4183 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4181 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4184 4182 4185 4183 if (data->need_update_smu7_dpm_table & 4186 4184 (DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_OD_UPDATE_MCLK)) 4187 - return ellesmere_program_memory_timing_parameters(hwmgr); 4185 + return polaris10_program_memory_timing_parameters(hwmgr); 4188 4186 4189 4187 return 0; 4190 4188 } 4191 4189 4192 - static int ellesmere_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 4190 + static int polaris10_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 4193 4191 { 4194 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4192 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4195 4193 4196 4194 if (0 == data->need_update_smu7_dpm_table) 4197 4195 return 0; ··· 4200 4198 (data->need_update_smu7_dpm_table & 4201 4199 (DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK))) { 4202 4200 4203 - PP_ASSERT_WITH_CODE(true == ellesmere_is_dpm_running(hwmgr), 4201 + PP_ASSERT_WITH_CODE(true == polaris10_is_dpm_running(hwmgr), 4204 4202 "Trying to Unfreeze SCLK DPM when DPM is disabled", 4205 4203 ); 4206 4204 PP_ASSERT_WITH_CODE(0 == smum_send_msg_to_smc(hwmgr->smumgr, ··· 4212 4210 if ((0 == data->mclk_dpm_key_disabled) && 4213 4211 (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK)) { 4214 4212 4215 - PP_ASSERT_WITH_CODE(true == ellesmere_is_dpm_running(hwmgr), 4213 + PP_ASSERT_WITH_CODE(true == polaris10_is_dpm_running(hwmgr), 4216 4214 "Trying to Unfreeze MCLK DPM when DPM is disabled", 4217 4215 ); 4218 4216 PP_ASSERT_WITH_CODE(0 == smum_send_msg_to_smc(hwmgr->smumgr, ··· 4226 4224 return 0; 4227 4225 } 4228 4226 4229 - static int ellesmere_notify_link_speed_change_after_state_change( 4227 + static int polaris10_notify_link_speed_change_after_state_change( 4230 4228 struct pp_hwmgr *hwmgr, const void *input) 4231 4229 { 4232 4230 const struct phm_set_power_state_input *states = 4233 4231 (const struct phm_set_power_state_input *)input; 4234 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4235 - const struct ellesmere_power_state *ellesmere_ps = 4236 - cast_const_phw_ellesmere_power_state(states->pnew_state); 4237 - uint16_t target_link_speed = ellesmere_get_maximum_link_speed(hwmgr, ellesmere_ps); 4232 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4233 + const struct polaris10_power_state *polaris10_ps = 4234 + cast_const_phw_polaris10_power_state(states->pnew_state); 4235 + uint16_t target_link_speed = polaris10_get_maximum_link_speed(hwmgr, polaris10_ps); 4238 4236 uint8_t request; 4239 4237 4240 4238 if (data->pspp_notify_required) { ··· 4260 4258 return 0; 4261 4259 } 4262 4260 4263 - static int ellesmere_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input) 4261 + static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input) 4264 4262 { 4265 4263 int tmp_result, result = 0; 4266 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4264 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4267 4265 4268 - tmp_result = ellesmere_find_dpm_states_clocks_in_dpm_table(hwmgr, input); 4266 + tmp_result = polaris10_find_dpm_states_clocks_in_dpm_table(hwmgr, input); 4269 4267 PP_ASSERT_WITH_CODE((0 == tmp_result), 4270 4268 "Failed to find DPM states clocks in DPM table!", 4271 4269 result = tmp_result); ··· 4273 4271 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 4274 4272 PHM_PlatformCaps_PCIEPerformanceRequest)) { 4275 4273 tmp_result = 4276 - ellesmere_request_link_speed_change_before_state_change(hwmgr, input); 4274 + polaris10_request_link_speed_change_before_state_change(hwmgr, input); 4277 4275 PP_ASSERT_WITH_CODE((0 == tmp_result), 4278 4276 "Failed to request link speed change before state change!", 4279 4277 result = tmp_result); 4280 4278 } 4281 4279 4282 - tmp_result = ellesmere_freeze_sclk_mclk_dpm(hwmgr); 4280 + tmp_result = polaris10_freeze_sclk_mclk_dpm(hwmgr); 4283 4281 PP_ASSERT_WITH_CODE((0 == tmp_result), 4284 4282 "Failed to freeze SCLK MCLK DPM!", result = tmp_result); 4285 4283 4286 - tmp_result = ellesmere_populate_and_upload_sclk_mclk_dpm_levels(hwmgr, input); 4284 + tmp_result = polaris10_populate_and_upload_sclk_mclk_dpm_levels(hwmgr, input); 4287 4285 PP_ASSERT_WITH_CODE((0 == tmp_result), 4288 4286 "Failed to populate and upload SCLK MCLK DPM levels!", 4289 4287 result = tmp_result); 4290 4288 4291 - tmp_result = ellesmere_generate_dpm_level_enable_mask(hwmgr, input); 4289 + tmp_result = polaris10_generate_dpm_level_enable_mask(hwmgr, input); 4292 4290 PP_ASSERT_WITH_CODE((0 == tmp_result), 4293 4291 "Failed to generate DPM level enabled mask!", 4294 4292 result = tmp_result); 4295 4293 4296 - tmp_result = ellesmere_update_vce_dpm(hwmgr, input); 4294 + tmp_result = polaris10_update_vce_dpm(hwmgr, input); 4297 4295 PP_ASSERT_WITH_CODE((0 == tmp_result), 4298 4296 "Failed to update VCE DPM!", 4299 4297 result = tmp_result); 4300 4298 4301 - tmp_result = ellesmere_update_sclk_threshold(hwmgr); 4299 + tmp_result = polaris10_update_sclk_threshold(hwmgr); 4302 4300 PP_ASSERT_WITH_CODE((0 == tmp_result), 4303 4301 "Failed to update SCLK threshold!", 4304 4302 result = tmp_result); 4305 4303 4306 - tmp_result = ellesmere_program_mem_timing_parameters(hwmgr); 4304 + tmp_result = polaris10_program_mem_timing_parameters(hwmgr); 4307 4305 PP_ASSERT_WITH_CODE((0 == tmp_result), 4308 4306 "Failed to program memory timing parameters!", 4309 4307 result = tmp_result); 4310 4308 4311 - tmp_result = ellesmere_unfreeze_sclk_mclk_dpm(hwmgr); 4309 + tmp_result = polaris10_unfreeze_sclk_mclk_dpm(hwmgr); 4312 4310 PP_ASSERT_WITH_CODE((0 == tmp_result), 4313 4311 "Failed to unfreeze SCLK MCLK DPM!", 4314 4312 result = tmp_result); 4315 4313 4316 - tmp_result = ellesmere_upload_dpm_level_enable_mask(hwmgr); 4314 + tmp_result = polaris10_upload_dpm_level_enable_mask(hwmgr); 4317 4315 PP_ASSERT_WITH_CODE((0 == tmp_result), 4318 4316 "Failed to upload DPM level enabled mask!", 4319 4317 result = tmp_result); ··· 4321 4319 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 4322 4320 PHM_PlatformCaps_PCIEPerformanceRequest)) { 4323 4321 tmp_result = 4324 - ellesmere_notify_link_speed_change_after_state_change(hwmgr, input); 4322 + polaris10_notify_link_speed_change_after_state_change(hwmgr, input); 4325 4323 PP_ASSERT_WITH_CODE((0 == tmp_result), 4326 4324 "Failed to notify link speed change after state change!", 4327 4325 result = tmp_result); ··· 4330 4328 return result; 4331 4329 } 4332 4330 4333 - static int ellesmere_set_max_fan_pwm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm) 4331 + static int polaris10_set_max_fan_pwm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm) 4334 4332 { 4335 4333 hwmgr->thermal_controller. 4336 4334 advanceFanControlParameters.usMaxFanPWM = us_max_fan_pwm; ··· 4342 4340 PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm); 4343 4341 } 4344 4342 4345 - int ellesmere_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display) 4343 + int polaris10_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display) 4346 4344 { 4347 4345 PPSMC_Msg msg = has_display ? (PPSMC_Msg)PPSMC_HasDisplay : (PPSMC_Msg)PPSMC_NoDisplay; 4348 4346 4349 4347 return (smum_send_msg_to_smc(hwmgr->smumgr, msg) == 0) ? 0 : -1; 4350 4348 } 4351 4349 4352 - int ellesmere_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr) 4350 + int polaris10_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr) 4353 4351 { 4354 4352 uint32_t num_active_displays = 0; 4355 4353 struct cgs_display_info info = {0}; ··· 4360 4358 num_active_displays = info.display_count; 4361 4359 4362 4360 if (num_active_displays > 1) /* to do && (pHwMgr->pPECI->displayConfiguration.bMultiMonitorInSync != TRUE)) */ 4363 - ellesmere_notify_smc_display_change(hwmgr, false); 4361 + polaris10_notify_smc_display_change(hwmgr, false); 4364 4362 else 4365 - ellesmere_notify_smc_display_change(hwmgr, true); 4363 + polaris10_notify_smc_display_change(hwmgr, true); 4366 4364 4367 4365 return 0; 4368 4366 } ··· 4373 4371 * @param hwmgr the address of the powerplay hardware manager. 4374 4372 * @return always OK 4375 4373 */ 4376 - int ellesmere_program_display_gap(struct pp_hwmgr *hwmgr) 4374 + int polaris10_program_display_gap(struct pp_hwmgr *hwmgr) 4377 4375 { 4378 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4376 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4379 4377 uint32_t num_active_displays = 0; 4380 4378 uint32_t display_gap = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL); 4381 4379 uint32_t display_gap2; ··· 4411 4409 4412 4410 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, data->soft_regs_start + offsetof(SMU74_SoftRegisters, VBlankTimeout), (frame_time_in_us - pre_vbi_time_in_us)); 4413 4411 4414 - if (num_active_displays == 1) 4415 - ellesmere_notify_smc_display_change(hwmgr, true); 4412 + polaris10_notify_smc_display_change(hwmgr, num_active_displays != 0); 4416 4413 4417 4414 return 0; 4418 4415 } 4419 4416 4420 4417 4421 - int ellesmere_display_configuration_changed_task(struct pp_hwmgr *hwmgr) 4418 + int polaris10_display_configuration_changed_task(struct pp_hwmgr *hwmgr) 4422 4419 { 4423 - return ellesmere_program_display_gap(hwmgr); 4420 + return polaris10_program_display_gap(hwmgr); 4424 4421 } 4425 4422 4426 4423 /** ··· 4429 4428 * @param usMaxFanRpm: max operating fan RPM value. 4430 4429 * @return The response that came from the SMC. 4431 4430 */ 4432 - static int ellesmere_set_max_fan_rpm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_rpm) 4431 + static int polaris10_set_max_fan_rpm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_rpm) 4433 4432 { 4434 4433 hwmgr->thermal_controller. 4435 4434 advanceFanControlParameters.usMaxFanRPM = us_max_fan_rpm; ··· 4441 4440 PPSMC_MSG_SetFanRpmMax, us_max_fan_rpm); 4442 4441 } 4443 4442 4444 - int ellesmere_register_internal_thermal_interrupt(struct pp_hwmgr *hwmgr, 4443 + int polaris10_register_internal_thermal_interrupt(struct pp_hwmgr *hwmgr, 4445 4444 const void *thermal_interrupt_info) 4446 4445 { 4447 4446 return 0; 4448 4447 } 4449 4448 4450 - bool ellesmere_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr) 4449 + bool polaris10_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr) 4451 4450 { 4452 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4451 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4453 4452 bool is_update_required = false; 4454 4453 struct cgs_display_info info = {0, 0, NULL}; 4455 4454 ··· 4460 4459 /* TO DO NEED TO GET DEEP SLEEP CLOCK FROM DAL 4461 4460 if (phm_cap_enabled(hwmgr->hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) { 4462 4461 cgs_get_min_clock_settings(hwmgr->device, &min_clocks); 4463 - if (min_clocks.engineClockInSR != data->display_timing.minClockInSR) 4462 + if (min_clocks.engineClockInSR != data->display_timing.minClockInSR && 4463 + (min_clocks.engineClockInSR >= POLARIS10_MINIMUM_ENGINE_CLOCK || 4464 + data->display_timing.minClockInSR >= POLARIS10_MINIMUM_ENGINE_CLOCK)) 4464 4465 is_update_required = true; 4465 4466 */ 4466 4467 return is_update_required; 4467 4468 } 4468 4469 4469 - static inline bool ellesmere_are_power_levels_equal(const struct ellesmere_performance_level *pl1, 4470 - const struct ellesmere_performance_level *pl2) 4470 + static inline bool polaris10_are_power_levels_equal(const struct polaris10_performance_level *pl1, 4471 + const struct polaris10_performance_level *pl2) 4471 4472 { 4472 4473 return ((pl1->memory_clock == pl2->memory_clock) && 4473 4474 (pl1->engine_clock == pl2->engine_clock) && ··· 4477 4474 (pl1->pcie_lane == pl2->pcie_lane)); 4478 4475 } 4479 4476 4480 - int ellesmere_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *pstate1, const struct pp_hw_power_state *pstate2, bool *equal) 4477 + int polaris10_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *pstate1, const struct pp_hw_power_state *pstate2, bool *equal) 4481 4478 { 4482 - const struct ellesmere_power_state *psa = cast_const_phw_ellesmere_power_state(pstate1); 4483 - const struct ellesmere_power_state *psb = cast_const_phw_ellesmere_power_state(pstate2); 4479 + const struct polaris10_power_state *psa = cast_const_phw_polaris10_power_state(pstate1); 4480 + const struct polaris10_power_state *psb = cast_const_phw_polaris10_power_state(pstate2); 4484 4481 int i; 4485 4482 4486 4483 if (pstate1 == NULL || pstate2 == NULL || equal == NULL) ··· 4493 4490 } 4494 4491 4495 4492 for (i = 0; i < psa->performance_level_count; i++) { 4496 - if (!ellesmere_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) { 4493 + if (!polaris10_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) { 4497 4494 /* If we have found even one performance level pair that is different the states are different. */ 4498 4495 *equal = false; 4499 4496 return 0; ··· 4508 4505 return 0; 4509 4506 } 4510 4507 4511 - int ellesmere_upload_mc_firmware(struct pp_hwmgr *hwmgr) 4508 + int polaris10_upload_mc_firmware(struct pp_hwmgr *hwmgr) 4512 4509 { 4513 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4510 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4514 4511 4515 4512 uint32_t vbios_version; 4516 4513 ··· 4530 4527 * PPMCME_FirmwareDescriptorEntry *pfd = NULL; 4531 4528 pfd = &tonga_mcmeFirmware; 4532 4529 if (0 == PHM_READ_FIELD(hwmgr->device, MC_SEQ_SUP_CNTL, RUN)) 4533 - ellesmere_load_mc_microcode(hwmgr, pfd->dpmThreshold, 4530 + polaris10_load_mc_microcode(hwmgr, pfd->dpmThreshold, 4534 4531 pfd->cfgArray, pfd->cfgSize, pfd->ioDebugArray, 4535 4532 pfd->ioDebugSize, pfd->ucodeArray, pfd->ucodeSize); 4536 4533 */ ··· 4543 4540 * @param hwmgr the address of the powerplay hardware manager. 4544 4541 * @return always 0 4545 4542 */ 4546 - static int ellesmere_read_clock_registers(struct pp_hwmgr *hwmgr) 4543 + static int polaris10_read_clock_registers(struct pp_hwmgr *hwmgr) 4547 4544 { 4548 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4545 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4549 4546 4550 4547 data->clock_registers.vCG_SPLL_FUNC_CNTL = cgs_read_ind_register(hwmgr->device, 4551 4548 CGS_IND_REG__SMC, ixCG_SPLL_FUNC_CNTL) ··· 4568 4565 * @param hwmgr the address of the powerplay hardware manager. 4569 4566 * @return always 0 4570 4567 */ 4571 - static int ellesmere_get_memory_type(struct pp_hwmgr *hwmgr) 4568 + static int polaris10_get_memory_type(struct pp_hwmgr *hwmgr) 4572 4569 { 4573 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4570 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4574 4571 uint32_t temp; 4575 4572 4576 4573 temp = cgs_read_register(hwmgr->device, mmMC_SEQ_MISC0); ··· 4588 4585 * @param hwmgr the address of the powerplay hardware manager. 4589 4586 * @return always 0 4590 4587 */ 4591 - static int ellesmere_enable_acpi_power_management(struct pp_hwmgr *hwmgr) 4588 + static int polaris10_enable_acpi_power_management(struct pp_hwmgr *hwmgr) 4592 4589 { 4593 4590 PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 4594 4591 GENERAL_PWRMGT, STATIC_PM_EN, 1); ··· 4602 4599 * @param hwmgr the address of the powerplay hardware manager. 4603 4600 * @return always 0 4604 4601 */ 4605 - static int ellesmere_init_power_gate_state(struct pp_hwmgr *hwmgr) 4602 + static int polaris10_init_power_gate_state(struct pp_hwmgr *hwmgr) 4606 4603 { 4607 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4604 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4608 4605 4609 4606 data->uvd_power_gated = false; 4610 4607 data->vce_power_gated = false; ··· 4613 4610 return 0; 4614 4611 } 4615 4612 4616 - static int ellesmere_init_sclk_threshold(struct pp_hwmgr *hwmgr) 4613 + static int polaris10_init_sclk_threshold(struct pp_hwmgr *hwmgr) 4617 4614 { 4618 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 4615 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4619 4616 data->low_sclk_interrupt_threshold = 0; 4620 4617 4621 4618 return 0; 4622 4619 } 4623 4620 4624 - int ellesmere_setup_asic_task(struct pp_hwmgr *hwmgr) 4621 + int polaris10_setup_asic_task(struct pp_hwmgr *hwmgr) 4625 4622 { 4626 4623 int tmp_result, result = 0; 4627 4624 4628 - ellesmere_upload_mc_firmware(hwmgr); 4625 + polaris10_upload_mc_firmware(hwmgr); 4629 4626 4630 - tmp_result = ellesmere_read_clock_registers(hwmgr); 4627 + tmp_result = polaris10_read_clock_registers(hwmgr); 4631 4628 PP_ASSERT_WITH_CODE((0 == tmp_result), 4632 4629 "Failed to read clock registers!", result = tmp_result); 4633 4630 4634 - tmp_result = ellesmere_get_memory_type(hwmgr); 4631 + tmp_result = polaris10_get_memory_type(hwmgr); 4635 4632 PP_ASSERT_WITH_CODE((0 == tmp_result), 4636 4633 "Failed to get memory type!", result = tmp_result); 4637 4634 4638 - tmp_result = ellesmere_enable_acpi_power_management(hwmgr); 4635 + tmp_result = polaris10_enable_acpi_power_management(hwmgr); 4639 4636 PP_ASSERT_WITH_CODE((0 == tmp_result), 4640 4637 "Failed to enable ACPI power management!", result = tmp_result); 4641 4638 4642 - tmp_result = ellesmere_init_power_gate_state(hwmgr); 4639 + tmp_result = polaris10_init_power_gate_state(hwmgr); 4643 4640 PP_ASSERT_WITH_CODE((0 == tmp_result), 4644 4641 "Failed to init power gate state!", result = tmp_result); 4645 4642 ··· 4647 4644 PP_ASSERT_WITH_CODE((0 == tmp_result), 4648 4645 "Failed to get MC microcode version!", result = tmp_result); 4649 4646 4650 - tmp_result = ellesmere_init_sclk_threshold(hwmgr); 4647 + tmp_result = polaris10_init_sclk_threshold(hwmgr); 4651 4648 PP_ASSERT_WITH_CODE((0 == tmp_result), 4652 4649 "Failed to init sclk threshold!", result = tmp_result); 4653 4650 4654 4651 return result; 4655 4652 } 4656 4653 4657 - static const struct pp_hwmgr_func ellesmere_hwmgr_funcs = { 4658 - .backend_init = &ellesmere_hwmgr_backend_init, 4659 - .backend_fini = &ellesmere_hwmgr_backend_fini, 4660 - .asic_setup = &ellesmere_setup_asic_task, 4661 - .dynamic_state_management_enable = &ellesmere_enable_dpm_tasks, 4662 - .apply_state_adjust_rules = ellesmere_apply_state_adjust_rules, 4663 - .force_dpm_level = &ellesmere_force_dpm_level, 4664 - .power_state_set = ellesmere_set_power_state_tasks, 4665 - .get_power_state_size = ellesmere_get_power_state_size, 4666 - .get_mclk = ellesmere_dpm_get_mclk, 4667 - .get_sclk = ellesmere_dpm_get_sclk, 4668 - .patch_boot_state = ellesmere_dpm_patch_boot_state, 4669 - .get_pp_table_entry = ellesmere_get_pp_table_entry, 4654 + static int polaris10_get_pp_table(struct pp_hwmgr *hwmgr, char **table) 4655 + { 4656 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4657 + 4658 + *table = (char *)&data->smc_state_table; 4659 + 4660 + return sizeof(struct SMU74_Discrete_DpmTable); 4661 + } 4662 + 4663 + static int polaris10_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size) 4664 + { 4665 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4666 + 4667 + void *table = (void *)&data->smc_state_table; 4668 + 4669 + memcpy(table, buf, size); 4670 + 4671 + return 0; 4672 + } 4673 + 4674 + static int polaris10_force_clock_level(struct pp_hwmgr *hwmgr, 4675 + enum pp_clock_type type, int level) 4676 + { 4677 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4678 + 4679 + if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) 4680 + return -EINVAL; 4681 + 4682 + switch (type) { 4683 + case PP_SCLK: 4684 + if (!data->sclk_dpm_key_disabled) 4685 + smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 4686 + PPSMC_MSG_SCLKDPM_SetEnabledMask, 4687 + (1 << level)); 4688 + break; 4689 + case PP_MCLK: 4690 + if (!data->mclk_dpm_key_disabled) 4691 + smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 4692 + PPSMC_MSG_MCLKDPM_SetEnabledMask, 4693 + (1 << level)); 4694 + break; 4695 + case PP_PCIE: 4696 + if (!data->pcie_dpm_key_disabled) 4697 + smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 4698 + PPSMC_MSG_PCIeDPM_ForceLevel, 4699 + (1 << level)); 4700 + break; 4701 + default: 4702 + break; 4703 + } 4704 + 4705 + return 0; 4706 + } 4707 + 4708 + static uint16_t polaris10_get_current_pcie_speed(struct pp_hwmgr *hwmgr) 4709 + { 4710 + uint32_t speedCntl = 0; 4711 + 4712 + /* mmPCIE_PORT_INDEX rename as mmPCIE_INDEX */ 4713 + speedCntl = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__PCIE, 4714 + ixPCIE_LC_SPEED_CNTL); 4715 + return((uint16_t)PHM_GET_FIELD(speedCntl, 4716 + PCIE_LC_SPEED_CNTL, LC_CURRENT_DATA_RATE)); 4717 + } 4718 + 4719 + static int polaris10_print_clock_levels(struct pp_hwmgr *hwmgr, 4720 + enum pp_clock_type type, char *buf) 4721 + { 4722 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 4723 + struct polaris10_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table); 4724 + struct polaris10_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table); 4725 + struct polaris10_single_dpm_table *pcie_table = &(data->dpm_table.pcie_speed_table); 4726 + int i, now, size = 0; 4727 + uint32_t clock, pcie_speed; 4728 + 4729 + switch (type) { 4730 + case PP_SCLK: 4731 + smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_API_GetSclkFrequency); 4732 + clock = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0); 4733 + 4734 + for (i = 0; i < sclk_table->count; i++) { 4735 + if (clock > sclk_table->dpm_levels[i].value) 4736 + continue; 4737 + break; 4738 + } 4739 + now = i; 4740 + 4741 + for (i = 0; i < sclk_table->count; i++) 4742 + size += sprintf(buf + size, "%d: %uMhz %s\n", 4743 + i, sclk_table->dpm_levels[i].value / 100, 4744 + (i == now) ? "*" : ""); 4745 + break; 4746 + case PP_MCLK: 4747 + smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_API_GetMclkFrequency); 4748 + clock = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0); 4749 + 4750 + for (i = 0; i < mclk_table->count; i++) { 4751 + if (clock > mclk_table->dpm_levels[i].value) 4752 + continue; 4753 + break; 4754 + } 4755 + now = i; 4756 + 4757 + for (i = 0; i < mclk_table->count; i++) 4758 + size += sprintf(buf + size, "%d: %uMhz %s\n", 4759 + i, mclk_table->dpm_levels[i].value / 100, 4760 + (i == now) ? "*" : ""); 4761 + break; 4762 + case PP_PCIE: 4763 + pcie_speed = polaris10_get_current_pcie_speed(hwmgr); 4764 + for (i = 0; i < pcie_table->count; i++) { 4765 + if (pcie_speed != pcie_table->dpm_levels[i].value) 4766 + continue; 4767 + break; 4768 + } 4769 + now = i; 4770 + 4771 + for (i = 0; i < pcie_table->count; i++) 4772 + size += sprintf(buf + size, "%d: %s %s\n", i, 4773 + (pcie_table->dpm_levels[i].value == 0) ? "2.5GB, x8" : 4774 + (pcie_table->dpm_levels[i].value == 1) ? "5.0GB, x16" : 4775 + (pcie_table->dpm_levels[i].value == 2) ? "8.0GB, x16" : "", 4776 + (i == now) ? "*" : ""); 4777 + break; 4778 + default: 4779 + break; 4780 + } 4781 + return size; 4782 + } 4783 + 4784 + static const struct pp_hwmgr_func polaris10_hwmgr_funcs = { 4785 + .backend_init = &polaris10_hwmgr_backend_init, 4786 + .backend_fini = &polaris10_hwmgr_backend_fini, 4787 + .asic_setup = &polaris10_setup_asic_task, 4788 + .dynamic_state_management_enable = &polaris10_enable_dpm_tasks, 4789 + .apply_state_adjust_rules = polaris10_apply_state_adjust_rules, 4790 + .force_dpm_level = &polaris10_force_dpm_level, 4791 + .power_state_set = polaris10_set_power_state_tasks, 4792 + .get_power_state_size = polaris10_get_power_state_size, 4793 + .get_mclk = polaris10_dpm_get_mclk, 4794 + .get_sclk = polaris10_dpm_get_sclk, 4795 + .patch_boot_state = polaris10_dpm_patch_boot_state, 4796 + .get_pp_table_entry = polaris10_get_pp_table_entry, 4670 4797 .get_num_of_pp_table_entries = tonga_get_number_of_powerplay_table_entries, 4671 - .print_current_perforce_level = ellesmere_print_current_perforce_level, 4672 - .powerdown_uvd = ellesmere_phm_powerdown_uvd, 4673 - .powergate_uvd = ellesmere_phm_powergate_uvd, 4674 - .powergate_vce = ellesmere_phm_powergate_vce, 4675 - .disable_clock_power_gating = ellesmere_phm_disable_clock_power_gating, 4676 - .update_clock_gatings = ellesmere_phm_update_clock_gatings, 4677 - .notify_smc_display_config_after_ps_adjustment = ellesmere_notify_smc_display_config_after_ps_adjustment, 4678 - .display_config_changed = ellesmere_display_configuration_changed_task, 4679 - .set_max_fan_pwm_output = ellesmere_set_max_fan_pwm_output, 4680 - .set_max_fan_rpm_output = ellesmere_set_max_fan_rpm_output, 4681 - .get_temperature = ellesmere_thermal_get_temperature, 4682 - .stop_thermal_controller = ellesmere_thermal_stop_thermal_controller, 4683 - .get_fan_speed_info = ellesmere_fan_ctrl_get_fan_speed_info, 4684 - .get_fan_speed_percent = ellesmere_fan_ctrl_get_fan_speed_percent, 4685 - .set_fan_speed_percent = ellesmere_fan_ctrl_set_fan_speed_percent, 4686 - .reset_fan_speed_to_default = ellesmere_fan_ctrl_reset_fan_speed_to_default, 4687 - .get_fan_speed_rpm = ellesmere_fan_ctrl_get_fan_speed_rpm, 4688 - .set_fan_speed_rpm = ellesmere_fan_ctrl_set_fan_speed_rpm, 4689 - .uninitialize_thermal_controller = ellesmere_thermal_ctrl_uninitialize_thermal_controller, 4690 - .register_internal_thermal_interrupt = ellesmere_register_internal_thermal_interrupt, 4691 - .check_smc_update_required_for_display_configuration = ellesmere_check_smc_update_required_for_display_configuration, 4692 - .check_states_equal = ellesmere_check_states_equal, 4693 - .get_pp_table = ellesmere_get_pp_table, 4694 - .set_pp_table = ellesmere_set_pp_table, 4695 - .force_clock_level = ellesmere_force_clock_level, 4696 - .print_clock_levels = ellesmere_print_clock_levels, 4697 - .enable_per_cu_power_gating = ellesmere_phm_enable_per_cu_power_gating, 4798 + .print_current_perforce_level = polaris10_print_current_perforce_level, 4799 + .powerdown_uvd = polaris10_phm_powerdown_uvd, 4800 + .powergate_uvd = polaris10_phm_powergate_uvd, 4801 + .powergate_vce = polaris10_phm_powergate_vce, 4802 + .disable_clock_power_gating = polaris10_phm_disable_clock_power_gating, 4803 + .update_clock_gatings = polaris10_phm_update_clock_gatings, 4804 + .notify_smc_display_config_after_ps_adjustment = polaris10_notify_smc_display_config_after_ps_adjustment, 4805 + .display_config_changed = polaris10_display_configuration_changed_task, 4806 + .set_max_fan_pwm_output = polaris10_set_max_fan_pwm_output, 4807 + .set_max_fan_rpm_output = polaris10_set_max_fan_rpm_output, 4808 + .get_temperature = polaris10_thermal_get_temperature, 4809 + .stop_thermal_controller = polaris10_thermal_stop_thermal_controller, 4810 + .get_fan_speed_info = polaris10_fan_ctrl_get_fan_speed_info, 4811 + .get_fan_speed_percent = polaris10_fan_ctrl_get_fan_speed_percent, 4812 + .set_fan_speed_percent = polaris10_fan_ctrl_set_fan_speed_percent, 4813 + .reset_fan_speed_to_default = polaris10_fan_ctrl_reset_fan_speed_to_default, 4814 + .get_fan_speed_rpm = polaris10_fan_ctrl_get_fan_speed_rpm, 4815 + .set_fan_speed_rpm = polaris10_fan_ctrl_set_fan_speed_rpm, 4816 + .uninitialize_thermal_controller = polaris10_thermal_ctrl_uninitialize_thermal_controller, 4817 + .register_internal_thermal_interrupt = polaris10_register_internal_thermal_interrupt, 4818 + .check_smc_update_required_for_display_configuration = polaris10_check_smc_update_required_for_display_configuration, 4819 + .check_states_equal = polaris10_check_states_equal, 4820 + .get_pp_table = polaris10_get_pp_table, 4821 + .set_pp_table = polaris10_set_pp_table, 4822 + .force_clock_level = polaris10_force_clock_level, 4823 + .print_clock_levels = polaris10_print_clock_levels, 4824 + .enable_per_cu_power_gating = polaris10_phm_enable_per_cu_power_gating, 4698 4825 }; 4699 4826 4700 - int ellesemere_hwmgr_init(struct pp_hwmgr *hwmgr) 4827 + int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr) 4701 4828 { 4702 - struct ellesmere_hwmgr *data; 4829 + struct polaris10_hwmgr *data; 4703 4830 4704 - data = kzalloc (sizeof(struct ellesmere_hwmgr), GFP_KERNEL); 4831 + data = kzalloc (sizeof(struct polaris10_hwmgr), GFP_KERNEL); 4705 4832 if (data == NULL) 4706 4833 return -ENOMEM; 4707 4834 4708 4835 hwmgr->backend = data; 4709 - hwmgr->hwmgr_func = &ellesmere_hwmgr_funcs; 4836 + hwmgr->hwmgr_func = &polaris10_hwmgr_funcs; 4710 4837 hwmgr->pptable_func = &tonga_pptable_funcs; 4711 - pp_ellesmere_thermal_initialize(hwmgr); 4838 + pp_polaris10_thermal_initialize(hwmgr); 4712 4839 4713 4840 return 0; 4714 4841 }
+89 -89
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_hwmgr.h drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
··· 21 21 * 22 22 */ 23 23 24 - #ifndef ELLESMERE_HWMGR_H 25 - #define ELLESMERE_HWMGR_H 24 + #ifndef POLARIS10_HWMGR_H 25 + #define POLARIS10_HWMGR_H 26 26 27 27 #include "hwmgr.h" 28 28 #include "smu74.h" 29 29 #include "smu74_discrete.h" 30 30 #include "ppatomctrl.h" 31 - #include "ellesmere_ppsmc.h" 32 - #include "ellesmere_powertune.h" 31 + #include "polaris10_ppsmc.h" 32 + #include "polaris10_powertune.h" 33 33 34 - #define ELLESMERE_MAX_HARDWARE_POWERLEVELS 2 34 + #define POLARIS10_MAX_HARDWARE_POWERLEVELS 2 35 35 36 - #define ELLESMERE_VOLTAGE_CONTROL_NONE 0x0 37 - #define ELLESMERE_VOLTAGE_CONTROL_BY_GPIO 0x1 38 - #define ELLESMERE_VOLTAGE_CONTROL_BY_SVID2 0x2 39 - #define ELLESMERE_VOLTAGE_CONTROL_MERGED 0x3 36 + #define POLARIS10_VOLTAGE_CONTROL_NONE 0x0 37 + #define POLARIS10_VOLTAGE_CONTROL_BY_GPIO 0x1 38 + #define POLARIS10_VOLTAGE_CONTROL_BY_SVID2 0x2 39 + #define POLARIS10_VOLTAGE_CONTROL_MERGED 0x3 40 40 41 41 #define DPMTABLE_OD_UPDATE_SCLK 0x00000001 42 42 #define DPMTABLE_OD_UPDATE_MCLK 0x00000002 43 43 #define DPMTABLE_UPDATE_SCLK 0x00000004 44 44 #define DPMTABLE_UPDATE_MCLK 0x00000008 45 45 46 - struct ellesmere_performance_level { 46 + struct polaris10_performance_level { 47 47 uint32_t memory_clock; 48 48 uint32_t engine_clock; 49 49 uint16_t pcie_gen; 50 50 uint16_t pcie_lane; 51 51 }; 52 52 53 - struct ellesmere_uvd_clocks { 53 + struct polaris10_uvd_clocks { 54 54 uint32_t vclk; 55 55 uint32_t dclk; 56 56 }; 57 57 58 - struct ellesmere_vce_clocks { 58 + struct polaris10_vce_clocks { 59 59 uint32_t evclk; 60 60 uint32_t ecclk; 61 61 }; 62 62 63 - struct ellesmere_power_state { 63 + struct polaris10_power_state { 64 64 uint32_t magic; 65 - struct ellesmere_uvd_clocks uvd_clks; 66 - struct ellesmere_vce_clocks vce_clks; 65 + struct polaris10_uvd_clocks uvd_clks; 66 + struct polaris10_vce_clocks vce_clks; 67 67 uint32_t sam_clk; 68 68 uint16_t performance_level_count; 69 69 bool dc_compatible; 70 70 uint32_t sclk_threshold; 71 - struct ellesmere_performance_level performance_levels[ELLESMERE_MAX_HARDWARE_POWERLEVELS]; 71 + struct polaris10_performance_level performance_levels[POLARIS10_MAX_HARDWARE_POWERLEVELS]; 72 72 }; 73 73 74 - struct ellesmere_dpm_level { 74 + struct polaris10_dpm_level { 75 75 bool enabled; 76 76 uint32_t value; 77 77 uint32_t param1; 78 78 }; 79 79 80 - #define ELLESMERE_MAX_DEEPSLEEP_DIVIDER_ID 5 80 + #define POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID 5 81 81 #define MAX_REGULAR_DPM_NUMBER 8 82 - #define ELLESMERE_MINIMUM_ENGINE_CLOCK 2500 82 + #define POLARIS10_MINIMUM_ENGINE_CLOCK 2500 83 83 84 - struct ellesmere_single_dpm_table { 84 + struct polaris10_single_dpm_table { 85 85 uint32_t count; 86 - struct ellesmere_dpm_level dpm_levels[MAX_REGULAR_DPM_NUMBER]; 86 + struct polaris10_dpm_level dpm_levels[MAX_REGULAR_DPM_NUMBER]; 87 87 }; 88 88 89 - struct ellesmere_dpm_table { 90 - struct ellesmere_single_dpm_table sclk_table; 91 - struct ellesmere_single_dpm_table mclk_table; 92 - struct ellesmere_single_dpm_table pcie_speed_table; 93 - struct ellesmere_single_dpm_table vddc_table; 94 - struct ellesmere_single_dpm_table vddci_table; 95 - struct ellesmere_single_dpm_table mvdd_table; 89 + struct polaris10_dpm_table { 90 + struct polaris10_single_dpm_table sclk_table; 91 + struct polaris10_single_dpm_table mclk_table; 92 + struct polaris10_single_dpm_table pcie_speed_table; 93 + struct polaris10_single_dpm_table vddc_table; 94 + struct polaris10_single_dpm_table vddci_table; 95 + struct polaris10_single_dpm_table mvdd_table; 96 96 }; 97 97 98 - struct ellesmere_clock_registers { 98 + struct polaris10_clock_registers { 99 99 uint32_t vCG_SPLL_FUNC_CNTL; 100 100 uint32_t vCG_SPLL_FUNC_CNTL_2; 101 101 uint32_t vCG_SPLL_FUNC_CNTL_3; ··· 116 116 #define DISABLE_MC_LOADMICROCODE 1 117 117 #define DISABLE_MC_CFGPROGRAMMING 2 118 118 119 - struct ellesmere_voltage_smio_registers { 119 + struct polaris10_voltage_smio_registers { 120 120 uint32_t vS0_VID_LOWER_SMIO_CNTL; 121 121 }; 122 122 123 - #define ELLESMERE_MAX_LEAKAGE_COUNT 8 123 + #define POLARIS10_MAX_LEAKAGE_COUNT 8 124 124 125 - struct ellesmere_leakage_voltage { 125 + struct polaris10_leakage_voltage { 126 126 uint16_t count; 127 - uint16_t leakage_id[ELLESMERE_MAX_LEAKAGE_COUNT]; 128 - uint16_t actual_voltage[ELLESMERE_MAX_LEAKAGE_COUNT]; 127 + uint16_t leakage_id[POLARIS10_MAX_LEAKAGE_COUNT]; 128 + uint16_t actual_voltage[POLARIS10_MAX_LEAKAGE_COUNT]; 129 129 }; 130 130 131 - struct ellesmere_vbios_boot_state { 131 + struct polaris10_vbios_boot_state { 132 132 uint16_t mvdd_bootup_value; 133 133 uint16_t vddc_bootup_value; 134 134 uint16_t vddci_bootup_value; ··· 139 139 }; 140 140 141 141 /* Ultra Low Voltage parameter structure */ 142 - struct ellesmere_ulv_parm { 142 + struct polaris10_ulv_parm { 143 143 bool ulv_supported; 144 144 uint32_t cg_ulv_parameter; 145 145 uint32_t ulv_volt_change_delay; 146 - struct ellesmere_performance_level ulv_power_level; 146 + struct polaris10_performance_level ulv_power_level; 147 147 }; 148 148 149 - struct ellesmere_display_timing { 149 + struct polaris10_display_timing { 150 150 uint32_t min_clock_in_sr; 151 151 uint32_t num_existing_displays; 152 152 }; 153 153 154 - struct ellesmere_dpmlevel_enable_mask { 154 + struct polaris10_dpmlevel_enable_mask { 155 155 uint32_t uvd_dpm_enable_mask; 156 156 uint32_t vce_dpm_enable_mask; 157 157 uint32_t acp_dpm_enable_mask; ··· 161 161 uint32_t pcie_dpm_enable_mask; 162 162 }; 163 163 164 - struct ellesmere_pcie_perf_range { 164 + struct polaris10_pcie_perf_range { 165 165 uint16_t max; 166 166 uint16_t min; 167 167 }; 168 - struct ellesmere_range_table { 168 + struct polaris10_range_table { 169 169 uint32_t trans_lower_frequency; /* in 10khz */ 170 170 uint32_t trans_upper_frequency; 171 171 }; 172 172 173 - struct ellesmere_hwmgr { 174 - struct ellesmere_dpm_table dpm_table; 175 - struct ellesmere_dpm_table golden_dpm_table; 173 + struct polaris10_hwmgr { 174 + struct polaris10_dpm_table dpm_table; 175 + struct polaris10_dpm_table golden_dpm_table; 176 176 SMU74_Discrete_DpmTable smc_state_table; 177 177 struct SMU74_Discrete_Ulv ulv_setting; 178 178 179 - struct ellesmere_range_table range_table[NUM_SCLK_RANGE]; 179 + struct polaris10_range_table range_table[NUM_SCLK_RANGE]; 180 180 uint32_t voting_rights_clients0; 181 181 uint32_t voting_rights_clients1; 182 182 uint32_t voting_rights_clients2; ··· 192 192 193 193 uint32_t active_auto_throttle_sources; 194 194 195 - struct ellesmere_clock_registers clock_registers; 196 - struct ellesmere_voltage_smio_registers voltage_smio_registers; 195 + struct polaris10_clock_registers clock_registers; 196 + struct polaris10_voltage_smio_registers voltage_smio_registers; 197 197 198 198 bool is_memory_gddr5; 199 199 uint16_t acpi_vddc; ··· 203 203 uint32_t pcie_gen_cap; 204 204 uint32_t pcie_lane_cap; 205 205 uint32_t pcie_spc_cap; 206 - struct ellesmere_leakage_voltage vddc_leakage; 207 - struct ellesmere_leakage_voltage Vddci_leakage; 206 + struct polaris10_leakage_voltage vddc_leakage; 207 + struct polaris10_leakage_voltage Vddci_leakage; 208 208 209 209 uint32_t mvdd_control; 210 210 uint32_t vddc_mask_low; ··· 218 218 uint32_t mclk_edc_enable_threshold; 219 219 uint32_t mclk_edcwr_enable_threshold; 220 220 bool is_uvd_enabled; 221 - struct ellesmere_vbios_boot_state vbios_boot_state; 221 + struct polaris10_vbios_boot_state vbios_boot_state; 222 222 223 223 bool pcie_performance_request; 224 224 bool battery_state; ··· 250 250 bool performance_request_registered; 251 251 252 252 /* ---- Low Power Features ---- */ 253 - struct ellesmere_ulv_parm ulv; 253 + struct polaris10_ulv_parm ulv; 254 254 255 255 /* ---- CAC Stuff ---- */ 256 256 uint32_t cac_table_start; ··· 264 264 bool enable_tdc_limit_feature; 265 265 bool enable_pkg_pwr_tracking_feature; 266 266 bool disable_uvd_power_tune_feature; 267 - struct ellesmere_pt_defaults *power_tune_defaults; 267 + struct polaris10_pt_defaults *power_tune_defaults; 268 268 struct SMU74_Discrete_PmFuses power_tune_table; 269 269 uint32_t dte_tj_offset; 270 270 uint32_t fast_watermark_threshold; ··· 273 273 bool vddc_phase_shed_control; 274 274 275 275 /* ---- DI/DT ---- */ 276 - struct ellesmere_display_timing display_timing; 276 + struct polaris10_display_timing display_timing; 277 277 uint32_t bif_sclk_table[SMU74_MAX_LEVELS_LINK]; 278 278 279 279 /* ---- Thermal Temperature Setting ---- */ 280 - struct ellesmere_dpmlevel_enable_mask dpm_level_enable_mask; 280 + struct polaris10_dpmlevel_enable_mask dpm_level_enable_mask; 281 281 uint32_t need_update_smu7_dpm_table; 282 282 uint32_t sclk_dpm_key_disabled; 283 283 uint32_t mclk_dpm_key_disabled; 284 284 uint32_t pcie_dpm_key_disabled; 285 285 uint32_t min_engine_clocks; 286 - struct ellesmere_pcie_perf_range pcie_gen_performance; 287 - struct ellesmere_pcie_perf_range pcie_lane_performance; 288 - struct ellesmere_pcie_perf_range pcie_gen_power_saving; 289 - struct ellesmere_pcie_perf_range pcie_lane_power_saving; 286 + struct polaris10_pcie_perf_range pcie_gen_performance; 287 + struct polaris10_pcie_perf_range pcie_lane_performance; 288 + struct polaris10_pcie_perf_range pcie_gen_power_saving; 289 + struct polaris10_pcie_perf_range pcie_lane_power_saving; 290 290 bool use_pcie_performance_levels; 291 291 bool use_pcie_power_saving_levels; 292 292 uint32_t activity_target[SMU74_MAX_LEVELS_GRAPHICS]; ··· 312 312 }; 313 313 314 314 /* To convert to Q8.8 format for firmware */ 315 - #define ELLESMERE_Q88_FORMAT_CONVERSION_UNIT 256 315 + #define POLARIS10_Q88_FORMAT_CONVERSION_UNIT 256 316 316 317 - enum Ellesmere_I2CLineID { 318 - Ellesmere_I2CLineID_DDC1 = 0x90, 319 - Ellesmere_I2CLineID_DDC2 = 0x91, 320 - Ellesmere_I2CLineID_DDC3 = 0x92, 321 - Ellesmere_I2CLineID_DDC4 = 0x93, 322 - Ellesmere_I2CLineID_DDC5 = 0x94, 323 - Ellesmere_I2CLineID_DDC6 = 0x95, 324 - Ellesmere_I2CLineID_SCLSDA = 0x96, 325 - Ellesmere_I2CLineID_DDCVGA = 0x97 317 + enum Polaris10_I2CLineID { 318 + Polaris10_I2CLineID_DDC1 = 0x90, 319 + Polaris10_I2CLineID_DDC2 = 0x91, 320 + Polaris10_I2CLineID_DDC3 = 0x92, 321 + Polaris10_I2CLineID_DDC4 = 0x93, 322 + Polaris10_I2CLineID_DDC5 = 0x94, 323 + Polaris10_I2CLineID_DDC6 = 0x95, 324 + Polaris10_I2CLineID_SCLSDA = 0x96, 325 + Polaris10_I2CLineID_DDCVGA = 0x97 326 326 }; 327 327 328 - #define ELLESMERE_I2C_DDC1DATA 0 329 - #define ELLESMERE_I2C_DDC1CLK 1 330 - #define ELLESMERE_I2C_DDC2DATA 2 331 - #define ELLESMERE_I2C_DDC2CLK 3 332 - #define ELLESMERE_I2C_DDC3DATA 4 333 - #define ELLESMERE_I2C_DDC3CLK 5 334 - #define ELLESMERE_I2C_SDA 40 335 - #define ELLESMERE_I2C_SCL 41 336 - #define ELLESMERE_I2C_DDC4DATA 65 337 - #define ELLESMERE_I2C_DDC4CLK 66 338 - #define ELLESMERE_I2C_DDC5DATA 0x48 339 - #define ELLESMERE_I2C_DDC5CLK 0x49 340 - #define ELLESMERE_I2C_DDC6DATA 0x4a 341 - #define ELLESMERE_I2C_DDC6CLK 0x4b 342 - #define ELLESMERE_I2C_DDCVGADATA 0x4c 343 - #define ELLESMERE_I2C_DDCVGACLK 0x4d 328 + #define POLARIS10_I2C_DDC1DATA 0 329 + #define POLARIS10_I2C_DDC1CLK 1 330 + #define POLARIS10_I2C_DDC2DATA 2 331 + #define POLARIS10_I2C_DDC2CLK 3 332 + #define POLARIS10_I2C_DDC3DATA 4 333 + #define POLARIS10_I2C_DDC3CLK 5 334 + #define POLARIS10_I2C_SDA 40 335 + #define POLARIS10_I2C_SCL 41 336 + #define POLARIS10_I2C_DDC4DATA 65 337 + #define POLARIS10_I2C_DDC4CLK 66 338 + #define POLARIS10_I2C_DDC5DATA 0x48 339 + #define POLARIS10_I2C_DDC5CLK 0x49 340 + #define POLARIS10_I2C_DDC6DATA 0x4a 341 + #define POLARIS10_I2C_DDC6CLK 0x4b 342 + #define POLARIS10_I2C_DDCVGADATA 0x4c 343 + #define POLARIS10_I2C_DDCVGACLK 0x4d 344 344 345 - #define ELLESMERE_UNUSED_GPIO_PIN 0x7F 345 + #define POLARIS10_UNUSED_GPIO_PIN 0x7F 346 346 347 - int ellesemere_hwmgr_init(struct pp_hwmgr *hwmgr); 347 + int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr); 348 348 349 - int ellesmere_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); 350 - int ellesmere_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate); 351 - int ellesmere_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); 349 + int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); 350 + int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate); 351 + int polaris10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); 352 352 353 353 #endif 354 354
+53 -53
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_powertune.c drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
··· 23 23 24 24 #include "hwmgr.h" 25 25 #include "smumgr.h" 26 - #include "ellesmere_hwmgr.h" 27 - #include "ellesmere_powertune.h" 28 - #include "ellesmere_smumgr.h" 26 + #include "polaris10_hwmgr.h" 27 + #include "polaris10_powertune.h" 28 + #include "polaris10_smumgr.h" 29 29 #include "smu74_discrete.h" 30 30 #include "pp_debug.h" 31 31 32 32 #define VOLTAGE_SCALE 4 33 33 #define POWERTUNE_DEFAULT_SET_MAX 1 34 34 35 - struct ellesmere_pt_defaults ellesmere_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = { 35 + struct polaris10_pt_defaults polaris10_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = { 36 36 /* sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt, 37 37 * TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT */ 38 38 { 1, 0xF, 0xFD, 0x19, 5, 45, 0, 0xB0000, ··· 40 40 { 0x17C, 0x172, 0x180, 0x1BC, 0x1B3, 0x1BD, 0x206, 0x200, 0x203, 0x25D, 0x25A, 0x255, 0x2C3, 0x2C5, 0x2B4 } }, 41 41 }; 42 42 43 - void ellesmere_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) 43 + void polaris10_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) 44 44 { 45 - struct ellesmere_hwmgr *ellesmere_hwmgr = (struct ellesmere_hwmgr *)(hwmgr->backend); 45 + struct polaris10_hwmgr *polaris10_hwmgr = (struct polaris10_hwmgr *)(hwmgr->backend); 46 46 struct phm_ppt_v1_information *table_info = 47 47 (struct phm_ppt_v1_information *)(hwmgr->pptable); 48 48 49 49 if (table_info && 50 50 table_info->cac_dtp_table->usPowerTuneDataSetID <= POWERTUNE_DEFAULT_SET_MAX && 51 51 table_info->cac_dtp_table->usPowerTuneDataSetID) 52 - ellesmere_hwmgr->power_tune_defaults = 53 - &ellesmere_power_tune_data_set_array 52 + polaris10_hwmgr->power_tune_defaults = 53 + &polaris10_power_tune_data_set_array 54 54 [table_info->cac_dtp_table->usPowerTuneDataSetID - 1]; 55 55 else 56 - ellesmere_hwmgr->power_tune_defaults = &ellesmere_power_tune_data_set_array[0]; 56 + polaris10_hwmgr->power_tune_defaults = &polaris10_power_tune_data_set_array[0]; 57 57 58 58 } 59 59 60 - int ellesmere_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr) 60 + int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr) 61 61 { 62 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 63 - struct ellesmere_pt_defaults *defaults = data->power_tune_defaults; 62 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 63 + struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 64 64 SMU74_Discrete_DpmTable *dpm_table = &(data->smc_state_table); 65 65 struct phm_ppt_v1_information *table_info = 66 66 (struct phm_ppt_v1_information *)(hwmgr->pptable); ··· 101 101 return 0; 102 102 } 103 103 104 - static int ellesmere_populate_svi_load_line(struct pp_hwmgr *hwmgr) 104 + static int polaris10_populate_svi_load_line(struct pp_hwmgr *hwmgr) 105 105 { 106 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 107 - struct ellesmere_pt_defaults *defaults = data->power_tune_defaults; 106 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 107 + struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 108 108 109 109 data->power_tune_table.SviLoadLineEn = defaults->SviLoadLineEn; 110 110 data->power_tune_table.SviLoadLineVddC = defaults->SviLoadLineVddC; ··· 114 114 return 0; 115 115 } 116 116 117 - static int ellesmere_populate_tdc_limit(struct pp_hwmgr *hwmgr) 117 + static int polaris10_populate_tdc_limit(struct pp_hwmgr *hwmgr) 118 118 { 119 119 uint16_t tdc_limit; 120 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 120 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 121 121 struct phm_ppt_v1_information *table_info = 122 122 (struct phm_ppt_v1_information *)(hwmgr->pptable); 123 - struct ellesmere_pt_defaults *defaults = data->power_tune_defaults; 123 + struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 124 124 125 125 tdc_limit = (uint16_t)(table_info->cac_dtp_table->usTDC * 128); 126 126 data->power_tune_table.TDC_VDDC_PkgLimit = ··· 132 132 return 0; 133 133 } 134 134 135 - static int ellesmere_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset) 135 + static int polaris10_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset) 136 136 { 137 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 138 - struct ellesmere_pt_defaults *defaults = data->power_tune_defaults; 137 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 138 + struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 139 139 uint32_t temp; 140 140 141 - if (ellesmere_read_smc_sram_dword(hwmgr->smumgr, 141 + if (polaris10_read_smc_sram_dword(hwmgr->smumgr, 142 142 fuse_table_offset + 143 143 offsetof(SMU74_Discrete_PmFuses, TdcWaterfallCtl), 144 144 (uint32_t *)&temp, data->sram_end)) ··· 156 156 return 0; 157 157 } 158 158 159 - static int ellesmere_populate_temperature_scaler(struct pp_hwmgr *hwmgr) 159 + static int polaris10_populate_temperature_scaler(struct pp_hwmgr *hwmgr) 160 160 { 161 161 int i; 162 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 162 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 163 163 164 164 /* Currently not used. Set all to zero. */ 165 165 for (i = 0; i < 16; i++) ··· 168 168 return 0; 169 169 } 170 170 171 - static int ellesmere_populate_fuzzy_fan(struct pp_hwmgr *hwmgr) 171 + static int polaris10_populate_fuzzy_fan(struct pp_hwmgr *hwmgr) 172 172 { 173 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 173 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 174 174 175 175 if ((hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity & (1 << 15)) 176 176 || 0 == hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity) ··· 182 182 return 0; 183 183 } 184 184 185 - static int ellesmere_populate_gnb_lpml(struct pp_hwmgr *hwmgr) 185 + static int polaris10_populate_gnb_lpml(struct pp_hwmgr *hwmgr) 186 186 { 187 187 int i; 188 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 188 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 189 189 190 190 /* Currently not used. Set all to zero. */ 191 191 for (i = 0; i < 16; i++) ··· 194 194 return 0; 195 195 } 196 196 197 - static int ellesmere_min_max_vgnb_lpml_id_from_bapm_vddc(struct pp_hwmgr *hwmgr) 197 + static int polaris10_min_max_vgnb_lpml_id_from_bapm_vddc(struct pp_hwmgr *hwmgr) 198 198 { 199 199 return 0; 200 200 } 201 201 202 - static int ellesmere_populate_bapm_vddc_base_leakage_sidd(struct pp_hwmgr *hwmgr) 202 + static int polaris10_populate_bapm_vddc_base_leakage_sidd(struct pp_hwmgr *hwmgr) 203 203 { 204 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 204 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 205 205 struct phm_ppt_v1_information *table_info = 206 206 (struct phm_ppt_v1_information *)(hwmgr->pptable); 207 207 uint16_t hi_sidd = data->power_tune_table.BapmVddCBaseLeakageHiSidd; ··· 219 219 return 0; 220 220 } 221 221 222 - int ellesmere_populate_pm_fuses(struct pp_hwmgr *hwmgr) 222 + int polaris10_populate_pm_fuses(struct pp_hwmgr *hwmgr) 223 223 { 224 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 224 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 225 225 uint32_t pm_fuse_table_offset; 226 226 227 227 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 228 228 PHM_PlatformCaps_PowerContainment)) { 229 - if (ellesmere_read_smc_sram_dword(hwmgr->smumgr, 229 + if (polaris10_read_smc_sram_dword(hwmgr->smumgr, 230 230 SMU7_FIRMWARE_HEADER_LOCATION + 231 231 offsetof(SMU74_Firmware_Header, PmFuseTable), 232 232 &pm_fuse_table_offset, data->sram_end)) ··· 234 234 "Attempt to get pm_fuse_table_offset Failed!", 235 235 return -EINVAL); 236 236 237 - if (ellesmere_populate_svi_load_line(hwmgr)) 237 + if (polaris10_populate_svi_load_line(hwmgr)) 238 238 PP_ASSERT_WITH_CODE(false, 239 239 "Attempt to populate SviLoadLine Failed!", 240 240 return -EINVAL); 241 241 242 - if (ellesmere_populate_tdc_limit(hwmgr)) 242 + if (polaris10_populate_tdc_limit(hwmgr)) 243 243 PP_ASSERT_WITH_CODE(false, 244 244 "Attempt to populate TDCLimit Failed!", return -EINVAL); 245 245 246 - if (ellesmere_populate_dw8(hwmgr, pm_fuse_table_offset)) 246 + if (polaris10_populate_dw8(hwmgr, pm_fuse_table_offset)) 247 247 PP_ASSERT_WITH_CODE(false, 248 248 "Attempt to populate TdcWaterfallCtl, " 249 249 "LPMLTemperature Min and Max Failed!", 250 250 return -EINVAL); 251 251 252 - if (0 != ellesmere_populate_temperature_scaler(hwmgr)) 252 + if (0 != polaris10_populate_temperature_scaler(hwmgr)) 253 253 PP_ASSERT_WITH_CODE(false, 254 254 "Attempt to populate LPMLTemperatureScaler Failed!", 255 255 return -EINVAL); 256 256 257 - if (ellesmere_populate_fuzzy_fan(hwmgr)) 257 + if (polaris10_populate_fuzzy_fan(hwmgr)) 258 258 PP_ASSERT_WITH_CODE(false, 259 259 "Attempt to populate Fuzzy Fan Control parameters Failed!", 260 260 return -EINVAL); 261 261 262 - if (ellesmere_populate_gnb_lpml(hwmgr)) 262 + if (polaris10_populate_gnb_lpml(hwmgr)) 263 263 PP_ASSERT_WITH_CODE(false, 264 264 "Attempt to populate GnbLPML Failed!", 265 265 return -EINVAL); 266 266 267 - if (ellesmere_min_max_vgnb_lpml_id_from_bapm_vddc(hwmgr)) 267 + if (polaris10_min_max_vgnb_lpml_id_from_bapm_vddc(hwmgr)) 268 268 PP_ASSERT_WITH_CODE(false, 269 269 "Attempt to populate GnbLPML Min and Max Vid Failed!", 270 270 return -EINVAL); 271 271 272 - if (ellesmere_populate_bapm_vddc_base_leakage_sidd(hwmgr)) 272 + if (polaris10_populate_bapm_vddc_base_leakage_sidd(hwmgr)) 273 273 PP_ASSERT_WITH_CODE(false, 274 274 "Attempt to populate BapmVddCBaseLeakage Hi and Lo " 275 275 "Sidd Failed!", return -EINVAL); 276 276 277 - if (ellesmere_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset, 277 + if (polaris10_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset, 278 278 (uint8_t *)&data->power_tune_table, 279 279 sizeof(struct SMU74_Discrete_PmFuses), data->sram_end)) 280 280 PP_ASSERT_WITH_CODE(false, ··· 284 284 return 0; 285 285 } 286 286 287 - int ellesmere_enable_smc_cac(struct pp_hwmgr *hwmgr) 287 + int polaris10_enable_smc_cac(struct pp_hwmgr *hwmgr) 288 288 { 289 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 289 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 290 290 int result = 0; 291 291 292 292 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, ··· 302 302 return result; 303 303 } 304 304 305 - int ellesmere_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n) 305 + int polaris10_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n) 306 306 { 307 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 307 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 308 308 309 309 if (data->power_containment_features & 310 310 POWERCONTAINMENT_FEATURE_PkgPwrLimit) ··· 313 313 return 0; 314 314 } 315 315 316 - static int ellesmere_set_overdriver_target_tdp(struct pp_hwmgr *pHwMgr, uint32_t target_tdp) 316 + static int polaris10_set_overdriver_target_tdp(struct pp_hwmgr *pHwMgr, uint32_t target_tdp) 317 317 { 318 318 return smum_send_msg_to_smc_with_parameter(pHwMgr->smumgr, 319 319 PPSMC_MSG_OverDriveSetTargetTdp, target_tdp); 320 320 } 321 321 322 - int ellesmere_enable_power_containment(struct pp_hwmgr *hwmgr) 322 + int polaris10_enable_power_containment(struct pp_hwmgr *hwmgr) 323 323 { 324 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 324 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 325 325 struct phm_ppt_v1_information *table_info = 326 326 (struct phm_ppt_v1_information *)(hwmgr->pptable); 327 327 int smc_result; ··· 363 363 data->power_containment_features |= 364 364 POWERCONTAINMENT_FEATURE_PkgPwrLimit; 365 365 366 - if (ellesmere_set_power_limit(hwmgr, default_limit)) 366 + if (polaris10_set_power_limit(hwmgr, default_limit)) 367 367 printk(KERN_ERR "Failed to set Default Power Limit in SMC!"); 368 368 } 369 369 } ··· 371 371 return result; 372 372 } 373 373 374 - int ellesmere_power_control_set_level(struct pp_hwmgr *hwmgr) 374 + int polaris10_power_control_set_level(struct pp_hwmgr *hwmgr) 375 375 { 376 376 struct phm_ppt_v1_information *table_info = 377 377 (struct phm_ppt_v1_information *)(hwmgr->pptable); ··· 389 389 * but message to be 8 bit fraction for messages 390 390 */ 391 391 target_tdp = ((100 + adjust_percent) * (int)(cac_table->usTDP * 256)) / 100; 392 - result = ellesmere_set_overdriver_target_tdp(hwmgr, (uint32_t)target_tdp); 392 + result = polaris10_set_overdriver_target_tdp(hwmgr, (uint32_t)target_tdp); 393 393 } 394 394 395 395 return result;
+19 -19
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_powertune.h drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.h
··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 * 22 22 */ 23 - #ifndef ELLESMERE_POWERTUNE_H 24 - #define ELLESMERE_POWERTUNE_H 23 + #ifndef POLARIS10_POWERTUNE_H 24 + #define POLARIS10_POWERTUNE_H 25 25 26 - enum ellesmere_pt_config_reg_type { 27 - ELLESMERE_CONFIGREG_MMR = 0, 28 - ELLESMERE_CONFIGREG_SMC_IND, 29 - ELLESMERE_CONFIGREG_DIDT_IND, 30 - ELLESMERE_CONFIGREG_CACHE, 31 - ELLESMERE_CONFIGREG_MAX 26 + enum polaris10_pt_config_reg_type { 27 + POLARIS10_CONFIGREG_MMR = 0, 28 + POLARIS10_CONFIGREG_SMC_IND, 29 + POLARIS10_CONFIGREG_DIDT_IND, 30 + POLARIS10_CONFIGREG_CACHE, 31 + POLARIS10_CONFIGREG_MAX 32 32 }; 33 33 34 34 /* PowerContainment Features */ ··· 36 36 #define POWERCONTAINMENT_FEATURE_TDCLimit 0x00000002 37 37 #define POWERCONTAINMENT_FEATURE_PkgPwrLimit 0x00000004 38 38 39 - struct ellesmere_pt_config_reg { 39 + struct polaris10_pt_config_reg { 40 40 uint32_t offset; 41 41 uint32_t mask; 42 42 uint32_t shift; 43 43 uint32_t value; 44 - enum ellesmere_pt_config_reg_type type; 44 + enum polaris10_pt_config_reg_type type; 45 45 }; 46 46 47 - struct ellesmere_pt_defaults { 47 + struct polaris10_pt_defaults { 48 48 uint8_t SviLoadLineEn; 49 49 uint8_t SviLoadLineVddC; 50 50 uint8_t TDC_VDDC_ThrottleReleaseLimitPerc; ··· 58 58 uint16_t BAPMTI_RC[SMU74_DTE_ITERATIONS * SMU74_DTE_SOURCES * SMU74_DTE_SINKS]; 59 59 }; 60 60 61 - void ellesmere_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr); 62 - int ellesmere_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr); 63 - int ellesmere_populate_pm_fuses(struct pp_hwmgr *hwmgr); 64 - int ellesmere_enable_smc_cac(struct pp_hwmgr *hwmgr); 65 - int ellesmere_enable_power_containment(struct pp_hwmgr *hwmgr); 66 - int ellesmere_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n); 67 - int ellesmere_power_control_set_level(struct pp_hwmgr *hwmgr); 61 + void polaris10_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr); 62 + int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr); 63 + int polaris10_populate_pm_fuses(struct pp_hwmgr *hwmgr); 64 + int polaris10_enable_smc_cac(struct pp_hwmgr *hwmgr); 65 + int polaris10_enable_power_containment(struct pp_hwmgr *hwmgr); 66 + int polaris10_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n); 67 + int polaris10_power_control_set_level(struct pp_hwmgr *hwmgr); 68 68 69 - #endif /* ELLESMERE_POWERTUNE_H */ 69 + #endif /* POLARIS10_POWERTUNE_H */ 70 70
+70 -70
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_thermal.c drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
··· 21 21 * 22 22 */ 23 23 24 - #include "ellesmere_thermal.h" 25 - #include "ellesmere_hwmgr.h" 26 - #include "ellesmere_smumgr.h" 27 - #include "ellesmere_ppsmc.h" 24 + #include "polaris10_thermal.h" 25 + #include "polaris10_hwmgr.h" 26 + #include "polaris10_smumgr.h" 27 + #include "polaris10_ppsmc.h" 28 28 #include "smu/smu_7_1_3_d.h" 29 29 #include "smu/smu_7_1_3_sh_mask.h" 30 30 31 - int ellesmere_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, 31 + int polaris10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, 32 32 struct phm_fan_speed_info *fan_speed_info) 33 33 { 34 34 if (hwmgr->thermal_controller.fanInfo.bNoFan) ··· 54 54 return 0; 55 55 } 56 56 57 - int ellesmere_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, 57 + int polaris10_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, 58 58 uint32_t *speed) 59 59 { 60 60 uint32_t duty100; ··· 83 83 return 0; 84 84 } 85 85 86 - int ellesmere_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) 86 + int polaris10_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) 87 87 { 88 88 uint32_t tach_period; 89 89 uint32_t crystal_clock_freq; ··· 112 112 * mode the fan control mode, 0 default, 1 by percent, 5, by RPM 113 113 * @exception Should always succeed. 114 114 */ 115 - int ellesmere_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode) 115 + int polaris10_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode) 116 116 { 117 117 118 118 if (hwmgr->fan_ctrl_is_in_default_mode) { ··· 138 138 * @param hwmgr the address of the powerplay hardware manager. 139 139 * @exception Should always succeed. 140 140 */ 141 - int ellesmere_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr) 141 + int polaris10_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr) 142 142 { 143 143 if (!hwmgr->fan_ctrl_is_in_default_mode) { 144 144 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, ··· 151 151 return 0; 152 152 } 153 153 154 - int ellesmere_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) 154 + int polaris10_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) 155 155 { 156 156 int result; 157 157 ··· 186 186 } 187 187 188 188 189 - int ellesmere_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr) 189 + int polaris10_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr) 190 190 { 191 191 return smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_StopFanControl); 192 192 } ··· 197 197 * @param speed is the percentage value (0% - 100%) to be set. 198 198 * @exception Fails is the 100% setting appears to be 0. 199 199 */ 200 - int ellesmere_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, 200 + int polaris10_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, 201 201 uint32_t speed) 202 202 { 203 203 uint32_t duty100; ··· 212 212 213 213 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 214 214 PHM_PlatformCaps_MicrocodeFanControl)) 215 - ellesmere_fan_ctrl_stop_smc_fan_control(hwmgr); 215 + polaris10_fan_ctrl_stop_smc_fan_control(hwmgr); 216 216 217 217 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 218 218 CG_FDO_CTRL1, FMAX_DUTY100); ··· 227 227 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 228 228 CG_FDO_CTRL0, FDO_STATIC_DUTY, duty); 229 229 230 - return ellesmere_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 230 + return polaris10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 231 231 } 232 232 233 233 /** ··· 235 235 * @param hwmgr the address of the powerplay hardware manager. 236 236 * @exception Always succeeds. 237 237 */ 238 - int ellesmere_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr) 238 + int polaris10_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr) 239 239 { 240 240 int result; 241 241 ··· 244 244 245 245 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 246 246 PHM_PlatformCaps_MicrocodeFanControl)) { 247 - result = ellesmere_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 247 + result = polaris10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 248 248 if (!result) 249 - result = ellesmere_fan_ctrl_start_smc_fan_control(hwmgr); 249 + result = polaris10_fan_ctrl_start_smc_fan_control(hwmgr); 250 250 } else 251 - result = ellesmere_fan_ctrl_set_default_mode(hwmgr); 251 + result = polaris10_fan_ctrl_set_default_mode(hwmgr); 252 252 253 253 return result; 254 254 } ··· 259 259 * @param speed is the percentage value (min - max) to be set. 260 260 * @exception Fails is the speed not lie between min and max. 261 261 */ 262 - int ellesmere_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) 262 + int polaris10_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) 263 263 { 264 264 uint32_t tach_period; 265 265 uint32_t crystal_clock_freq; ··· 273 273 274 274 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 275 275 PHM_PlatformCaps_MicrocodeFanControl)) 276 - ellesmere_fan_ctrl_stop_smc_fan_control(hwmgr); 276 + polaris10_fan_ctrl_stop_smc_fan_control(hwmgr); 277 277 278 278 crystal_clock_freq = tonga_get_xclk(hwmgr); 279 279 ··· 282 282 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 283 283 CG_TACH_STATUS, TACH_PERIOD, tach_period); 284 284 285 - return ellesmere_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 285 + return polaris10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 286 286 } 287 287 288 288 /** ··· 290 290 * 291 291 * @param hwmgr The address of the hardware manager. 292 292 */ 293 - int ellesmere_thermal_get_temperature(struct pp_hwmgr *hwmgr) 293 + int polaris10_thermal_get_temperature(struct pp_hwmgr *hwmgr) 294 294 { 295 295 int temp; 296 296 ··· 299 299 300 300 /* Bit 9 means the reading is lower than the lowest usable value. */ 301 301 if (temp & 0x200) 302 - temp = ELLESMERE_THERMAL_MAXIMUM_TEMP_READING; 302 + temp = POLARIS10_THERMAL_MAXIMUM_TEMP_READING; 303 303 else 304 304 temp = temp & 0x1ff; 305 305 ··· 315 315 * @param range Temperature range to be programmed for high and low alert signals 316 316 * @exception PP_Result_BadInput if the input data is not valid. 317 317 */ 318 - static int ellesmere_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, 318 + static int polaris10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, 319 319 uint32_t low_temp, uint32_t high_temp) 320 320 { 321 - uint32_t low = ELLESMERE_THERMAL_MINIMUM_ALERT_TEMP * 321 + uint32_t low = POLARIS10_THERMAL_MINIMUM_ALERT_TEMP * 322 322 PP_TEMPERATURE_UNITS_PER_CENTIGRADES; 323 - uint32_t high = ELLESMERE_THERMAL_MAXIMUM_ALERT_TEMP * 323 + uint32_t high = POLARIS10_THERMAL_MAXIMUM_ALERT_TEMP * 324 324 PP_TEMPERATURE_UNITS_PER_CENTIGRADES; 325 325 326 326 if (low < low_temp) ··· 349 349 * 350 350 * @param hwmgr The address of the hardware manager. 351 351 */ 352 - static int ellesmere_thermal_initialize(struct pp_hwmgr *hwmgr) 352 + static int polaris10_thermal_initialize(struct pp_hwmgr *hwmgr) 353 353 { 354 354 if (hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) 355 355 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, ··· 368 368 * 369 369 * @param hwmgr The address of the hardware manager. 370 370 */ 371 - static int ellesmere_thermal_enable_alert(struct pp_hwmgr *hwmgr) 371 + static int polaris10_thermal_enable_alert(struct pp_hwmgr *hwmgr) 372 372 { 373 373 uint32_t alert; 374 374 375 375 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 376 376 CG_THERMAL_INT, THERM_INT_MASK); 377 - alert &= ~(ELLESMERE_THERMAL_HIGH_ALERT_MASK | ELLESMERE_THERMAL_LOW_ALERT_MASK); 377 + alert &= ~(POLARIS10_THERMAL_HIGH_ALERT_MASK | POLARIS10_THERMAL_LOW_ALERT_MASK); 378 378 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 379 379 CG_THERMAL_INT, THERM_INT_MASK, alert); 380 380 ··· 386 386 * Disable thermal alerts on the RV770 thermal controller. 387 387 * @param hwmgr The address of the hardware manager. 388 388 */ 389 - static int ellesmere_thermal_disable_alert(struct pp_hwmgr *hwmgr) 389 + static int polaris10_thermal_disable_alert(struct pp_hwmgr *hwmgr) 390 390 { 391 391 uint32_t alert; 392 392 393 393 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 394 394 CG_THERMAL_INT, THERM_INT_MASK); 395 - alert |= (ELLESMERE_THERMAL_HIGH_ALERT_MASK | ELLESMERE_THERMAL_LOW_ALERT_MASK); 395 + alert |= (POLARIS10_THERMAL_HIGH_ALERT_MASK | POLARIS10_THERMAL_LOW_ALERT_MASK); 396 396 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, 397 397 CG_THERMAL_INT, THERM_INT_MASK, alert); 398 398 ··· 405 405 * Currently just disables alerts. 406 406 * @param hwmgr The address of the hardware manager. 407 407 */ 408 - int ellesmere_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr) 408 + int polaris10_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr) 409 409 { 410 - int result = ellesmere_thermal_disable_alert(hwmgr); 410 + int result = polaris10_thermal_disable_alert(hwmgr); 411 411 412 412 if (!hwmgr->thermal_controller.fanInfo.bNoFan) 413 - ellesmere_fan_ctrl_set_default_mode(hwmgr); 413 + polaris10_fan_ctrl_set_default_mode(hwmgr); 414 414 415 415 return result; 416 416 } ··· 424 424 * @param Result the last failure code 425 425 * @return result from set temperature range routine 426 426 */ 427 - int tf_ellesmere_thermal_setup_fan_table(struct pp_hwmgr *hwmgr, 427 + int tf_polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr, 428 428 void *input, void *output, void *storage, int result) 429 429 { 430 - struct ellesmere_hwmgr *data = (struct ellesmere_hwmgr *)(hwmgr->backend); 430 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 431 431 SMU74_Discrete_FanTable fan_table = { FDO_MODE_HARDWARE }; 432 432 uint32_t duty100; 433 433 uint32_t t_diff1, t_diff2, pwm_diff1, pwm_diff2; ··· 502 502 hwmgr->device, CGS_IND_REG__SMC, 503 503 CG_MULT_THERMAL_CTRL, TEMP_SEL); 504 504 505 - res = ellesmere_copy_bytes_to_smc(hwmgr->smumgr, data->fan_table_start, 505 + res = polaris10_copy_bytes_to_smc(hwmgr->smumgr, data->fan_table_start, 506 506 (uint8_t *)&fan_table, (uint32_t)sizeof(fan_table), 507 507 data->sram_end); 508 508 ··· 536 536 * @param Result the last failure code 537 537 * @return result from set temperature range routine 538 538 */ 539 - int tf_ellesmere_thermal_start_smc_fan_control(struct pp_hwmgr *hwmgr, 539 + int tf_polaris10_thermal_start_smc_fan_control(struct pp_hwmgr *hwmgr, 540 540 void *input, void *output, void *storage, int result) 541 541 { 542 542 /* If the fantable setup has failed we could have disabled ··· 546 546 */ 547 547 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 548 548 PHM_PlatformCaps_MicrocodeFanControl)) { 549 - ellesmere_fan_ctrl_start_smc_fan_control(hwmgr); 550 - ellesmere_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 549 + polaris10_fan_ctrl_start_smc_fan_control(hwmgr); 550 + polaris10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); 551 551 } 552 552 553 553 return 0; ··· 562 562 * @param Result the last failure code 563 563 * @return result from set temperature range routine 564 564 */ 565 - int tf_ellesmere_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, 565 + int tf_polaris10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, 566 566 void *input, void *output, void *storage, int result) 567 567 { 568 568 struct PP_TemperatureRange *range = (struct PP_TemperatureRange *)input; ··· 570 570 if (range == NULL) 571 571 return -EINVAL; 572 572 573 - return ellesmere_thermal_set_temperature_range(hwmgr, range->min, range->max); 573 + return polaris10_thermal_set_temperature_range(hwmgr, range->min, range->max); 574 574 } 575 575 576 576 /** ··· 582 582 * @param Result the last failure code 583 583 * @return result from initialize thermal controller routine 584 584 */ 585 - int tf_ellesmere_thermal_initialize(struct pp_hwmgr *hwmgr, 585 + int tf_polaris10_thermal_initialize(struct pp_hwmgr *hwmgr, 586 586 void *input, void *output, void *storage, int result) 587 587 { 588 - return ellesmere_thermal_initialize(hwmgr); 588 + return polaris10_thermal_initialize(hwmgr); 589 589 } 590 590 591 591 /** ··· 597 597 * @param Result the last failure code 598 598 * @return result from enable alert routine 599 599 */ 600 - int tf_ellesmere_thermal_enable_alert(struct pp_hwmgr *hwmgr, 600 + int tf_polaris10_thermal_enable_alert(struct pp_hwmgr *hwmgr, 601 601 void *input, void *output, void *storage, int result) 602 602 { 603 - return ellesmere_thermal_enable_alert(hwmgr); 603 + return polaris10_thermal_enable_alert(hwmgr); 604 604 } 605 605 606 606 /** ··· 612 612 * @param Result the last failure code 613 613 * @return result from disable alert routine 614 614 */ 615 - static int tf_ellesmere_thermal_disable_alert(struct pp_hwmgr *hwmgr, 615 + static int tf_polaris10_thermal_disable_alert(struct pp_hwmgr *hwmgr, 616 616 void *input, void *output, void *storage, int result) 617 617 { 618 - return ellesmere_thermal_disable_alert(hwmgr); 618 + return polaris10_thermal_disable_alert(hwmgr); 619 619 } 620 620 621 - static int tf_ellesmere_thermal_avfs_enable(struct pp_hwmgr *hwmgr, 621 + static int tf_polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr, 622 622 void *input, void *output, void *storage, int result) 623 623 { 624 624 int ret; 625 625 struct pp_smumgr *smumgr = (struct pp_smumgr *)(hwmgr->smumgr); 626 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 626 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 627 627 628 628 if (smu_data->avfs.avfs_btc_status != AVFS_BTC_ENABLEAVFS) 629 629 return 0; ··· 639 639 } 640 640 641 641 static struct phm_master_table_item 642 - ellesmere_thermal_start_thermal_controller_master_list[] = { 643 - {NULL, tf_ellesmere_thermal_initialize}, 644 - {NULL, tf_ellesmere_thermal_set_temperature_range}, 645 - {NULL, tf_ellesmere_thermal_enable_alert}, 646 - {NULL, tf_ellesmere_thermal_avfs_enable}, 642 + polaris10_thermal_start_thermal_controller_master_list[] = { 643 + {NULL, tf_polaris10_thermal_initialize}, 644 + {NULL, tf_polaris10_thermal_set_temperature_range}, 645 + {NULL, tf_polaris10_thermal_enable_alert}, 646 + {NULL, tf_polaris10_thermal_avfs_enable}, 647 647 /* We should restrict performance levels to low before we halt the SMC. 648 648 * On the other hand we are still in boot state when we do this 649 649 * so it would be pointless. 650 650 * If this assumption changes we have to revisit this table. 651 651 */ 652 - {NULL, tf_ellesmere_thermal_setup_fan_table}, 653 - {NULL, tf_ellesmere_thermal_start_smc_fan_control}, 652 + {NULL, tf_polaris10_thermal_setup_fan_table}, 653 + {NULL, tf_polaris10_thermal_start_smc_fan_control}, 654 654 {NULL, NULL} 655 655 }; 656 656 657 657 static struct phm_master_table_header 658 - ellesmere_thermal_start_thermal_controller_master = { 658 + polaris10_thermal_start_thermal_controller_master = { 659 659 0, 660 660 PHM_MasterTableFlag_None, 661 - ellesmere_thermal_start_thermal_controller_master_list 661 + polaris10_thermal_start_thermal_controller_master_list 662 662 }; 663 663 664 664 static struct phm_master_table_item 665 - ellesmere_thermal_set_temperature_range_master_list[] = { 666 - {NULL, tf_ellesmere_thermal_disable_alert}, 667 - {NULL, tf_ellesmere_thermal_set_temperature_range}, 668 - {NULL, tf_ellesmere_thermal_enable_alert}, 665 + polaris10_thermal_set_temperature_range_master_list[] = { 666 + {NULL, tf_polaris10_thermal_disable_alert}, 667 + {NULL, tf_polaris10_thermal_set_temperature_range}, 668 + {NULL, tf_polaris10_thermal_enable_alert}, 669 669 {NULL, NULL} 670 670 }; 671 671 672 672 struct phm_master_table_header 673 - ellesmere_thermal_set_temperature_range_master = { 673 + polaris10_thermal_set_temperature_range_master = { 674 674 0, 675 675 PHM_MasterTableFlag_None, 676 - ellesmere_thermal_set_temperature_range_master_list 676 + polaris10_thermal_set_temperature_range_master_list 677 677 }; 678 678 679 - int ellesmere_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr) 679 + int polaris10_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr) 680 680 { 681 681 if (!hwmgr->thermal_controller.fanInfo.bNoFan) 682 - ellesmere_fan_ctrl_set_default_mode(hwmgr); 682 + polaris10_fan_ctrl_set_default_mode(hwmgr); 683 683 return 0; 684 684 } 685 685 ··· 688 688 * @param hwmgr The address of the hardware manager. 689 689 * @exception Any error code from the low-level communication. 690 690 */ 691 - int pp_ellesmere_thermal_initialize(struct pp_hwmgr *hwmgr) 691 + int pp_polaris10_thermal_initialize(struct pp_hwmgr *hwmgr) 692 692 { 693 693 int result; 694 694 695 695 result = phm_construct_table(hwmgr, 696 - &ellesmere_thermal_set_temperature_range_master, 696 + &polaris10_thermal_set_temperature_range_master, 697 697 &(hwmgr->set_temperature_range)); 698 698 699 699 if (!result) { 700 700 result = phm_construct_table(hwmgr, 701 - &ellesmere_thermal_start_thermal_controller_master, 701 + &polaris10_thermal_start_thermal_controller_master, 702 702 &(hwmgr->start_thermal_controller)); 703 703 if (result) 704 704 phm_destroy_table(hwmgr, &(hwmgr->set_temperature_range));
-62
drivers/gpu/drm/amd/powerplay/hwmgr/ellesmere_thermal.h
··· 1 - /* 2 - * Copyright 2016 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - */ 23 - 24 - #ifndef _ELLESMERE_THERMAL_H_ 25 - #define _ELLESMERE_THERMAL_H_ 26 - 27 - #include "hwmgr.h" 28 - 29 - #define ELLESMERE_THERMAL_HIGH_ALERT_MASK 0x1 30 - #define ELLESMERE_THERMAL_LOW_ALERT_MASK 0x2 31 - 32 - #define ELLESMERE_THERMAL_MINIMUM_TEMP_READING -256 33 - #define ELLESMERE_THERMAL_MAXIMUM_TEMP_READING 255 34 - 35 - #define ELLESMERE_THERMAL_MINIMUM_ALERT_TEMP 0 36 - #define ELLESMERE_THERMAL_MAXIMUM_ALERT_TEMP 255 37 - 38 - #define FDO_PWM_MODE_STATIC 1 39 - #define FDO_PWM_MODE_STATIC_RPM 5 40 - 41 - 42 - extern int tf_ellesmere_thermal_initialize(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 43 - extern int tf_ellesmere_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 44 - extern int tf_ellesmere_thermal_enable_alert(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 45 - 46 - extern int ellesmere_thermal_get_temperature(struct pp_hwmgr *hwmgr); 47 - extern int ellesmere_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr); 48 - extern int ellesmere_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info); 49 - extern int ellesmere_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, uint32_t *speed); 50 - extern int ellesmere_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr); 51 - extern int ellesmere_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode); 52 - extern int ellesmere_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, uint32_t speed); 53 - extern int ellesmere_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr); 54 - extern int pp_ellesmere_thermal_initialize(struct pp_hwmgr *hwmgr); 55 - extern int ellesmere_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr); 56 - extern int ellesmere_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed); 57 - extern int ellesmere_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed); 58 - extern int ellesmere_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr); 59 - extern uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr); 60 - 61 - #endif 62 -
+4 -4
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
··· 34 34 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr); 35 35 extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr); 36 36 extern int fiji_hwmgr_init(struct pp_hwmgr *hwmgr); 37 - extern int ellesemere_hwmgr_init(struct pp_hwmgr *hwmgr); 37 + extern int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr); 38 38 39 39 int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle) 40 40 { ··· 68 68 case CHIP_FIJI: 69 69 fiji_hwmgr_init(hwmgr); 70 70 break; 71 - case CHIP_BAFFIN: 72 - case CHIP_ELLESMERE: 73 - ellesemere_hwmgr_init(hwmgr); 71 + case CHIP_POLARIS11: 72 + case CHIP_POLARIS10: 73 + polaris10_hwmgr_init(hwmgr); 74 74 break; 75 75 default: 76 76 return -EINVAL;
+62
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_dyn_defaults.h
··· 1 + /* 2 + * Copyright 2015 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + */ 23 + 24 + #ifndef POLARIS10_DYN_DEFAULTS_H 25 + #define POLARIS10_DYN_DEFAULTS_H 26 + 27 + 28 + enum Polaris10dpm_TrendDetection { 29 + Polaris10Adpm_TrendDetection_AUTO, 30 + Polaris10Adpm_TrendDetection_UP, 31 + Polaris10Adpm_TrendDetection_DOWN 32 + }; 33 + typedef enum Polaris10dpm_TrendDetection Polaris10dpm_TrendDetection; 34 + 35 + /* We need to fill in the default values */ 36 + 37 + 38 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT0 0x3FFFC102 39 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT1 0x000400 40 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT2 0xC00080 41 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT3 0xC00200 42 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT4 0xC01680 43 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT5 0xC00033 44 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT6 0xC00033 45 + #define PPPOLARIS10_VOTINGRIGHTSCLIENTS_DFLT7 0x3FFFC000 46 + 47 + 48 + #define PPPOLARIS10_THERMALPROTECTCOUNTER_DFLT 0x200 49 + #define PPPOLARIS10_STATICSCREENTHRESHOLDUNIT_DFLT 0 50 + #define PPPOLARIS10_STATICSCREENTHRESHOLD_DFLT 0x00C8 51 + #define PPPOLARIS10_GFXIDLECLOCKSTOPTHRESHOLD_DFLT 0x200 52 + #define PPPOLARIS10_REFERENCEDIVIDER_DFLT 4 53 + 54 + #define PPPOLARIS10_ULVVOLTAGECHANGEDELAY_DFLT 1687 55 + 56 + #define PPPOLARIS10_CGULVPARAMETER_DFLT 0x00040035 57 + #define PPPOLARIS10_CGULVCONTROL_DFLT 0x00007450 58 + #define PPPOLARIS10_TARGETACTIVITY_DFLT 50 59 + #define PPPOLARIS10_MCLK_TARGETACTIVITY_DFLT 10 60 + 61 + #endif 62 +
+62
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.h
··· 1 + /* 2 + * Copyright 2016 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + */ 23 + 24 + #ifndef _POLARIS10_THERMAL_H_ 25 + #define _POLARIS10_THERMAL_H_ 26 + 27 + #include "hwmgr.h" 28 + 29 + #define POLARIS10_THERMAL_HIGH_ALERT_MASK 0x1 30 + #define POLARIS10_THERMAL_LOW_ALERT_MASK 0x2 31 + 32 + #define POLARIS10_THERMAL_MINIMUM_TEMP_READING -256 33 + #define POLARIS10_THERMAL_MAXIMUM_TEMP_READING 255 34 + 35 + #define POLARIS10_THERMAL_MINIMUM_ALERT_TEMP 0 36 + #define POLARIS10_THERMAL_MAXIMUM_ALERT_TEMP 255 37 + 38 + #define FDO_PWM_MODE_STATIC 1 39 + #define FDO_PWM_MODE_STATIC_RPM 5 40 + 41 + 42 + extern int tf_polaris10_thermal_initialize(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 43 + extern int tf_polaris10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 44 + extern int tf_polaris10_thermal_enable_alert(struct pp_hwmgr *hwmgr, void *input, void *output, void *storage, int result); 45 + 46 + extern int polaris10_thermal_get_temperature(struct pp_hwmgr *hwmgr); 47 + extern int polaris10_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr); 48 + extern int polaris10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info); 49 + extern int polaris10_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, uint32_t *speed); 50 + extern int polaris10_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr); 51 + extern int polaris10_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode); 52 + extern int polaris10_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, uint32_t speed); 53 + extern int polaris10_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr); 54 + extern int pp_polaris10_thermal_initialize(struct pp_hwmgr *hwmgr); 55 + extern int polaris10_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr); 56 + extern int polaris10_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed); 57 + extern int polaris10_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed); 58 + extern int polaris10_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr); 59 + extern uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr); 60 + 61 + #endif 62 +
+5 -5
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h
··· 209 209 ATOM_Tonga_PCIE_Record entries[1]; /* Dynamically allocate entries. */ 210 210 } ATOM_Tonga_PCIE_Table; 211 211 212 - typedef struct _ATOM_Ellesmere_PCIE_Record { 212 + typedef struct _ATOM_Polaris10_PCIE_Record { 213 213 UCHAR ucPCIEGenSpeed; 214 214 UCHAR usPCIELaneWidth; 215 215 UCHAR ucReserved[2]; 216 216 ULONG ulPCIE_Sclk; 217 - } ATOM_Ellesmere_PCIE_Record; 217 + } ATOM_Polaris10_PCIE_Record; 218 218 219 - typedef struct _ATOM_Ellesmere_PCIE_Table { 219 + typedef struct _ATOM_Polaris10_PCIE_Table { 220 220 UCHAR ucRevId; 221 221 UCHAR ucNumEntries; /* Number of entries. */ 222 - ATOM_Ellesmere_PCIE_Record entries[1]; /* Dynamically allocate entries. */ 223 - } ATOM_Ellesmere_PCIE_Table; 222 + ATOM_Polaris10_PCIE_Record entries[1]; /* Dynamically allocate entries. */ 223 + } ATOM_Polaris10_PCIE_Table; 224 224 225 225 226 226 typedef struct _ATOM_Tonga_MM_Dependency_Record {
+2 -2
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
··· 493 493 494 494 *pp_tonga_pcie_table = pcie_table; 495 495 } else { 496 - /* Ellesmere/Baffin and newer. */ 497 - const ATOM_Ellesmere_PCIE_Table *atom_pcie_table = (ATOM_Ellesmere_PCIE_Table *)pTable; 496 + /* Polaris10/Polaris11 and newer. */ 497 + const ATOM_Polaris10_PCIE_Table *atom_pcie_table = (ATOM_Polaris10_PCIE_Table *)pTable; 498 498 PP_ASSERT_WITH_CODE((atom_pcie_table->ucNumEntries != 0), 499 499 "Invalid PowerPlay Table!", return -1); 500 500
+10 -2
drivers/gpu/drm/amd/powerplay/inc/ellesmere_ppsmc.h drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h
··· 21 21 * 22 22 */ 23 23 24 - #ifndef ELLESMERE_PP_SMC_H 25 - #define ELLESMERE_PP_SMC_H 24 + #ifndef POLARIS10_PP_SMC_H 25 + #define POLARIS10_PP_SMC_H 26 26 27 27 28 28 #pragma pack(push, 1) ··· 386 386 387 387 #define PPSMC_MSG_GFX_CU_PG_ENABLE ((uint16_t) 0x280) 388 388 #define PPSMC_MSG_GFX_CU_PG_DISABLE ((uint16_t) 0x281) 389 + #define PPSMC_MSG_GetCurrPkgPwr ((uint16_t) 0x282) 389 390 390 391 #define PPSMC_MSG_SetGpuPllDfsForSclk ((uint16_t) 0x300) 392 + #define PPSMC_MSG_Didt_Block_Function ((uint16_t) 0x301) 393 + 394 + #define PPSMC_MSG_SecureSRBMWrite ((uint16_t) 0x600) 395 + #define PPSMC_MSG_SecureSRBMRead ((uint16_t) 0x601) 396 + #define PPSMC_MSG_SetAddress ((uint16_t) 0x800) 397 + #define PPSMC_MSG_GetData ((uint16_t) 0x801) 398 + #define PPSMC_MSG_SetData ((uint16_t) 0x802) 391 399 392 400 typedef uint16_t PPSMC_Msg; 393 401
+2 -2
drivers/gpu/drm/amd/powerplay/inc/ellesmere_pwrvirus.h drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h
··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 * 22 22 */ 23 - #ifndef _ELLESMERE_PWRVIRUS_H 24 - #define _ELLESMERE_PWRVIRUS_H 23 + #ifndef _POLARIS10_PWRVIRUS_H 24 + #define _POLARIS10_PWRVIRUS_H 25 25 26 26 #define mmSMC_IND_INDEX_11 0x01AC 27 27 #define mmSMC_IND_DATA_11 0x01AD
+42
drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h
··· 705 705 uint16_t Sclk_dpm_residency[8]; 706 706 uint16_t Uvd_dpm_residency[8]; 707 707 uint16_t Vce_dpm_residency[8]; 708 + uint16_t Mclk_dpm_residency[4]; 708 709 709 710 uint32_t P_vddci_acc; 710 711 uint32_t P_vddr1_acc; ··· 779 778 #define SMU7_THERM_OUT_MODE_DISABLE 0x0 780 779 #define SMU7_THERM_OUT_MODE_THERM_ONLY 0x1 781 780 #define SMU7_THERM_OUT_MODE_THERM_VRHOT 0x2 781 + 782 + // DIDT Defines 783 + #define SQ_Enable_MASK 0x1 784 + #define SQ_IR_MASK 0x2 785 + #define SQ_PCC_MASK 0x4 786 + #define SQ_EDC_MASK 0x8 787 + 788 + #define TCP_Enable_MASK 0x100 789 + #define TCP_IR_MASK 0x200 790 + #define TCP_PCC_MASK 0x400 791 + #define TCP_EDC_MASK 0x800 792 + 793 + #define TD_Enable_MASK 0x10000 794 + #define TD_IR_MASK 0x20000 795 + #define TD_PCC_MASK 0x40000 796 + #define TD_EDC_MASK 0x80000 797 + 798 + #define DB_Enable_MASK 0x1000000 799 + #define DB_IR_MASK 0x2000000 800 + #define DB_PCC_MASK 0x4000000 801 + #define DB_EDC_MASK 0x8000000 802 + 803 + #define SQ_Enable_SHIFT 0 804 + #define SQ_IR_SHIFT 1 805 + #define SQ_PCC_SHIFT 2 806 + #define SQ_EDC_SHIFT 3 807 + 808 + #define TCP_Enable_SHIFT 8 809 + #define TCP_IR_SHIFT 9 810 + #define TCP_PCC_SHIFT 10 811 + #define TCP_EDC_SHIFT 11 812 + 813 + #define TD_Enable_SHIFT 16 814 + #define TD_IR_SHIFT 17 815 + #define TD_PCC_SHIFT 18 816 + #define TD_EDC_SHIFT 19 817 + 818 + #define DB_Enable_SHIFT 24 819 + #define DB_IR_SHIFT 25 820 + #define DB_PCC_SHIFT 26 821 + #define DB_EDC_SHIFT 27 782 822 783 823 #pragma pack(pop) 784 824
+1 -1
drivers/gpu/drm/amd/powerplay/smumgr/Makefile
··· 2 2 # Makefile for the 'smu manager' sub-component of powerplay. 3 3 # It provides the smu management services for the driver. 4 4 5 - SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o ellesmere_smumgr.o 5 + SMU_MGR = smumgr.o cz_smumgr.o tonga_smumgr.o fiji_smumgr.o polaris10_smumgr.o 6 6 7 7 AMD_PP_SMUMGR = $(addprefix $(AMD_PP_PATH)/smumgr/,$(SMU_MGR)) 8 8
+122 -122
drivers/gpu/drm/amd/powerplay/smumgr/ellesmere_smumgr.c drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
··· 24 24 #include "smumgr.h" 25 25 #include "smu74.h" 26 26 #include "smu_ucode_xfer_vi.h" 27 - #include "ellesmere_smumgr.h" 27 + #include "polaris10_smumgr.h" 28 28 #include "smu74_discrete.h" 29 29 #include "smu/smu_7_1_3_d.h" 30 30 #include "smu/smu_7_1_3_sh_mask.h" ··· 34 34 #include "gca/gfx_8_0_d.h" 35 35 #include "bif/bif_5_0_d.h" 36 36 #include "bif/bif_5_0_sh_mask.h" 37 - #include "ellesmere_pwrvirus.h" 37 + #include "polaris10_pwrvirus.h" 38 38 #include "ppatomctrl.h" 39 39 #include "pp_debug.h" 40 40 #include "cgs_common.h" 41 41 42 - #define ELLESMERE_SMC_SIZE 0x20000 42 + #define POLARIS10_SMC_SIZE 0x20000 43 43 #define VOLTAGE_SCALE 4 44 44 45 45 /* Microcode file is stored in this buffer */ ··· 49 49 50 50 #define SMC_RAM_END 0x40000 51 51 52 - SMU74_Discrete_GraphicsLevel avfs_graphics_level_ellesmere[8] = { 52 + SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = { 53 53 /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */ 54 54 /* Voltage, DpmLevel, DivId, Level, FuncCntl3, FuncCntl4, DynRm, DynRm1 Did, Padding,ForActivity, ForThrottle, UpHyst, DownHyst, DownHyst, Throttle */ 55 55 { 0x3c0fd047, 0x00, 0x03, 0x1e00, 0x00200410, 0x87020000, 0, 0, 0x16, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x30750000, 0, 0, 0, 0, 0, 0, 0 } }, ··· 62 62 { 0xf811d047, 0x01, 0x00, 0x1e00, 0x00000610, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x80380100, 0, 0, 0, 0, 0, 0, 0 } } 63 63 }; 64 64 65 - SMU74_Discrete_MemoryLevel avfs_memory_level_ellesmere = {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00, 65 + SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00, 66 66 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x00, 0x00}; 67 67 68 68 /** ··· 70 70 * @param smumgr the address of the powerplay hardware manager. 71 71 * @param smcAddress the address in the SMC RAM to access. 72 72 */ 73 - static int ellesmere_set_smc_sram_address(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t limit) 73 + static int polaris10_set_smc_sram_address(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t limit) 74 74 { 75 75 PP_ASSERT_WITH_CODE((0 == (3 & smc_addr)), "SMC address must be 4 byte aligned.", return -EINVAL); 76 76 PP_ASSERT_WITH_CODE((limit > (smc_addr + 3)), "SMC addr is beyond the SMC RAM area.", return -EINVAL); ··· 89 89 * @param src the byte array to copy the bytes to. 90 90 * @param byte_count the number of bytes to copy. 91 91 */ 92 - int ellesmere_copy_bytes_from_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, uint32_t *dest, uint32_t byte_count, uint32_t limit) 92 + int polaris10_copy_bytes_from_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, uint32_t *dest, uint32_t byte_count, uint32_t limit) 93 93 { 94 94 uint32_t data; 95 95 uint32_t addr; ··· 103 103 addr = smc_start_address; 104 104 105 105 while (byte_count >= 4) { 106 - ellesmere_read_smc_sram_dword(smumgr, addr, &data, limit); 106 + polaris10_read_smc_sram_dword(smumgr, addr, &data, limit); 107 107 108 108 *dest = PP_SMC_TO_HOST_UL(data); 109 109 ··· 113 113 } 114 114 115 115 if (byte_count) { 116 - ellesmere_read_smc_sram_dword(smumgr, addr, &data, limit); 116 + polaris10_read_smc_sram_dword(smumgr, addr, &data, limit); 117 117 *pdata = PP_SMC_TO_HOST_UL(data); 118 118 /* Cast dest into byte type in dest_byte. This way, we don't overflow if the allocated memory is not 4-byte aligned. */ 119 119 dest_byte = (uint8_t *)dest; ··· 132 132 * @param src the byte array to copy the bytes from. 133 133 * @param byte_count the number of bytes to copy. 134 134 */ 135 - int ellesmere_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, 135 + int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, 136 136 const uint8_t *src, uint32_t byte_count, uint32_t limit) 137 137 { 138 138 int result; ··· 150 150 /* Bytes are written into the SMC addres space with the MSB first. */ 151 151 data = src[0] * 0x1000000 + src[1] * 0x10000 + src[2] * 0x100 + src[3]; 152 152 153 - result = ellesmere_set_smc_sram_address(smumgr, addr, limit); 153 + result = polaris10_set_smc_sram_address(smumgr, addr, limit); 154 154 155 155 if (0 != result) 156 156 return result; ··· 166 166 167 167 data = 0; 168 168 169 - result = ellesmere_set_smc_sram_address(smumgr, addr, limit); 169 + result = polaris10_set_smc_sram_address(smumgr, addr, limit); 170 170 171 171 if (0 != result) 172 172 return result; ··· 186 186 187 187 data |= (original_data & ~((~0UL) << extra_shift)); 188 188 189 - result = ellesmere_set_smc_sram_address(smumgr, addr, limit); 189 + result = polaris10_set_smc_sram_address(smumgr, addr, limit); 190 190 191 191 if (0 != result) 192 192 return result; ··· 198 198 } 199 199 200 200 201 - static int ellesmere_program_jump_on_start(struct pp_smumgr *smumgr) 201 + static int polaris10_program_jump_on_start(struct pp_smumgr *smumgr) 202 202 { 203 203 static unsigned char data[4] = { 0xE0, 0x00, 0x80, 0x40 }; 204 204 205 - ellesmere_copy_bytes_to_smc(smumgr, 0x0, data, 4, sizeof(data)+1); 205 + polaris10_copy_bytes_to_smc(smumgr, 0x0, data, 4, sizeof(data)+1); 206 206 207 207 return 0; 208 208 } ··· 212 212 * 213 213 * @param smumgr the address of the powerplay hardware manager. 214 214 */ 215 - bool ellesmere_is_smc_ram_running(struct pp_smumgr *smumgr) 215 + bool polaris10_is_smc_ram_running(struct pp_smumgr *smumgr) 216 216 { 217 217 return ((0 == SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, SMC_SYSCON_CLOCK_CNTL_0, ck_disable)) 218 218 && (0x20100 <= cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMC_PC_C))); ··· 225 225 * @param msg the message to send. 226 226 * @return The response that came from the SMC. 227 227 */ 228 - int ellesmere_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg) 228 + int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg) 229 229 { 230 - if (!ellesmere_is_smc_ram_running(smumgr)) 230 + if (!polaris10_is_smc_ram_running(smumgr)) 231 231 return -1; 232 232 233 233 SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); ··· 254 254 * @param msg the message to send. 255 255 * @return Always return 0. 256 256 */ 257 - int ellesmere_send_msg_to_smc_without_waiting(struct pp_smumgr *smumgr, uint16_t msg) 257 + int polaris10_send_msg_to_smc_without_waiting(struct pp_smumgr *smumgr, uint16_t msg) 258 258 { 259 259 cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg); 260 260 ··· 269 269 * @param parameter: the parameter to send 270 270 * @return The response that came from the SMC. 271 271 */ 272 - int ellesmere_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter) 272 + int polaris10_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter) 273 273 { 274 - if (!ellesmere_is_smc_ram_running(smumgr)) { 274 + if (!polaris10_is_smc_ram_running(smumgr)) { 275 275 return -1; 276 276 } 277 277 ··· 279 279 280 280 cgs_write_register(smumgr->device, mmSMC_MSG_ARG_0, parameter); 281 281 282 - return ellesmere_send_msg_to_smc(smumgr, msg); 282 + return polaris10_send_msg_to_smc(smumgr, msg); 283 283 } 284 284 285 285 ··· 291 291 * @param parameter: the parameter to send 292 292 * @return The response that came from the SMC. 293 293 */ 294 - int ellesmere_send_msg_to_smc_with_parameter_without_waiting(struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter) 294 + int polaris10_send_msg_to_smc_with_parameter_without_waiting(struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter) 295 295 { 296 296 cgs_write_register(smumgr->device, mmSMC_MSG_ARG_0, parameter); 297 297 298 - return ellesmere_send_msg_to_smc_without_waiting(smumgr, msg); 298 + return polaris10_send_msg_to_smc_without_waiting(smumgr, msg); 299 299 } 300 300 301 - int ellesmere_send_msg_to_smc_offset(struct pp_smumgr *smumgr) 301 + int polaris10_send_msg_to_smc_offset(struct pp_smumgr *smumgr) 302 302 { 303 303 cgs_write_register(smumgr->device, mmSMC_MSG_ARG_0, 0x20000); 304 304 ··· 319 319 * @param msg the message to send. 320 320 * @return The response that came from the SMC. 321 321 */ 322 - int ellesmere_wait_for_smc_inactive(struct pp_smumgr *smumgr) 322 + int polaris10_wait_for_smc_inactive(struct pp_smumgr *smumgr) 323 323 { 324 324 /* If the SMC is not even on it qualifies as inactive. */ 325 - if (!ellesmere_is_smc_ram_running(smumgr)) 325 + if (!polaris10_is_smc_ram_running(smumgr)) 326 326 return -1; 327 327 328 328 SMUM_WAIT_VFPF_INDIRECT_FIELD(smumgr, SMC_IND, SMC_SYSCON_CLOCK_CNTL_0, cken, 0); ··· 336 336 * @param smumgr the address of the powerplay hardware manager. 337 337 * @param pFirmware the data structure containing the various sections of the firmware. 338 338 */ 339 - static int ellesmere_upload_smc_firmware_data(struct pp_smumgr *smumgr, uint32_t length, uint32_t *src, uint32_t limit) 339 + static int polaris10_upload_smc_firmware_data(struct pp_smumgr *smumgr, uint32_t length, uint32_t *src, uint32_t limit) 340 340 { 341 341 uint32_t byte_count = length; 342 342 ··· 355 355 return 0; 356 356 } 357 357 358 - static enum cgs_ucode_id ellesmere_convert_fw_type_to_cgs(uint32_t fw_type) 358 + static enum cgs_ucode_id polaris10_convert_fw_type_to_cgs(uint32_t fw_type) 359 359 { 360 360 enum cgs_ucode_id result = CGS_UCODE_ID_MAXIMUM; 361 361 ··· 400 400 return result; 401 401 } 402 402 403 - static int ellesmere_upload_smu_firmware_image(struct pp_smumgr *smumgr) 403 + static int polaris10_upload_smu_firmware_image(struct pp_smumgr *smumgr) 404 404 { 405 405 int result = 0; 406 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 406 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 407 407 408 408 struct cgs_firmware_info info = {0}; 409 409 410 410 if (smu_data->security_hard_key == 1) 411 411 cgs_get_firmware_info(smumgr->device, 412 - ellesmere_convert_fw_type_to_cgs(UCODE_ID_SMU), &info); 412 + polaris10_convert_fw_type_to_cgs(UCODE_ID_SMU), &info); 413 413 else 414 414 cgs_get_firmware_info(smumgr->device, 415 - ellesmere_convert_fw_type_to_cgs(UCODE_ID_SMU_SK), &info); 415 + polaris10_convert_fw_type_to_cgs(UCODE_ID_SMU_SK), &info); 416 416 417 417 /* TO DO cgs_init_samu_load_smu(smumgr->device, (uint32_t *)info.kptr, info.image_size, smu_data->post_initial_boot);*/ 418 - result = ellesmere_upload_smc_firmware_data(smumgr, info.image_size, (uint32_t *)info.kptr, ELLESMERE_SMC_SIZE); 418 + result = polaris10_upload_smc_firmware_data(smumgr, info.image_size, (uint32_t *)info.kptr, POLARIS10_SMC_SIZE); 419 419 420 420 return result; 421 421 } ··· 427 427 * @param smcAddress the address in the SMC RAM to access. 428 428 * @param value and output parameter for the data read from the SMC SRAM. 429 429 */ 430 - int ellesmere_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit) 430 + int polaris10_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit) 431 431 { 432 432 int result; 433 433 434 - result = ellesmere_set_smc_sram_address(smumgr, smc_addr, limit); 434 + result = polaris10_set_smc_sram_address(smumgr, smc_addr, limit); 435 435 436 436 if (result) 437 437 return result; ··· 447 447 * @param smc_addr the address in the SMC RAM to access. 448 448 * @param value to write to the SMC SRAM. 449 449 */ 450 - int ellesmere_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit) 450 + int polaris10_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit) 451 451 { 452 452 int result; 453 453 454 - result = ellesmere_set_smc_sram_address(smumgr, smc_addr, limit); 454 + result = polaris10_set_smc_sram_address(smumgr, smc_addr, limit); 455 455 456 456 if (result) 457 457 return result; ··· 462 462 } 463 463 464 464 465 - int ellesmere_smu_fini(struct pp_smumgr *smumgr) 465 + int polaris10_smu_fini(struct pp_smumgr *smumgr) 466 466 { 467 467 if (smumgr->backend) { 468 468 kfree(smumgr->backend); ··· 472 472 } 473 473 474 474 /* Convert the firmware type to SMU type mask. For MEC, we need to check all MEC related type */ 475 - static uint32_t ellesmere_get_mask_for_firmware_type(uint32_t fw_type) 475 + static uint32_t polaris10_get_mask_for_firmware_type(uint32_t fw_type) 476 476 { 477 477 uint32_t result = 0; 478 478 ··· 509 509 510 510 /* Populate one firmware image to the data structure */ 511 511 512 - static int ellesmere_populate_single_firmware_entry(struct pp_smumgr *smumgr, 512 + static int polaris10_populate_single_firmware_entry(struct pp_smumgr *smumgr, 513 513 uint32_t fw_type, 514 514 struct SMU_Entry *entry) 515 515 { ··· 517 517 struct cgs_firmware_info info = {0}; 518 518 519 519 result = cgs_get_firmware_info(smumgr->device, 520 - ellesmere_convert_fw_type_to_cgs(fw_type), 520 + polaris10_convert_fw_type_to_cgs(fw_type), 521 521 &info); 522 522 523 523 if (!result) { ··· 539 539 return 0; 540 540 } 541 541 542 - static int ellesmere_request_smu_load_fw(struct pp_smumgr *smumgr) 542 + static int polaris10_request_smu_load_fw(struct pp_smumgr *smumgr) 543 543 { 544 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 544 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 545 545 uint32_t fw_to_load; 546 546 547 547 int result = 0; ··· 557 557 smu_data->soft_regs_start + offsetof(SMU74_SoftRegisters, UcodeLoadStatus), 558 558 0x0); 559 559 560 - ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_SMU_DRAM_ADDR_HI, smu_data->smu_buffer.mc_addr_high); 561 - ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_SMU_DRAM_ADDR_LO, smu_data->smu_buffer.mc_addr_low); 560 + polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_SMU_DRAM_ADDR_HI, smu_data->smu_buffer.mc_addr_high); 561 + polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_SMU_DRAM_ADDR_LO, smu_data->smu_buffer.mc_addr_low); 562 562 563 563 toc = (struct SMU_DRAMData_TOC *)smu_data->header; 564 564 toc->num_entries = 0; 565 565 toc->structure_version = 1; 566 566 567 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_RLC_G, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 568 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_CE, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 569 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_PFP, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 570 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_ME, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 571 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 572 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC_JT1, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 573 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC_JT2, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 574 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_SDMA0, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 575 - PP_ASSERT_WITH_CODE(0 == ellesmere_populate_single_firmware_entry(smumgr, UCODE_ID_SDMA1, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 567 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_RLC_G, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 568 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_CE, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 569 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_PFP, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 570 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_ME, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 571 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 572 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC_JT1, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 573 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_CP_MEC_JT2, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 574 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_SDMA0, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 575 + PP_ASSERT_WITH_CODE(0 == polaris10_populate_single_firmware_entry(smumgr, UCODE_ID_SDMA1, &toc->entry[toc->num_entries++]), "Failed to Get Firmware Entry.", return -1); 576 576 577 - ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, smu_data->header_buffer.mc_addr_high); 578 - ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, smu_data->header_buffer.mc_addr_low); 577 + polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, smu_data->header_buffer.mc_addr_high); 578 + polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, smu_data->header_buffer.mc_addr_low); 579 579 580 580 fw_to_load = UCODE_ID_RLC_G_MASK 581 581 + UCODE_ID_SDMA0_MASK ··· 585 585 + UCODE_ID_CP_PFP_MASK 586 586 + UCODE_ID_CP_MEC_MASK; 587 587 588 - if (ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_LoadUcodes, fw_to_load)) 588 + if (polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_LoadUcodes, fw_to_load)) 589 589 printk(KERN_ERR "Fail to Request SMU Load uCode"); 590 590 591 591 return result; 592 592 } 593 593 594 594 /* Check if the FW has been loaded, SMU will not return if loading has not finished. */ 595 - static int ellesmere_check_fw_load_finish(struct pp_smumgr *smumgr, uint32_t fw_type) 595 + static int polaris10_check_fw_load_finish(struct pp_smumgr *smumgr, uint32_t fw_type) 596 596 { 597 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 598 - uint32_t fw_mask = ellesmere_get_mask_for_firmware_type(fw_type); 597 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 598 + uint32_t fw_mask = polaris10_get_mask_for_firmware_type(fw_type); 599 599 uint32_t ret; 600 600 /* Check SOFT_REGISTERS_TABLE_28.UcodeLoadStatus */ 601 601 ret = smum_wait_on_indirect_register(smumgr, mmSMC_IND_INDEX_11, ··· 605 605 return ret; 606 606 } 607 607 608 - static int ellesmere_reload_firmware(struct pp_smumgr *smumgr) 608 + static int polaris10_reload_firmware(struct pp_smumgr *smumgr) 609 609 { 610 610 return smumgr->smumgr_funcs->start_smu(smumgr); 611 611 } 612 612 613 - static int ellesmere_setup_pwr_virus(struct pp_smumgr *smumgr) 613 + static int polaris10_setup_pwr_virus(struct pp_smumgr *smumgr) 614 614 { 615 615 int i; 616 616 int result = -1; 617 617 uint32_t reg, data; 618 618 619 619 PWR_Command_Table *pvirus = pwr_virus_table; 620 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 620 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 621 621 622 622 623 623 for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) { ··· 644 644 return result; 645 645 } 646 646 647 - static int ellesmere_perform_btc(struct pp_smumgr *smumgr) 647 + static int polaris10_perform_btc(struct pp_smumgr *smumgr) 648 648 { 649 649 int result = 0; 650 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 650 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 651 651 652 652 if (0 != smu_data->avfs.avfs_btc_param) { 653 - if (0 != ellesmere_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_PerformBtc, smu_data->avfs.avfs_btc_param)) { 654 - printk("[AVFS][SmuEllesmere_PerformBtc] PerformBTC SMU msg failed"); 653 + if (0 != polaris10_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_PerformBtc, smu_data->avfs.avfs_btc_param)) { 654 + printk("[AVFS][SmuPolaris10_PerformBtc] PerformBTC SMU msg failed"); 655 655 result = -1; 656 656 } 657 657 } ··· 667 667 } 668 668 669 669 670 - int ellesmere_setup_graphics_level_structure(struct pp_smumgr *smumgr) 670 + int polaris10_setup_graphics_level_structure(struct pp_smumgr *smumgr) 671 671 { 672 672 uint32_t vr_config; 673 673 uint32_t dpm_table_start; ··· 675 675 uint16_t u16_boot_mvdd; 676 676 uint32_t graphics_level_address, vr_config_address, graphics_level_size; 677 677 678 - graphics_level_size = sizeof(avfs_graphics_level_ellesmere); 678 + graphics_level_size = sizeof(avfs_graphics_level_polaris10); 679 679 u16_boot_mvdd = PP_HOST_TO_SMC_US(1300 * VOLTAGE_SCALE); 680 680 681 - PP_ASSERT_WITH_CODE(0 == ellesmere_read_smc_sram_dword(smumgr, 681 + PP_ASSERT_WITH_CODE(0 == polaris10_read_smc_sram_dword(smumgr, 682 682 SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, DpmTable), 683 683 &dpm_table_start, 0x40000), 684 - "[AVFS][Ellesmere_SetupGfxLvlStruct] SMU could not communicate starting address of DPM table", 684 + "[AVFS][Polaris10_SetupGfxLvlStruct] SMU could not communicate starting address of DPM table", 685 685 return -1); 686 686 687 687 /* Default value for VRConfig = VR_MERGED_WITH_VDDC + VR_STATIC_VOLTAGE(VDDCI) */ ··· 689 689 690 690 vr_config_address = dpm_table_start + offsetof(SMU74_Discrete_DpmTable, VRConfig); 691 691 692 - PP_ASSERT_WITH_CODE(0 == ellesmere_copy_bytes_to_smc(smumgr, vr_config_address, 692 + PP_ASSERT_WITH_CODE(0 == polaris10_copy_bytes_to_smc(smumgr, vr_config_address, 693 693 (uint8_t *)&vr_config, sizeof(uint32_t), 0x40000), 694 - "[AVFS][Ellesmere_SetupGfxLvlStruct] Problems copying VRConfig value over to SMC", 694 + "[AVFS][Polaris10_SetupGfxLvlStruct] Problems copying VRConfig value over to SMC", 695 695 return -1); 696 696 697 697 graphics_level_address = dpm_table_start + offsetof(SMU74_Discrete_DpmTable, GraphicsLevel); 698 698 699 - PP_ASSERT_WITH_CODE(0 == ellesmere_copy_bytes_to_smc(smumgr, graphics_level_address, 700 - (uint8_t *)(&avfs_graphics_level_ellesmere), 699 + PP_ASSERT_WITH_CODE(0 == polaris10_copy_bytes_to_smc(smumgr, graphics_level_address, 700 + (uint8_t *)(&avfs_graphics_level_polaris10), 701 701 graphics_level_size, 0x40000), 702 - "[AVFS][Ellesmere_SetupGfxLvlStruct] Copying of SCLK DPM table failed!", 702 + "[AVFS][Polaris10_SetupGfxLvlStruct] Copying of SCLK DPM table failed!", 703 703 return -1); 704 704 705 705 graphics_level_address = dpm_table_start + offsetof(SMU74_Discrete_DpmTable, MemoryLevel); 706 706 707 - PP_ASSERT_WITH_CODE(0 == ellesmere_copy_bytes_to_smc(smumgr, graphics_level_address, 708 - (uint8_t *)(&avfs_memory_level_ellesmere), sizeof(avfs_memory_level_ellesmere), 0x40000), 709 - "[AVFS][Ellesmere_SetupGfxLvlStruct] Copying of MCLK DPM table failed!", 707 + PP_ASSERT_WITH_CODE(0 == polaris10_copy_bytes_to_smc(smumgr, graphics_level_address, 708 + (uint8_t *)(&avfs_memory_level_polaris10), sizeof(avfs_memory_level_polaris10), 0x40000), 709 + "[AVFS][Polaris10_SetupGfxLvlStruct] Copying of MCLK DPM table failed!", 710 710 return -1); 711 711 712 712 /* MVDD Boot value - neccessary for getting rid of the hang that occurs during Mclk DPM enablement */ 713 713 714 714 graphics_level_address = dpm_table_start + offsetof(SMU74_Discrete_DpmTable, BootMVdd); 715 715 716 - PP_ASSERT_WITH_CODE(0 == ellesmere_copy_bytes_to_smc(smumgr, graphics_level_address, 716 + PP_ASSERT_WITH_CODE(0 == polaris10_copy_bytes_to_smc(smumgr, graphics_level_address, 717 717 (uint8_t *)(&u16_boot_mvdd), sizeof(u16_boot_mvdd), 0x40000), 718 - "[AVFS][Ellesmere_SetupGfxLvlStruct] Copying of DPM table failed!", 718 + "[AVFS][Polaris10_SetupGfxLvlStruct] Copying of DPM table failed!", 719 719 return -1); 720 720 721 721 return 0; 722 722 } 723 723 724 - int ellesmere_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT) 724 + int polaris10_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT) 725 725 { 726 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 726 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 727 727 728 728 switch (smu_data->avfs.avfs_btc_status) { 729 729 case AVFS_BTC_COMPLETED_PREVIOUSLY: ··· 732 732 case AVFS_BTC_BOOT: /* Cold Boot State - Post SMU Start */ 733 733 734 734 smu_data->avfs.avfs_btc_status = AVFS_BTC_DPMTABLESETUP_FAILED; 735 - PP_ASSERT_WITH_CODE(0 == ellesmere_setup_graphics_level_structure(smumgr), 736 - "[AVFS][Ellesmere_AVFSEventMgr] Could not Copy Graphics Level table over to SMU", 735 + PP_ASSERT_WITH_CODE(0 == polaris10_setup_graphics_level_structure(smumgr), 736 + "[AVFS][Polaris10_AVFSEventMgr] Could not Copy Graphics Level table over to SMU", 737 737 return -1); 738 738 739 739 if (smu_data->avfs.avfs_btc_param > 1) { 740 - printk("[AVFS][Ellesmere_AVFSEventMgr] AC BTC has not been successfully verified on Fiji. There may be in this setting."); 740 + printk("[AVFS][Polaris10_AVFSEventMgr] AC BTC has not been successfully verified on Fiji. There may be in this setting."); 741 741 smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL; 742 - PP_ASSERT_WITH_CODE(-1 == ellesmere_setup_pwr_virus(smumgr), 743 - "[AVFS][Ellesmere_AVFSEventMgr] Could not setup Pwr Virus for AVFS ", 742 + PP_ASSERT_WITH_CODE(-1 == polaris10_setup_pwr_virus(smumgr), 743 + "[AVFS][Polaris10_AVFSEventMgr] Could not setup Pwr Virus for AVFS ", 744 744 return -1); 745 745 } 746 746 747 747 smu_data->avfs.avfs_btc_status = AVFS_BTC_FAILED; 748 - PP_ASSERT_WITH_CODE(0 == ellesmere_perform_btc(smumgr), 749 - "[AVFS][Ellesmere_AVFSEventMgr] Failure at SmuEllesmere_PerformBTC. AVFS Disabled", 748 + PP_ASSERT_WITH_CODE(0 == polaris10_perform_btc(smumgr), 749 + "[AVFS][Polaris10_AVFSEventMgr] Failure at SmuPolaris10_PerformBTC. AVFS Disabled", 750 750 return -1); 751 751 752 752 break; ··· 763 763 return 0; 764 764 } 765 765 766 - static int ellesmere_start_smu_in_protection_mode(struct pp_smumgr *smumgr) 766 + static int polaris10_start_smu_in_protection_mode(struct pp_smumgr *smumgr) 767 767 { 768 768 int result = 0; 769 769 ··· 774 774 SMUM_WRITE_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, 775 775 SMC_SYSCON_RESET_CNTL, rst_reg, 1); 776 776 777 - result = ellesmere_upload_smu_firmware_image(smumgr); 777 + result = polaris10_upload_smu_firmware_image(smumgr); 778 778 if (result != 0) 779 779 return result; 780 780 ··· 793 793 794 794 795 795 /* Call Test SMU message with 0x20000 offset to trigger SMU start */ 796 - ellesmere_send_msg_to_smc_offset(smumgr); 796 + polaris10_send_msg_to_smc_offset(smumgr); 797 797 798 798 /* Wait done bit to be set */ 799 799 /* Check pass/failed indicator */ ··· 818 818 return result; 819 819 } 820 820 821 - static int ellesmere_start_smu_in_non_protection_mode(struct pp_smumgr *smumgr) 821 + static int polaris10_start_smu_in_non_protection_mode(struct pp_smumgr *smumgr) 822 822 { 823 823 int result = 0; 824 824 ··· 834 834 SMC_SYSCON_RESET_CNTL, 835 835 rst_reg, 1); 836 836 837 - result = ellesmere_upload_smu_firmware_image(smumgr); 837 + result = polaris10_upload_smu_firmware_image(smumgr); 838 838 if (result != 0) 839 839 return result; 840 840 841 841 /* Set smc instruct start point at 0x0 */ 842 - ellesmere_program_jump_on_start(smumgr); 842 + polaris10_program_jump_on_start(smumgr); 843 843 844 844 SMUM_WRITE_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, 845 845 SMC_SYSCON_CLOCK_CNTL_0, ck_disable, 0); ··· 855 855 return result; 856 856 } 857 857 858 - static int ellesmere_start_smu(struct pp_smumgr *smumgr) 858 + static int polaris10_start_smu(struct pp_smumgr *smumgr) 859 859 { 860 860 int result = 0; 861 - struct ellesmere_smumgr *smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 861 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 862 862 bool SMU_VFT_INTACT; 863 863 864 864 /* Only start SMC if SMC RAM is not running */ 865 - if (!ellesmere_is_smc_ram_running(smumgr)) { 865 + if (!polaris10_is_smc_ram_running(smumgr)) { 866 866 SMU_VFT_INTACT = false; 867 867 smu_data->protected_mode = (uint8_t) (SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, SMU_FIRMWARE, SMU_MODE)); 868 868 smu_data->security_hard_key = (uint8_t) (SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, SMU_FIRMWARE, SMU_SEL)); 869 869 870 870 /* Check if SMU is running in protected mode */ 871 871 if (smu_data->protected_mode == 0) { 872 - result = ellesmere_start_smu_in_non_protection_mode(smumgr); 872 + result = polaris10_start_smu_in_non_protection_mode(smumgr); 873 873 } else { 874 - result = ellesmere_start_smu_in_protection_mode(smumgr); 874 + result = polaris10_start_smu_in_protection_mode(smumgr); 875 875 876 876 /* If failed, try with different security Key. */ 877 877 if (result != 0) { 878 878 smu_data->security_hard_key ^= 1; 879 - result = ellesmere_start_smu_in_protection_mode(smumgr); 879 + result = polaris10_start_smu_in_protection_mode(smumgr); 880 880 } 881 881 } 882 882 883 883 if (result != 0) 884 884 PP_ASSERT_WITH_CODE(0, "Failed to load SMU ucode.", return result); 885 885 886 - ellesmere_avfs_event_mgr(smumgr, true); 886 + polaris10_avfs_event_mgr(smumgr, true); 887 887 } else 888 888 SMU_VFT_INTACT = true; /*Driver went offline but SMU was still alive and contains the VFT table */ 889 889 890 890 smu_data->post_initial_boot = true; 891 - ellesmere_avfs_event_mgr(smumgr, SMU_VFT_INTACT); 891 + polaris10_avfs_event_mgr(smumgr, SMU_VFT_INTACT); 892 892 /* Setup SoftRegsStart here for register lookup in case DummyBackEnd is used and ProcessFirmwareHeader is not executed */ 893 - ellesmere_read_smc_sram_dword(smumgr, SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, SoftRegisters), 893 + polaris10_read_smc_sram_dword(smumgr, SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, SoftRegisters), 894 894 &(smu_data->soft_regs_start), 0x40000); 895 895 896 - result = ellesmere_request_smu_load_fw(smumgr); 896 + result = polaris10_request_smu_load_fw(smumgr); 897 897 898 898 return result; 899 899 } 900 900 901 - static int ellesmere_smu_init(struct pp_smumgr *smumgr) 901 + static int polaris10_smu_init(struct pp_smumgr *smumgr) 902 902 { 903 - struct ellesmere_smumgr *smu_data; 903 + struct polaris10_smumgr *smu_data; 904 904 uint8_t *internal_buf; 905 905 uint64_t mc_addr = 0; 906 906 /* Allocate memory for backend private data */ 907 - smu_data = (struct ellesmere_smumgr *)(smumgr->backend); 907 + smu_data = (struct polaris10_smumgr *)(smumgr->backend); 908 908 smu_data->header_buffer.data_size = 909 909 ((sizeof(struct SMU_DRAMData_TOC) / 4096) + 1) * 4096; 910 910 smu_data->smu_buffer.data_size = 200*4096; ··· 955 955 } 956 956 957 957 static const struct pp_smumgr_func ellsemere_smu_funcs = { 958 - .smu_init = ellesmere_smu_init, 959 - .smu_fini = ellesmere_smu_fini, 960 - .start_smu = ellesmere_start_smu, 961 - .check_fw_load_finish = ellesmere_check_fw_load_finish, 962 - .request_smu_load_fw = ellesmere_reload_firmware, 958 + .smu_init = polaris10_smu_init, 959 + .smu_fini = polaris10_smu_fini, 960 + .start_smu = polaris10_start_smu, 961 + .check_fw_load_finish = polaris10_check_fw_load_finish, 962 + .request_smu_load_fw = polaris10_reload_firmware, 963 963 .request_smu_load_specific_fw = NULL, 964 - .send_msg_to_smc = ellesmere_send_msg_to_smc, 965 - .send_msg_to_smc_with_parameter = ellesmere_send_msg_to_smc_with_parameter, 964 + .send_msg_to_smc = polaris10_send_msg_to_smc, 965 + .send_msg_to_smc_with_parameter = polaris10_send_msg_to_smc_with_parameter, 966 966 .download_pptable_settings = NULL, 967 967 .upload_pptable_settings = NULL, 968 968 }; 969 969 970 - int ellesmere_smum_init(struct pp_smumgr *smumgr) 970 + int polaris10_smum_init(struct pp_smumgr *smumgr) 971 971 { 972 - struct ellesmere_smumgr *ellesmere_smu = NULL; 972 + struct polaris10_smumgr *polaris10_smu = NULL; 973 973 974 - ellesmere_smu = kzalloc(sizeof(struct ellesmere_smumgr), GFP_KERNEL); 974 + polaris10_smu = kzalloc(sizeof(struct polaris10_smumgr), GFP_KERNEL); 975 975 976 - if (ellesmere_smu == NULL) 976 + if (polaris10_smu == NULL) 977 977 return -1; 978 978 979 - smumgr->backend = ellesmere_smu; 979 + smumgr->backend = polaris10_smu; 980 980 smumgr->smumgr_funcs = &ellsemere_smu_funcs; 981 981 982 982 return 0;
+13 -13
drivers/gpu/drm/amd/powerplay/smumgr/ellesmere_smumgr.h drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.h
··· 21 21 * 22 22 */ 23 23 24 - #ifndef _ELLESMERE_SMUMANAGER_H 25 - #define _ELLESMERE_SMUMANAGER_H 24 + #ifndef _POLARIS10_SMUMANAGER_H 25 + #define _POLARIS10_SMUMANAGER_H 26 26 27 - #include <ellesmere_ppsmc.h> 27 + #include <polaris10_ppsmc.h> 28 28 #include <pp_endian.h> 29 29 30 - struct ellesmere_avfs { 30 + struct polaris10_avfs { 31 31 enum AVFS_BTC_STATUS avfs_btc_status; 32 32 uint32_t avfs_btc_param; 33 33 }; 34 34 35 - struct ellesmere_buffer_entry { 35 + struct polaris10_buffer_entry { 36 36 uint32_t data_size; 37 37 uint32_t mc_addr_low; 38 38 uint32_t mc_addr_high; ··· 40 40 unsigned long handle; 41 41 }; 42 42 43 - struct ellesmere_smumgr { 43 + struct polaris10_smumgr { 44 44 uint8_t *header; 45 45 uint8_t *mec_image; 46 - struct ellesmere_buffer_entry smu_buffer; 47 - struct ellesmere_buffer_entry header_buffer; 46 + struct polaris10_buffer_entry smu_buffer; 47 + struct polaris10_buffer_entry header_buffer; 48 48 uint32_t soft_regs_start; 49 49 uint8_t *read_rrm_straps; 50 50 uint32_t read_drm_straps_mc_address_high; ··· 53 53 bool post_initial_boot; 54 54 uint8_t protected_mode; 55 55 uint8_t security_hard_key; 56 - struct ellesmere_avfs avfs; 56 + struct polaris10_avfs avfs; 57 57 }; 58 58 59 59 60 - int ellesmere_smum_init(struct pp_smumgr *smumgr); 60 + int polaris10_smum_init(struct pp_smumgr *smumgr); 61 61 62 - int ellesmere_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit); 63 - int ellesmere_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit); 64 - int ellesmere_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, 62 + int polaris10_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit); 63 + int polaris10_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit); 64 + int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address, 65 65 const uint8_t *src, uint32_t byte_count, uint32_t limit); 66 66 67 67 #endif
+4 -4
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
··· 30 30 #include "cz_smumgr.h" 31 31 #include "tonga_smumgr.h" 32 32 #include "fiji_smumgr.h" 33 - #include "ellesmere_smumgr.h" 33 + #include "polaris10_smumgr.h" 34 34 35 35 int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle) 36 36 { ··· 63 63 case CHIP_FIJI: 64 64 fiji_smum_init(smumgr); 65 65 break; 66 - case CHIP_BAFFIN: 67 - case CHIP_ELLESMERE: 68 - ellesmere_smum_init(smumgr); 66 + case CHIP_POLARIS11: 67 + case CHIP_POLARIS10: 68 + polaris10_smum_init(smumgr); 69 69 break; 70 70 default: 71 71 return -EINVAL;