processor.h 4.2 KB

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