summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 01:01:24 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 01:01:24 +0000
commit0b07c3ff5e38e6cac47a4eb0cce038d9b4fd708a (patch)
treea66c598254ca63d6612de72460aa4fc58a09151a /sys/dev/pci
parentbf6e834ac3eb15dcb01bc8f5c72319a3cea93df1 (diff)
drm/radeon: Make r100_cp_ring_info() and radeon_ring_gfx() safe (v2)
From Alex Ivanov 38921933f2075f3c676c1ee1014523f86161b69d in ubuntu 3.8 0eb3448aa6b31fbf24c31756aba7940cac5ad6b8 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/radeon/r100.c10
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ring.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/radeon/r100.c b/sys/dev/pci/drm/radeon/r100.c
index 8960dfa3a26..2ba10dcea03 100644
--- a/sys/dev/pci/drm/radeon/r100.c
+++ b/sys/dev/pci/drm/radeon/r100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r100.c,v 1.5 2014/02/09 12:33:44 jsg Exp $ */
+/* $OpenBSD: r100.c,v 1.6 2014/02/10 01:01:23 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -3064,9 +3064,11 @@ static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data)
seq_printf(m, "CP_RB_RPTR 0x%08x\n", rdp);
seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw);
seq_printf(m, "%u dwords in ring\n", count);
- for (j = 0; j <= count; j++) {
- i = (rdp + j) & ring->ptr_mask;
- seq_printf(m, "r[%04d]=0x%08x\n", i, ring->ring[i]);
+ if (ring->ready) {
+ for (j = 0; j <= count; j++) {
+ i = (rdp + j) & ring->ptr_mask;
+ seq_printf(m, "r[%04d]=0x%08x\n", i, ring->ring[i]);
+ }
}
return 0;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_ring.c b/sys/dev/pci/drm/radeon/radeon_ring.c
index 662fdc774da..978effc3688 100644
--- a/sys/dev/pci/drm/radeon/radeon_ring.c
+++ b/sys/dev/pci/drm/radeon/radeon_ring.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_ring.c,v 1.4 2014/02/09 23:57:04 jsg Exp $ */
+/* $OpenBSD: radeon_ring.c,v 1.5 2014/02/10 01:01:23 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -807,9 +807,11 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)
* packet that is the root issue
*/
i = (ring->rptr + ring->ptr_mask + 1 - 32) & ring->ptr_mask;
- for (j = 0; j <= (count + 32); j++) {
- seq_printf(m, "r[%5d]=0x%08x\n", i, ring->ring[i]);
- i = (i + 1) & ring->ptr_mask;
+ if (ring->ready) {
+ for (j = 0; j <= (count + 32); j++) {
+ seq_printf(m, "r[%5d]=0x%08x\n", i, ring->ring[i]);
+ i = (i + 1) & ring->ptr_mask;
+ }
}
return 0;
}