Commit 22f2447c authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: widely share the API for data table retrieving

Considering the data table retrieving can be more widely shared,
amdgpu_atombios.c is the right place.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 443c7f3c
...@@ -2036,3 +2036,20 @@ int amdgpu_atombios_init(struct amdgpu_device *adev) ...@@ -2036,3 +2036,20 @@ int amdgpu_atombios_init(struct amdgpu_device *adev)
return 0; return 0;
} }
int amdgpu_atombios_get_data_table(struct amdgpu_device *adev,
uint32_t table,
uint16_t *size,
uint8_t *frev,
uint8_t *crev,
uint8_t **addr)
{
uint16_t data_start;
if (!amdgpu_atom_parse_data_header(adev->mode_info.atom_context, table,
size, frev, crev, &data_start))
return -EINVAL;
*addr = (uint8_t *)adev->mode_info.atom_context->bios + data_start;
return 0;
}
...@@ -216,6 +216,13 @@ int amdgpu_atombios_get_svi2_info(struct amdgpu_device *adev, ...@@ -216,6 +216,13 @@ int amdgpu_atombios_get_svi2_info(struct amdgpu_device *adev,
u8 voltage_type, u8 voltage_type,
u8 *svd_gpio_id, u8 *svc_gpio_id); u8 *svd_gpio_id, u8 *svc_gpio_id);
int amdgpu_atombios_get_data_table(struct amdgpu_device *adev,
uint32_t table,
uint16_t *size,
uint8_t *frev,
uint8_t *crev,
uint8_t **addr);
void amdgpu_atombios_fini(struct amdgpu_device *adev); void amdgpu_atombios_fini(struct amdgpu_device *adev);
int amdgpu_atombios_init(struct amdgpu_device *adev); int amdgpu_atombios_init(struct amdgpu_device *adev);
......
...@@ -689,22 +689,6 @@ static int smu_late_init(void *handle) ...@@ -689,22 +689,6 @@ static int smu_late_init(void *handle)
return 0; return 0;
} }
int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
uint16_t *size, uint8_t *frev, uint8_t *crev,
uint8_t **addr)
{
struct amdgpu_device *adev = smu->adev;
uint16_t data_start;
if (!amdgpu_atom_parse_data_header(adev->mode_info.atom_context, table,
size, frev, crev, &data_start))
return -EINVAL;
*addr = (uint8_t *)adev->mode_info.atom_context->bios + data_start;
return 0;
}
static int smu_init_fb_allocations(struct smu_context *smu) static int smu_init_fb_allocations(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "smu_internal.h" #include "smu_internal.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "amdgpu_atomfirmware.h" #include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "smu_v11_0.h" #include "smu_v11_0.h"
#include "smu11_driver_if_arcturus.h" #include "smu11_driver_if_arcturus.h"
#include "soc15_common.h" #include "soc15_common.h"
...@@ -488,7 +489,7 @@ static int arcturus_append_powerplay_table(struct smu_context *smu) ...@@ -488,7 +489,7 @@ static int arcturus_append_powerplay_table(struct smu_context *smu)
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
smc_dpm_info); smc_dpm_info);
ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL, ret = amdgpu_atombios_get_data_table(smu->adev, index, NULL, NULL, NULL,
(uint8_t **)&smc_dpm_table); (uint8_t **)&smc_dpm_table);
if (ret) if (ret)
return ret; return ret;
......
...@@ -679,10 +679,6 @@ bool smu_mode1_reset_is_support(struct smu_context *smu); ...@@ -679,10 +679,6 @@ bool smu_mode1_reset_is_support(struct smu_context *smu);
int smu_mode1_reset(struct smu_context *smu); int smu_mode1_reset(struct smu_context *smu);
int smu_mode2_reset(struct smu_context *smu); int smu_mode2_reset(struct smu_context *smu);
extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
uint16_t *size, uint8_t *frev, uint8_t *crev,
uint8_t **addr);
extern const struct amd_ip_funcs smu_ip_funcs; extern const struct amd_ip_funcs smu_ip_funcs;
extern const struct amdgpu_ip_block_version smu_v11_0_ip_block; extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "smu_internal.h" #include "smu_internal.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "amdgpu_atomfirmware.h" #include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "soc15_common.h" #include "soc15_common.h"
#include "smu_v11_0.h" #include "smu_v11_0.h"
#include "smu11_driver_if_navi10.h" #include "smu11_driver_if_navi10.h"
...@@ -467,7 +468,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu) ...@@ -467,7 +468,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu)
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
smc_dpm_info); smc_dpm_info);
ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL, ret = amdgpu_atombios_get_data_table(adev, index, NULL, NULL, NULL,
(uint8_t **)&smc_dpm_table); (uint8_t **)&smc_dpm_table);
if (ret) if (ret)
return ret; return ret;
...@@ -487,7 +488,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu) ...@@ -487,7 +488,7 @@ static int navi10_append_powerplay_table(struct smu_context *smu)
sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header));
break; break;
case 7: /* nv12 */ case 7: /* nv12 */
ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL, ret = amdgpu_atombios_get_data_table(adev, index, NULL, NULL, NULL,
(uint8_t **)&smc_dpm_table_v4_7); (uint8_t **)&smc_dpm_table_v4_7);
if (ret) if (ret)
return ret; return ret;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "smu_internal.h" #include "smu_internal.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "amdgpu_atomfirmware.h" #include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "smu_v11_0.h" #include "smu_v11_0.h"
#include "smu11_driver_if_sienna_cichlid.h" #include "smu11_driver_if_sienna_cichlid.h"
#include "soc15_common.h" #include "soc15_common.h"
...@@ -399,7 +400,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) ...@@ -399,7 +400,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu)
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
smc_dpm_info); smc_dpm_info);
ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL, ret = amdgpu_atombios_get_data_table(smu->adev, index, NULL, NULL, NULL,
(uint8_t **)&smc_dpm_table); (uint8_t **)&smc_dpm_table);
if (ret) if (ret)
return ret; return ret;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "smu_internal.h" #include "smu_internal.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "amdgpu_atomfirmware.h" #include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "smu_v11_0.h" #include "smu_v11_0.h"
#include "soc15_common.h" #include "soc15_common.h"
#include "atom.h" #include "atom.h"
...@@ -416,7 +417,7 @@ int smu_v11_0_setup_pptable(struct smu_context *smu) ...@@ -416,7 +417,7 @@ int smu_v11_0_setup_pptable(struct smu_context *smu)
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
powerplayinfo); powerplayinfo);
ret = smu_get_atom_data_table(smu, index, &atom_table_size, &frev, &crev, ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
(uint8_t **)&table); (uint8_t **)&table);
if (ret) if (ret)
return ret; return ret;
...@@ -631,7 +632,7 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu) ...@@ -631,7 +632,7 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
firmwareinfo); firmwareinfo);
ret = smu_get_atom_data_table(smu, index, &size, &frev, &crev, ret = amdgpu_atombios_get_data_table(smu->adev, index, &size, &frev, &crev,
(uint8_t **)&header); (uint8_t **)&header);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment