diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-02 09:04:29 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-02 09:54:46 -0400 |
commit | cd391e206f486955e216a61bd9ebcb0e142122e9 (patch) | |
tree | ecbf2facf4199093d44bae7e16767566353758d8 /sound/pci/ctxfi/ctvmem.c | |
parent | d2b9b96c516d4d61663d92ab4ad4f15ca0134ef2 (diff) |
ALSA: ctxfi - Remove PAGE_SIZE limitation
Remove the limitation of PAGE_SIZE to be 4k by defining the own
page size and macros for 4k. 8kb page size could be natively supported,
but it's disabled right now for simplicity.
Also, clean up using upper_32_bits() macro.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ctxfi/ctvmem.c')
-rw-r--r-- | sound/pci/ctxfi/ctvmem.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c index 363b67e3a9e7..74a03623d047 100644 --- a/sound/pci/ctxfi/ctvmem.c +++ b/sound/pci/ctxfi/ctvmem.c | |||
@@ -18,12 +18,11 @@ | |||
18 | #include "ctvmem.h" | 18 | #include "ctvmem.h" |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
21 | #include <asm/page.h> /* for PAGE_SIZE macro definition */ | ||
22 | #include <linux/io.h> | 21 | #include <linux/io.h> |
23 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
24 | 23 | ||
25 | #define CT_PTES_PER_PAGE (PAGE_SIZE / sizeof(void *)) | 24 | #define CT_PTES_PER_PAGE (CT_PAGE_SIZE / sizeof(void *)) |
26 | #define CT_ADDRS_PER_PAGE (CT_PTES_PER_PAGE * PAGE_SIZE) | 25 | #define CT_ADDRS_PER_PAGE (CT_PTES_PER_PAGE * CT_PAGE_SIZE) |
27 | 26 | ||
28 | /* * | 27 | /* * |
29 | * Find or create vm block based on requested @size. | 28 | * Find or create vm block based on requested @size. |
@@ -138,24 +137,24 @@ ct_vm_map(struct ct_vm *vm, void *host_addr, int size) | |||
138 | return NULL; | 137 | return NULL; |
139 | } | 138 | } |
140 | 139 | ||
141 | start_phys = (virt_to_phys(host_addr) & PAGE_MASK); | 140 | start_phys = (virt_to_phys(host_addr) & CT_PAGE_MASK); |
142 | pages = (PAGE_ALIGN(virt_to_phys(host_addr) + size) | 141 | pages = (CT_PAGE_ALIGN(virt_to_phys(host_addr) + size) |
143 | - start_phys) >> PAGE_SHIFT; | 142 | - start_phys) >> CT_PAGE_SHIFT; |
144 | 143 | ||
145 | ptp = vm->ptp[0]; | 144 | ptp = vm->ptp[0]; |
146 | 145 | ||
147 | block = get_vm_block(vm, (pages << PAGE_SHIFT)); | 146 | block = get_vm_block(vm, (pages << CT_PAGE_SHIFT)); |
148 | if (block == NULL) { | 147 | if (block == NULL) { |
149 | printk(KERN_ERR "ctxfi: No virtual memory block that is big " | 148 | printk(KERN_ERR "ctxfi: No virtual memory block that is big " |
150 | "enough to allocate!\n"); | 149 | "enough to allocate!\n"); |
151 | return NULL; | 150 | return NULL; |
152 | } | 151 | } |
153 | 152 | ||
154 | pte_start = (block->addr >> PAGE_SHIFT); | 153 | pte_start = (block->addr >> CT_PAGE_SHIFT); |
155 | for (i = 0; i < pages; i++) | 154 | for (i = 0; i < pages; i++) |
156 | ptp[pte_start+i] = start_phys + (i << PAGE_SHIFT); | 155 | ptp[pte_start+i] = start_phys + (i << CT_PAGE_SHIFT); |
157 | 156 | ||
158 | block->addr += (virt_to_phys(host_addr) & (~PAGE_MASK)); | 157 | block->addr += (virt_to_phys(host_addr) & (~CT_PAGE_MASK)); |
159 | block->size = size; | 158 | block->size = size; |
160 | 159 | ||
161 | return block; | 160 | return block; |
@@ -164,9 +163,9 @@ ct_vm_map(struct ct_vm *vm, void *host_addr, int size) | |||
164 | static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) | 163 | static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) |
165 | { | 164 | { |
166 | /* do unmapping */ | 165 | /* do unmapping */ |
167 | block->size = ((block->addr + block->size + PAGE_SIZE - 1) | 166 | block->size = ((block->addr + block->size + CT_PAGE_SIZE - 1) |
168 | & PAGE_MASK) - (block->addr & PAGE_MASK); | 167 | & CT_PAGE_MASK) - (block->addr & CT_PAGE_MASK); |
169 | block->addr &= PAGE_MASK; | 168 | block->addr &= CT_PAGE_MASK; |
170 | put_vm_block(vm, block); | 169 | put_vm_block(vm, block); |
171 | } | 170 | } |
172 | 171 | ||