cache.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * include/asm-parisc/cache.h
  3. */
  4. #ifndef __ARCH_PARISC_CACHE_H
  5. #define __ARCH_PARISC_CACHE_H
  6. /*
  7. * PA 2.0 processors have 64-byte cachelines; PA 1.1 processors have
  8. * 32-byte cachelines. The default configuration is not for SMP anyway,
  9. * so if you're building for SMP, you should select the appropriate
  10. * processor type. There is a potential livelock danger when running
  11. * a machine with this value set too small, but it's more probable you'll
  12. * just ruin performance.
  13. */
  14. #ifdef CONFIG_PA20
  15. #define L1_CACHE_BYTES 64
  16. #define L1_CACHE_SHIFT 6
  17. #else
  18. #define L1_CACHE_BYTES 32
  19. #define L1_CACHE_SHIFT 5
  20. #endif
  21. #ifndef __ASSEMBLY__
  22. #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
  23. #define SMP_CACHE_BYTES L1_CACHE_BYTES
  24. #define __read_mostly __attribute__((__section__(".data.read_mostly")))
  25. extern void flush_data_cache_local(void *); /* flushes local data-cache only */
  26. extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */
  27. #ifdef CONFIG_SMP
  28. extern void flush_data_cache(void); /* flushes data-cache only (all processors) */
  29. extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
  30. #else
  31. #define flush_data_cache() flush_data_cache_local(NULL)
  32. #define flush_instruction_cache() flush_instruction_cache_local(NULL)
  33. #endif
  34. extern void parisc_cache_init(void); /* initializes cache-flushing */
  35. extern void flush_all_caches(void); /* flush everything (tlb & cache) */
  36. extern int get_cache_info(char *);
  37. extern void flush_user_icache_range_asm(unsigned long, unsigned long);
  38. extern void flush_kernel_icache_range_asm(unsigned long, unsigned long);
  39. extern void flush_user_dcache_range_asm(unsigned long, unsigned long);
  40. extern void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
  41. extern void flush_kernel_dcache_page_asm(void *);
  42. extern void flush_kernel_icache_page(void *);
  43. extern void disable_sr_hashing(void); /* turns off space register hashing */
  44. extern void disable_sr_hashing_asm(int); /* low level support for above */
  45. extern void free_sid(unsigned long);
  46. unsigned long alloc_sid(void);
  47. extern void flush_user_dcache_page(unsigned long);
  48. extern void flush_user_icache_page(unsigned long);
  49. struct seq_file;
  50. extern void show_cache_info(struct seq_file *m);
  51. extern int split_tlb;
  52. extern int dcache_stride;
  53. extern int icache_stride;
  54. extern struct pdc_cache_info cache_info;
  55. #define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr));
  56. #define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr));
  57. #define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" : : "r" (addr));
  58. #endif /* ! __ASSEMBLY__ */
  59. /* Classes of processor wrt: disabling space register hashing */
  60. #define SRHASH_PCXST 0 /* pcxs, pcxt, pcxt_ */
  61. #define SRHASH_PCXL 1 /* pcxl */
  62. #define SRHASH_PA20 2 /* pcxu, pcxu_, pcxw, pcxw_ */
  63. #endif