From: jsg Date: Wed, 27 Mar 2024 04:55:35 +0000 (+0000) Subject: drm/amd/pm: Fix esm reg mask use to get pcie speed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c7da3a276f1a244ab0ee60612ee1e50f96b47729;p=openbsd drm/amd/pm: Fix esm reg mask use to get pcie speed From Asad Kamal 310ae9eb3d2a13345f2590e7581fd45d97323a02 in linux-6.6.y/6.6.23 b485b899e5b8f83723833feca30a1a1e3df778df in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu11/arcturus_ppt.c index 61c9ddef233..e2e14b15455 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu11/arcturus_ppt.c @@ -2358,8 +2358,8 @@ static uint16_t arcturus_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (uint16_t)(((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (uint16_t)(((esm_ctrl >> 8) & 0x7F) + 128); return smu_v11_0_get_current_pcie_link_speed(smu); } diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c index 9ca85938a85..266cea9b242 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c @@ -1722,8 +1722,8 @@ static int aldebaran_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (((esm_ctrl >> 8) & 0x7F) + 128); return smu_v13_0_get_current_pcie_link_speed(smu); } diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index 75ebdb12fe5..37902e91847 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c @@ -1943,8 +1943,8 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu) /* TODO: confirm this on real target */ esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL); - if ((esm_ctrl >> 15) & 0x1FFFF) - return (((esm_ctrl >> 8) & 0x3F) + 128); + if ((esm_ctrl >> 15) & 0x1) + return (((esm_ctrl >> 8) & 0x7F) + 128); speed_level = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) & PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK)