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