Lines Matching refs:win
73 struct msc_window *win; member
153 struct msc_window *win; in msc_oldest_window() local
166 list_for_each_entry(win, &msc->win_list, entry) { in msc_oldest_window()
167 if (win->block[0].addr == win_addr) in msc_oldest_window()
171 if (msc_block_is_empty(win->block[0].bdesc)) in msc_oldest_window()
175 return win; in msc_oldest_window()
187 static unsigned int msc_win_oldest_block(struct msc_window *win) in msc_win_oldest_block() argument
190 struct msc_block_desc *bdesc = win->block[0].bdesc; in msc_win_oldest_block()
200 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_win_oldest_block()
201 bdesc = win->block[blk].bdesc; in msc_win_oldest_block()
215 static inline bool msc_is_last_win(struct msc_window *win) in msc_is_last_win() argument
217 return win->entry.next == &win->msc->win_list; in msc_is_last_win()
226 static struct msc_window *msc_next_window(struct msc_window *win) in msc_next_window() argument
228 if (msc_is_last_win(win)) in msc_next_window()
229 return list_entry(win->msc->win_list.next, struct msc_window, in msc_next_window()
232 return list_entry(win->entry.next, struct msc_window, entry); in msc_next_window()
237 return iter->win->block[iter->block].bdesc; in msc_iter_bdesc()
293 iter->start_block = msc_win_oldest_block(iter->win); in msc_iter_block_start()
316 iter->win = iter->start_win; in msc_iter_win_start()
326 iter->win = msc_next_window(iter->win); in msc_iter_win_advance()
329 if (iter->win == iter->start_win) { in msc_iter_win_advance()
357 if (++iter->block == iter->win->nr_blocks) in msc_iter_block_advance()
462 struct msc_window *win; in msc_buffer_clear_hw_header() local
464 list_for_each_entry(win, &msc->win_list, entry) { in msc_buffer_clear_hw_header()
469 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_buffer_clear_hw_header()
470 struct msc_block_desc *bdesc = win->block[blk].bdesc; in msc_buffer_clear_hw_header()
684 struct msc_window *win; in msc_buffer_win_alloc() local
691 win = kzalloc(offsetof(struct msc_window, block[nr_blocks]), in msc_buffer_win_alloc()
693 if (!win) in msc_buffer_win_alloc()
700 win->pgoff = prev->pgoff + prev->nr_blocks; in msc_buffer_win_alloc()
704 win->block[i].bdesc = in msc_buffer_win_alloc()
706 &win->block[i].addr, GFP_KERNEL); in msc_buffer_win_alloc()
708 if (!win->block[i].bdesc) in msc_buffer_win_alloc()
713 set_memory_uc((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_alloc()
717 win->msc = msc; in msc_buffer_win_alloc()
718 win->nr_blocks = nr_blocks; in msc_buffer_win_alloc()
721 msc->base = win->block[0].bdesc; in msc_buffer_win_alloc()
722 msc->base_addr = win->block[0].addr; in msc_buffer_win_alloc()
725 list_add_tail(&win->entry, &msc->win_list); in msc_buffer_win_alloc()
734 set_memory_wb((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_alloc()
737 win->block[i].bdesc, win->block[i].addr); in msc_buffer_win_alloc()
739 kfree(win); in msc_buffer_win_alloc()
752 static void msc_buffer_win_free(struct msc *msc, struct msc_window *win) in msc_buffer_win_free() argument
756 msc->nr_pages -= win->nr_blocks; in msc_buffer_win_free()
758 list_del(&win->entry); in msc_buffer_win_free()
764 for (i = 0; i < win->nr_blocks; i++) { in msc_buffer_win_free()
765 struct page *page = virt_to_page(win->block[i].bdesc); in msc_buffer_win_free()
770 set_memory_wb((unsigned long)win->block[i].bdesc, 1); in msc_buffer_win_free()
772 dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE, in msc_buffer_win_free()
773 win->block[i].bdesc, win->block[i].addr); in msc_buffer_win_free()
776 kfree(win); in msc_buffer_win_free()
788 struct msc_window *win, *next_win; in msc_buffer_relink() local
791 list_for_each_entry(win, &msc->win_list, entry) { in msc_buffer_relink()
799 if (msc_is_last_win(win)) { in msc_buffer_relink()
804 next_win = list_entry(win->entry.next, in msc_buffer_relink()
808 for (blk = 0; blk < win->nr_blocks; blk++) { in msc_buffer_relink()
809 struct msc_block_desc *bdesc = win->block[blk].bdesc; in msc_buffer_relink()
819 if (blk == win->nr_blocks - 1) { in msc_buffer_relink()
822 win->block[0].addr >> PAGE_SHIFT; in msc_buffer_relink()
825 win->block[blk + 1].addr >> PAGE_SHIFT; in msc_buffer_relink()
842 struct msc_window *win, *iter; in msc_buffer_multi_free() local
844 list_for_each_entry_safe(win, iter, &msc->win_list, entry) in msc_buffer_multi_free()
845 msc_buffer_win_free(msc, win); in msc_buffer_multi_free()
987 struct msc_window *win; in msc_buffer_get_page() local
992 list_for_each_entry(win, &msc->win_list, entry) in msc_buffer_get_page()
993 if (pgoff >= win->pgoff && pgoff < win->pgoff + win->nr_blocks) in msc_buffer_get_page()
999 pgoff -= win->pgoff; in msc_buffer_get_page()
1000 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
1414 rewin = krealloc(win, sizeof(*win) * nr_wins, GFP_KERNEL); in nr_pages_store()
1416 kfree(win); in nr_pages_store()
1420 win = rewin; in nr_pages_store()
1421 win[nr_wins - 1] = val; in nr_pages_store()
1431 ret = msc_buffer_alloc(msc, win, nr_wins); in nr_pages_store()
1435 kfree(win); in nr_pages_store()