162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (C) 2003 Microtronix Datacom Ltd. 362306a36Sopenharmony_ci * Copyright (C) 2000-2002 Greg Ungerer <gerg@snapgear.com> 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 662306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 762306a36Sopenharmony_ci * for more details. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef _ASM_NIOS2_CACHEFLUSH_H 1162306a36Sopenharmony_ci#define _ASM_NIOS2_CACHEFLUSH_H 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <linux/mm_types.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * This flag is used to indicate that the page pointed to by a pte is clean 1762306a36Sopenharmony_ci * and does not require cleaning before returning it to the user. 1862306a36Sopenharmony_ci */ 1962306a36Sopenharmony_ci#define PG_dcache_clean PG_arch_1 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_cistruct mm_struct; 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciextern void flush_cache_all(void); 2462306a36Sopenharmony_ciextern void flush_cache_mm(struct mm_struct *mm); 2562306a36Sopenharmony_ciextern void flush_cache_dup_mm(struct mm_struct *mm); 2662306a36Sopenharmony_ciextern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 2762306a36Sopenharmony_ci unsigned long end); 2862306a36Sopenharmony_ciextern void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, 2962306a36Sopenharmony_ci unsigned long pfn); 3062306a36Sopenharmony_ci#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 3162306a36Sopenharmony_civoid flush_dcache_page(struct page *page); 3262306a36Sopenharmony_civoid flush_dcache_folio(struct folio *folio); 3362306a36Sopenharmony_ci#define flush_dcache_folio flush_dcache_folio 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciextern void flush_icache_range(unsigned long start, unsigned long end); 3662306a36Sopenharmony_civoid flush_icache_pages(struct vm_area_struct *vma, struct page *page, 3762306a36Sopenharmony_ci unsigned int nr); 3862306a36Sopenharmony_ci#define flush_icache_pages flush_icache_pages 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define flush_cache_vmap(start, end) flush_dcache_range(start, end) 4162306a36Sopenharmony_ci#define flush_cache_vmap_early(start, end) do { } while (0) 4262306a36Sopenharmony_ci#define flush_cache_vunmap(start, end) flush_dcache_range(start, end) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciextern void copy_to_user_page(struct vm_area_struct *vma, struct page *page, 4562306a36Sopenharmony_ci unsigned long user_vaddr, 4662306a36Sopenharmony_ci void *dst, void *src, int len); 4762306a36Sopenharmony_ciextern void copy_from_user_page(struct vm_area_struct *vma, struct page *page, 4862306a36Sopenharmony_ci unsigned long user_vaddr, 4962306a36Sopenharmony_ci void *dst, void *src, int len); 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciextern void flush_dcache_range(unsigned long start, unsigned long end); 5262306a36Sopenharmony_ciextern void invalidate_dcache_range(unsigned long start, unsigned long end); 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define flush_dcache_mmap_lock(mapping) xa_lock_irq(&mapping->i_pages) 5562306a36Sopenharmony_ci#define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&mapping->i_pages) 5662306a36Sopenharmony_ci#define flush_dcache_mmap_lock_irqsave(mapping, flags) \ 5762306a36Sopenharmony_ci xa_lock_irqsave(&mapping->i_pages, flags) 5862306a36Sopenharmony_ci#define flush_dcache_mmap_unlock_irqrestore(mapping, flags) \ 5962306a36Sopenharmony_ci xa_unlock_irqrestore(&mapping->i_pages, flags) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#endif /* _ASM_NIOS2_CACHEFLUSH_H */ 62