diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-02-21 11:39:39 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-02-21 11:39:39 +0000 |
| commit | 0f6e4d6258b97795a60add11c3c94bf5e5ccf563 (patch) | |
| tree | 43b877a42befcabe70ea63f92e1508c03f8deef1 /sys/external | |
| parent | 1f89ce7ee0b1686ce188271df9c01790c38d4065 (diff) | |
amdgpu: Fix scale factor for 64-bit doorbell indexing.
The register is 64 bits wide, but the indexing is for 32-bit
quantities (and presumably index must be even here).
Found by Jeff Frasca -- thanks!
Diffstat (limited to 'sys/external')
| -rw-r--r-- | sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c index 72faf1c7e6c..17268a8a59a 100644 --- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c @@ -1,4 +1,4 @@ -/* $NetBSD: amdgpu_device.c,v 1.17 2022/09/20 23:01:42 mrg Exp $ */ +/* $NetBSD: amdgpu_device.c,v 1.18 2023/02/21 11:39:39 riastradh Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. @@ -28,7 +28,7 @@ * Jerome Glisse */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.17 2022/09/20 23:01:42 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.18 2023/02/21 11:39:39 riastradh Exp $"); #include <linux/power_supply.h> #include <linux/kthread.h> @@ -483,19 +483,19 @@ u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index) #ifdef __NetBSD__ #ifdef _LP64 return bus_space_read_8(adev->doorbell.bst, adev->doorbell.bsh, - 8*index); + 4*index); #else uint64_t lo, hi; #if _BYTE_ORDER == _LITTLE_ENDIAN lo = bus_space_read_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index); + 4*index); hi = bus_space_read_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index + 4); + 4*index + 4); #else hi = bus_space_read_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index); + 4*index); lo = bus_space_read_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index + 4); + 4*index + 4); #endif return lo | (hi << 32); #endif @@ -524,21 +524,21 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v) #ifdef __NetBSD__ #ifdef _LP64 bus_space_write_8(adev->doorbell.bst, adev->doorbell.bsh, - 8*index, v); + 4*index, v); #else /* * XXX This might not be as atomic as one might hope... */ #if _BYTE_ORDER == _LITTLE_ENDIAN bus_space_write_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index, v & 0xffffffffU); + 4*index, v & 0xffffffffU); bus_space_write_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index + 4, v >> 32); + 4*index + 4, v >> 32); #else bus_space_write_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index, v >> 32); + 4*index, v >> 32); bus_space_write_4(adev->doorbell.bst, adev->doorbell.bsh, - 8*index + 4, v & 0xffffffffU); + 4*index + 4, v & 0xffffffffU); #endif #endif #else |
