processor.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_SH_PROCESSOR_H
  3. #define __ASM_SH_PROCESSOR_H
  4. #include <asm/cpu-features.h>
  5. #include <asm/segment.h>
  6. #include <asm/cache.h>
  7. #ifndef __ASSEMBLY__
  8. /*
  9. * CPU type and hardware bug flags. Kept separately for each CPU.
  10. *
  11. * Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
  12. * in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
  13. * for parsing the subtype in get_cpu_subtype().
  14. */
  15. enum cpu_type {
  16. /* SH-2 types */
  17. CPU_SH7619, CPU_J2,
  18. /* SH-2A types */
  19. CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_SH7264, CPU_SH7269,
  20. CPU_MXG,
  21. /* SH-3 types */
  22. CPU_SH7705, CPU_SH7706, CPU_SH7707,
  23. CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
  24. CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
  25. CPU_SH7720, CPU_SH7721, CPU_SH7729,
  26. /* SH-4 types */
  27. CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
  28. CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
  29. /* SH-4A types */
  30. CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
  31. CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SH7734, CPU_SHX3,
  32. /* SH4AL-DSP types */
  33. CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372,
  34. /* SH-5 types */
  35. CPU_SH5_101, CPU_SH5_103,
  36. /* Unknown subtype */
  37. CPU_SH_NONE
  38. };
  39. enum cpu_family {
  40. CPU_FAMILY_SH2,
  41. CPU_FAMILY_SH2A,
  42. CPU_FAMILY_SH3,
  43. CPU_FAMILY_SH4,
  44. CPU_FAMILY_SH4A,
  45. CPU_FAMILY_SH4AL_DSP,
  46. CPU_FAMILY_SH5,
  47. CPU_FAMILY_UNKNOWN,
  48. };
  49. /*
  50. * TLB information structure
  51. *
  52. * Defined for both I and D tlb, per-processor.
  53. */
  54. struct tlb_info {
  55. unsigned long long next;
  56. unsigned long long first;
  57. unsigned long long last;
  58. unsigned int entries;
  59. unsigned int step;
  60. unsigned long flags;
  61. };
  62. struct sh_cpuinfo {
  63. unsigned int type, family;
  64. int cut_major, cut_minor;
  65. unsigned long loops_per_jiffy;
  66. unsigned long asid_cache;
  67. struct cache_info icache; /* Primary I-cache */
  68. struct cache_info dcache; /* Primary D-cache */
  69. struct cache_info scache; /* Secondary cache */
  70. /* TLB info */
  71. struct tlb_info itlb;
  72. struct tlb_info dtlb;
  73. unsigned int phys_bits;
  74. unsigned long flags;
  75. } __attribute__ ((aligned(L1_CACHE_BYTES)));
  76. extern struct sh_cpuinfo cpu_data[];
  77. #define boot_cpu_data cpu_data[0]
  78. #define current_cpu_data cpu_data[smp_processor_id()]
  79. #define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
  80. #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
  81. #define cpu_relax() barrier()
  82. void default_idle(void);
  83. void stop_this_cpu(void *);
  84. /* Forward decl */
  85. struct seq_operations;
  86. struct task_struct;
  87. extern struct pt_regs fake_swapper_regs;
  88. extern void cpu_init(void);
  89. extern void cpu_probe(void);
  90. /* arch/sh/kernel/process.c */
  91. extern unsigned int xstate_size;
  92. extern void free_thread_xstate(struct task_struct *);
  93. extern struct kmem_cache *task_xstate_cachep;
  94. /* arch/sh/mm/alignment.c */
  95. extern int get_unalign_ctl(struct task_struct *, unsigned long addr);
  96. extern int set_unalign_ctl(struct task_struct *, unsigned int val);
  97. #define GET_UNALIGN_CTL(tsk, addr) get_unalign_ctl((tsk), (addr))
  98. #define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
  99. /* arch/sh/mm/init.c */
  100. extern unsigned int mem_init_done;
  101. /* arch/sh/kernel/setup.c */
  102. const char *get_cpu_subtype(struct sh_cpuinfo *c);
  103. extern const struct seq_operations cpuinfo_op;
  104. /* thread_struct flags */
  105. #define SH_THREAD_UAC_NOPRINT (1 << 0)
  106. #define SH_THREAD_UAC_SIGBUS (1 << 1)
  107. #define SH_THREAD_UAC_MASK (SH_THREAD_UAC_NOPRINT | SH_THREAD_UAC_SIGBUS)
  108. /* processor boot mode configuration */
  109. #define MODE_PIN0 (1 << 0)
  110. #define MODE_PIN1 (1 << 1)
  111. #define MODE_PIN2 (1 << 2)
  112. #define MODE_PIN3 (1 << 3)
  113. #define MODE_PIN4 (1 << 4)
  114. #define MODE_PIN5 (1 << 5)
  115. #define MODE_PIN6 (1 << 6)
  116. #define MODE_PIN7 (1 << 7)
  117. #define MODE_PIN8 (1 << 8)
  118. #define MODE_PIN9 (1 << 9)
  119. #define MODE_PIN10 (1 << 10)
  120. #define MODE_PIN11 (1 << 11)
  121. #define MODE_PIN12 (1 << 12)
  122. #define MODE_PIN13 (1 << 13)
  123. #define MODE_PIN14 (1 << 14)
  124. #define MODE_PIN15 (1 << 15)
  125. int generic_mode_pins(void);
  126. int test_mode_pin(int pin);
  127. #ifdef CONFIG_VSYSCALL
  128. int vsyscall_init(void);
  129. #else
  130. #define vsyscall_init() do { } while (0)
  131. #endif
  132. /*
  133. * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
  134. */
  135. #ifdef CONFIG_CPU_SH2A
  136. extern unsigned int instruction_size(unsigned int insn);
  137. #elif defined(CONFIG_SUPERH32)
  138. #define instruction_size(insn) (2)
  139. #else
  140. #define instruction_size(insn) (4)
  141. #endif
  142. #endif /* __ASSEMBLY__ */
  143. #ifdef CONFIG_SUPERH32
  144. # include <asm/processor_32.h>
  145. #else
  146. # include <asm/processor_64.h>
  147. #endif
  148. #endif /* __ASM_SH_PROCESSOR_H */