summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-01-10 01:20:03 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-01-10 01:20:03 +0000
commit215111e59933dc568264e2fd76b2a45d2c370b56 (patch)
tree04049ea37416331362f9487613f79b4ac60426e8 /sys/dev/pci
parenta40de63507918c6dbfe2015104b2c0218c17eeba (diff)
Use efifb_stolen() to prevent radeondrm from using aperture memory
overlapping the framebuffer. Prompted by ring tests failing. Diagnosed, fix suggested by and ok kettenis@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ttm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c
index 0ce9fed2931..faf9f8310e8 100644
--- a/sys/dev/pci/drm/radeon/radeon_ttm.c
+++ b/sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -39,6 +39,14 @@
#include "radeon_reg.h"
#include "radeon.h"
+#ifdef __amd64__
+#include "efifb.h"
+#endif
+
+#if NEFIFB > 0
+#include <machine/efifbvar.h>
+#endif
+
#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
static int radeon_ttm_debugfs_init(struct radeon_device *rdev);
@@ -923,6 +931,13 @@ static struct ttm_bo_driver radeon_bo_driver = {
int radeon_ttm_init(struct radeon_device *rdev)
{
int r;
+ unsigned long stolen_size = 0;
+
+#if NEFIFB > 0
+ stolen_size = efifb_stolen();
+#endif
+ if (stolen_size == 0)
+ stolen_size = 256 * 1024;
r = radeon_ttm_global_init(rdev);
if (r) {
@@ -966,7 +981,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
RADEON_GEM_DOMAIN_VRAM, 0, NULL,
NULL, &rdev->stollen_vga_memory);
#else
- r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
+ r = radeon_bo_create(rdev, stolen_size, PAGE_SIZE, true,
RADEON_GEM_DOMAIN_VRAM, 0, NULL,
NULL, &rdev->stollen_vga_memory);
#endif