cfq-iosched: fix rcu freeing of cfq io contexts
[deliverable/linux.git] / include / asm-blackfin / processor.h
CommitLineData
1394f032
BW
1#ifndef __ASM_BFIN_PROCESSOR_H
2#define __ASM_BFIN_PROCESSOR_H
3
4/*
5 * Default implementation of macro that returns current
6 * instruction pointer ("program counter").
7 */
8#define current_text_addr() ({ __label__ _l; _l: &&_l;})
9
10#include <asm/blackfin.h>
11#include <asm/segment.h>
12#include <linux/compiler.h>
13
14static inline unsigned long rdusp(void)
15{
16 unsigned long usp;
17
18 __asm__ __volatile__("%0 = usp;\n\t":"=da"(usp));
19 return usp;
20}
21
22static inline void wrusp(unsigned long usp)
23{
24 __asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
25}
26
27/*
28 * User space process size: 1st byte beyond user address space.
29 */
30extern unsigned long memory_end;
31#define TASK_SIZE (memory_end)
32
922a70d3
DH
33#ifdef __KERNEL__
34#define STACK_TOP TASK_SIZE
35#endif
36
1394f032
BW
37#define TASK_UNMAPPED_BASE 0
38
39struct thread_struct {
40 unsigned long ksp; /* kernel stack pointer */
41 unsigned long usp; /* user stack pointer */
42 unsigned short seqstat; /* saved status register */
43 unsigned long esp0; /* points to SR of stack frame pt_regs */
44 unsigned long pc; /* instruction pointer */
45 void * debuggerinfo;
46};
47
48#define INIT_THREAD { \
49 sizeof(init_stack) + (unsigned long) init_stack, 0, \
50 PS_S, 0, 0 \
51}
52
53/*
54 * Do necessary setup to start up a newly executed thread.
55 *
56 * pass the data segment into user programs if it exists,
57 * it can't hurt anything as far as I can tell
58 */
59#define start_thread(_regs, _pc, _usp) \
60do { \
61 set_fs(USER_DS); \
62 (_regs)->pc = (_pc); \
63 if (current->mm) \
64 (_regs)->p5 = current->mm->start_data; \
f7e4217b 65 task_thread_info(current)->l1_task_info.stack_start \
1394f032 66 = (void *)current->mm->context.stack_start; \
f7e4217b
RZ
67 task_thread_info(current)->l1_task_info.lowest_sp = (void *)(_usp); \
68 memcpy(L1_SCRATCH_TASK_INFO, &task_thread_info(current)->l1_task_info, \
1394f032
BW
69 sizeof(*L1_SCRATCH_TASK_INFO)); \
70 wrusp(_usp); \
71} while(0)
72
73/* Forward declaration, a strange C thing */
74struct task_struct;
75
76/* Free all resources held by a thread. */
77static inline void release_thread(struct task_struct *dead_task)
78{
79}
80
81#define prepare_to_copy(tsk) do { } while (0)
82
83extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
84
85/*
86 * Free current thread data structures etc..
87 */
88static inline void exit_thread(void)
89{
90}
91
92/*
93 * Return saved PC of a blocked thread.
94 */
95#define thread_saved_pc(tsk) (tsk->thread.pc)
96
97unsigned long get_wchan(struct task_struct *p);
98
99#define KSTK_EIP(tsk) \
100 ({ \
101 unsigned long eip = 0; \
102 if ((tsk)->thread.esp0 > PAGE_SIZE && \
103 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
104 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
105 eip; })
106#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
107
108#define cpu_relax() barrier()
109
110/* Get the Silicon Revision of the chip */
e8c44319 111static inline uint32_t __pure bfin_revid(void)
1394f032
BW
112{
113 /* stored in the upper 4 bits */
114 return bfin_read_CHIPID() >> 28;
115}
116
e8c44319 117static inline uint32_t __pure bfin_compiled_revid(void)
1394f032
BW
118{
119#if defined(CONFIG_BF_REV_0_0)
120 return 0;
121#elif defined(CONFIG_BF_REV_0_1)
122 return 1;
123#elif defined(CONFIG_BF_REV_0_2)
124 return 2;
125#elif defined(CONFIG_BF_REV_0_3)
126 return 3;
127#elif defined(CONFIG_BF_REV_0_4)
128 return 4;
129#elif defined(CONFIG_BF_REV_0_5)
130 return 5;
de3025f4
JZ
131#elif defined(CONFIG_BF_REV_ANY)
132 return 0xffff;
133#else
134 return -1;
1394f032
BW
135#endif
136}
137
138#endif
This page took 0.135342 seconds and 5 git commands to generate.