Home | History | Annotate | Download | only in asm
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ***   To edit the content of this header, modify the corresponding
     11  ***   source file (e.g. under external/kernel-headers/original/) then
     12  ***   run bionic/libc/kernel/tools/update_all.py
     13  ***
     14  ***   Any manual change here will be lost the next time this script will
     15  ***   be run. You've been warned!
     16  ***
     17  ****************************************************************************
     18  ****************************************************************************/
     19 #ifndef _ASMARM_CACHEFLUSH_H
     20 #define _ASMARM_CACHEFLUSH_H
     21 #include <linux/sched.h>
     22 #include <linux/mm.h>
     23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     24 #include <asm/glue.h>
     25 #include <asm/shmparam.h>
     26 #define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
     27 #undef _CACHE
     28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     29 #undef MULTI_CACHE
     30 #if !defined(_CACHE) && !defined(MULTI_CACHE)
     31 #error Unknown cache maintainence model
     32 #endif
     33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     34 #define PG_dcache_dirty PG_arch_1
     35 struct cpu_cache_fns {
     36  void (*flush_kern_all)(void);
     37  void (*flush_user_all)(void);
     38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     39  void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
     40  void (*coherent_kern_range)(unsigned long, unsigned long);
     41  void (*coherent_user_range)(unsigned long, unsigned long);
     42  void (*flush_kern_dcache_page)(void *);
     43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     44  void (*dma_inv_range)(unsigned long, unsigned long);
     45  void (*dma_clean_range)(unsigned long, unsigned long);
     46  void (*dma_flush_range)(unsigned long, unsigned long);
     47 };
     48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     49 #ifdef MULTI_CACHE
     50 #define __cpuc_flush_kern_all cpu_cache.flush_kern_all
     51 #define __cpuc_flush_user_all cpu_cache.flush_user_all
     52 #define __cpuc_flush_user_range cpu_cache.flush_user_range
     53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     54 #define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
     55 #define __cpuc_coherent_user_range cpu_cache.coherent_user_range
     56 #define __cpuc_flush_dcache_page cpu_cache.flush_kern_dcache_page
     57 #define dmac_inv_range cpu_cache.dma_inv_range
     58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     59 #define dmac_clean_range cpu_cache.dma_clean_range
     60 #define dmac_flush_range cpu_cache.dma_flush_range
     61 #else
     62 #define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
     63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     64 #define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
     65 #define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
     66 #define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
     67 #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
     68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     69 #define __cpuc_flush_dcache_page __glue(_CACHE,_flush_kern_dcache_page)
     70 #define dmac_inv_range __glue(_CACHE,_dma_inv_range)
     71 #define dmac_clean_range __glue(_CACHE,_dma_clean_range)
     72 #define dmac_flush_range __glue(_CACHE,_dma_flush_range)
     73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     74 #endif
     75 #define flush_cache_vmap(start, end) flush_cache_all()
     76 #define flush_cache_vunmap(start, end) flush_cache_all()
     77 #define copy_to_user_page(vma, page, vaddr, dst, src, len)   do {   memcpy(dst, src, len);   flush_ptrace_access(vma, page, vaddr, dst, len, 1);  } while (0)
     78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     79 #define copy_from_user_page(vma, page, vaddr, dst, src, len)   do {   memcpy(dst, src, len);   } while (0)
     80 #define flush_cache_all() __cpuc_flush_kern_all()
     81 #define flush_cache_user_range(vma,start,end)   __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
     82 #define flush_icache_range(s,e) __cpuc_coherent_kern_range(s,e)
     83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     84 #define clean_dcache_area(start,size) cpu_dcache_clean_area(start, size)
     85 #define flush_dcache_mmap_lock(mapping)   write_lock_irq(&(mapping)->tree_lock)
     86 #define flush_dcache_mmap_unlock(mapping)   write_unlock_irq(&(mapping)->tree_lock)
     87 #define flush_icache_user_range(vma,page,addr,len)   flush_dcache_page(page)
     88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     89 #define flush_icache_page(vma,page) do { } while (0)
     90 #define __cacheid_present(val) (val != read_cpuid(CPUID_ID))
     91 #define __cacheid_vivt(val) ((val & (15 << 25)) != (14 << 25))
     92 #define __cacheid_vipt(val) ((val & (15 << 25)) == (14 << 25))
     93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     94 #define __cacheid_vipt_nonaliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25))
     95 #define __cacheid_vipt_aliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25 | 1 << 23))
     96 #define cache_is_vivt()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   (!__cacheid_present(__val)) || __cacheid_vivt(__val);   })
     97 #define cache_is_vipt()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) && __cacheid_vipt(__val);   })
     98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     99 #define cache_is_vipt_nonaliasing()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) &&   __cacheid_vipt_nonaliasing(__val);   })
    100 #define cache_is_vipt_aliasing()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) &&   __cacheid_vipt_aliasing(__val);   })
    101 #endif
    102