AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hawking Zhang <Hawking.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>, Tao Zhou <tao.zhou1@amd.com>,
	"Stanley Yang" <Stanley.Yang@amd.com>,
	Yang Wang <kevinyang.wang@amd.com>,
	YiPeng Chai <YiPeng.Chai@amd.com>,
	Candice Li <Candice.Li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>, Le Ma <le.ma@amd.com>,
	Lijo Lazar <lijo.lazar@amd.com>,
	Hawking Zhang <Hawking.Zhang@amd.com>
Subject: [PATCH 2/5] drm/amdgpu: Init pcie_index/data address as fallback
Date: Tue, 2 Jan 2024 22:07:34 +0800	[thread overview]
Message-ID: <20240102140742.23917-2-Hawking.Zhang@amd.com> (raw)
In-Reply-To: <20240102140742.23917-1-Hawking.Zhang@amd.com>

To allow using this helper for indirect access when
nbio funcs is not available. For instance, in ip
discovery phase.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 001a35fa0f19..873419a5b9aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -781,12 +781,22 @@ u32 amdgpu_device_indirect_rreg_ext(struct amdgpu_device *adev,
 	void __iomem *pcie_index_hi_offset;
 	void __iomem *pcie_data_offset;
 
-	pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
-	pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
-	if ((reg_addr >> 32) && (adev->nbio.funcs->get_pcie_index_hi_offset))
-		pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);
-	else
+	if (unlikely(!adev->nbio.funcs)) {
+		pcie_index = (0x38 >> 2);
+		pcie_data = (0x3C >> 2);
+	} else {
+		pcie_index = adev->nbio.funcs->get_pcie_index_offset(adev);
+		pcie_data = adev->nbio.funcs->get_pcie_data_offset(adev);
+	}
+
+	if (reg_addr >> 32) {
+		if (unlikely(!adev->nbio.funcs))
+			pcie_index_hi = (0x44 >> 2);
+		else
+			pcie_index_hi = adev->nbio.funcs->get_pcie_index_hi_offset(adev);
+	} else {
 		pcie_index_hi = 0;
+	}
 
 	spin_lock_irqsave(&adev->pcie_idx_lock, flags);
 	pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index * 4;
-- 
2.17.1


  reply	other threads:[~2024-01-02 14:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 14:07 [PATCH 1/5] drm/amdgpu: drop psp v13 query_boot_status implementation Hawking Zhang
2024-01-02 14:07 ` Hawking Zhang [this message]
2024-01-02 14:07 ` [PATCH 4/5] drm/amdgpu: Query boot status if discovery failed Hawking Zhang
2024-01-02 17:49   ` Felix Kuehling
2024-01-03  2:04     ` Zhang, Hawking
2024-01-02 14:07 ` [PATCH 5/5] drm/amdgpu: Query boot status if boot failed Hawking Zhang
2024-01-02 14:07 ` [PATCH v2 3/5] drm/amdgpu: Add ras helper to query boot errors v2 Hawking Zhang
2024-01-03  9:46   ` Zhang, Morris
2024-01-07 15:31     ` Zhang, Hawking
  -- strict thread matches above, loose matches on Subject: below --
2024-01-02  3:43 [PATCH 0/5] Add boot time error reporting Hawking Zhang
2024-01-02  3:43 ` [PATCH 2/5] drm/amdgpu: Init pcie_index/data address as fallback Hawking Zhang
2024-01-02 19:43   ` Alex Deucher
2024-01-03  2:17     ` Zhang, Hawking

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240102140742.23917-2-Hawking.Zhang@amd.com \
    --to=hawking.zhang@amd.com \
    --cc=Candice.Li@amd.com \
    --cc=Stanley.Yang@amd.com \
    --cc=YiPeng.Chai@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=kevinyang.wang@amd.com \
    --cc=le.ma@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=tao.zhou1@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox