aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-02 09:04:29 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-02 09:54:46 -0400
commitcd391e206f486955e216a61bd9ebcb0e142122e9 (patch)
treeecbf2facf4199093d44bae7e16767566353758d8 /sound
parentd2b9b96c516d4d61663d92ab4ad4f15ca0134ef2 (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')
-rw-r--r--sound/pci/Kconfig1
-rw-r--r--sound/pci/ctxfi/cthw20k1.c16
-rw-r--r--sound/pci/ctxfi/cthw20k2.c17
-rw-r--r--sound/pci/ctxfi/ctvmem.c25
-rw-r--r--sound/pci/ctxfi/ctvmem.h8
5 files changed, 30 insertions, 37 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 2d7fef5df017..3a7640feaf92 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -277,7 +277,6 @@ config SND_CS5535AUDIO
277 277
278config SND_CTXFI 278config SND_CTXFI
279 tristate "Creative Sound Blaster X-Fi" 279 tristate "Creative Sound Blaster X-Fi"
280 depends on X86
281 select SND_PCM 280 select SND_PCM
282 help 281 help
283 If you want to use soundcards based on Creative Sound Blastr X-Fi 282 If you want to use soundcards based on Creative Sound Blastr X-Fi
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index 44283bd7b2df..b7b8e6f41d0d 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -1249,19 +1249,15 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
1249 } 1249 }
1250 1250
1251 trnctl = 0x13; /* 32-bit, 4k-size page */ 1251 trnctl = 0x13; /* 32-bit, 4k-size page */
1252#if BITS_PER_LONG == 64 1252 ptp_phys_low = (u32)info->vm_pgt_phys;
1253 ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1); 1253 ptp_phys_high = upper_32_bits(info->vm_pgt_phys);
1254 ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1); 1254 if (sizeof(void *) == 8) /* 64bit address */
1255 trnctl |= (1<<2); 1255 trnctl |= (1 << 2);
1256#elif BITS_PER_LONG == 32 1256#if 0 /* Only 4k h/w pages for simplicitiy */
1257 ptp_phys_low = info->vm_pgt_phys & (~0UL);
1258 ptp_phys_high = 0;
1259#else
1260# error "Unknown BITS_PER_LONG!"
1261#endif
1262#if PAGE_SIZE == 8192 1257#if PAGE_SIZE == 8192
1263 trnctl |= (1<<5); 1258 trnctl |= (1<<5);
1264#endif 1259#endif
1260#endif
1265 hw_write_20kx(hw, PTPALX, ptp_phys_low); 1261 hw_write_20kx(hw, PTPALX, ptp_phys_low);
1266 hw_write_20kx(hw, PTPAHX, ptp_phys_high); 1262 hw_write_20kx(hw, PTPAHX, ptp_phys_high);
1267 hw_write_20kx(hw, TRNCTL, trnctl); 1263 hw_write_20kx(hw, TRNCTL, trnctl);
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index 7c24c2ca96bd..349728765f2c 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -1203,19 +1203,10 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
1203 } 1203 }
1204 1204
1205 vmctl = 0x80000C0F; /* 32-bit, 4k-size page */ 1205 vmctl = 0x80000C0F; /* 32-bit, 4k-size page */
1206#if BITS_PER_LONG == 64 1206 ptp_phys_low = (u32)info->vm_pgt_phys;
1207 ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1); 1207 ptp_phys_high = upper_32_bits(info->vm_pgt_phys);
1208 ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1); 1208 if (sizeof(void *) == 8) /* 64bit address */
1209 vmctl |= (3<<8); 1209 vmctl |= (3 << 8);
1210#elif BITS_PER_LONG == 32
1211 ptp_phys_low = info->vm_pgt_phys & (~0UL);
1212 ptp_phys_high = 0;
1213#else
1214# error "Unknown BITS_PER_LONG!"
1215#endif
1216#if PAGE_SIZE == 8192
1217# error "Don't support 8k-page!"
1218#endif
1219 /* Write page table physical address to all PTPAL registers */ 1210 /* Write page table physical address to all PTPAL registers */
1220 for (i = 0; i < 64; i++) { 1211 for (i = 0; i < 64; i++) {
1221 hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low); 1212 hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low);
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)
164static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) 163static 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
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 618952efa5b3..17d2d37a9ea7 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -23,6 +23,14 @@
23#include <linux/mutex.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 */