cache.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * include/asm-parisc/cache.h
  4. */
  5. #ifndef __ARCH_PARISC_CACHE_H
  6. #define __ARCH_PARISC_CACHE_H
  7. #include <asm/alternative.h>
  8. /*
  9. * PA 2.0 processors have 64 and 128-byte L2 cachelines; PA 1.1 processors
  10. * have 32-byte cachelines. The L1 length appears to be 16 bytes but this
  11. * is not clearly documented.
  12. */
  13. #define L1_CACHE_BYTES 16
  14. #define L1_CACHE_SHIFT 4
  15. #ifndef __ASSEMBLER__
  16. #define SMP_CACHE_BYTES L1_CACHE_BYTES
  17. #ifdef CONFIG_PA20
  18. #define ARCH_DMA_MINALIGN 128
  19. #else
  20. #define ARCH_DMA_MINALIGN 32
  21. #endif
  22. #define ARCH_KMALLOC_MINALIGN 16 /* ldcw requires 16-byte alignment */
  23. #define arch_slab_minalign() ((unsigned)dcache_stride)
  24. #define cache_line_size() dcache_stride
  25. #define dma_get_cache_alignment cache_line_size
  26. #define __read_mostly __section(".data..read_mostly")
  27. void parisc_cache_init(void); /* initializes cache-flushing */
  28. void disable_sr_hashing_asm(int); /* low level support for above */
  29. void disable_sr_hashing(void); /* turns off space register hashing */
  30. void free_sid(unsigned long);
  31. unsigned long alloc_sid(void);
  32. struct seq_file;
  33. extern void show_cache_info(struct seq_file *m);
  34. extern int split_tlb;
  35. extern int dcache_stride;
  36. extern int icache_stride;
  37. extern struct pdc_cache_info cache_info;
  38. extern struct pdc_btlb_info btlb_info;
  39. void parisc_setup_cache_timing(void);
  40. #define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
  41. ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
  42. : : "i"(sr), "r" (addr) : "memory")
  43. #define pitlb(sr, addr) asm volatile("pitlb 0(%%sr%0,%1)" \
  44. ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
  45. ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \
  46. : : "i"(sr), "r" (addr) : "memory")
  47. #define asm_io_fdc(addr) asm volatile("fdc %%r0(%0)" \
  48. ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \
  49. ALTERNATIVE(ALT_COND_NO_IOC_FDC, INSN_NOP) \
  50. : : "r" (addr) : "memory")
  51. #define asm_io_sync() asm volatile("sync" \
  52. ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \
  53. ALTERNATIVE(ALT_COND_NO_IOC_FDC, INSN_NOP) :::"memory")
  54. #define asm_syncdma() asm volatile("syncdma" :::"memory")
  55. #endif /* ! __ASSEMBLER__ */
  56. /* Classes of processor wrt: disabling space register hashing */
  57. #define SRHASH_PCXST 0 /* pcxs, pcxt, pcxt_ */
  58. #define SRHASH_PCXL 1 /* pcxl */
  59. #define SRHASH_PA20 2 /* pcxu, pcxu_, pcxw, pcxw_ */
  60. #endif