mmu.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _ASM_ARC_MMU_H
  9. #define _ASM_ARC_MMU_H
  10. #if defined(CONFIG_ARC_MMU_V1)
  11. #define CONFIG_ARC_MMU_VER 1
  12. #elif defined(CONFIG_ARC_MMU_V2)
  13. #define CONFIG_ARC_MMU_VER 2
  14. #elif defined(CONFIG_ARC_MMU_V3)
  15. #define CONFIG_ARC_MMU_VER 3
  16. #elif defined(CONFIG_ARC_MMU_V4)
  17. #define CONFIG_ARC_MMU_VER 4
  18. #endif
  19. /* MMU Management regs */
  20. #define ARC_REG_MMU_BCR 0x06f
  21. #if (CONFIG_ARC_MMU_VER < 4)
  22. #define ARC_REG_TLBPD0 0x405
  23. #define ARC_REG_TLBPD1 0x406
  24. #define ARC_REG_TLBINDEX 0x407
  25. #define ARC_REG_TLBCOMMAND 0x408
  26. #define ARC_REG_PID 0x409
  27. #define ARC_REG_SCRATCH_DATA0 0x418
  28. #else
  29. #define ARC_REG_TLBPD0 0x460
  30. #define ARC_REG_TLBPD1 0x461
  31. #define ARC_REG_TLBINDEX 0x464
  32. #define ARC_REG_TLBCOMMAND 0x465
  33. #define ARC_REG_PID 0x468
  34. #define ARC_REG_SCRATCH_DATA0 0x46c
  35. #endif
  36. /* Bits in MMU PID register */
  37. #define __TLB_ENABLE (1 << 31)
  38. #define __PROG_ENABLE (1 << 30)
  39. #define MMU_ENABLE (__TLB_ENABLE | __PROG_ENABLE)
  40. /* Error code if probe fails */
  41. #define TLB_LKUP_ERR 0x80000000
  42. #if (CONFIG_ARC_MMU_VER < 4)
  43. #define TLB_DUP_ERR (TLB_LKUP_ERR | 0x00000001)
  44. #else
  45. #define TLB_DUP_ERR (TLB_LKUP_ERR | 0x40000000)
  46. #endif
  47. /* TLB Commands */
  48. #define TLBWrite 0x1
  49. #define TLBRead 0x2
  50. #define TLBGetIndex 0x3
  51. #define TLBProbe 0x4
  52. #if (CONFIG_ARC_MMU_VER >= 2)
  53. #define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */
  54. #define TLBIVUTLB 0x6 /* explicitly inv uTLBs */
  55. #endif
  56. #if (CONFIG_ARC_MMU_VER >= 4)
  57. #define TLBInsertEntry 0x7
  58. #define TLBDeleteEntry 0x8
  59. #endif
  60. #ifndef __ASSEMBLY__
  61. typedef struct {
  62. unsigned long asid[NR_CPUS]; /* 8 bit MMU PID + Generation cycle */
  63. } mm_context_t;
  64. #ifdef CONFIG_ARC_DBG_TLB_PARANOIA
  65. void tlb_paranoid_check(unsigned int mm_asid, unsigned long address);
  66. #else
  67. #define tlb_paranoid_check(a, b)
  68. #endif
  69. void arc_mmu_init(void);
  70. extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
  71. void read_decode_mmu_bcr(void);
  72. #endif /* !__ASSEMBLY__ */
  73. #endif