summaryrefslogtreecommitdiff
path: root/bsd-core/drm_memory.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-09-26 15:37:21 +1000
committerDave Airlie <airlied@redhat.com>2008-09-30 14:13:49 +1000
commit972f6572652bc4a2f6c44c525e5e91f2becdb62a (patch)
tree60af3dc7e8a7c0f8bef7a3927dae161093b10dbe /bsd-core/drm_memory.c
parent89126bb58ec82511758bed36a28e698b721fb435 (diff)
parent2db8e0c8ef8c7a66460fceda129533b364f6418c (diff)
Merge remote branch 'origin/master' into modesetting-gem
Conflicts: libdrm/Makefile.am libdrm/dri_bufmgr.h linux-core/drm_irq.c linux-core/drm_sysfs.c linux-core/drm_ttm.c shared-core/i915_dma.c shared-core/i915_irq.c shared-core/nouveau_drv.h shared-core/radeon_cp.c
Diffstat (limited to 'bsd-core/drm_memory.c')
-rw-r--r--bsd-core/drm_memory.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
index 05343f3f..2dfd2b8e 100644
--- a/bsd-core/drm_memory.c
+++ b/bsd-core/drm_memory.c
@@ -42,9 +42,6 @@ MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures");
void drm_mem_init(void)
{
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- malloc_type_attach(M_DRM);
-#endif
}
void drm_mem_uninit(void)
@@ -69,7 +66,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
if (pt == NULL)
return NULL;
if (oldpt && oldsize) {
- memcpy(pt, oldpt, oldsize);
+ memcpy(pt, oldpt, DRM_MIN(oldsize,size));
free(oldpt, M_DRM);
}
return pt;
@@ -80,29 +77,21 @@ void drm_free(void *pt, size_t size, int area)
free(pt, M_DRM);
}
+void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map)
+{
+ return pmap_mapdev_attr(map->offset, map->size, PAT_WRITE_COMBINING);
+}
+
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
{
-#ifdef __FreeBSD__
return pmap_mapdev(map->offset, map->size);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- map->bst = dev->pa.pa_memt;
- if (bus_space_map(map->bst, map->offset, map->size,
- BUS_SPACE_MAP_LINEAR, &map->bsh))
- return NULL;
- return bus_space_vaddr(map->bst, map->bsh);
-#endif
}
void drm_ioremapfree(drm_local_map_t *map)
{
-#ifdef __FreeBSD__
pmap_unmapdev((vm_offset_t) map->handle, map->size);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- bus_space_unmap(map->bst, map->bsh, map->size);
-#endif
}
-#ifdef __FreeBSD__
int
drm_mtrr_add(unsigned long offset, size_t size, int flags)
{
@@ -130,30 +119,3 @@ drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-int
-drm_mtrr_add(unsigned long offset, size_t size, int flags)
-{
- struct mtrr mtrrmap;
- int one = 1;
-
- mtrrmap.base = offset;
- mtrrmap.len = size;
- mtrrmap.type = flags;
- mtrrmap.flags = MTRR_VALID;
- return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
-}
-
-int
-drm_mtrr_del(unsigned long offset, size_t size, int flags)
-{
- struct mtrr mtrrmap;
- int one = 1;
-
- mtrrmap.base = offset;
- mtrrmap.len = size;
- mtrrmap.type = flags;
- mtrrmap.flags = 0;
- return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
-}
-#endif