Lines Matching full:page

7  *  Trident 4DWave-NX memory page allocation (TLB area)
19 /* page arguments of these two macros are Trident page (4096 bytes), not like
22 #define __set_tlb_bus(trident,page,addr) \ argument
23 (trident)->tlb.entries[page] = cpu_to_le32((addr) & ~(SNDRV_TRIDENT_PAGE_SIZE-1))
24 #define __tlb_to_addr(trident,page) \ argument
25 (dma_addr_t)le32_to_cpu((trident->tlb.entries[page]) & ~(SNDRV_TRIDENT_PAGE_SIZE - 1))
28 /* page size == SNDRV_TRIDENT_PAGE_SIZE */
29 #define ALIGN_PAGE_SIZE PAGE_SIZE /* minimum page size for allocation */
31 /* fill TLB entrie(s) corresponding to page with ptr */
32 #define set_tlb_bus(trident,page,addr) __set_tlb_bus(trident,page,addr) argument
33 /* fill TLB entrie(s) corresponding to page with silence pointer */
34 #define set_silent_tlb(trident,page) __set_tlb_bus(trident, page, trident->tlb.silent_page->addr) argument
35 /* get aligned page from offset address */
37 /* get offset address from aligned page */
38 #define aligned_page_offset(page) ((page) << 12) argument
39 /* get PCI physical address from aligned page */
40 #define page_to_addr(trident,page) __tlb_to_addr(trident, page) argument
43 /* page size == SNDRV_TRIDENT_PAGE_SIZE x 2*/
47 #define aligned_page_offset(page) ((page) << 13) argument
48 #define page_to_addr(trident,page) __tlb_to_addr(trident, (page) << 1) argument
51 static inline void set_tlb_bus(struct snd_trident *trident, int page, in set_tlb_bus() argument
54 page <<= 1; in set_tlb_bus()
55 __set_tlb_bus(trident, page, addr); in set_tlb_bus()
56 __set_tlb_bus(trident, page+1, addr + SNDRV_TRIDENT_PAGE_SIZE); in set_tlb_bus()
58 static inline void set_silent_tlb(struct snd_trident *trident, int page) in set_silent_tlb() argument
60 page <<= 1; in set_silent_tlb()
61 __set_tlb_bus(trident, page, trident->tlb.silent_page->addr); in set_silent_tlb()
62 __set_tlb_bus(trident, page+1, trident->tlb.silent_page->addr); in set_silent_tlb()
72 * of accessing page in set_tlb_bus and set_silent_tlb. search_empty()
76 #define aligned_page_offset(page) ((page) * ALIGN_PAGE_SIZE) argument
77 #define page_to_addr(trident,page) __tlb_to_addr(trident, (page) * UNIT_PAGES) argument
80 static inline void set_tlb_bus(struct snd_trident *trident, int page, in set_tlb_bus() argument
84 page *= UNIT_PAGES; in set_tlb_bus()
85 for (i = 0; i < UNIT_PAGES; i++, page++) { in set_tlb_bus()
86 __set_tlb_bus(trident, page, addr); in set_tlb_bus()
90 static inline void set_silent_tlb(struct snd_trident *trident, int page) in set_silent_tlb() argument
93 page *= UNIT_PAGES; in set_silent_tlb()
94 for (i = 0; i < UNIT_PAGES; i++, page++) in set_silent_tlb()
95 __set_tlb_bus(trident, page, trident->tlb.silent_page->addr); in set_silent_tlb()
111 int page, psize; in search_empty() local
115 page = 0; in search_empty()
118 if (page + psize <= firstpg(blk)) in search_empty()
120 page = lastpg(blk) + 1; in search_empty()
122 if (page + psize > MAX_ALIGN_PAGES) in search_empty()
130 blk->offset = aligned_page_offset(page); /* set aligned offset */ in search_empty()
131 firstpg(blk) = page; in search_empty()
132 lastpg(blk) = page + psize - 1; in search_empty()
147 dev_err(trident->card->dev, "page is not aligned\n"); in is_valid_page()
154 * page allocation for DMA (Scatter-Gather version)
163 int idx, page; in snd_trident_alloc_sg_pages() local
184 for (page = firstpg(blk); page <= lastpg(blk); page++, idx++) { in snd_trident_alloc_sg_pages()
192 set_tlb_bus(trident, page, addr); in snd_trident_alloc_sg_pages()
199 * page allocation for DMA (contiguous version)
207 int page; in snd_trident_alloc_cont_pages() local
228 for (page = firstpg(blk); page <= lastpg(blk); page++, in snd_trident_alloc_cont_pages()
235 set_tlb_bus(trident, page, addr); in snd_trident_alloc_cont_pages()
242 * page allocation for DMA
258 * release DMA buffer from page table
264 int page; in snd_trident_free_pages() local
272 for (page = firstpg(blk); page <= lastpg(blk); page++) in snd_trident_free_pages()
273 set_silent_tlb(trident, page); in snd_trident_free_pages()