From d8d245e6156c5dcd34cee66ea6b95778f4cf0a2b Mon Sep 17 00:00:00 2001 From: Jay Estabrook Date: Mon, 16 May 2011 21:55:08 -0400 Subject: [PATCH] Fix DRM on Alpha Tested-by: Matt Turner --- drivers/gpu/drm/drm_bufs.c | 3 --- drivers/gpu/drm/drm_vm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3e257a5..e1bd713 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -183,9 +183,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, return -EINVAL; } #endif -#ifdef __alpha__ - map->offset += dev->hose->mem_space->start; -#endif /* Some drivers preinitialize some maps, without the X Server * needing to be aware of it. Therefore, we just return success * when the server tries to create a duplicate map. diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 2c3fcbd..5db96d45 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -526,7 +526,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) { #ifdef __alpha__ - return dev->hose->dense_mem_base - dev->hose->mem_space->start; + return dev->hose->dense_mem_base; #else return 0; #endif diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 60125dd..69b0fd9 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -450,6 +450,20 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_ return -EINVAL; mem->bus.base = rdev->mc.aper_base; mem->bus.is_iomem = true; +#ifdef __alpha__ + /* Alpha: use bus.addr to hold the ioremap() return, so we can modify bus.base below */ + if (mem->placement & TTM_PL_FLAG_WC) { + mem->bus.addr = ioremap_wc(mem->bus.base + mem->bus.offset, mem->bus.size); + } else { + mem->bus.addr = ioremap_nocache(mem->bus.base + mem->bus.offset, mem->bus.size); + } + /* Alpha: Take just the bus offset and add the hose/domain memory base. + Then, bus.base can be returned for use in an mmap() call. */ + mem->bus.base = (mem->bus.base & 0x0ffffffffUL) + rdev->ddev->hose->dense_mem_base; + DRM_DEBUG("VRAM: orig.bus.base=%lx bus.offset=%lx bus.addr=%lx bus.base=%lx HOSE=%lx\n", + rdev->mc.aper_base, mem->bus.offset, mem->bus.addr, + mem->bus.base, rdev->ddev->hose->dense_mem_base); +#endif break; default: return -EINVAL; -- 1.7.3.4