Module Name: src
Committed By: riastradh
Date: Tue Feb 21 11:39:39 UTC 2023
Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_device.c
Log Message:
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!
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.18
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17 Tue Sep 20 23:01:42 2022
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Tue Feb 21 11:39:39 2023
@@ -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_
#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
#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