drm/amdgpu: Move to common indirect reg access helper
Subsystems (2)
PATCH 1/2 drm/amdgpu: Move to common indirect reg access helper
Replace soc15, nv, soc21 specific callbacks with common one. so we don't need to duplicate code when introduce new asics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 32 +++++++------- drivers/gpu/drm/amd/amdgpu/nv.c | 49 ++-------------------- drivers/gpu/drm/amd/amdgpu/soc15.c | 49 ++-------------------- drivers/gpu/drm/amd/amdgpu/soc21.c | 48 ++------------------- 5 files changed, 30 insertions(+), 152 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -4
@@ -1142,16 +1142,12 @@ void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value)uint8_t amdgpu_mm_rreg8 (struct amdgpu_device *adev,uint32_t offset);u32 amdgpu_device_indirect_rreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr);u64 amdgpu_device_indirect_rreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr);void amdgpu_device_indirect_wreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u32 reg_data);void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u64 reg_data);bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -14
@@ -676,20 +676,20 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)* amdgpu_device_indirect_rreg - read an indirect register * * @adev: amdgpu_device pointer -* @pcie_index: mmio register offset -* @pcie_data: mmio register offset * @reg_addr: indirect register address to read from * * Returns the value of indirect register @reg_addr */ u32 amdgpu_device_indirect_rreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr) { -unsigned long flags; -u32 r; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_offset;void __iomem *pcie_data_offset; +u32 r; + + pcie_index = adev->nbio.funcs->get_pcie_index_offset (adev); + pcie_data = adev->nbio.funcs->get_pcie_data_offset (adev);spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ;
@@ -707,20 +707,20 @@ u32 amdgpu_device_indirect_rreg(struct amdgpu_device *adev,* amdgpu_device_indirect_rreg64 - read a 64bits indirect register * * @adev: amdgpu_device pointer -* @pcie_index: mmio register offset -* @pcie_data: mmio register offset * @reg_addr: indirect register address to read from * * Returns the value of indirect register @reg_addr */ u64 amdgpu_device_indirect_rreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr) { -unsigned long flags; -u64 r; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_offset;void __iomem *pcie_data_offset; +u64 r; + + pcie_index = adev->nbio.funcs->get_pcie_index_offset (adev); + pcie_data = adev->nbio.funcs->get_pcie_data_offset (adev);spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ;
@@ -750,13 +750,15 @@ u64 amdgpu_device_indirect_rreg64(struct amdgpu_device *adev,* */ void amdgpu_device_indirect_wreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u32 reg_data) { -unsigned long flags; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_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); +spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ; pcie_data_offset = (void __iomem *)adev->rmmio + pcie_data *4 ;
@@ -779,13 +781,15 @@ void amdgpu_device_indirect_wreg(struct amdgpu_device *adev,* */ void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u64 reg_data) { -unsigned long flags; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_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); +spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ; pcie_data_offset = (void __iomem *)adev->rmmio + pcie_data *4 ;
drivers/gpu/drm/amd/amdgpu/nv.c +4 -45
61 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/soc15.c +4 -45
61 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/soc21.c +4 -44
60 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/2 drm/amdgpu: Move to common helper to query soc rev_id
Replace soc15, nv, soc21 get_rev_id callback with common helper so we don't need to duplicate code when introduce new asics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.c | 7 +------ drivers/gpu/drm/amd/amdgpu/soc15.c | 7 +------ drivers/gpu/drm/amd/amdgpu/soc21.c | 7 +------ 5 files changed, 16 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1149,7 +1149,7 @@ void amdgpu_device_indirect_wreg(struct amdgpu_device *adev, u32 reg_addr, u32 reg_data);void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev,u32 reg_addr,u64 reg_data); - +u32 amdgpu_device_get_rev_id (struct amdgpu_device *adev);bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);bool amdgpu_device_has_dc_support (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -0
@@ -807,6 +807,18 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev,spin_unlock_irqrestore (&adev->pcie_idx_lock, flags); } +/** +* amdgpu_device_get_rev_id - query device rev_id +* +* @adev: amdgpu_device pointer +* +* Return device rev_id +*/ +u32 amdgpu_device_get_rev_id (struct amdgpu_device *adev) +{ +return adev->nbio.funcs->get_rev_id (adev); +} +/** * amdgpu_invalid_rreg - dummy reg read function *
drivers/gpu/drm/amd/amdgpu/nv.c +1 -6
@@ -566,11 +566,6 @@ void nv_set_virt_ops(struct amdgpu_device *adev) adev->virt.ops = &xgpu_nv_virt_ops; } -static uint32_t nv_get_rev_id (struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static bool nv_need_full_reset (struct amdgpu_device *adev) {return true;
@@ -712,7 +707,7 @@ static int nv_common_early_init(void *handle) adev->asic_funcs = &nv_asic_funcs; - adev->rev_id =nv_get_rev_id (adev); + adev->rev_id =amdgpu_device_get_rev_id (adev); adev->external_rev_id =0xff ;/* TODO: split the GC and PG flags based on the relevant IP version for which * they are relevant.
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -6
@@ -653,11 +653,6 @@ const struct amdgpu_ip_block_version vega10_common_ip_block = .funcs = &soc15_common_ip_funcs, }; -static uint32_t soc15_get_rev_id (struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static void soc15_reg_base_init (struct amdgpu_device *adev) {/* Set IP register base before any HW register access */
@@ -907,7 +902,7 @@ static int soc15_common_early_init(void *handle) adev->se_cac_rreg = &soc15_se_cac_rreg; adev->se_cac_wreg = &soc15_se_cac_wreg; - adev->rev_id =soc15_get_rev_id (adev); + adev->rev_id =amdgpu_device_get_rev_id (adev); adev->external_rev_id =0xFF ;/* TODO: split the GC and PG flags based on the relevant IP version for which * they are relevant.
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -6
@@ -411,11 +411,6 @@ const struct amdgpu_ip_block_version soc21_common_ip_block = .funcs = &soc21_common_ip_funcs, }; -static uint32_t soc21_get_rev_id (struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static bool soc21_need_full_reset (struct amdgpu_device *adev) {switch (adev->ip_versions[GC_HWIP ][0 ]) {
@@ -557,7 +552,7 @@ static int soc21_common_early_init(void *handle) adev->asic_funcs = &soc21_asic_funcs; - adev->rev_id =soc21_get_rev_id (adev); + adev->rev_id =amdgpu_device_get_rev_id (adev); adev->external_rev_id =0xff ;switch (adev->ip_versions[GC_HWIP ][0 ]) {case IP_VERSION (11 ,0 ,0 ):
Signature · 1 line
2.17.1
RE: [PATCH 2/2] drm/amdgpu: Move to common helper to query soc rev_id
Series is Reviewed-by: Likun Gao <[email protected]>.
Regards,
Likun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Hawking Zhang
Sent: Monday, March 6, 2023 4:04 PM
To: [email protected]; Gao, Likun <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Move to common helper to query soc rev_id
Replace soc15, nv, soc21 get_rev_id callback with common helper so we don't need to duplicate code when introduce new asics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.c | 7 +------ drivers/gpu/drm/amd/amdgpu/soc15.c | 7 +------ drivers/gpu/drm/amd/amdgpu/soc21.c | 7 +------ 5 files changed, 16 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1149,7 +1149,7 @@ void amdgpu_device_indirect_wreg(struct amdgpu_device *adev, u32 reg_addr, u32 reg_data);void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev,u32 reg_addr,u64 reg_data); - +u32 amdgpu_device_get_rev_id (struct amdgpu_device *adev);bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);bool amdgpu_device_has_dc_support (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11 -0
@@ -807,6 +807,18 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev,spin_unlock_irqrestore (&adev->pcie_idx_lock, flags); } +/** +* amdgpu_device_get_rev_id - query device rev_id +* +* @adev: amdgpu_device pointer +* +* Return device rev_id +*/ +u32 amdgpu_device_get_rev_id (struct amdgpu_device *adev) { +return adev->nbio.funcs->get_rev_id (adev); +} +/** * amdgpu_invalid_rreg - dummy reg read function *
drivers/gpu/drm/amd/amdgpu/nv.c +1 -5
@@ -566,11 +566,6 @@ void nv_set_virt_ops(struct amdgpu_device *adev) adev->virt.ops = &xgpu_nv_virt_ops; } -static uint32_t nv_get_rev_id(struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static bool nv_need_full_reset (struct amdgpu_device *adev) {return true;
@@ -712,7 +707,7 @@ static int nv_common_early_init(void *handle) adev->asic_funcs = &nv_asic_funcs; - adev->rev_id =nv_get_rev_id (adev); + adev->rev_id =amdgpu_device_get_rev_id (adev); adev->external_rev_id =0xff ;/* TODO: split the GC and PG flags based on the relevant IP version for which * they are relevant.
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -4
@@ -653,11 +653,6 @@ const struct amdgpu_ip_block_version vega10_common_ip_block = .funcs = &soc15_common_ip_funcs, }; -static uint32_t soc15_get_rev_id(struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static void soc15_reg_base_init (struct amdgpu_device *adev) { /* Set IP register base before any HW register access */ @@ -907,7 +902,7 @@ static int soc15_common_early_init(void *handle) adev->se_cac_rreg = &soc15_se_cac_rreg;
adev->se_cac_wreg = &soc15_se_cac_wreg;
- adev->rev_id = soc15_get_rev_id(adev);
+ adev->rev_id = amdgpu_device_get_rev_id(adev);
adev->external_rev_id = 0xFF;
/* TODO: split the GC and PG flags based on the relevant IP version for which
* they are relevant.
drivers/gpu/drm/amd/amdgpu/soc21.c +0 -4
@@ -411,11 +411,6 @@ const struct amdgpu_ip_block_version soc21_common_ip_block = .funcs = &soc21_common_ip_funcs, }; -static uint32_t soc21_get_rev_id(struct amdgpu_device *adev) -{ -return adev->nbio.funcs->get_rev_id (adev); -} -static bool soc21_need_full_reset (struct amdgpu_device *adev) { switch (adev->ip_versions[GC_HWIP][0]) { @@ -557,7 +552,7 @@ static int soc21_common_early_init(void *handle)
adev->asic_funcs = &soc21_asic_funcs;
- adev->rev_id = soc21_get_rev_id(adev);
+ adev->rev_id = amdgpu_device_get_rev_id(adev);
adev->external_rev_id = 0xff;
switch (adev->ip_versions[GC_HWIP][0]) {
case IP_VERSION(11, 0, 0):
--
2.17.1
Am 06.03.23 um 09:04 schrieb Hawking Zhang:
Quoted 3 lines
Replace soc15, nv, soc21 specific callbacks with common one. so we don't need to duplicate code when introduce new asics.
Nice cleanup. Is pcie_rreg/pcie_wreg/... now still set to anything else than the common functions? If not we might also remove the callback.
Quoted 1 line
Signed-off-by Hawking Zhang <[email protected]>
Quoted 321 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 32 +++++++------- drivers/gpu/drm/amd/amdgpu/nv.c | 49 ++-------------------- drivers/gpu/drm/amd/amdgpu/soc15.c | 49 ++-------------------- drivers/gpu/drm/amd/amdgpu/soc21.c | 48 ++------------------- 5 files changed, 30 insertions(+), 152 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-4@@ -1142,16 +1142,12 @@ void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value)uint8_t amdgpu_mm_rreg8 (struct amdgpu_device *adev,uint32_t offset);u32 amdgpu_device_indirect_rreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr);u64 amdgpu_device_indirect_rreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr);void amdgpu_device_indirect_wreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u32 reg_data);void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u64 reg_data);bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18
-14@@ -676,20 +676,20 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)* amdgpu_device_indirect_rreg - read an indirect register * * @adev: amdgpu_device pointer -* @pcie_index: mmio register offset -* @pcie_data: mmio register offset * @reg_addr: indirect register address to read from * * Returns the value of indirect register @reg_addr */ u32 amdgpu_device_indirect_rreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr) { -unsigned long flags; -u32 r; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_offset;void __iomem *pcie_data_offset; +u32 r; + + pcie_index = adev->nbio.funcs->get_pcie_index_offset (adev); + pcie_data = adev->nbio.funcs->get_pcie_data_offset (adev);spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ;@@ -707,20 +707,20 @@ u32 amdgpu_device_indirect_rreg(struct amdgpu_device *adev,* amdgpu_device_indirect_rreg64 - read a 64bits indirect register * * @adev: amdgpu_device pointer -* @pcie_index: mmio register offset -* @pcie_data: mmio register offset * @reg_addr: indirect register address to read from * * Returns the value of indirect register @reg_addr */ u64 amdgpu_device_indirect_rreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr) { -unsigned long flags; -u64 r; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_offset;void __iomem *pcie_data_offset; +u64 r; + + pcie_index = adev->nbio.funcs->get_pcie_index_offset (adev); + pcie_data = adev->nbio.funcs->get_pcie_data_offset (adev);spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ;@@ -750,13 +750,15 @@ u64 amdgpu_device_indirect_rreg64(struct amdgpu_device *adev,* */ void amdgpu_device_indirect_wreg (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u32 reg_data) { -unsigned long flags; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_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); +spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ; pcie_data_offset = (void __iomem *)adev->rmmio + pcie_data *4 ;@@ -779,13 +781,15 @@ void amdgpu_device_indirect_wreg(struct amdgpu_device *adev,* */ void amdgpu_device_indirect_wreg64 (struct amdgpu_device *adev, -u32 pcie_index,u32 pcie_data,u32 reg_addr,u64 reg_data) { -unsigned long flags; +unsigned long flags, pcie_index, pcie_data;void __iomem *pcie_index_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); +spin_lock_irqsave (&adev->pcie_idx_lock, flags); pcie_index_offset = (void __iomem *)adev->rmmio + pcie_index *4 ; pcie_data_offset = (void __iomem *)adev->rmmio + pcie_data *4 ;drivers/gpu/drm/amd/amdgpu/nv.c +4
-45@@ -280,47 +280,6 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode, } } -/* -* Indirect registers accessor -*/ -static u32 nv_pcie_rreg (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg (adev, address, data, reg); -} - -static void nv_pcie_wreg (struct amdgpu_device *adev,u32 reg,u32 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg (adev, address, data, reg, v); -} - -static u64 nv_pcie_rreg64 (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg64 (adev, address, data, reg); -} - -static void nv_pcie_wreg64 (struct amdgpu_device *adev,u32 reg,u64 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg64 (adev, address, data, reg, v); -} -static u32 nv_didt_rreg (struct amdgpu_device *adev,u32 reg) {unsigned long flags, address, data;@@ -737,10 +696,10 @@ static int nv_common_early_init(void *handle) } adev->smc_rreg =NULL ; adev->smc_wreg =NULL ; - adev->pcie_rreg = &nv_pcie_rreg; - adev->pcie_wreg = &nv_pcie_wreg; - adev->pcie_rreg64 = &nv_pcie_rreg64; - adev->pcie_wreg64 = &nv_pcie_wreg64; + adev->pcie_rreg = &amdgpu_device_indirect_rreg; + adev->pcie_wreg = &amdgpu_device_indirect_wreg; + adev->pcie_rreg64 = &amdgpu_device_indirect_rreg64; + adev->pcie_wreg64 = &amdgpu_device_indirect_wreg64; adev->pciep_rreg = amdgpu_device_pcie_port_rreg; adev->pciep_wreg = amdgpu_device_pcie_port_wreg;drivers/gpu/drm/amd/amdgpu/soc15.c +4
-45@@ -191,47 +191,6 @@ static int soc15_query_video_codecs(struct amdgpu_device *adev, bool encode, } } -/* -* Indirect registers accessor -*/ -static u32 soc15_pcie_rreg (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg (adev, address, data, reg); -} - -static void soc15_pcie_wreg (struct amdgpu_device *adev,u32 reg,u32 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg (adev, address, data, reg, v); -} - -static u64 soc15_pcie_rreg64 (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg64 (adev, address, data, reg); -} - -static void soc15_pcie_wreg64 (struct amdgpu_device *adev,u32 reg,u64 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg64 (adev, address, data, reg, v); -} -static u32 soc15_uvd_ctx_rreg (struct amdgpu_device *adev,u32 reg) {unsigned long flags, address, data;@@ -935,10 +894,10 @@ static int soc15_common_early_init(void *handle) } adev->smc_rreg =NULL ; adev->smc_wreg =NULL ; - adev->pcie_rreg = &soc15_pcie_rreg; - adev->pcie_wreg = &soc15_pcie_wreg; - adev->pcie_rreg64 = &soc15_pcie_rreg64; - adev->pcie_wreg64 = &soc15_pcie_wreg64; + adev->pcie_rreg = &amdgpu_device_indirect_rreg; + adev->pcie_wreg = &amdgpu_device_indirect_wreg; + adev->pcie_rreg64 = &amdgpu_device_indirect_rreg64; + adev->pcie_wreg64 = &amdgpu_device_indirect_wreg64; adev->uvd_ctx_rreg = &soc15_uvd_ctx_rreg; adev->uvd_ctx_wreg = &soc15_uvd_ctx_wreg; adev->didt_rreg = &soc15_didt_rreg;drivers/gpu/drm/amd/amdgpu/soc21.c +4
-44@@ -127,46 +127,6 @@ static int soc21_query_video_codecs(struct amdgpu_device *adev, bool encode,return -EINVAL ; } } -/* -* Indirect registers accessor -*/ -static u32 soc21_pcie_rreg (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg (adev, address, data, reg); -} - -static void soc21_pcie_wreg (struct amdgpu_device *adev,u32 reg,u32 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg (adev, address, data, reg, v); -} - -static u64 soc21_pcie_rreg64 (struct amdgpu_device *adev,u32 reg) -{ -unsigned long address, data; - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -return amdgpu_device_indirect_rreg64 (adev, address, data, reg); -} - -static void soc21_pcie_wreg64 (struct amdgpu_device *adev,u32 reg,u64 v) -{ -unsigned long address, data; - - address = adev->nbio.funcs->get_pcie_index_offset (adev); - data = adev->nbio.funcs->get_pcie_data_offset (adev); - -amdgpu_device_indirect_wreg64 (adev, address, data, reg, v); -}static u32 soc21_didt_rreg (struct amdgpu_device *adev,u32 reg) {@@ -581,10 +541,10 @@ static int soc21_common_early_init(void *handle) adev->rmmio_remap.bus_addr = adev->rmmio_base +MMIO_REG_HOLE_OFFSET ; adev->smc_rreg =NULL ; adev->smc_wreg =NULL ; - adev->pcie_rreg = &soc21_pcie_rreg; - adev->pcie_wreg = &soc21_pcie_wreg; - adev->pcie_rreg64 = &soc21_pcie_rreg64; - adev->pcie_wreg64 = &soc21_pcie_wreg64; + adev->pcie_rreg = &amdgpu_device_indirect_rreg; + adev->pcie_wreg = &amdgpu_device_indirect_wreg; + adev->pcie_rreg64 = &amdgpu_device_indirect_rreg64; + adev->pcie_wreg64 = &amdgpu_device_indirect_wreg64; adev->pciep_rreg = amdgpu_device_pcie_port_rreg; adev->pciep_wreg = amdgpu_device_pcie_port_wreg;