1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include "amdgpu.h"
24#include "smuio_v9_0.h"
25#include "smuio/smuio_9_0_offset.h"
26#include "smuio/smuio_9_0_sh_mask.h"
27
28static u32 smuio_v9_0_get_rom_index_offset(struct amdgpu_device *adev)
29{
30 return SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
31}
32
33static u32 smuio_v9_0_get_rom_data_offset(struct amdgpu_device *adev)
34{
35 return SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
36}
37
38static void smuio_v9_0_update_rom_clock_gating(struct amdgpu_device *adev, bool enable)
39{
40 u32 def, data;
41
42
43 if (adev->flags & AMD_IS_APU)
44 return;
45
46 def = data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
47
48 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_ROM_MGCG))
49 data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
50 CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK);
51 else
52 data |= CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |
53 CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK;
54
55 if (def != data)
56 WREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0, data);
57}
58
59static void smuio_v9_0_get_clock_gating_state(struct amdgpu_device *adev, u32 *flags)
60{
61 u32 data;
62
63
64 if (adev->flags & AMD_IS_APU)
65 return;
66
67 data = RREG32_SOC15(SMUIO, 0, mmCGTT_ROM_CLK_CTRL0);
68 if (!(data & CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK))
69 *flags |= AMD_CG_SUPPORT_ROM_MGCG;
70}
71
72const struct amdgpu_smuio_funcs smuio_v9_0_funcs = {
73 .get_rom_index_offset = smuio_v9_0_get_rom_index_offset,
74 .get_rom_data_offset = smuio_v9_0_get_rom_data_offset,
75 .update_rom_clock_gating = smuio_v9_0_update_rom_clock_gating,
76 .get_clock_gating_state = smuio_v9_0_get_clock_gating_state,
77};
78