summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorStephane Marchesin <marchesin@icps.u-strasbg.fr>2007-01-05 20:49:34 +0100
committerStephane Marchesin <marchesin@icps.u-strasbg.fr>2007-01-05 20:49:34 +0100
commit025f281bbfe81960e8c60234f5eafd37cbe2d881 (patch)
tree3fef7c6ed9853ccc02ae354439e569d37778bc2e /shared-core
parentf80659bc2967dbed4aed0d44a550bb4a9e4569b5 (diff)
nouveau: Add an mtrr over the whole FB
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/nouveau_drv.h4
-rw-r--r--shared-core/nouveau_state.c16
2 files changed, 19 insertions, 1 deletions
diff --git a/shared-core/nouveau_drv.h b/shared-core/nouveau_drv.h
index 6e998f3a..7f012d65 100644
--- a/shared-core/nouveau_drv.h
+++ b/shared-core/nouveau_drv.h
@@ -129,6 +129,9 @@ typedef struct drm_nouveau_private {
uint64_t fb_phys;
uint64_t agp_phys;
+ /* the mtrr covering the FB */
+ int fb_mtrr;
+
struct mem_block *agp_heap;
struct mem_block *fb_heap;
struct mem_block *fb_nomap_heap;
@@ -142,6 +145,7 @@ drm_nouveau_private_t;
extern void nouveau_preclose(drm_device_t * dev, DRMFILE filp);
extern int nouveau_load(struct drm_device *dev, unsigned long flags);
extern int nouveau_firstopen(struct drm_device *dev);
+extern void nouveau_lastclose(struct drm_device *dev);
extern int nouveau_unload(struct drm_device *dev);
extern int nouveau_ioctl_getparam(DRM_IOCTL_ARGS);
extern int nouveau_ioctl_setparam(DRM_IOCTL_ARGS);
diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c
index c66ecd4e..2d0f7985 100644
--- a/shared-core/nouveau_state.c
+++ b/shared-core/nouveau_state.c
@@ -46,7 +46,7 @@ int nouveau_firstopen(struct drm_device *dev)
/* resource 0 is mmio regs */
/* resource 1 is linear FB */
- /* resource 2 is ??? (mmio regs + 0x1000000) */
+ /* resource 2 is RAMIN (mmio regs + 0x1000000) */
/* resource 6 is bios */
/* map the mmio regs */
@@ -71,6 +71,11 @@ int nouveau_firstopen(struct drm_device *dev)
ret = nouveau_fifo_init(dev);
if (ret) return ret;
+#if __OS_HAS_MTRR
+ /* setup a mtrr over the FB */
+ dev_priv->fb_mtrr=drm_mtrr_add(drm_get_resource_start(dev, 1),nouveau_mem_fb_amount(dev), DRM_MTRR_WC);
+#endif
+
/* FIXME: doesn't belong here, and have no idea what it's for.. */
if (dev_priv->card_type >= NV_40)
nv40_graph_init(dev);
@@ -98,6 +103,15 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
return 0;
}
+void nouveau_lastclose(struct drm_device *dev)
+{
+#if __OS_HAS_MTRR
+ drm_nouveau_private_t *dev_priv = dev->dev_private;
+ if(dev_priv->fb_mtrr>0)
+ drm_mtrr_del(dev_priv->fb_mtrr, drm_get_resource_start(dev, 1),nouveau_mem_fb_amount(dev), DRM_MTRR_WC);
+#endif
+}
+
int nouveau_unload(struct drm_device *dev)
{
drm_free(dev->dev_private, sizeof(*dev->dev_private), DRM_MEM_DRIVER);