From 2f53ce4af2f7db911d908ff382738f30be004e8b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 19 Jul 2007 11:05:13 -0700 Subject: Move MMIO drm_addmap (and code that depends on it) to xgi_bootstrap. For reasons that I don't understand, the drm_addmap call would succeed in xgi_driver_load, but writes to the map later would oops. Moving it to xgi_bootstrap fixes this problem. --- linux-core/xgi_drv.c | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'linux-core/xgi_drv.c') diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c index 3b9f4cb1..13e79169 100644 --- a/linux-core/xgi_drv.c +++ b/linux-core/xgi_drv.c @@ -188,7 +188,38 @@ int xgi_bootstrap(DRM_IOCTL_ARGS) return 0; } + err = drm_addmap(dev, info->mmio.base, info->mmio.size, + _DRM_REGISTERS, _DRM_KERNEL, + &info->mmio_map); + if (err) { + DRM_ERROR("Unable to map MMIO region: %d\n", err); + return err; + } + xgi_enable_mmio(info); + //xgi_enable_ge(info); + + info->fb.size = IN3CFB(info->mmio_map, 0x54) * 8 * 1024 * 1024; + + DRM_INFO("fb base: 0x%lx, size: 0x%x (probed)\n", + (unsigned long) info->fb.base, info->fb.size); + + + if ((info->fb.base == 0) || (info->fb.size == 0)) { + DRM_ERROR("frame buffer appears to be wrong: 0x%lx 0x%x\n", + (unsigned long) info->fb.base, info->fb.size); + return DRM_ERR(EINVAL); + } + + + /* Init the resource manager */ + err = xgi_fb_heap_init(info); + if (err) { + DRM_ERROR("xgi_fb_heap_init() failed\n"); + return err; + } + + info->pcie.size = bs.gart_size * (1024 * 1024); @@ -280,36 +311,12 @@ int xgi_driver_load(struct drm_device *dev, unsigned long flags) } - err = drm_addmap(dev, info->mmio.base, info->mmio.size, - _DRM_REGISTERS, _DRM_KERNEL | _DRM_READ_ONLY, - &info->mmio_map); - if (err) { - DRM_ERROR("Unable to map MMIO region: %d\n", err); - return err; - } - - xgi_enable_mmio(info); - //xgi_enable_ge(info); - info->fb.base = drm_get_resource_start(dev, 0); info->fb.size = drm_get_resource_len(dev, 0); DRM_INFO("fb base: 0x%lx, size: 0x%x\n", (unsigned long) info->fb.base, info->fb.size); - info->fb.size = IN3CFB(info->mmio_map, 0x54) * 8 * 1024 * 1024; - - DRM_INFO("fb base: 0x%lx, size: 0x%x (probed)\n", - (unsigned long) info->fb.base, info->fb.size); - - - if ((info->fb.base == 0) || (info->fb.size == 0)) { - DRM_ERROR("frame buffer appears to be wrong: 0x%lx 0x%x\n", - (unsigned long) info->fb.base, info->fb.size); - return DRM_ERR(EINVAL); - } - - xgi_mem_block_cache = kmem_cache_create("xgi_mem_block", sizeof(struct xgi_mem_block), @@ -321,13 +328,6 @@ int xgi_driver_load(struct drm_device *dev, unsigned long flags) } - /* Init the resource manager */ - err = xgi_fb_heap_init(info); - if (err) { - DRM_ERROR("xgi_fb_heap_init() failed\n"); - return err; - } - return 0; } -- cgit v1.2.3