processor.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * User space process size. This is mostly meaningless for NOMMU
  20. * but some C6X processors may have RAM addresses up to 0xFFFFFFFF.
  21. * Since calls like mmap() can return an address or an error, we
  22. * have to allow room for error returns when code does something
  23. * like:
  24. *
  25. * addr = do_mmap(...)
  26. * if ((unsigned long)addr >= TASK_SIZE)
  27. * ... its an error code, not an address ...
  28. *
  29. * Here, we allow for 4096 error codes which means we really can't
  30. * use the last 4K page on systems with RAM extending all the way
  31. * to the end of the 32-bit address space.
  32. */
  33. #define TASK_SIZE 0xFFFFF000
  34. /*
  35. * This decides where the kernel will search for a free chunk of vm
  36. * space during mmap's. We won't be using it
  37. */
  38. #define TASK_UNMAPPED_BASE 0
  39. struct thread_struct {
  40. unsigned long long b15_14;
  41. unsigned long long a15_14;
  42. unsigned long long b13_12;
  43. unsigned long long a13_12;
  44. unsigned long long b11_10;
  45. unsigned long long a11_10;
  46. unsigned long long ricl_icl;
  47. unsigned long usp; /* user stack pointer */
  48. unsigned long pc; /* kernel pc */
  49. unsigned long wchan;
  50. };
  51. #define INIT_THREAD \
  52. { \
  53. .usp = 0, \
  54. .wchan = 0, \
  55. }
  56. #define INIT_MMAP { \
  57. &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \
  58. NULL, NULL }
  59. #define task_pt_regs(task) \
  60. ((struct pt_regs *)(THREAD_START_SP + task_stack_page(task)) - 1)
  61. #define alloc_kernel_stack() __get_free_page(GFP_KERNEL)
  62. #define free_kernel_stack(page) free_page((page))
  63. /* Forward declaration, a strange C thing */
  64. struct task_struct;
  65. extern void start_thread(struct pt_regs *regs, unsigned int pc,
  66. unsigned long usp);
  67. /* Free all resources held by a thread. */
  68. static inline void release_thread(struct task_struct *dead_task)
  69. {
  70. }
  71. /*
  72. * saved kernel SP and DP of a blocked thread.
  73. */
  74. #ifdef _BIG_ENDIAN
  75. #define thread_saved_ksp(tsk) \
  76. (*(unsigned long *)&(tsk)->thread.b15_14)
  77. #define thread_saved_dp(tsk) \
  78. (*(((unsigned long *)&(tsk)->thread.b15_14) + 1))
  79. #else
  80. #define thread_saved_ksp(tsk) \
  81. (*(((unsigned long *)&(tsk)->thread.b15_14) + 1))
  82. #define thread_saved_dp(tsk) \
  83. (*(unsigned long *)&(tsk)->thread.b15_14)
  84. #endif
  85. extern unsigned long get_wchan(struct task_struct *p);
  86. #define KSTK_EIP(task) (task_pt_regs(task)->pc)
  87. #define KSTK_ESP(task) (task_pt_regs(task)->sp)
  88. #define cpu_relax() do { } while (0)
  89. extern const struct seq_operations cpuinfo_op;
  90. /* Reset the board */
  91. #define HARD_RESET_NOW()
  92. extern unsigned int c6x_core_freq;
  93. extern void (*c6x_restart)(void);
  94. extern void (*c6x_halt)(void);
  95. #endif /* ASM_C6X_PROCESSOR_H */