aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2018-01-04 05:13:20 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-03-14 15:38:26 -0400
commit421a2a30c121660c4628e4494dcca1fceab8a4be (patch)
tree9a1e82f112d113cbd344fcf4baaf403db5bbd8bc /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent1e09b05386f32efbebb798cf0341eca4b424c960 (diff)
drm/amdgpu: implement mmio byte access helper for MB
mailbox registers can be accessed with a byte boundry according to BIF team, so this patch prepares register byte access and will be used by following patches. Actually, for mailbox registers once the byte field is touched even not changed, the mailbox behaves, so we need the byte width accessing to those sort of regs. Signed-off-by: Monk Liu <Monk.Liu@amd.com> Reviewed-by: Pixel Ding <Pixel.Ding@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index cc582e2271e1..e32ff159ba89 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -121,6 +121,32 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg,
121 return ret; 121 return ret;
122} 122}
123 123
124/*
125 * MMIO register read with bytes helper functions
126 * @offset:bytes offset from MMIO start
127 *
128*/
129
130uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset) {
131 if (offset < adev->rmmio_size)
132 return (readb(adev->rmmio + offset));
133 BUG();
134}
135
136/*
137 * MMIO register write with bytes helper functions
138 * @offset:bytes offset from MMIO start
139 * @value: the value want to be written to the register
140 *
141*/
142void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value) {
143 if (offset < adev->rmmio_size)
144 writeb(value, adev->rmmio + offset);
145 else
146 BUG();
147}
148
149
124void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v, 150void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
125 uint32_t acc_flags) 151 uint32_t acc_flags)
126{ 152{