[amd] common: fix indirect register access

This commit is contained in:
Adam Madsen 2020-11-18 17:43:28 -06:00
parent 864b808696
commit ed604594d3
1 changed files with 4 additions and 4 deletions

View File

@ -38,11 +38,11 @@ static inline bool drm_can_sleep(void)
#define RREG32(reg) \
({ \
u32 __out; \
if ((reg) < adev_to_amd_private(adev)->mmio_size) \
if (((reg) * 4) < adev_to_amd_private(adev)->mmio_size) \
__out = readl(adev_to_amd_private(adev)->mmio + (reg)); \
else \
{ \
writel((reg), adev_to_amd_private(adev)->mmio + mmMM_INDEX); \
writel(((reg) * 4), adev_to_amd_private(adev)->mmio + mmMM_INDEX); \
__out = readl(adev_to_amd_private(adev)->mmio + mmMM_DATA); \
} \
__out; \
@ -51,11 +51,11 @@ static inline bool drm_can_sleep(void)
#define WREG32(reg, v) \
do \
{ \
if ((reg) < adev_to_amd_private(adev)->mmio_size) \
if (((reg) * 4) < adev_to_amd_private(adev)->mmio_size) \
writel(v, adev_to_amd_private(adev)->mmio + (reg)); \
else \
{ \
writel((reg), adev_to_amd_private(adev)->mmio + mmMM_INDEX); \
writel(((reg) * 4), adev_to_amd_private(adev)->mmio + mmMM_INDEX); \
writel(v, adev_to_amd_private(adev)->mmio + mmMM_DATA); \
} \
} while (0)