From 97cb7f6e6c4d7d78de7e174d8776a95ef7fd1e8a Mon Sep 17 00:00:00 2001 From: Chunming Zhou Date: Fri, 22 May 2015 11:33:31 -0400 Subject: [PATCH] drm/amdgpu: Implement the pciconfig callbacks for CGS This implements the pciconfig register accessors. Reviewed-by: Jammy Zhou Signed-off-by: Chunming Zhou Signed-off-by: Alex Deucher --- 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 7ba92f711f8c..6ac3df856b49 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -21,6 +21,7 @@ * * */ +#include #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, -- 2.20.1