1b843c749SSergey Zigachev /*
2b843c749SSergey Zigachev  * Copyright 2016 Advanced Micro Devices, Inc.
3b843c749SSergey Zigachev  *
4b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10b843c749SSergey Zigachev  *
11b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13b843c749SSergey Zigachev  *
14b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21b843c749SSergey Zigachev  *
22b843c749SSergey Zigachev  */
23b843c749SSergey Zigachev 
24b843c749SSergey Zigachev #include "smumgr.h"
25b843c749SSergey Zigachev #include "smu10_inc.h"
26b843c749SSergey Zigachev #include "soc15_common.h"
27b843c749SSergey Zigachev #include "smu10_smumgr.h"
28b843c749SSergey Zigachev #include "ppatomctrl.h"
29b843c749SSergey Zigachev #include "rv_ppsmc.h"
30b843c749SSergey Zigachev #include "smu10_driver_if.h"
31b843c749SSergey Zigachev #include "smu10.h"
32b843c749SSergey Zigachev #include "ppatomctrl.h"
33b843c749SSergey Zigachev #include "pp_debug.h"
34b843c749SSergey Zigachev 
35b843c749SSergey Zigachev 
36b843c749SSergey Zigachev #define BUFFER_SIZE                 80000
37b843c749SSergey Zigachev #define MAX_STRING_SIZE             15
38b843c749SSergey Zigachev #define BUFFER_SIZETWO              131072
39b843c749SSergey Zigachev 
40b843c749SSergey Zigachev #define MP0_Public                  0x03800000
41b843c749SSergey Zigachev #define MP0_SRAM                    0x03900000
42b843c749SSergey Zigachev #define MP1_Public                  0x03b00000
43b843c749SSergey Zigachev #define MP1_SRAM                    0x03c00004
44b843c749SSergey Zigachev 
45b843c749SSergey Zigachev #define smnMP1_FIRMWARE_FLAGS       0x3010028
46b843c749SSergey Zigachev 
47b843c749SSergey Zigachev 
smu10_wait_for_response(struct pp_hwmgr * hwmgr)48b843c749SSergey Zigachev static uint32_t smu10_wait_for_response(struct pp_hwmgr *hwmgr)
49b843c749SSergey Zigachev {
50b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
51b843c749SSergey Zigachev 	uint32_t reg;
52b843c749SSergey Zigachev 
53b843c749SSergey Zigachev 	reg = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_90);
54b843c749SSergey Zigachev 
55b843c749SSergey Zigachev 	phm_wait_for_register_unequal(hwmgr, reg,
56b843c749SSergey Zigachev 			0, MP1_C2PMSG_90__CONTENT_MASK);
57b843c749SSergey Zigachev 
58b843c749SSergey Zigachev 	return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90);
59b843c749SSergey Zigachev }
60b843c749SSergey Zigachev 
smu10_send_msg_to_smc_without_waiting(struct pp_hwmgr * hwmgr,uint16_t msg)61b843c749SSergey Zigachev static int smu10_send_msg_to_smc_without_waiting(struct pp_hwmgr *hwmgr,
62b843c749SSergey Zigachev 		uint16_t msg)
63b843c749SSergey Zigachev {
64b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
65b843c749SSergey Zigachev 
66b843c749SSergey Zigachev 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);
67b843c749SSergey Zigachev 
68b843c749SSergey Zigachev 	return 0;
69b843c749SSergey Zigachev }
70b843c749SSergey Zigachev 
smu10_read_arg_from_smc(struct pp_hwmgr * hwmgr)71b843c749SSergey Zigachev static uint32_t smu10_read_arg_from_smc(struct pp_hwmgr *hwmgr)
72b843c749SSergey Zigachev {
73b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
74b843c749SSergey Zigachev 
75b843c749SSergey Zigachev 	return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82);
76b843c749SSergey Zigachev }
77b843c749SSergey Zigachev 
smu10_send_msg_to_smc(struct pp_hwmgr * hwmgr,uint16_t msg)78b843c749SSergey Zigachev static int smu10_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
79b843c749SSergey Zigachev {
80b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
81b843c749SSergey Zigachev 
82b843c749SSergey Zigachev 	smu10_wait_for_response(hwmgr);
83b843c749SSergey Zigachev 
84b843c749SSergey Zigachev 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
85b843c749SSergey Zigachev 
86b843c749SSergey Zigachev 	smu10_send_msg_to_smc_without_waiting(hwmgr, msg);
87b843c749SSergey Zigachev 
88b843c749SSergey Zigachev 	if (smu10_wait_for_response(hwmgr) == 0)
89b843c749SSergey Zigachev 		printk("Failed to send Message %x.\n", msg);
90b843c749SSergey Zigachev 
91b843c749SSergey Zigachev 	return 0;
92b843c749SSergey Zigachev }
93b843c749SSergey Zigachev 
94b843c749SSergey Zigachev 
smu10_send_msg_to_smc_with_parameter(struct pp_hwmgr * hwmgr,uint16_t msg,uint32_t parameter)95b843c749SSergey Zigachev static int smu10_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr,
96b843c749SSergey Zigachev 		uint16_t msg, uint32_t parameter)
97b843c749SSergey Zigachev {
98b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
99b843c749SSergey Zigachev 
100b843c749SSergey Zigachev 	smu10_wait_for_response(hwmgr);
101b843c749SSergey Zigachev 
102b843c749SSergey Zigachev 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
103b843c749SSergey Zigachev 
104b843c749SSergey Zigachev 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82, parameter);
105b843c749SSergey Zigachev 
106b843c749SSergey Zigachev 	smu10_send_msg_to_smc_without_waiting(hwmgr, msg);
107b843c749SSergey Zigachev 
108b843c749SSergey Zigachev 
109b843c749SSergey Zigachev 	if (smu10_wait_for_response(hwmgr) == 0)
110b843c749SSergey Zigachev 		printk("Failed to send Message %x.\n", msg);
111b843c749SSergey Zigachev 
112b843c749SSergey Zigachev 	return 0;
113b843c749SSergey Zigachev }
114b843c749SSergey Zigachev 
smu10_copy_table_from_smc(struct pp_hwmgr * hwmgr,uint8_t * table,int16_t table_id)115b843c749SSergey Zigachev static int smu10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
116b843c749SSergey Zigachev 		uint8_t *table, int16_t table_id)
117b843c749SSergey Zigachev {
118b843c749SSergey Zigachev 	struct smu10_smumgr *priv =
119b843c749SSergey Zigachev 			(struct smu10_smumgr *)(hwmgr->smu_backend);
120b843c749SSergey Zigachev 
121b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(table_id < MAX_SMU_TABLE,
122b843c749SSergey Zigachev 			"Invalid SMU Table ID!", return -EINVAL;);
123b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].version != 0,
124b843c749SSergey Zigachev 			"Invalid SMU Table version!", return -EINVAL;);
125b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0,
126b843c749SSergey Zigachev 			"Invalid SMU Table Length!", return -EINVAL;);
127b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
128b843c749SSergey Zigachev 			PPSMC_MSG_SetDriverDramAddrHigh,
129b843c749SSergey Zigachev 			upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
130b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
131b843c749SSergey Zigachev 			PPSMC_MSG_SetDriverDramAddrLow,
132b843c749SSergey Zigachev 			lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
133b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
134b843c749SSergey Zigachev 			PPSMC_MSG_TransferTableSmu2Dram,
135b843c749SSergey Zigachev 			priv->smu_tables.entry[table_id].table_id);
136b843c749SSergey Zigachev 
137b843c749SSergey Zigachev 	memcpy(table, (uint8_t *)priv->smu_tables.entry[table_id].table,
138b843c749SSergey Zigachev 			priv->smu_tables.entry[table_id].size);
139b843c749SSergey Zigachev 
140b843c749SSergey Zigachev 	return 0;
141b843c749SSergey Zigachev }
142b843c749SSergey Zigachev 
smu10_copy_table_to_smc(struct pp_hwmgr * hwmgr,uint8_t * table,int16_t table_id)143b843c749SSergey Zigachev static int smu10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
144b843c749SSergey Zigachev 		uint8_t *table, int16_t table_id)
145b843c749SSergey Zigachev {
146b843c749SSergey Zigachev 	struct smu10_smumgr *priv =
147b843c749SSergey Zigachev 			(struct smu10_smumgr *)(hwmgr->smu_backend);
148b843c749SSergey Zigachev 
149b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(table_id < MAX_SMU_TABLE,
150b843c749SSergey Zigachev 			"Invalid SMU Table ID!", return -EINVAL;);
151b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].version != 0,
152b843c749SSergey Zigachev 			"Invalid SMU Table version!", return -EINVAL;);
153b843c749SSergey Zigachev 	PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0,
154b843c749SSergey Zigachev 			"Invalid SMU Table Length!", return -EINVAL;);
155b843c749SSergey Zigachev 
156b843c749SSergey Zigachev 	memcpy(priv->smu_tables.entry[table_id].table, table,
157b843c749SSergey Zigachev 			priv->smu_tables.entry[table_id].size);
158b843c749SSergey Zigachev 
159b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
160b843c749SSergey Zigachev 			PPSMC_MSG_SetDriverDramAddrHigh,
161b843c749SSergey Zigachev 			upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
162b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
163b843c749SSergey Zigachev 			PPSMC_MSG_SetDriverDramAddrLow,
164b843c749SSergey Zigachev 			lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
165b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
166b843c749SSergey Zigachev 			PPSMC_MSG_TransferTableDram2Smu,
167b843c749SSergey Zigachev 			priv->smu_tables.entry[table_id].table_id);
168b843c749SSergey Zigachev 
169b843c749SSergey Zigachev 	return 0;
170b843c749SSergey Zigachev }
171b843c749SSergey Zigachev 
smu10_verify_smc_interface(struct pp_hwmgr * hwmgr)172b843c749SSergey Zigachev static int smu10_verify_smc_interface(struct pp_hwmgr *hwmgr)
173b843c749SSergey Zigachev {
174b843c749SSergey Zigachev 	uint32_t smc_driver_if_version;
175b843c749SSergey Zigachev 
176b843c749SSergey Zigachev 	smu10_send_msg_to_smc(hwmgr,
177b843c749SSergey Zigachev 			PPSMC_MSG_GetDriverIfVersion);
178b843c749SSergey Zigachev 	smc_driver_if_version = smu10_read_arg_from_smc(hwmgr);
179b843c749SSergey Zigachev 
180b843c749SSergey Zigachev 	if (smc_driver_if_version != SMU10_DRIVER_IF_VERSION) {
181b843c749SSergey Zigachev 		pr_err("Attempt to read SMC IF Version Number Failed!\n");
182b843c749SSergey Zigachev 		return -EINVAL;
183b843c749SSergey Zigachev 	}
184b843c749SSergey Zigachev 
185b843c749SSergey Zigachev 	return 0;
186b843c749SSergey Zigachev }
187b843c749SSergey Zigachev 
188b843c749SSergey Zigachev /* sdma is disabled by default in vbios, need to re-enable in driver */
smu10_smc_enable_sdma(struct pp_hwmgr * hwmgr)189b843c749SSergey Zigachev static void smu10_smc_enable_sdma(struct pp_hwmgr *hwmgr)
190b843c749SSergey Zigachev {
191b843c749SSergey Zigachev 	smu10_send_msg_to_smc(hwmgr,
192b843c749SSergey Zigachev 			PPSMC_MSG_PowerUpSdma);
193b843c749SSergey Zigachev }
194b843c749SSergey Zigachev 
smu10_smc_disable_sdma(struct pp_hwmgr * hwmgr)195b843c749SSergey Zigachev static void smu10_smc_disable_sdma(struct pp_hwmgr *hwmgr)
196b843c749SSergey Zigachev {
197b843c749SSergey Zigachev 	smu10_send_msg_to_smc(hwmgr,
198b843c749SSergey Zigachev 			PPSMC_MSG_PowerDownSdma);
199b843c749SSergey Zigachev }
200b843c749SSergey Zigachev 
201b843c749SSergey Zigachev /* vcn is disabled by default in vbios, need to re-enable in driver */
smu10_smc_enable_vcn(struct pp_hwmgr * hwmgr)202b843c749SSergey Zigachev static void smu10_smc_enable_vcn(struct pp_hwmgr *hwmgr)
203b843c749SSergey Zigachev {
204b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
205b843c749SSergey Zigachev 			PPSMC_MSG_PowerUpVcn, 0);
206b843c749SSergey Zigachev }
207b843c749SSergey Zigachev 
smu10_smc_disable_vcn(struct pp_hwmgr * hwmgr)208b843c749SSergey Zigachev static void smu10_smc_disable_vcn(struct pp_hwmgr *hwmgr)
209b843c749SSergey Zigachev {
210b843c749SSergey Zigachev 	smu10_send_msg_to_smc_with_parameter(hwmgr,
211b843c749SSergey Zigachev 			PPSMC_MSG_PowerDownVcn, 0);
212b843c749SSergey Zigachev }
213b843c749SSergey Zigachev 
smu10_smu_fini(struct pp_hwmgr * hwmgr)214b843c749SSergey Zigachev static int smu10_smu_fini(struct pp_hwmgr *hwmgr)
215b843c749SSergey Zigachev {
216b843c749SSergey Zigachev 	struct smu10_smumgr *priv =
217b843c749SSergey Zigachev 			(struct smu10_smumgr *)(hwmgr->smu_backend);
218b843c749SSergey Zigachev 
219b843c749SSergey Zigachev 	if (priv) {
220b843c749SSergey Zigachev 		smu10_smc_disable_sdma(hwmgr);
221b843c749SSergey Zigachev 		smu10_smc_disable_vcn(hwmgr);
222b843c749SSergey Zigachev 		amdgpu_bo_free_kernel(&priv->smu_tables.entry[SMU10_WMTABLE].handle,
223*78973132SSergey Zigachev 					(u64 *)&priv->smu_tables.entry[SMU10_WMTABLE].mc_addr,
224b843c749SSergey Zigachev 					&priv->smu_tables.entry[SMU10_WMTABLE].table);
225b843c749SSergey Zigachev 		amdgpu_bo_free_kernel(&priv->smu_tables.entry[SMU10_CLOCKTABLE].handle,
226*78973132SSergey Zigachev 					(u64 *)&priv->smu_tables.entry[SMU10_CLOCKTABLE].mc_addr,
227b843c749SSergey Zigachev 					&priv->smu_tables.entry[SMU10_CLOCKTABLE].table);
228b843c749SSergey Zigachev 		kfree(hwmgr->smu_backend);
229b843c749SSergey Zigachev 		hwmgr->smu_backend = NULL;
230b843c749SSergey Zigachev 	}
231b843c749SSergey Zigachev 
232b843c749SSergey Zigachev 	return 0;
233b843c749SSergey Zigachev }
234b843c749SSergey Zigachev 
smu10_start_smu(struct pp_hwmgr * hwmgr)235b843c749SSergey Zigachev static int smu10_start_smu(struct pp_hwmgr *hwmgr)
236b843c749SSergey Zigachev {
237b843c749SSergey Zigachev 	struct amdgpu_device *adev = hwmgr->adev;
238b843c749SSergey Zigachev 
239b843c749SSergey Zigachev 	smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetSmuVersion);
240b843c749SSergey Zigachev 	hwmgr->smu_version = smu10_read_arg_from_smc(hwmgr);
241b843c749SSergey Zigachev 	adev->pm.fw_version = hwmgr->smu_version >> 8;
242b843c749SSergey Zigachev 
243b843c749SSergey Zigachev 	if (smu10_verify_smc_interface(hwmgr))
244b843c749SSergey Zigachev 		return -EINVAL;
245b843c749SSergey Zigachev 	smu10_smc_enable_sdma(hwmgr);
246b843c749SSergey Zigachev 	smu10_smc_enable_vcn(hwmgr);
247b843c749SSergey Zigachev 	return 0;
248b843c749SSergey Zigachev }
249b843c749SSergey Zigachev 
smu10_smu_init(struct pp_hwmgr * hwmgr)250b843c749SSergey Zigachev static int smu10_smu_init(struct pp_hwmgr *hwmgr)
251b843c749SSergey Zigachev {
252b843c749SSergey Zigachev 	struct smu10_smumgr *priv;
253b843c749SSergey Zigachev 	int r;
254b843c749SSergey Zigachev 
255b843c749SSergey Zigachev 	priv = kzalloc(sizeof(struct smu10_smumgr), GFP_KERNEL);
256b843c749SSergey Zigachev 
257b843c749SSergey Zigachev 	if (!priv)
258b843c749SSergey Zigachev 		return -ENOMEM;
259b843c749SSergey Zigachev 
260b843c749SSergey Zigachev 	hwmgr->smu_backend = priv;
261b843c749SSergey Zigachev 
262b843c749SSergey Zigachev 	/* allocate space for watermarks table */
263b843c749SSergey Zigachev 	r = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
264b843c749SSergey Zigachev 			sizeof(Watermarks_t),
265b843c749SSergey Zigachev 			PAGE_SIZE,
266b843c749SSergey Zigachev 			AMDGPU_GEM_DOMAIN_VRAM,
267b843c749SSergey Zigachev 			&priv->smu_tables.entry[SMU10_WMTABLE].handle,
268*78973132SSergey Zigachev 			(u64 *)&priv->smu_tables.entry[SMU10_WMTABLE].mc_addr,
269b843c749SSergey Zigachev 			&priv->smu_tables.entry[SMU10_WMTABLE].table);
270b843c749SSergey Zigachev 
271b843c749SSergey Zigachev 	if (r)
272b843c749SSergey Zigachev 		goto err0;
273b843c749SSergey Zigachev 
274b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_WMTABLE].version = 0x01;
275b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_WMTABLE].size = sizeof(Watermarks_t);
276b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_WMTABLE].table_id = TABLE_WATERMARKS;
277b843c749SSergey Zigachev 
278b843c749SSergey Zigachev 	/* allocate space for watermarks table */
279b843c749SSergey Zigachev 	r = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
280b843c749SSergey Zigachev 			sizeof(DpmClocks_t),
281b843c749SSergey Zigachev 			PAGE_SIZE,
282b843c749SSergey Zigachev 			AMDGPU_GEM_DOMAIN_VRAM,
283b843c749SSergey Zigachev 			&priv->smu_tables.entry[SMU10_CLOCKTABLE].handle,
284*78973132SSergey Zigachev 			(u64 *)&priv->smu_tables.entry[SMU10_CLOCKTABLE].mc_addr,
285b843c749SSergey Zigachev 			&priv->smu_tables.entry[SMU10_CLOCKTABLE].table);
286b843c749SSergey Zigachev 
287b843c749SSergey Zigachev 	if (r)
288b843c749SSergey Zigachev 		goto err1;
289b843c749SSergey Zigachev 
290b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_CLOCKTABLE].version = 0x01;
291b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_CLOCKTABLE].size = sizeof(DpmClocks_t);
292b843c749SSergey Zigachev 	priv->smu_tables.entry[SMU10_CLOCKTABLE].table_id = TABLE_DPMCLOCKS;
293b843c749SSergey Zigachev 
294b843c749SSergey Zigachev 	return 0;
295b843c749SSergey Zigachev 
296b843c749SSergey Zigachev err1:
297b843c749SSergey Zigachev 	amdgpu_bo_free_kernel(&priv->smu_tables.entry[SMU10_WMTABLE].handle,
298*78973132SSergey Zigachev 				(u64 *)&priv->smu_tables.entry[SMU10_WMTABLE].mc_addr,
299b843c749SSergey Zigachev 				&priv->smu_tables.entry[SMU10_WMTABLE].table);
300b843c749SSergey Zigachev err0:
301b843c749SSergey Zigachev 	kfree(priv);
302b843c749SSergey Zigachev 	return -EINVAL;
303b843c749SSergey Zigachev }
304b843c749SSergey Zigachev 
smu10_smc_table_manager(struct pp_hwmgr * hwmgr,uint8_t * table,uint16_t table_id,bool rw)305b843c749SSergey Zigachev static int smu10_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw)
306b843c749SSergey Zigachev {
307b843c749SSergey Zigachev 	int ret;
308b843c749SSergey Zigachev 
309b843c749SSergey Zigachev 	if (rw)
310b843c749SSergey Zigachev 		ret = smu10_copy_table_from_smc(hwmgr, table, table_id);
311b843c749SSergey Zigachev 	else
312b843c749SSergey Zigachev 		ret = smu10_copy_table_to_smc(hwmgr, table, table_id);
313b843c749SSergey Zigachev 
314b843c749SSergey Zigachev 	return ret;
315b843c749SSergey Zigachev }
316b843c749SSergey Zigachev 
317b843c749SSergey Zigachev 
318b843c749SSergey Zigachev const struct pp_smumgr_func smu10_smu_funcs = {
319b843c749SSergey Zigachev 	.smu_init = &smu10_smu_init,
320b843c749SSergey Zigachev 	.smu_fini = &smu10_smu_fini,
321b843c749SSergey Zigachev 	.start_smu = &smu10_start_smu,
322b843c749SSergey Zigachev 	.request_smu_load_specific_fw = NULL,
323b843c749SSergey Zigachev 	.send_msg_to_smc = &smu10_send_msg_to_smc,
324b843c749SSergey Zigachev 	.send_msg_to_smc_with_parameter = &smu10_send_msg_to_smc_with_parameter,
325b843c749SSergey Zigachev 	.download_pptable_settings = NULL,
326b843c749SSergey Zigachev 	.upload_pptable_settings = NULL,
327b843c749SSergey Zigachev 	.get_argument = smu10_read_arg_from_smc,
328b843c749SSergey Zigachev 	.smc_table_manager = smu10_smc_table_manager,
329b843c749SSergey Zigachev };
330b843c749SSergey Zigachev 
331b843c749SSergey Zigachev 
332