cache.h 2.8 KB

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