processor.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Port on Texas Instruments TMS320C6x architecture
  3. *
  4. * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
  5. * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
  6. *
  7. * Updated for 2.6.34: Mark Salter <msalter@redhat.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef _ASM_C6X_PROCESSOR_H
  14. #define _ASM_C6X_PROCESSOR_H
  15. #include <asm/ptrace.h>
  16. #include <asm/page.h>
  17. #include <asm/current.h>
  18. /*
  19. * Default implementation of macro that returns current
  20. * instruction pointer ("program counter").
  21. */
  22. #define current_text_addr() \
  23. ({ \
  24. void *__pc; \
  25. asm("mvc .S2 pce1,%0\n" : "=b"(__pc)); \
  26. __pc; \
  27. })
  28. /*
  29. * User space process size. This is mostly meaningless for NOMMU
  30. * but some C6X processors may have RAM addresses up to 0xFFFFFFFF.
  31. * Since calls like mmap() can return an address or an error, we
  32. * have to allow room for error returns when code does something
  33. * like:
  34. *
  35. * addr = do_mmap(...)
  36. * if ((unsigned long)addr >= TASK_SIZE)
  37. * ... its an error code, not an address ...
  38. *
  39. * Here, we allow for 4096 error codes which means we really can't
  40. * use the last 4K page on systems with RAM extending all the way
  41. * to the end of the 32-bit address space.
  42. */
  43. #define TASK_SIZE 0xFFFFF000
  44. /*
  45. * This decides where the kernel will search for a free chunk of vm
  46. * space during mmap's. We won't be using it
  47. */
  48. #define TASK_UNMAPPED_BASE 0
  49. struct thread_struct {
  50. unsigned long long b15_14;
  51. unsigned long long a15_14;
  52. unsigned long long b13_12;
  53. unsigned long long a13_12;
  54. unsigned long long b11_10;
  55. unsigned long long a11_10;
  56. unsigned long long ricl_icl;
  57. unsigned long usp; /* user stack pointer */
  58. unsigned long pc; /* kernel pc */
  59. unsigned long wchan;
  60. };
  61. #define INIT_THREAD \
  62. { \
  63. .usp = 0, \
  64. .wchan = 0, \
  65. }
  66. #define INIT_MMAP { \
  67. &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \
  68. NULL, NULL }
  69. #define task_pt_regs(task) \
  70. ((struct pt_regs *)(THREAD_START_SP + task_stack_page(task)) - 1)
  71. #define alloc_kernel_stack() __get_free_page(GFP_KERNEL)
  72. #define free_kernel_stack(page) free_page((page))
  73. /* Forward declaration, a strange C thing */
  74. struct task_struct;
  75. extern void start_thread(struct pt_regs *regs, unsigned int pc,
  76. unsigned long usp);
  77. /* Free all resources held by a thread. */
  78. static inline void release_thread(struct task_struct *dead_task)
  79. {
  80. }
  81. #define copy_segments(tsk, mm) do { } while (0)
  82. #define release_segments(mm) do { } while (0)
  83. /*
  84. * saved PC of a blocked thread.
  85. */
  86. #define thread_saved_pc(tsk) (task_pt_regs(tsk)->pc)
  87. /*
  88. * saved kernel SP and DP of a blocked thread.
  89. */
  90. #ifdef _BIG_ENDIAN
  91. #define thread_saved_ksp(tsk) \
  92. (*(unsigned long *)&(tsk)->thread.b15_14)
  93. #define thread_saved_dp(tsk) \
  94. (*(((unsigned long *)&(tsk)->thread.b15_14) + 1))
  95. #else
  96. #define thread_saved_ksp(tsk) \
  97. (*(((unsigned long *)&(tsk)->thread.b15_14) + 1))
  98. #define thread_saved_dp(tsk) \
  99. (*(unsigned long *)&(tsk)->thread.b15_14)
  100. #endif
  101. extern unsigned long get_wchan(struct task_struct *p);
  102. #define KSTK_EIP(task) (task_pt_regs(task)->pc)
  103. #define KSTK_ESP(task) (task_pt_regs(task)->sp)
  104. #define cpu_relax() do { } while (0)
  105. #define cpu_relax_lowlatency() cpu_relax()
  106. extern const struct seq_operations cpuinfo_op;
  107. /* Reset the board */
  108. #define HARD_RESET_NOW()
  109. extern unsigned int c6x_core_freq;
  110. extern void (*c6x_restart)(void);
  111. extern void (*c6x_halt)(void);
  112. #endif /* ASM_C6X_PROCESSOR_H */