Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ttm_object.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
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
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24  * USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 /*
28  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29  */
37 #ifndef _TTM_OBJECT_H_
38 #define _TTM_OBJECT_H_
39 
40 #include <linux/list.h>
41 #include <drm/drm_hashtab.h>
42 #include <linux/kref.h>
43 #include <ttm/ttm_memory.h>
44 
65 };
66 
85 };
86 
87 struct ttm_object_file;
88 struct ttm_object_device;
89 
125  bool shareable;
127  struct kref refcount;
130  enum ttm_ref_type ref_type);
131 };
132 
147 extern int ttm_base_object_init(struct ttm_object_file *tfile,
148  struct ttm_base_object *base,
149  bool shareable,
150  enum ttm_object_type type,
151  void (*refcount_release) (struct ttm_base_object
152  **),
153  void (*ref_obj_release) (struct ttm_base_object
154  *,
155  enum ttm_ref_type
156  ref_type));
157 
170  *tfile, uint32_t key);
171 
181 extern void ttm_base_object_unref(struct ttm_base_object **p_base);
182 
202 extern int ttm_ref_object_add(struct ttm_object_file *tfile,
203  struct ttm_base_object *base,
204  enum ttm_ref_type ref_type, bool *existed);
216 extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
217  unsigned long key,
218  enum ttm_ref_type ref_type);
219 
230  *tdev,
231  unsigned int hash_order);
232 
244 extern void ttm_object_file_release(struct ttm_object_file **p_tfile);
245 
256  (struct ttm_mem_global *mem_glob, unsigned int hash_order);
257 
269 extern void ttm_object_device_release(struct ttm_object_device **p_tdev);
270 
271 #endif