cache.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _ASM_POWERPC_CACHE_H
  2. #define _ASM_POWERPC_CACHE_H
  3. #ifdef __KERNEL__
  4. /* bytes per L1 cache line */
  5. #if defined(CONFIG_8xx) || defined(CONFIG_403GCX)
  6. #define L1_CACHE_SHIFT 4
  7. #define MAX_COPY_PREFETCH 1
  8. #elif defined(CONFIG_PPC_E500MC)
  9. #define L1_CACHE_SHIFT 6
  10. #define MAX_COPY_PREFETCH 4
  11. #elif defined(CONFIG_PPC32)
  12. #define MAX_COPY_PREFETCH 4
  13. #if defined(CONFIG_PPC_47x)
  14. #define L1_CACHE_SHIFT 7
  15. #else
  16. #define L1_CACHE_SHIFT 5
  17. #endif
  18. #else /* CONFIG_PPC64 */
  19. #define L1_CACHE_SHIFT 7
  20. #endif
  21. #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
  22. #define SMP_CACHE_BYTES L1_CACHE_BYTES
  23. #if defined(__powerpc64__) && !defined(__ASSEMBLY__)
  24. struct ppc64_caches {
  25. u32 dsize; /* L1 d-cache size */
  26. u32 dline_size; /* L1 d-cache line size */
  27. u32 log_dline_size;
  28. u32 dlines_per_page;
  29. u32 isize; /* L1 i-cache size */
  30. u32 iline_size; /* L1 i-cache line size */
  31. u32 log_iline_size;
  32. u32 ilines_per_page;
  33. };
  34. extern struct ppc64_caches ppc64_caches;
  35. #endif /* __powerpc64__ && ! __ASSEMBLY__ */
  36. #if !defined(__ASSEMBLY__)
  37. #define __read_mostly __attribute__((__section__(".data..read_mostly")))
  38. #ifdef CONFIG_6xx
  39. extern long _get_L2CR(void);
  40. extern long _get_L3CR(void);
  41. extern void _set_L2CR(unsigned long);
  42. extern void _set_L3CR(unsigned long);
  43. #else
  44. #define _get_L2CR() 0L
  45. #define _get_L3CR() 0L
  46. #define _set_L2CR(val) do { } while(0)
  47. #define _set_L3CR(val) do { } while(0)
  48. #endif
  49. extern void cacheable_memzero(void *p, unsigned int nb);
  50. extern void *cacheable_memcpy(void *, const void *, unsigned int);
  51. #endif /* !__ASSEMBLY__ */
  52. #endif /* __KERNEL__ */
  53. #endif /* _ASM_POWERPC_CACHE_H */