All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Chunming Zhou <David1.Zhou@amd.com>,
	Maruthi.Bayyavarapu@amd.com
Subject: [PATCH 04/12] drm/amdgpu: Implement the pciconfig callbacks for CGS
Date: Thu,  9 Jul 2015 12:21:03 -0400	[thread overview]
Message-ID: <1436458871-16358-4-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1436458871-16358-1-git-send-email-alexander.deucher@amd.com>

From: Chunming Zhou <David1.Zhou@amd.com>

This implements the pciconfig register accessors.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 40 +++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 7ba92f7..6ac3df8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -21,6 +21,7 @@
  *
  *
  */
+#include <linux/pci.h>
 #include "amdgpu.h"
 #include "cgs_linux.h"
 
@@ -163,42 +164,57 @@ static void amdgpu_cgs_write_ind_register(void *cgs_device,
 
 static uint8_t amdgpu_cgs_read_pci_config_byte(void *cgs_device, unsigned addr)
 {
-	/* TODO */
-	return 0;
+	CGS_FUNC_ADEV;
+	uint8_t val;
+	int ret = pci_read_config_byte(adev->pdev, addr, &val);
+	if (WARN(ret, "pci_read_config_byte error"))
+		return 0;
+	return val;
 }
 
 static uint16_t amdgpu_cgs_read_pci_config_word(void *cgs_device, unsigned addr)
 {
-	/* TODO */
-	return 0;
+	CGS_FUNC_ADEV;
+	uint16_t val;
+	int ret = pci_read_config_word(adev->pdev, addr, &val);
+	if (WARN(ret, "pci_read_config_word error"))
+		return 0;
+	return val;
 }
 
 static uint32_t amdgpu_cgs_read_pci_config_dword(void *cgs_device,
 						 unsigned addr)
 {
-	/* TODO */
-	return 0;
+	CGS_FUNC_ADEV;
+	uint32_t val;
+	int ret = pci_read_config_dword(adev->pdev, addr, &val);
+	if (WARN(ret, "pci_read_config_dword error"))
+		return 0;
+	return val;
 }
 
 static void amdgpu_cgs_write_pci_config_byte(void *cgs_device, unsigned addr,
 					     uint8_t value)
 {
-	/* TODO */
-	return;
+	CGS_FUNC_ADEV;
+	int ret = pci_write_config_byte(adev->pdev, addr, value);
+	WARN(ret, "pci_write_config_byte error");
 }
 
 static void amdgpu_cgs_write_pci_config_word(void *cgs_device, unsigned addr,
 					     uint16_t value)
 {
-	/* TODO */
-	return;
+	CGS_FUNC_ADEV;
+	int ret = pci_write_config_word(adev->pdev, addr, value);
+	WARN(ret, "pci_write_config_word error");
 }
 
 static void amdgpu_cgs_write_pci_config_dword(void *cgs_device, unsigned addr,
 					      uint32_t value)
 {
-	/* TODO */
-	return;
+	CGS_FUNC_ADEV;
+	int ret = pci_write_config_dword(adev->pdev, addr, value);
+	WARN(ret, "pci_write_config_dword error");
 }
 
 static const void *amdgpu_cgs_atom_get_data_table(void *cgs_device,
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-07-09 16:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 16:21 [PATCH 01/12] drm/amdgpu: add amd_gnb_bus support Alex Deucher
2015-07-09 16:21 ` [PATCH 02/12] drm/amd: Add CGS interfaces Alex Deucher
2015-07-09 16:21 ` [PATCH 03/12] drm/amdgpu: Implement mmio callbacks for CGS Alex Deucher
2015-07-09 16:21 ` Alex Deucher [this message]
2015-07-09 16:21 ` [PATCH 05/12] drm/amdgpu: Implement irq interfaces " Alex Deucher
2015-07-09 16:21 ` [PATCH 06/12] drm/amdgpu: add atom " Alex Deucher
2015-07-09 16:21 ` [PATCH 07/12] drm/amdgpu: implement cgs gpu memory callbacks Alex Deucher
2015-09-29 11:40   ` Daniel Vetter
2015-09-29 12:39     ` Christian König
2015-09-29 15:20       ` Daniel Vetter
2015-09-29 15:41         ` Alex Deucher
2015-09-29 20:10           ` Dave Airlie
2015-09-29 20:28             ` Alex Deucher
2015-09-30  6:54               ` Daniel Vetter
2015-09-30  7:36                 ` Christian König
2015-09-30  6:51             ` Daniel Vetter
2015-09-30  6:55           ` Daniel Vetter
2015-07-09 16:21 ` [PATCH 08/12] drm/amd: add ACP 2.x register headers Alex Deucher
2015-07-09 16:21 ` [PATCH 09/12] drm/amd: add ACP driver support (v4) Alex Deucher
2015-07-09 16:21 ` [PATCH 10/12] drm/amd: modify ACP DMA buffer position update logic Alex Deucher
2015-07-09 16:21 ` [PATCH 11/12] drm/amd: add ACP suspend/resume functionality Alex Deucher
2015-07-09 16:21 ` [PATCH 12/12] drm/amd: remove amd gnb bus default runtime pm ops Alex Deucher

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=1436458871-16358-4-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=David1.Zhou@amd.com \
    --cc=Maruthi.Bayyavarapu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.