summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Noland <rnoland@2hip.net>2008-10-10 13:06:22 -0400
committerRobert Noland <rnoland@2hip.net>2008-10-10 13:06:22 -0400
commitcdd3e9fc562bd57e0272e4c4d1c0707776bd01a1 (patch)
tree97d7b554a5c040630fabcb693b7b26ab4ca5a9f1
parent1150a42d4398b14c5db2f34a5beba613528df147 (diff)
[FreeBSD] Rework all of the memory allocations
Allocate memory from different pools. This allows the OS to track memory allocations for us, much like the linux memory debugging. This will ease tracking down memory leaks since the OS can track the number of allocations from each pool and help to point us in the right direction. Also replace drm_alloc and friends with static __inline__ versions while we are here.
-rw-r--r--bsd-core/ati_pcigart.c11
-rw-r--r--bsd-core/drmP.h72
-rw-r--r--bsd-core/drm_agpsupport.c9
-rw-r--r--bsd-core/drm_auth.c4
-rw-r--r--bsd-core/drm_bufs.c72
-rw-r--r--bsd-core/drm_context.c12
-rw-r--r--bsd-core/drm_dma.c14
-rw-r--r--bsd-core/drm_drv.c10
-rw-r--r--bsd-core/drm_fops.c6
-rw-r--r--bsd-core/drm_ioctl.c10
-rw-r--r--bsd-core/drm_irq.c11
-rw-r--r--bsd-core/drm_memory.c49
-rw-r--r--bsd-core/drm_pci.c10
-rw-r--r--bsd-core/drm_scatter.c12
-rw-r--r--bsd-core/drm_sysctl.c19
-rw-r--r--bsd-core/i915_drv.c4
-rw-r--r--bsd-core/mach64_drv.c4
-rw-r--r--bsd-core/mga_drv.c4
-rw-r--r--bsd-core/r128_drv.c4
-rw-r--r--bsd-core/radeon_drv.c4
-rw-r--r--bsd-core/savage_drv.c4
-rw-r--r--bsd-core/sis_drv.c4
-rw-r--r--bsd-core/tdfx_drv.c4
-rw-r--r--bsd-core/via_drv.c4
24 files changed, 184 insertions, 173 deletions
diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c
index 5feeeba8..bae10a69 100644
--- a/bsd-core/ati_pcigart.c
+++ b/bsd-core/ati_pcigart.c
@@ -61,7 +61,8 @@ drm_ati_alloc_pcigart_table(struct drm_device *dev,
struct drm_dma_handle *dmah;
int flags, ret;
- dmah = malloc(sizeof(struct drm_dma_handle), M_DRM, M_ZERO | M_NOWAIT);
+ dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA,
+ M_ZERO | M_NOWAIT);
if (dmah == NULL)
return ENOMEM;
@@ -74,7 +75,7 @@ drm_ati_alloc_pcigart_table(struct drm_device *dev,
BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */
&dmah->tag);
if (ret != 0) {
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return ENOMEM;
}
@@ -85,7 +86,7 @@ drm_ati_alloc_pcigart_table(struct drm_device *dev,
ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, flags, &dmah->map);
if (ret != 0) {
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return ENOMEM;
}
DRM_LOCK();
@@ -95,7 +96,7 @@ drm_ati_alloc_pcigart_table(struct drm_device *dev,
if (ret != 0) {
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return ENOMEM;
}
@@ -112,7 +113,7 @@ drm_ati_free_pcigart_table(struct drm_device *dev,
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
dev->sg->dmah = NULL;
}
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index fcce9066..c7e40230 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -126,27 +126,24 @@ struct drm_file;
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
-#define DRM_MEM_DMA 0
-#define DRM_MEM_SAREA 1
-#define DRM_MEM_DRIVER 2
-#define DRM_MEM_MAGIC 3
-#define DRM_MEM_IOCTLS 4
-#define DRM_MEM_MAPS 5
-#define DRM_MEM_BUFS 6
-#define DRM_MEM_SEGS 7
-#define DRM_MEM_PAGES 8
-#define DRM_MEM_FILES 9
-#define DRM_MEM_QUEUES 10
-#define DRM_MEM_CMDS 11
-#define DRM_MEM_MAPPINGS 12
-#define DRM_MEM_BUFLISTS 13
-#define DRM_MEM_AGPLISTS 14
-#define DRM_MEM_TOTALAGP 15
-#define DRM_MEM_BOUNDAGP 16
-#define DRM_MEM_CTXBITMAP 17
-#define DRM_MEM_STUB 18
-#define DRM_MEM_SGLISTS 19
-#define DRM_MEM_DRAWABLE 20
+MALLOC_DECLARE(DRM_MEM_DMA);
+MALLOC_DECLARE(DRM_MEM_SAREA);
+MALLOC_DECLARE(DRM_MEM_DRIVER);
+MALLOC_DECLARE(DRM_MEM_MAGIC);
+MALLOC_DECLARE(DRM_MEM_IOCTLS);
+MALLOC_DECLARE(DRM_MEM_MAPS);
+MALLOC_DECLARE(DRM_MEM_BUFS);
+MALLOC_DECLARE(DRM_MEM_SEGS);
+MALLOC_DECLARE(DRM_MEM_PAGES);
+MALLOC_DECLARE(DRM_MEM_FILES);
+MALLOC_DECLARE(DRM_MEM_QUEUES);
+MALLOC_DECLARE(DRM_MEM_CMDS);
+MALLOC_DECLARE(DRM_MEM_MAPPINGS);
+MALLOC_DECLARE(DRM_MEM_BUFLISTS);
+MALLOC_DECLARE(DRM_MEM_AGPLISTS);
+MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
+MALLOC_DECLARE(DRM_MEM_SGLISTS);
+MALLOC_DECLARE(DRM_MEM_DRAWABLE);
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
@@ -157,8 +154,6 @@ struct drm_file;
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
-MALLOC_DECLARE(M_DRM);
-
#define __OS_HAS_AGP 1
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
@@ -745,11 +740,6 @@ extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
/* Memory management support (drm_memory.c) */
void drm_mem_init(void);
void drm_mem_uninit(void);
-void *drm_alloc(size_t size, int area);
-void *drm_calloc(size_t nmemb, size_t size, int area);
-void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
- int area);
-void drm_free(void *pt, size_t size, int area);
void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
void drm_ioremapfree(drm_local_map_t *map);
@@ -963,6 +953,32 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
size_t align, dma_addr_t maxaddr);
void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
+/* Inline replacements for drm_alloc and friends */
+static __inline__ void *
+drm_alloc(size_t size, struct malloc_type *area)
+{
+ return malloc(size, area, M_NOWAIT);
+}
+
+static __inline__ void *
+drm_calloc(size_t nmemb, size_t size, struct malloc_type *area)
+{
+ return malloc(size * nmemb, area, M_NOWAIT | M_ZERO);
+}
+
+static __inline__ void *
+drm_realloc(void *oldpt, size_t oldsize, size_t size,
+ struct malloc_type *area)
+{
+ return reallocf(oldpt, size, area, M_NOWAIT);
+}
+
+static __inline__ void
+drm_free(void *pt, size_t size, struct malloc_type *area)
+{
+ free(pt, area);
+}
+
/* Inline replacements for DRM_IOREMAP macros */
static __inline__ void
drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index a568c5a5..34b23af1 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -209,7 +209,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
if (!dev->agp || !dev->agp->acquired)
return EINVAL;
- entry = malloc(sizeof(*entry), M_DRM, M_NOWAIT | M_ZERO);
+ entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT | M_ZERO);
if (entry == NULL)
return ENOMEM;
@@ -220,7 +220,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
handle = drm_agp_allocate_memory(pages, type);
DRM_LOCK();
if (handle == NULL) {
- free(entry, M_DRM);
+ free(entry, DRM_MEM_AGPLISTS);
return ENOMEM;
}
@@ -371,7 +371,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
drm_agp_free_memory(entry->handle);
DRM_LOCK();
- free(entry, M_DRM);
+ free(entry, DRM_MEM_AGPLISTS);
return 0;
@@ -405,7 +405,8 @@ drm_agp_head_t *drm_agp_init(void)
DRM_DEBUG("agp_available = %d\n", agp_available);
if (agp_available) {
- head = malloc(sizeof(*head), M_DRM, M_NOWAIT | M_ZERO);
+ head = malloc(sizeof(*head), DRM_MEM_AGPLISTS,
+ M_NOWAIT | M_ZERO);
if (head == NULL)
return NULL;
head->agpdev = agpdev;
diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c
index b5fc5587..6a76ed59 100644
--- a/bsd-core/drm_auth.c
+++ b/bsd-core/drm_auth.c
@@ -74,7 +74,7 @@ static int drm_add_magic(struct drm_device *dev, struct drm_file *priv,
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
hash = drm_hash_magic(magic);
- entry = malloc(sizeof(*entry), M_DRM, M_ZERO | M_NOWAIT);
+ entry = malloc(sizeof(*entry), DRM_MEM_MAGIC, M_ZERO | M_NOWAIT);
if (!entry)
return ENOMEM;
entry->magic = magic;
@@ -118,7 +118,7 @@ static int drm_remove_magic(struct drm_device *dev, drm_magic_t magic)
if (prev) {
prev->next = pt->next;
}
- free(pt, M_DRM);
+ free(pt, DRM_MEM_MAGIC);
return 0;
}
}
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index 60f57cfd..303b2404 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -135,7 +135,7 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
/* Allocate a new map structure, fill it in, and do any type-specific
* initialization necessary.
*/
- map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT);
+ map = malloc(sizeof(*map), DRM_MEM_MAPS, M_ZERO | M_NOWAIT);
if (!map) {
DRM_LOCK();
return ENOMEM;
@@ -157,11 +157,11 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
map->mtrr = 1;
break;
case _DRM_SHM:
- map->handle = malloc(map->size, M_DRM, M_NOWAIT);
+ map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT);
DRM_DEBUG("%lu %d %p\n",
map->size, drm_order(map->size), map->handle);
if (!map->handle) {
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
DRM_LOCK();
return ENOMEM;
}
@@ -171,8 +171,8 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
DRM_LOCK();
if (dev->lock.hw_lock != NULL) {
DRM_UNLOCK();
- free(map->handle, M_DRM);
- free(map, M_DRM);
+ free(map->handle, DRM_MEM_MAPS);
+ free(map, DRM_MEM_MAPS);
return EBUSY;
}
dev->lock.hw_lock = map->handle; /* Pointer to lock */
@@ -202,14 +202,14 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
}
}
if (!valid) {
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
DRM_LOCK();
return EACCES;
}*/
break;
case _DRM_SCATTER_GATHER:
if (!dev->sg) {
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
DRM_LOCK();
return EINVAL;
}
@@ -227,7 +227,7 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
align = PAGE_SIZE;
map->dmah = drm_pci_alloc(dev, map->size, align, 0xfffffffful);
if (map->dmah == NULL) {
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
DRM_LOCK();
return ENOMEM;
}
@@ -236,7 +236,7 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
break;
default:
DRM_ERROR("Bad map type %d\n", map->type);
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
DRM_LOCK();
return EINVAL;
}
@@ -310,7 +310,7 @@ void drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
}
break;
case _DRM_SHM:
- free(map->handle, M_DRM);
+ free(map->handle, DRM_MEM_MAPS);
break;
case _DRM_AGP:
case _DRM_SCATTER_GATHER:
@@ -328,7 +328,7 @@ void drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
map->bsr);
}
- free(map, M_DRM);
+ free(map, DRM_MEM_MAPS);
}
/* Remove a map private from list and deallocate resources if the mapping
@@ -371,16 +371,16 @@ static void drm_cleanup_buf_error(struct drm_device *dev,
for (i = 0; i < entry->seg_count; i++) {
drm_pci_free(dev, entry->seglist[i]);
}
- free(entry->seglist, M_DRM);
+ free(entry->seglist, DRM_MEM_SEGS);
entry->seg_count = 0;
}
if (entry->buf_count) {
for (i = 0; i < entry->buf_count; i++) {
- free(entry->buflist[i].dev_private, M_DRM);
+ free(entry->buflist[i].dev_private, DRM_MEM_BUFS);
}
- free(entry->buflist, M_DRM);
+ free(entry->buflist, DRM_MEM_BUFS);
entry->buf_count = 0;
}
@@ -447,7 +447,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
entry = &dma->bufs[order];
- entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM,
+ entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
if (!entry->buflist) {
return ENOMEM;
@@ -473,7 +473,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
+ buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
/* Set count correctly so we free the proper amount. */
@@ -490,8 +490,8 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM,
- M_NOWAIT);
+ (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
+ DRM_MEM_BUFS, M_NOWAIT);
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
@@ -549,22 +549,22 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
entry = &dma->bufs[order];
- entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM,
+ entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
- entry->seglist = malloc(count * sizeof(*entry->seglist), M_DRM,
+ entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS,
M_NOWAIT | M_ZERO);
/* Keep the original pagelist until we know all the allocations
* have succeeded
*/
temp_pagelist = malloc((dma->page_count + (count << page_order)) *
- sizeof(*dma->pagelist), M_DRM, M_NOWAIT);
+ sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT);
if (entry->buflist == NULL || entry->seglist == NULL ||
temp_pagelist == NULL) {
- free(temp_pagelist, M_DRM);
- free(entry->seglist, M_DRM);
- free(entry->buflist, M_DRM);
+ free(temp_pagelist, DRM_MEM_PAGES);
+ free(entry->seglist, DRM_MEM_SEGS);
+ free(entry->buflist, DRM_MEM_BUFS);
return ENOMEM;
}
@@ -589,7 +589,7 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
entry->buf_count = count;
entry->seg_count = count;
drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, M_DRM);
+ free(temp_pagelist, DRM_MEM_PAGES);
return ENOMEM;
}
@@ -617,14 +617,14 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
- M_NOWAIT | M_ZERO);
+ buf->dev_private = malloc(buf->dev_priv_size,
+ DRM_MEM_BUFS, M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
entry->seg_count = count;
drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, M_DRM);
+ free(temp_pagelist, DRM_MEM_PAGES);
return ENOMEM;
}
@@ -635,12 +635,12 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
}
temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM,
- M_NOWAIT);
+ (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
+ DRM_MEM_BUFS, M_NOWAIT);
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, M_DRM);
+ free(temp_pagelist, DRM_MEM_PAGES);
return ENOMEM;
}
dma->buflist = temp_buflist;
@@ -652,7 +652,7 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
/* No allocations failed, so now we can replace the orginal pagelist
* with the new one.
*/
- free(dma->pagelist, M_DRM);
+ free(dma->pagelist, DRM_MEM_PAGES);
dma->pagelist = temp_pagelist;
dma->buf_count += entry->buf_count;
@@ -706,7 +706,7 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
entry = &dma->bufs[order];
- entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM,
+ entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
if (entry->buflist == NULL)
return ENOMEM;
@@ -731,7 +731,7 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
+ buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
/* Set count correctly so we free the proper amount. */
@@ -751,8 +751,8 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM,
- M_NOWAIT);
+ (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
+ DRM_MEM_BUFS, M_NOWAIT);
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
index bca899cb..4dddd9c8 100644
--- a/bsd-core/drm_context.c
+++ b/bsd-core/drm_context.c
@@ -77,7 +77,7 @@ int drm_ctxbitmap_next(struct drm_device *dev)
ctx_sareas = realloc(dev->context_sareas,
dev->max_context * sizeof(*dev->context_sareas),
- M_DRM, M_NOWAIT);
+ DRM_MEM_SAREA, M_NOWAIT);
if (ctx_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
DRM_UNLOCK();
@@ -88,7 +88,8 @@ int drm_ctxbitmap_next(struct drm_device *dev)
} else {
/* max_context == 1 at this point */
dev->context_sareas = malloc(dev->max_context *
- sizeof(*dev->context_sareas), M_DRM, M_NOWAIT);
+ sizeof(*dev->context_sareas), DRM_MEM_SAREA,
+ M_NOWAIT);
if (dev->context_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
DRM_UNLOCK();
@@ -107,7 +108,8 @@ int drm_ctxbitmap_init(struct drm_device *dev)
int temp;
DRM_LOCK();
- dev->ctx_bitmap = malloc(PAGE_SIZE, M_DRM, M_NOWAIT | M_ZERO);
+ dev->ctx_bitmap = malloc(PAGE_SIZE, DRM_MEM_CTXBITMAP,
+ M_NOWAIT | M_ZERO);
if (dev->ctx_bitmap == NULL) {
DRM_UNLOCK();
return ENOMEM;
@@ -128,8 +130,8 @@ void drm_ctxbitmap_cleanup(struct drm_device *dev)
{
DRM_LOCK();
if (dev->context_sareas != NULL)
- free(dev->context_sareas, M_DRM);
- free(dev->ctx_bitmap, M_DRM);
+ free(dev->context_sareas, DRM_MEM_SAREA);
+ free(dev->ctx_bitmap, DRM_MEM_CTXBITMAP);
DRM_UNLOCK();
}
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 51f60683..c2d9994e 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -41,7 +41,7 @@
int drm_dma_setup(struct drm_device *dev)
{
- dev->dma = malloc(sizeof(*dev->dma), M_DRM, M_NOWAIT | M_ZERO);
+ dev->dma = malloc(sizeof(*dev->dma), DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
if (dev->dma == NULL)
return ENOMEM;
@@ -67,21 +67,21 @@ void drm_dma_takedown(struct drm_device *dev)
for (j = 0; j < dma->bufs[i].seg_count; j++) {
drm_pci_free(dev, dma->bufs[i].seglist[j]);
}
- free(dma->bufs[i].seglist, M_DRM);
+ free(dma->bufs[i].seglist, DRM_MEM_SEGS);
}
if (dma->bufs[i].buf_count) {
for (j = 0; j < dma->bufs[i].buf_count; j++) {
free(dma->bufs[i].buflist[j].dev_private,
- M_DRM);
+ DRM_MEM_BUFS);
}
- free(dma->bufs[i].buflist, M_DRM);
+ free(dma->bufs[i].buflist, DRM_MEM_BUFS);
}
}
- free(dma->buflist, M_DRM);
- free(dma->pagelist, M_DRM);
- free(dev->dma, M_DRM);
+ free(dma->buflist, DRM_MEM_BUFS);
+ free(dma->pagelist, DRM_MEM_PAGES);
+ free(dev->dma, DRM_MEM_DRIVER);
dev->dma = NULL;
DRM_SPINUNINIT(&dev->dma_lock);
}
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index a35d60a7..725e5a9d 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -280,7 +280,7 @@ static int drm_lastclose(struct drm_device *dev)
drm_irq_uninstall(dev);
if (dev->unique) {
- free(dev->unique, M_DRM);
+ free(dev->unique, DRM_MEM_DRIVER);
dev->unique = NULL;
dev->unique_len = 0;
}
@@ -288,7 +288,7 @@ static int drm_lastclose(struct drm_device *dev)
for (i = 0; i < DRM_HASH_SIZE; i++) {
for (pt = dev->magiclist[i].head; pt; pt = next) {
next = pt->next;
- free(pt, M_DRM);
+ free(pt, DRM_MEM_MAGIC);
}
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
@@ -310,7 +310,7 @@ static int drm_lastclose(struct drm_device *dev)
if (entry->bound)
drm_agp_unbind_memory(entry->handle);
drm_agp_free_memory(entry->handle);
- free(entry, M_DRM);
+ free(entry, DRM_MEM_AGPLISTS);
}
dev->agp->memory = NULL;
@@ -479,7 +479,7 @@ static void drm_unload(struct drm_device *dev)
}
if (dev->agp) {
- free(dev->agp, M_DRM);
+ free(dev->agp, DRM_MEM_AGPLISTS);
dev->agp = NULL;
}
@@ -623,7 +623,7 @@ void drm_close(void *data)
if (dev->driver->postclose != NULL)
dev->driver->postclose(dev, file_priv);
TAILQ_REMOVE(&dev->files, file_priv, link);
- free(file_priv, M_DRM);
+ free(file_priv, DRM_MEM_FILES);
/* ========================================================
* End inline drm_release
diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c
index 6850f489..c6a8d195 100644
--- a/bsd-core/drm_fops.c
+++ b/bsd-core/drm_fops.c
@@ -50,14 +50,14 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
- priv = malloc(sizeof(*priv), M_DRM, M_NOWAIT | M_ZERO);
+ priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO);
if (priv == NULL) {
return ENOMEM;
}
retcode = devfs_set_cdevpriv(priv, drm_close);
if (retcode != 0) {
- free(priv, M_DRM);
+ free(priv, DRM_MEM_FILES);
return retcode;
}
@@ -76,7 +76,7 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
retcode = -dev->driver->open(dev, priv);
if (retcode != 0) {
devfs_clear_cdevpriv();
- free(priv, M_DRM);
+ free(priv, DRM_MEM_FILES);
DRM_UNLOCK();
return retcode;
}
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c
index 0523291e..cae853ee 100644
--- a/bsd-core/drm_ioctl.c
+++ b/bsd-core/drm_ioctl.c
@@ -69,12 +69,12 @@ int drm_setunique(struct drm_device *dev, void *data,
if (!u->unique_len || u->unique_len > 1024)
return EINVAL;
- busid = malloc(u->unique_len + 1, M_DRM, M_WAITOK);
+ busid = malloc(u->unique_len + 1, DRM_MEM_DRIVER, M_WAITOK);
if (busid == NULL)
return ENOMEM;
if (DRM_COPY_FROM_USER(busid, u->unique, u->unique_len)) {
- free(busid, M_DRM);
+ free(busid, DRM_MEM_DRIVER);
return EFAULT;
}
busid[u->unique_len] = '\0';
@@ -84,7 +84,7 @@ int drm_setunique(struct drm_device *dev, void *data,
*/
ret = sscanf(busid, "PCI:%d:%d:%d", &bus, &slot, &func);
if (ret != 3) {
- free(busid, M_DRM);
+ free(busid, DRM_MEM_DRIVER);
return EINVAL;
}
domain = bus >> 8;
@@ -94,7 +94,7 @@ int drm_setunique(struct drm_device *dev, void *data,
(bus != dev->pci_bus) ||
(slot != dev->pci_slot) ||
(func != dev->pci_func)) {
- free(busid, M_DRM);
+ free(busid, DRM_MEM_DRIVER);
return EINVAL;
}
@@ -125,7 +125,7 @@ drm_set_busid(struct drm_device *dev)
}
dev->unique_len = 20;
- dev->unique = malloc(dev->unique_len + 1, M_DRM, M_NOWAIT);
+ dev->unique = malloc(dev->unique_len + 1, DRM_MEM_DRIVER, M_NOWAIT);
if (dev->unique == NULL) {
DRM_UNLOCK();
return ENOMEM;
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index 00d4b31e..5e99bb33 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -111,8 +111,7 @@ static void drm_vblank_cleanup(struct drm_device *dev)
vblank_disable_fn((void *)dev);
- drm_free(dev->vblank, sizeof(struct drm_vblank_info) * dev->num_crtcs,
- DRM_MEM_DRIVER);
+ free(dev->vblank, DRM_MEM_DRIVER);
dev->num_crtcs = 0;
}
@@ -125,8 +124,8 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
atomic_set(&dev->vbl_signal_pending, 0);
dev->num_crtcs = num_crtcs;
- dev->vblank = drm_calloc(num_crtcs, sizeof(struct drm_vblank_info),
- DRM_MEM_DRIVER);
+ dev->vblank = malloc(sizeof(struct drm_vblank_info) * num_crtcs,
+ DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
if (!dev->vblank)
goto err;
@@ -429,8 +428,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
if (flags & _DRM_VBLANK_SIGNAL) {
#if 0 /* disabled */
- drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t), M_DRM,
- M_NOWAIT | M_ZERO);
+ drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t),
+ DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
if (vbl_sig == NULL)
return ENOMEM;
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
index 2dfd2b8e..ac43cb0c 100644
--- a/bsd-core/drm_memory.c
+++ b/bsd-core/drm_memory.c
@@ -38,7 +38,25 @@
#include "drmP.h"
-MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures");
+MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures");
+MALLOC_DEFINE(DRM_MEM_SAREA, "drm_sarea", "DRM SAREA Data Structures");
+MALLOC_DEFINE(DRM_MEM_DRIVER, "drm_driver", "DRM DRIVER Data Structures");
+MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures");
+MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures");
+MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures");
+MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures");
+MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures");
+MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures");
+MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures");
+MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures");
+MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures");
+MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures");
+MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures");
+MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures");
+MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap",
+ "DRM CTXBITMAP Data Structures");
+MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures");
+MALLOC_DEFINE(DRM_MEM_DRAWABLE, "drm_drawable", "DRM DRAWABLE Data Structures");
void drm_mem_init(void)
{
@@ -48,35 +66,6 @@ void drm_mem_uninit(void)
{
}
-void *drm_alloc(size_t size, int area)
-{
- return malloc(size, M_DRM, M_NOWAIT);
-}
-
-void *drm_calloc(size_t nmemb, size_t size, int area)
-{
- return malloc(size * nmemb, M_DRM, M_NOWAIT | M_ZERO);
-}
-
-void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
-{
- void *pt;
-
- pt = malloc(size, M_DRM, M_NOWAIT);
- if (pt == NULL)
- return NULL;
- if (oldpt && oldsize) {
- memcpy(pt, oldpt, DRM_MIN(oldsize,size));
- free(oldpt, M_DRM);
- }
- return pt;
-}
-
-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);
diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c
index e21715b2..5a3cb61b 100644
--- a/bsd-core/drm_pci.c
+++ b/bsd-core/drm_pci.c
@@ -64,7 +64,7 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
return NULL;
}
- dmah = malloc(sizeof(drm_dma_handle_t), M_DRM, M_ZERO | M_NOWAIT);
+ dmah = malloc(sizeof(drm_dma_handle_t), DRM_MEM_DMA, M_ZERO | M_NOWAIT);
if (dmah == NULL)
return NULL;
@@ -83,7 +83,7 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */
&dmah->tag);
if (ret != 0) {
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return NULL;
}
@@ -91,7 +91,7 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
&dmah->map);
if (ret != 0) {
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return NULL;
}
@@ -100,7 +100,7 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
if (ret != 0) {
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
return NULL;
}
@@ -119,7 +119,7 @@ drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
+ free(dmah, DRM_MEM_DMA);
}
/*@}*/
diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c
index 550e6f88..7d47e605 100644
--- a/bsd-core/drm_scatter.c
+++ b/bsd-core/drm_scatter.c
@@ -40,9 +40,9 @@
void drm_sg_cleanup(drm_sg_mem_t *entry)
{
- free((void *)entry->handle, M_DRM);
- free(entry->busaddr, M_DRM);
- free(entry, M_DRM);
+ free((void *)entry->handle, DRM_MEM_PAGES);
+ free(entry->busaddr, DRM_MEM_PAGES);
+ free(entry, DRM_MEM_SGLISTS);
}
int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request)
@@ -54,7 +54,7 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request)
if (dev->sg)
return EINVAL;
- entry = malloc(sizeof(*entry), M_DRM, M_WAITOK | M_ZERO);
+ entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
if (!entry)
return ENOMEM;
@@ -63,14 +63,14 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request)
entry->pages = pages;
- entry->busaddr = malloc(pages * sizeof(*entry->busaddr), M_DRM,
+ entry->busaddr = malloc(pages * sizeof(*entry->busaddr), DRM_MEM_PAGES,
M_WAITOK | M_ZERO);
if (!entry->busaddr) {
drm_sg_cleanup(entry);
return ENOMEM;
}
- entry->handle = (long)malloc(pages << PAGE_SHIFT, M_DRM,
+ entry->handle = (long)malloc(pages << PAGE_SHIFT, DRM_MEM_PAGES,
M_WAITOK | M_ZERO);
if (entry->handle == 0) {
drm_sg_cleanup(entry);
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
index f9cfd9cf..f0227aa7 100644
--- a/bsd-core/drm_sysctl.c
+++ b/bsd-core/drm_sysctl.c
@@ -59,7 +59,7 @@ int drm_sysctl_init(struct drm_device *dev)
struct sysctl_oid *top, *drioid;
int i;
- info = malloc(sizeof *info, M_DRM, M_WAITOK | M_ZERO);
+ info = malloc(sizeof *info, DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
if ( !info )
return 1;
dev->sysctl = info;
@@ -111,7 +111,7 @@ int drm_sysctl_cleanup(struct drm_device *dev)
int error;
error = sysctl_ctx_free( &dev->sysctl->ctx );
- free(dev->sysctl, M_DRM);
+ free(dev->sysctl, DRM_MEM_DRIVER);
dev->sysctl = NULL;
return error;
@@ -169,7 +169,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
TAILQ_FOREACH(map, &dev->maplist, link)
mapcount++;
- tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, M_DRM, M_NOWAIT);
+ tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER,
+ M_NOWAIT);
if (tempmaps == NULL) {
DRM_UNLOCK();
return ENOMEM;
@@ -205,7 +206,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
SYSCTL_OUT(req, "", 1);
done:
- free(tempmaps, M_DRM);
+ free(tempmaps, DRM_MEM_DRIVER);
return retcode;
}
@@ -229,7 +230,8 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
}
DRM_SPINLOCK(&dev->dma_lock);
tempdma = *dma;
- templists = malloc(sizeof(int) * dma->buf_count, M_DRM, M_NOWAIT);
+ templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER,
+ M_NOWAIT);
for (i = 0; i < dma->buf_count; i++)
templists[i] = dma->buflist[i]->list;
dma = &tempdma;
@@ -261,7 +263,7 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
SYSCTL_OUT(req, "", 1);
done:
- free(templists, M_DRM);
+ free(templists, DRM_MEM_DRIVER);
return retcode;
}
@@ -279,7 +281,8 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
TAILQ_FOREACH(priv, &dev->files, link)
privcount++;
- tempprivs = malloc(sizeof(struct drm_file) * privcount, M_DRM, M_NOWAIT);
+ tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER,
+ M_NOWAIT);
if (tempprivs == NULL) {
DRM_UNLOCK();
return ENOMEM;
@@ -304,6 +307,6 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
SYSCTL_OUT(req, "", 1);
done:
- free(tempprivs, M_DRM);
+ free(tempprivs, DRM_MEM_DRIVER);
return retcode;
}
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index 87703210..0c36a6f1 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -109,7 +109,7 @@ i915_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
i915_configure(dev);
@@ -125,7 +125,7 @@ i915_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c
index 03a533a9..1cbe5f39 100644
--- a/bsd-core/mach64_drv.c
+++ b/bsd-core/mach64_drv.c
@@ -83,7 +83,7 @@ mach64_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
mach64_configure(dev);
@@ -99,7 +99,7 @@ mach64_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index ae3675c3..af250e83 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -127,7 +127,7 @@ mga_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
mga_configure(dev);
@@ -143,7 +143,7 @@ mga_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index f239ea36..3dbf66eb 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -82,7 +82,7 @@ r128_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
r128_configure(dev);
@@ -98,7 +98,7 @@ r128_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
index ab5968b2..46bccb39 100644
--- a/bsd-core/radeon_drv.c
+++ b/bsd-core/radeon_drv.c
@@ -87,7 +87,7 @@ radeon_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
radeon_configure(dev);
@@ -103,7 +103,7 @@ radeon_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c
index 5cf2d611..96643aae 100644
--- a/bsd-core/savage_drv.c
+++ b/bsd-core/savage_drv.c
@@ -73,7 +73,7 @@ savage_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
savage_configure(dev);
@@ -89,7 +89,7 @@ savage_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
index 55a6231c..2b6be29f 100644
--- a/bsd-core/sis_drv.c
+++ b/bsd-core/sis_drv.c
@@ -67,7 +67,7 @@ sis_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
sis_configure(dev);
@@ -83,7 +83,7 @@ sis_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
index 61952564..775efcc1 100644
--- a/bsd-core/tdfx_drv.c
+++ b/bsd-core/tdfx_drv.c
@@ -69,7 +69,7 @@ tdfx_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
tdfx_configure(dev);
@@ -85,7 +85,7 @@ tdfx_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}
diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c
index d16efc43..cae7231c 100644
--- a/bsd-core/via_drv.c
+++ b/bsd-core/via_drv.c
@@ -80,7 +80,7 @@ via_attach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
- dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM,
+ dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
M_WAITOK | M_ZERO);
via_configure(dev);
@@ -96,7 +96,7 @@ via_detach(device_t nbdev)
ret = drm_detach(nbdev);
- free(dev->driver, M_DRM);
+ free(dev->driver, DRM_MEM_DRIVER);
return ret;
}