summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
diff options
context:
space:
mode:
authorKent Russell <kent.russell@amd.com>2020-04-27 09:28:04 -0400
committerAlex Deucher <alexander.deucher@amd.com>2020-06-02 16:47:58 -0400
commit81a16241114ba4e0b188e517e5e8522951dfeb7b (patch)
treee82be507158dae4f8c6f37447cec211e6654d08d /drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
parentbce9ff0eacaf308a740206bcb69a9e473daf6ac9 (diff)
drm/amdgpu: Add unique_id and serial_number for Arcturus v3
Add support for unique_id and serial_number, as these are now the same value, and will be for future ASICs as well. v2: Explicitly create unique_id only for VG10/20/ARC v3: Change set_unique_id to get_unique_id for clarity Signed-off-by: Kent Russell <kent.russell@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/arcturus_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/arcturus_ppt.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index d66ac7457574..df7b408319f7 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2262,6 +2262,37 @@ static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
i2c_del_adapter(control);
}
+static void arcturus_get_unique_id(struct smu_context *smu)
+{
+ struct amdgpu_device *adev = smu->adev;
+ uint32_t top32, bottom32, smu_version, size;
+ char sn[16];
+ uint64_t id;
+
+ if (smu_get_smc_version(smu, NULL, &smu_version)) {
+ pr_warn("Failed to get smu version, cannot get unique_id or serial_number\n");
+ return;
+ }
+
+ /* PPSMC_MSG_ReadSerial* is supported by 54.23.0 and onwards */
+ if (smu_version < 0x361700) {
+ pr_warn("ReadSerial is only supported by PMFW 54.23.0 and onwards\n");
+ return;
+ }
+
+ /* Get the SN to turn into a Unique ID */
+ smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32, &top32);
+ smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumBottom32, &bottom32);
+
+ id = ((uint64_t)bottom32 << 32) | top32;
+ adev->unique_id = id;
+ /* For Arcturus-and-later, unique_id == serial_number, so convert it to a
+ * 16-digit HEX string for convenience and backwards-compatibility
+ */
+ size = sprintf(sn, "%llx", id);
+ memcpy(adev->serial, &sn, size);
+}
+
static bool arcturus_is_baco_supported(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
@@ -2416,6 +2447,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
.dpm_set_uvd_enable = arcturus_dpm_set_uvd_enable,
.i2c_eeprom_init = arcturus_i2c_eeprom_control_init,
.i2c_eeprom_fini = arcturus_i2c_eeprom_control_fini,
+ .get_unique_id = arcturus_get_unique_id,
.init_microcode = smu_v11_0_init_microcode,
.load_microcode = smu_v11_0_load_microcode,
.init_smc_tables = smu_v11_0_init_smc_tables,