Lines Matching refs:win
79 struct msc_window *win; member
160 struct msc_window *win; in msc_oldest_window() local
173 list_for_each_entry(win, &msc->win_list, entry) { in msc_oldest_window()
174 if (win->block[0].addr == win_addr) in msc_oldest_window()
178 if (msc_block_is_empty(win->block[0].bdesc)) in msc_oldest_window()
182 return win; in msc_oldest_window()
194 static unsigned int msc_win_oldest_block(struct msc_window *win) in msc_win_oldest_block() argument
197 struct msc_block_desc *bdesc = win->block[0].bdesc; in msc_win_oldest_block()
207 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_win_oldest_block()
208 bdesc = win->block[blk].bdesc; in msc_win_oldest_block()
222 static inline bool msc_is_last_win(struct msc_window *win) in msc_is_last_win() argument
224 return win->entry.next == &win->msc->win_list; in msc_is_last_win()
233 static struct msc_window *msc_next_window(struct msc_window *win) in msc_next_window() argument
235 if (msc_is_last_win(win)) in msc_next_window()
236 return list_entry(win->msc->win_list.next, struct msc_window, in msc_next_window()
239 return list_entry(win->entry.next, struct msc_window, entry); in msc_next_window()
244 return iter->win->block[iter->block].bdesc; in msc_iter_bdesc()
286 iter->start_block = msc_win_oldest_block(iter->win); in msc_iter_block_start()
309 iter->win = iter->start_win; in msc_iter_win_start()
319 iter->win = msc_next_window(iter->win); in msc_iter_win_advance()
322 if (iter->win == iter->start_win) { in msc_iter_win_advance()
350 if (++iter->block == iter->win->nr_blocks) in msc_iter_block_advance()
455 struct msc_window *win; in msc_buffer_clear_hw_header() local
458 list_for_each_entry(win, &msc->win_list, entry) { in msc_buffer_clear_hw_header()
463 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_buffer_clear_hw_header()
464 struct msc_block_desc *bdesc = win->block[blk].bdesc; in msc_buffer_clear_hw_header()
677 struct msc_window *win; in msc_buffer_win_alloc() local
684 win = kzalloc(offsetof(struct msc_window, block[nr_blocks]), in msc_buffer_win_alloc()
686 if (!win) in msc_buffer_win_alloc()
693 win->pgoff = prev->pgoff + prev->nr_blocks; in msc_buffer_win_alloc()
697 win->block[i].bdesc = dma_alloc_coherent(msc_dev(msc), size, in msc_buffer_win_alloc()
698 &win->block[i].addr, in msc_buffer_win_alloc()
703 set_memory_uc((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_alloc()
706 if (!win->block[i].bdesc) in msc_buffer_win_alloc()
710 win->msc = msc; in msc_buffer_win_alloc()
711 win->nr_blocks = nr_blocks; in msc_buffer_win_alloc()
714 msc->base = win->block[0].bdesc; in msc_buffer_win_alloc()
715 msc->base_addr = win->block[0].addr; in msc_buffer_win_alloc()
718 list_add_tail(&win->entry, &msc->win_list); in msc_buffer_win_alloc()
727 set_memory_wb((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_alloc()
729 dma_free_coherent(msc_dev(msc), size, win->block[i].bdesc, in msc_buffer_win_alloc()
730 win->block[i].addr); in msc_buffer_win_alloc()
732 kfree(win); in msc_buffer_win_alloc()
745 static void msc_buffer_win_free(struct msc *msc, struct msc_window *win) in msc_buffer_win_free() argument
749 msc->nr_pages -= win->nr_blocks; in msc_buffer_win_free()
751 list_del(&win->entry); in msc_buffer_win_free()
757 for (i = 0; i < win->nr_blocks; i++) { in msc_buffer_win_free()
758 struct page *page = virt_to_page(win->block[i].bdesc); in msc_buffer_win_free()
763 set_memory_wb((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_free()
765 dma_free_coherent(msc_dev(win->msc), PAGE_SIZE, in msc_buffer_win_free()
766 win->block[i].bdesc, win->block[i].addr); in msc_buffer_win_free()
769 kfree(win); in msc_buffer_win_free()
781 struct msc_window *win, *next_win; in msc_buffer_relink() local
784 list_for_each_entry(win, &msc->win_list, entry) { in msc_buffer_relink()
792 if (msc_is_last_win(win)) { in msc_buffer_relink()
797 next_win = list_entry(win->entry.next, in msc_buffer_relink()
801 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_buffer_relink()
802 struct msc_block_desc *bdesc = win->block[blk].bdesc; in msc_buffer_relink()
812 if (blk == win->nr_blocks - 1) { in msc_buffer_relink()
815 win->block[0].addr >> PAGE_SHIFT; in msc_buffer_relink()
818 win->block[blk + 1].addr >> PAGE_SHIFT; in msc_buffer_relink()
835 struct msc_window *win, *iter; in msc_buffer_multi_free() local
837 list_for_each_entry_safe(win, iter, &msc->win_list, entry) in msc_buffer_multi_free()
838 msc_buffer_win_free(msc, win); in msc_buffer_multi_free()
980 struct msc_window *win; in msc_buffer_get_page() local
985 list_for_each_entry(win, &msc->win_list, entry) in msc_buffer_get_page()
986 if (pgoff >= win->pgoff && pgoff < win->pgoff + win->nr_blocks) in msc_buffer_get_page()
992 pgoff -= win->pgoff; in msc_buffer_get_page()
993 return virt_to_page(win->block[pgoff].bdesc); in msc_buffer_get_page()
1349 struct msc_window *win; in nr_pages_show() local
1357 list_for_each_entry(win, &msc->win_list, entry) { in nr_pages_show()
1359 "%d%c", win->nr_blocks, in nr_pages_show()
1360 msc_is_last_win(win) ? '\n' : ','); in nr_pages_show()
1376 unsigned long val, *win = NULL, *rewin; in nr_pages_store() local
1409 rewin = krealloc(win, sizeof(*win) * nr_wins, GFP_KERNEL); in nr_pages_store()
1411 kfree(win); in nr_pages_store()
1415 win = rewin; in nr_pages_store()
1416 win[nr_wins - 1] = val; in nr_pages_store()
1426 ret = msc_buffer_alloc(msc, win, nr_wins); in nr_pages_store()
1430 kfree(win); in nr_pages_store()