processor.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #ifndef __ASM_SH_PROCESSOR_H
  2. #define __ASM_SH_PROCESSOR_H
  3. #include <asm/cpu-features.h>
  4. #include <asm/segment.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. /* SH-5 types */
  34. CPU_SH5_101, CPU_SH5_103,
  35. /* Unknown subtype */
  36. CPU_SH_NONE
  37. };
  38. enum cpu_family {
  39. CPU_FAMILY_SH2,
  40. CPU_FAMILY_SH2A,
  41. CPU_FAMILY_SH3,
  42. CPU_FAMILY_SH4,
  43. CPU_FAMILY_SH4A,
  44. CPU_FAMILY_SH4AL_DSP,
  45. CPU_FAMILY_SH5,
  46. CPU_FAMILY_UNKNOWN,
  47. };
  48. /*
  49. * TLB information structure
  50. *
  51. * Defined for both I and D tlb, per-processor.
  52. */
  53. struct tlb_info {
  54. unsigned long long next;
  55. unsigned long long first;
  56. unsigned long long last;
  57. unsigned int entries;
  58. unsigned int step;
  59. unsigned long flags;
  60. };
  61. struct sh_cpuinfo {
  62. unsigned int type, family;
  63. int cut_major, cut_minor;
  64. unsigned long loops_per_jiffy;
  65. unsigned long asid_cache;
  66. struct cache_info icache; /* Primary I-cache */
  67. struct cache_info dcache; /* Primary D-cache */
  68. struct cache_info scache; /* Secondary cache */
  69. /* TLB info */
  70. struct tlb_info itlb;
  71. struct tlb_info dtlb;
  72. unsigned int phys_bits;
  73. unsigned long flags;
  74. } __attribute__ ((aligned(L1_CACHE_BYTES)));
  75. extern struct sh_cpuinfo cpu_data[];
  76. #define boot_cpu_data cpu_data[0]
  77. #define current_cpu_data cpu_data[smp_processor_id()]
  78. #define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
  79. #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
  80. #define cpu_relax() barrier()
  81. #define cpu_relax_lowlatency() cpu_relax()
  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 */