2017-03-07 03:03:02 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "smumgr.h"
|
|
|
|
#include "vega10_inc.h"
|
2018-04-10 12:32:16 +08:00
|
|
|
#include "soc15_common.h"
|
2017-03-07 03:03:02 +08:00
|
|
|
#include "vega10_smumgr.h"
|
2018-03-16 15:26:15 +08:00
|
|
|
#include "vega10_hwmgr.h"
|
2017-03-07 03:03:02 +08:00
|
|
|
#include "vega10_ppsmc.h"
|
|
|
|
#include "smu9_driver_if.h"
|
2018-07-13 03:47:30 +08:00
|
|
|
#include "smu9_smumgr.h"
|
2017-03-07 03:03:02 +08:00
|
|
|
#include "ppatomctrl.h"
|
|
|
|
#include "pp_debug.h"
|
2018-03-07 16:40:21 +08:00
|
|
|
|
2017-03-07 03:03:02 +08:00
|
|
|
|
2018-03-16 15:16:10 +08:00
|
|
|
static int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
uint8_t *table, int16_t table_id)
|
|
|
|
{
|
2018-03-16 16:16:27 +08:00
|
|
|
struct vega10_smumgr *priv = hwmgr->smu_backend;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
PP_ASSERT_WITH_CODE(table_id < MAX_SMU_TABLE,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table ID!", return -EINVAL);
|
2017-03-07 03:03:02 +08:00
|
|
|
PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].version != 0,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table version!", return -EINVAL);
|
2017-03-07 03:03:02 +08:00
|
|
|
PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table Length!", return -EINVAL);
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_SetDriverDramAddrHigh,
|
2018-03-06 13:31:13 +08:00
|
|
|
upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_SetDriverDramAddrLow,
|
2018-03-06 13:31:13 +08:00
|
|
|
lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_TransferTableSmu2Dram,
|
2018-02-22 17:20:53 +08:00
|
|
|
priv->smu_tables.entry[table_id].table_id);
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
memcpy(table, priv->smu_tables.entry[table_id].table,
|
|
|
|
priv->smu_tables.entry[table_id].size);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-16 15:16:10 +08:00
|
|
|
static int vega10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
uint8_t *table, int16_t table_id)
|
|
|
|
{
|
2018-03-16 16:16:27 +08:00
|
|
|
struct vega10_smumgr *priv = hwmgr->smu_backend;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
PP_ASSERT_WITH_CODE(table_id < MAX_SMU_TABLE,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table ID!", return -EINVAL);
|
2017-03-07 03:03:02 +08:00
|
|
|
PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].version != 0,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table version!", return -EINVAL);
|
2017-03-07 03:03:02 +08:00
|
|
|
PP_ASSERT_WITH_CODE(priv->smu_tables.entry[table_id].size != 0,
|
2017-05-02 16:01:00 +08:00
|
|
|
"Invalid SMU Table Length!", return -EINVAL);
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
memcpy(priv->smu_tables.entry[table_id].table, table,
|
|
|
|
priv->smu_tables.entry[table_id].size);
|
|
|
|
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_SetDriverDramAddrHigh,
|
2018-03-06 13:31:13 +08:00
|
|
|
upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_SetDriverDramAddrLow,
|
2018-03-06 13:31:13 +08:00
|
|
|
lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_TransferTableDram2Smu,
|
2018-02-22 17:20:53 +08:00
|
|
|
priv->smu_tables.entry[table_id].table_id);
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-09-21 09:50:54 +08:00
|
|
|
int vega10_enable_smc_features(struct pp_hwmgr *hwmgr,
|
|
|
|
bool enable, uint32_t feature_mask)
|
|
|
|
{
|
|
|
|
int msg = enable ? PPSMC_MSG_EnableSmuFeatures :
|
|
|
|
PPSMC_MSG_DisableSmuFeatures;
|
|
|
|
|
|
|
|
return smum_send_msg_to_smc_with_parameter(hwmgr,
|
|
|
|
msg, feature_mask);
|
|
|
|
}
|
|
|
|
|
2018-09-21 11:34:42 +08:00
|
|
|
int vega10_get_enabled_smc_features(struct pp_hwmgr *hwmgr,
|
|
|
|
uint64_t *features_enabled)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
2017-05-02 16:01:00 +08:00
|
|
|
if (features_enabled == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc(hwmgr, PPSMC_MSG_GetEnabledSmuFeatures);
|
|
|
|
*features_enabled = smu9_get_argument(hwmgr);
|
2018-03-16 15:16:10 +08:00
|
|
|
|
2018-02-22 17:20:53 +08:00
|
|
|
return 0;
|
2017-03-07 03:03:02 +08:00
|
|
|
}
|
|
|
|
|
2018-02-22 20:27:07 +08:00
|
|
|
static bool vega10_is_dpm_running(struct pp_hwmgr *hwmgr)
|
|
|
|
{
|
2018-09-21 11:34:42 +08:00
|
|
|
uint64_t features_enabled = 0;
|
2018-02-22 20:27:07 +08:00
|
|
|
|
2018-09-21 11:34:42 +08:00
|
|
|
vega10_get_enabled_smc_features(hwmgr, &features_enabled);
|
2018-02-22 20:27:07 +08:00
|
|
|
|
|
|
|
if (features_enabled & SMC_DPM_FEATURES)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-16 13:56:18 +08:00
|
|
|
static int vega10_set_tools_address(struct pp_hwmgr *hwmgr)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
2018-03-16 16:16:27 +08:00
|
|
|
struct vega10_smumgr *priv = hwmgr->smu_backend;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
2018-03-06 13:13:21 +08:00
|
|
|
if (priv->smu_tables.entry[TOOLSTABLE].mc_addr) {
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_SetToolsDramAddrHigh,
|
2018-03-06 13:31:13 +08:00
|
|
|
upper_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr));
|
2018-07-13 03:47:30 +08:00
|
|
|
smu9_send_msg_to_smc_with_parameter(hwmgr,
|
2018-02-22 17:20:53 +08:00
|
|
|
PPSMC_MSG_SetToolsDramAddrLow,
|
2018-03-06 13:31:13 +08:00
|
|
|
lower_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr));
|
2017-03-07 03:03:02 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
static int vega10_verify_smc_interface(struct pp_hwmgr *hwmgr)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
|
|
|
uint32_t smc_driver_if_version;
|
2018-02-27 19:15:08 +08:00
|
|
|
struct amdgpu_device *adev = hwmgr->adev;
|
2017-06-23 15:06:37 +08:00
|
|
|
uint32_t dev_id;
|
|
|
|
uint32_t rev_id;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
2018-07-13 03:47:30 +08:00
|
|
|
PP_ASSERT_WITH_CODE(!smu9_send_msg_to_smc(hwmgr,
|
2017-03-07 03:03:02 +08:00
|
|
|
PPSMC_MSG_GetDriverIfVersion),
|
|
|
|
"Attempt to get SMC IF Version Number Failed!",
|
2017-05-02 16:01:00 +08:00
|
|
|
return -EINVAL);
|
2018-07-13 03:47:30 +08:00
|
|
|
smc_driver_if_version = smu9_get_argument(hwmgr);
|
2017-03-07 03:03:02 +08:00
|
|
|
|
2018-02-27 19:15:08 +08:00
|
|
|
dev_id = adev->pdev->device;
|
|
|
|
rev_id = adev->pdev->revision;
|
2017-06-23 15:06:37 +08:00
|
|
|
|
|
|
|
if (!((dev_id == 0x687f) &&
|
|
|
|
((rev_id == 0xc0) ||
|
|
|
|
(rev_id == 0xc1) ||
|
|
|
|
(rev_id == 0xc3)))) {
|
|
|
|
if (smc_driver_if_version != SMU9_DRIVER_IF_VERSION) {
|
2017-11-16 23:27:27 +08:00
|
|
|
pr_err("Your firmware(0x%x) doesn't match SMU9_DRIVER_IF_VERSION(0x%x). Please update your firmware!\n",
|
|
|
|
smc_driver_if_version, SMU9_DRIVER_IF_VERSION);
|
2017-06-23 15:06:37 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2017-04-20 15:25:39 +08:00
|
|
|
}
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
static int vega10_smu_init(struct pp_hwmgr *hwmgr)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
|
|
|
struct vega10_smumgr *priv;
|
2018-03-06 13:13:21 +08:00
|
|
|
unsigned long tools_size;
|
2017-03-07 03:03:02 +08:00
|
|
|
int ret;
|
|
|
|
struct cgs_firmware_info info = {0};
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
ret = cgs_get_firmware_info(hwmgr->device,
|
2018-03-07 16:40:21 +08:00
|
|
|
CGS_UCODE_ID_SMU,
|
2017-03-07 03:03:02 +08:00
|
|
|
&info);
|
|
|
|
if (ret || !info.kptr)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
priv = kzalloc(sizeof(struct vega10_smumgr), GFP_KERNEL);
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2017-09-27 01:28:27 +08:00
|
|
|
hwmgr->smu_backend = priv;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
/* allocate space for pptable */
|
2018-03-06 13:13:21 +08:00
|
|
|
ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
|
2017-03-07 03:03:02 +08:00
|
|
|
sizeof(PPTable_t),
|
|
|
|
PAGE_SIZE,
|
2018-03-06 13:13:21 +08:00
|
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
2018-03-15 02:07:49 +08:00
|
|
|
&priv->smu_tables.entry[PPTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].table);
|
2018-03-06 13:13:21 +08:00
|
|
|
if (ret)
|
2018-03-14 09:43:00 +08:00
|
|
|
goto free_backend;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
priv->smu_tables.entry[PPTABLE].version = 0x01;
|
|
|
|
priv->smu_tables.entry[PPTABLE].size = sizeof(PPTable_t);
|
|
|
|
priv->smu_tables.entry[PPTABLE].table_id = TABLE_PPTABLE;
|
|
|
|
|
|
|
|
/* allocate space for watermarks table */
|
2018-03-06 13:13:21 +08:00
|
|
|
ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
|
2017-03-07 03:03:02 +08:00
|
|
|
sizeof(Watermarks_t),
|
|
|
|
PAGE_SIZE,
|
2018-03-06 13:13:21 +08:00
|
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
2018-03-15 02:07:49 +08:00
|
|
|
&priv->smu_tables.entry[WMTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].table);
|
2018-03-06 13:13:21 +08:00
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto err0;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
priv->smu_tables.entry[WMTABLE].version = 0x01;
|
|
|
|
priv->smu_tables.entry[WMTABLE].size = sizeof(Watermarks_t);
|
|
|
|
priv->smu_tables.entry[WMTABLE].table_id = TABLE_WATERMARKS;
|
|
|
|
|
|
|
|
/* allocate space for AVFS table */
|
2018-03-06 13:13:21 +08:00
|
|
|
ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
|
2017-03-07 03:03:02 +08:00
|
|
|
sizeof(AvfsTable_t),
|
|
|
|
PAGE_SIZE,
|
2018-03-06 13:13:21 +08:00
|
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
2018-03-15 02:07:49 +08:00
|
|
|
&priv->smu_tables.entry[AVFSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].table);
|
2018-03-06 13:13:21 +08:00
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto err1;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
priv->smu_tables.entry[AVFSTABLE].version = 0x01;
|
|
|
|
priv->smu_tables.entry[AVFSTABLE].size = sizeof(AvfsTable_t);
|
|
|
|
priv->smu_tables.entry[AVFSTABLE].table_id = TABLE_AVFS;
|
|
|
|
|
2017-04-12 17:32:35 +08:00
|
|
|
tools_size = 0x19000;
|
2017-03-07 03:03:02 +08:00
|
|
|
if (tools_size) {
|
2018-03-06 13:13:21 +08:00
|
|
|
ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
|
2017-03-07 03:03:02 +08:00
|
|
|
tools_size,
|
|
|
|
PAGE_SIZE,
|
2018-03-06 13:13:21 +08:00
|
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
2018-03-15 02:07:49 +08:00
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].table);
|
2018-03-06 13:13:21 +08:00
|
|
|
if (ret)
|
|
|
|
goto err2;
|
|
|
|
priv->smu_tables.entry[TOOLSTABLE].version = 0x01;
|
|
|
|
priv->smu_tables.entry[TOOLSTABLE].size = tools_size;
|
|
|
|
priv->smu_tables.entry[TOOLSTABLE].table_id = TABLE_PMSTATUSLOG;
|
2017-03-07 03:03:02 +08:00
|
|
|
}
|
|
|
|
|
2017-04-12 17:52:07 +08:00
|
|
|
/* allocate space for AVFS Fuse table */
|
2018-03-06 13:13:21 +08:00
|
|
|
ret = amdgpu_bo_create_kernel((struct amdgpu_device *)hwmgr->adev,
|
2017-04-12 17:52:07 +08:00
|
|
|
sizeof(AvfsFuseOverride_t),
|
|
|
|
PAGE_SIZE,
|
2018-03-06 13:13:21 +08:00
|
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
2018-03-15 02:07:49 +08:00
|
|
|
&priv->smu_tables.entry[AVFSFUSETABLE].handle,
|
|
|
|
&priv->smu_tables.entry[AVFSFUSETABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[AVFSFUSETABLE].table);
|
2018-03-06 13:13:21 +08:00
|
|
|
if (ret)
|
|
|
|
goto err3;
|
2017-04-12 17:52:07 +08:00
|
|
|
|
|
|
|
priv->smu_tables.entry[AVFSFUSETABLE].version = 0x01;
|
|
|
|
priv->smu_tables.entry[AVFSFUSETABLE].size = sizeof(AvfsFuseOverride_t);
|
|
|
|
priv->smu_tables.entry[AVFSFUSETABLE].table_id = TABLE_AVFS_FUSE_OVERRIDE;
|
2018-03-15 02:07:49 +08:00
|
|
|
|
2017-04-12 17:52:07 +08:00
|
|
|
|
2017-03-07 03:03:02 +08:00
|
|
|
return 0;
|
2018-03-06 13:13:21 +08:00
|
|
|
|
|
|
|
err3:
|
|
|
|
if (priv->smu_tables.entry[TOOLSTABLE].table)
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[TOOLSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].table);
|
|
|
|
err2:
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[AVFSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].table);
|
|
|
|
err1:
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[WMTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].table);
|
|
|
|
err0:
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].table);
|
2018-03-14 09:43:00 +08:00
|
|
|
free_backend:
|
|
|
|
kfree(hwmgr->smu_backend);
|
|
|
|
|
2018-03-06 13:13:21 +08:00
|
|
|
return -EINVAL;
|
2017-03-07 03:03:02 +08:00
|
|
|
}
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
static int vega10_smu_fini(struct pp_hwmgr *hwmgr)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
2018-03-16 16:16:27 +08:00
|
|
|
struct vega10_smumgr *priv = hwmgr->smu_backend;
|
2017-03-07 03:03:02 +08:00
|
|
|
|
|
|
|
if (priv) {
|
2018-03-06 13:13:21 +08:00
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[PPTABLE].table);
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[WMTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[WMTABLE].table);
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[AVFSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[AVFSTABLE].table);
|
2017-03-07 03:03:02 +08:00
|
|
|
if (priv->smu_tables.entry[TOOLSTABLE].table)
|
2018-03-06 13:13:21 +08:00
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[TOOLSTABLE].handle,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[TOOLSTABLE].table);
|
|
|
|
amdgpu_bo_free_kernel(&priv->smu_tables.entry[AVFSFUSETABLE].handle,
|
|
|
|
&priv->smu_tables.entry[AVFSFUSETABLE].mc_addr,
|
|
|
|
&priv->smu_tables.entry[AVFSFUSETABLE].table);
|
2017-09-27 01:28:27 +08:00
|
|
|
kfree(hwmgr->smu_backend);
|
|
|
|
hwmgr->smu_backend = NULL;
|
2017-03-07 03:03:02 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
static int vega10_start_smu(struct pp_hwmgr *hwmgr)
|
2017-03-07 03:03:02 +08:00
|
|
|
{
|
2018-07-13 03:47:30 +08:00
|
|
|
if (!smu9_is_smc_ram_running(hwmgr))
|
2018-02-22 16:33:05 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
PP_ASSERT_WITH_CODE(!vega10_verify_smc_interface(hwmgr),
|
2017-03-07 03:03:02 +08:00
|
|
|
"Failed to verify SMC interface!",
|
2017-05-02 16:01:00 +08:00
|
|
|
return -EINVAL);
|
2017-05-26 03:59:59 +08:00
|
|
|
|
2017-09-20 11:22:56 +08:00
|
|
|
vega10_set_tools_address(hwmgr);
|
2017-05-26 03:59:59 +08:00
|
|
|
|
2017-03-07 03:03:02 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-07-13 03:47:30 +08:00
|
|
|
static int vega10_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table,
|
|
|
|
uint16_t table_id, bool rw)
|
2018-03-16 15:16:10 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (rw)
|
|
|
|
ret = vega10_copy_table_from_smc(hwmgr, table, table_id);
|
|
|
|
else
|
|
|
|
ret = vega10_copy_table_to_smc(hwmgr, table, table_id);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-03-07 03:03:02 +08:00
|
|
|
const struct pp_smumgr_func vega10_smu_funcs = {
|
|
|
|
.smu_init = &vega10_smu_init,
|
|
|
|
.smu_fini = &vega10_smu_fini,
|
|
|
|
.start_smu = &vega10_start_smu,
|
|
|
|
.request_smu_load_specific_fw = NULL,
|
2018-07-13 03:47:30 +08:00
|
|
|
.send_msg_to_smc = &smu9_send_msg_to_smc,
|
|
|
|
.send_msg_to_smc_with_parameter = &smu9_send_msg_to_smc_with_parameter,
|
2017-03-07 03:03:02 +08:00
|
|
|
.download_pptable_settings = NULL,
|
|
|
|
.upload_pptable_settings = NULL,
|
2018-02-22 20:27:07 +08:00
|
|
|
.is_dpm_running = vega10_is_dpm_running,
|
2018-07-13 03:47:30 +08:00
|
|
|
.get_argument = smu9_get_argument,
|
2018-03-16 15:16:10 +08:00
|
|
|
.smc_table_manager = vega10_smc_table_manager,
|
2017-03-07 03:03:02 +08:00
|
|
|
};
|