drm: userspace rip out TTM API
[platform/upstream/libdrm.git] / shared-core / nv50_instmem.c
index 1eeb54d..b7a51f0 100644 (file)
@@ -69,7 +69,11 @@ nv50_instmem_init(struct drm_device *dev)
                return -ENOMEM;
        dev_priv->Engine.instmem.priv = priv;
 
-       /* Reserve the last MiB of VRAM, we should probably try to avoid 
+       /* Save state, will restore at takedown. */
+       for (i = 0x1700; i <= 0x1710; i+=4)
+               priv->save1700[(i-0x1700)/4] = NV_READ(i);
+
+       /* Reserve the last MiB of VRAM, we should probably try to avoid
         * setting up the below tables over the top of the VBIOS image at
         * some point.
         */
@@ -144,7 +148,7 @@ nv50_instmem_init(struct drm_device *dev)
                        BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, v | 1);
                else
                        BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, 0x00000009);
-               BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000); 
+               BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000);
        }
 
        BAR0_WI32(chan->vm_pd, 0x00, priv->pramin_pt->instance | 0x63);
@@ -239,7 +243,8 @@ nv50_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj, uin
                return -EINVAL;
 
        gpuobj->im_backing = nouveau_mem_alloc(dev, NV50_INSTMEM_PAGE_SIZE,
-                                              *sz, NOUVEAU_MEM_FB,
+                                              *sz, NOUVEAU_MEM_FB |
+                                              NOUVEAU_MEM_NOVM,
                                               (struct drm_file *)-2);
        if (!gpuobj->im_backing) {
                DRM_ERROR("Couldn't allocate vram to back PRAMIN pages\n");
@@ -259,7 +264,7 @@ nv50_instmem_clear(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
                        dev_priv->Engine.instmem.unbind(dev, gpuobj);
                nouveau_mem_free(dev, gpuobj->im_backing);
                gpuobj->im_backing = NULL;
-       }       
+       }
 }
 
 int
@@ -317,4 +322,3 @@ nv50_instmem_unbind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
        gpuobj->im_bound = 0;
        return 0;
 }
-