aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ctxfi/ctvmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ctxfi/ctvmem.h')
-rw-r--r--sound/pci/ctxfi/ctvmem.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 4eb5bdd5cad4..01e4fd0386a3 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -20,24 +20,36 @@
20 20
21#define CT_PTP_NUM 1 /* num of device page table pages */ 21#define CT_PTP_NUM 1 /* num of device page table pages */
22 22
23#include <linux/spinlock.h> 23#include <linux/mutex.h>
24#include <linux/list.h> 24#include <linux/list.h>
25 25
26/* The chip can handle the page table of 4k pages
27 * (emu20k1 can handle even 8k pages, but we don't use it right now)
28 */
29#define CT_PAGE_SIZE 4096
30#define CT_PAGE_SHIFT 12
31#define CT_PAGE_MASK (~(PAGE_SIZE - 1))
32#define CT_PAGE_ALIGN(addr) ALIGN(addr, CT_PAGE_SIZE)
33
26struct ct_vm_block { 34struct ct_vm_block {
27 unsigned int addr; /* starting logical addr of this block */ 35 unsigned int addr; /* starting logical addr of this block */
28 unsigned int size; /* size of this device virtual mem block */ 36 unsigned int size; /* size of this device virtual mem block */
29 struct list_head list; 37 struct list_head list;
30}; 38};
31 39
40struct snd_pcm_substream;
41
32/* Virtual memory management object for card device */ 42/* Virtual memory management object for card device */
33struct ct_vm { 43struct ct_vm {
34 void *ptp[CT_PTP_NUM]; /* Device page table pages */ 44 void *ptp[CT_PTP_NUM]; /* Device page table pages */
35 unsigned int size; /* Available addr space in bytes */ 45 unsigned int size; /* Available addr space in bytes */
36 struct list_head unused; /* List of unused blocks */ 46 struct list_head unused; /* List of unused blocks */
37 struct list_head used; /* List of used blocks */ 47 struct list_head used; /* List of used blocks */
48 struct mutex lock;
38 49
39 /* Map host addr (kmalloced/vmalloced) to device logical addr. */ 50 /* Map host addr (kmalloced/vmalloced) to device logical addr. */
40 struct ct_vm_block *(*map)(struct ct_vm *, void *host_addr, int size); 51 struct ct_vm_block *(*map)(struct ct_vm *, struct snd_pcm_substream *,
52 int size);
41 /* Unmap device logical addr area. */ 53 /* Unmap device logical addr area. */
42 void (*unmap)(struct ct_vm *, struct ct_vm_block *block); 54 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
43 void *(*get_ptp_virt)(struct ct_vm *vm, int index); 55 void *(*get_ptp_virt)(struct ct_vm *vm, int index);