Path: blob/master/arch/frv/include/asm/cacheflush.h
15118 views
/* cacheflush.h: FRV cache flushing routines1*2* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#ifndef _ASM_CACHEFLUSH_H12#define _ASM_CACHEFLUSH_H1314/* Keep includes the same across arches. */15#include <linux/mm.h>1617/*18* virtually-indexed cache management (our cache is physically indexed)19*/20#define flush_cache_all() do {} while(0)21#define flush_cache_mm(mm) do {} while(0)22#define flush_cache_dup_mm(mm) do {} while(0)23#define flush_cache_range(mm, start, end) do {} while(0)24#define flush_cache_page(vma, vmaddr, pfn) do {} while(0)25#define flush_cache_vmap(start, end) do {} while(0)26#define flush_cache_vunmap(start, end) do {} while(0)27#define flush_dcache_mmap_lock(mapping) do {} while(0)28#define flush_dcache_mmap_unlock(mapping) do {} while(0)2930/*31* physically-indexed cache management32* - see arch/frv/lib/cache.S33*/34extern void frv_dcache_writeback(unsigned long start, unsigned long size);35extern void frv_cache_invalidate(unsigned long start, unsigned long size);36extern void frv_icache_invalidate(unsigned long start, unsigned long size);37extern void frv_cache_wback_inv(unsigned long start, unsigned long size);3839static inline void __flush_cache_all(void)40{41asm volatile(" dcef @(gr0,gr0),#1 \n"42" icei @(gr0,gr0),#1 \n"43" membar \n"44: : : "memory"45);46}4748/* dcache/icache coherency... */49#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 150#ifdef CONFIG_MMU51extern void flush_dcache_page(struct page *page);52#else53static inline void flush_dcache_page(struct page *page)54{55unsigned long addr = page_to_phys(page);56frv_dcache_writeback(addr, addr + PAGE_SIZE);57}58#endif5960static inline void flush_page_to_ram(struct page *page)61{62flush_dcache_page(page);63}6465static inline void flush_icache(void)66{67__flush_cache_all();68}6970static inline void flush_icache_range(unsigned long start, unsigned long end)71{72frv_cache_wback_inv(start, end);73}7475#ifdef CONFIG_MMU76extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,77unsigned long start, unsigned long len);78#else79static inline void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,80unsigned long start, unsigned long len)81{82frv_cache_wback_inv(start, start + len);83}84#endif8586static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page)87{88flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);89}9091/*92* permit ptrace to access another process's address space through the icache93* and the dcache94*/95#define copy_to_user_page(vma, page, vaddr, dst, src, len) \96do { \97memcpy((dst), (src), (len)); \98flush_icache_user_range((vma), (page), (vaddr), (len)); \99} while(0)100101#define copy_from_user_page(vma, page, vaddr, dst, src, len) \102memcpy((dst), (src), (len))103104#endif /* _ASM_CACHEFLUSH_H */105106107