2 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
4 * This source file is released under GPL v2 license (no other versions).
5 * See the COPYING file included in the main directory of this source
6 * distribution for the license terms and conditions.
11 * This file contains the definition of virtual memory management object
21 #define CT_PTP_NUM 1 /* num of device page table pages */
23 #include <linux/mutex.h>
24 #include <linux/list.h>
27 unsigned int addr; /* starting logical addr of this block */
28 unsigned int size; /* size of this device virtual mem block */
29 struct list_head list;
32 /* Virtual memory management object for card device */
34 void *ptp[CT_PTP_NUM]; /* Device page table pages */
35 unsigned int size; /* Available addr space in bytes */
36 struct list_head unused; /* List of unused blocks */
37 struct list_head used; /* List of used blocks */
40 /* Map host addr (kmalloced/vmalloced) to device logical addr. */
41 struct ct_vm_block *(*map)(struct ct_vm *, void *host_addr, int size);
42 /* Unmap device logical addr area. */
43 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
44 void *(*get_ptp_virt)(struct ct_vm *vm, int index);
47 int ct_vm_create(struct ct_vm **rvm);
48 void ct_vm_destroy(struct ct_vm *vm);