The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/drm/drm_memory.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  *Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
    3  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
    4  * All Rights Reserved.
    5  *
    6  * Permission is hereby granted, free of charge, to any person obtaining a
    7  * copy of this software and associated documentation files (the "Software"),
    8  * to deal in the Software without restriction, including without limitation
    9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   10  * and/or sell copies of the Software, and to permit persons to whom the
   11  * Software is furnished to do so, subject to the following conditions:
   12  *
   13  * The above copyright notice and this permission notice (including the next
   14  * paragraph) shall be included in all copies or substantial portions of the
   15  * Software.
   16  *
   17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   20  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   23  * OTHER DEALINGS IN THE SOFTWARE.
   24  *
   25  * Authors:
   26  *    Rickard E. (Rik) Faith <faith@valinux.com>
   27  *    Gareth Hughes <gareth@valinux.com>
   28  *
   29  */
   30 
   31 #include <sys/cdefs.h>
   32 __FBSDID("$FreeBSD$");
   33 
   34 /** @file drm_memory.c
   35  * Wrappers for kernel memory allocation routines, and MTRR management support.
   36  *
   37  * This file previously implemented a memory consumption tracking system using
   38  * the "area" argument for various different types of allocations, but that
   39  * has been stripped out for now.
   40  */
   41 
   42 #include "dev/drm/drmP.h"
   43 
   44 MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures");
   45 MALLOC_DEFINE(DRM_MEM_SAREA, "drm_sarea", "DRM SAREA Data Structures");
   46 MALLOC_DEFINE(DRM_MEM_DRIVER, "drm_driver", "DRM DRIVER Data Structures");
   47 MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures");
   48 MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures");
   49 MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures");
   50 MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures");
   51 MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures");
   52 MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures");
   53 MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures");
   54 MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures");
   55 MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures");
   56 MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures");
   57 MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures");
   58 MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures");
   59 MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap",
   60     "DRM CTXBITMAP Data Structures");
   61 MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures");
   62 MALLOC_DEFINE(DRM_MEM_DRAWABLE, "drm_drawable", "DRM DRAWABLE Data Structures");
   63 MALLOC_DEFINE(DRM_MEM_MM, "drm_sman", "DRM MEMORY MANAGER Data Structures");
   64 MALLOC_DEFINE(DRM_MEM_HASHTAB, "drm_hashtab", "DRM HASHTABLE Data Structures");
   65 
   66 void drm_mem_init(void)
   67 {
   68 }
   69 
   70 void drm_mem_uninit(void)
   71 {
   72 }
   73 
   74 void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map)
   75 {
   76         return pmap_mapdev_attr(map->offset, map->size, VM_MEMATTR_WRITE_COMBINING);
   77 }
   78 
   79 void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
   80 {
   81         return pmap_mapdev(map->offset, map->size);
   82 }
   83 
   84 void drm_ioremapfree(drm_local_map_t *map)
   85 {
   86         pmap_unmapdev((vm_offset_t) map->virtual, map->size);
   87 }
   88 
   89 int
   90 drm_mtrr_add(unsigned long offset, size_t size, int flags)
   91 {
   92         int act;
   93         struct mem_range_desc mrdesc;
   94 
   95         mrdesc.mr_base = offset;
   96         mrdesc.mr_len = size;
   97         mrdesc.mr_flags = flags;
   98         act = MEMRANGE_SET_UPDATE;
   99         strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
  100         return mem_range_attr_set(&mrdesc, &act);
  101 }
  102 
  103 int
  104 drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
  105 {
  106         int act;
  107         struct mem_range_desc mrdesc;
  108 
  109         mrdesc.mr_base = offset;
  110         mrdesc.mr_len = size;
  111         mrdesc.mr_flags = flags;
  112         act = MEMRANGE_SET_REMOVE;
  113         strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
  114         return mem_range_attr_set(&mrdesc, &act);
  115 }

Cache object: 285555cee60fe421f31926ecb9138e19


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.