powerpc/pci: Remove redundant pcnet32 fixup
[linux-2.6/verdex.git] / arch / blackfin / include / asm / processor.h
blob0eece23b41c7c1ddaeb2f04908c20b5c9f16cd0f
1 #ifndef __ASM_BFIN_PROCESSOR_H
2 #define __ASM_BFIN_PROCESSOR_H
4 /*
5 * Default implementation of macro that returns current
6 * instruction pointer ("program counter").
7 */
8 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
10 #include <asm/blackfin.h>
11 #include <asm/segment.h>
12 #include <linux/compiler.h>
14 static inline unsigned long rdusp(void)
16 unsigned long usp;
18 __asm__ __volatile__("%0 = usp;\n\t":"=da"(usp));
19 return usp;
22 static inline void wrusp(unsigned long usp)
24 __asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
27 static inline unsigned long __get_SP(void)
29 unsigned long sp;
31 __asm__ __volatile__("%0 = sp;\n\t" : "=da"(sp));
32 return sp;
36 * User space process size: 1st byte beyond user address space.
37 * Fairly meaningless on nommu. Parts of user programs can be scattered
38 * in a lot of places, so just disable this by setting it to 0xFFFFFFFF.
40 #define TASK_SIZE 0xFFFFFFFF
42 #ifdef __KERNEL__
43 #define STACK_TOP TASK_SIZE
44 #endif
46 #define TASK_UNMAPPED_BASE 0
48 struct thread_struct {
49 unsigned long ksp; /* kernel stack pointer */
50 unsigned long usp; /* user stack pointer */
51 unsigned short seqstat; /* saved status register */
52 unsigned long esp0; /* points to SR of stack frame pt_regs */
53 unsigned long pc; /* instruction pointer */
54 void * debuggerinfo;
57 #define INIT_THREAD { \
58 sizeof(init_stack) + (unsigned long) init_stack, 0, \
59 PS_S, 0, 0 \
63 * Do necessary setup to start up a newly executed thread.
65 * pass the data segment into user programs if it exists,
66 * it can't hurt anything as far as I can tell
68 #ifndef CONFIG_SMP
69 #define start_thread(_regs, _pc, _usp) \
70 do { \
71 set_fs(USER_DS); \
72 (_regs)->pc = (_pc); \
73 if (current->mm) \
74 (_regs)->p5 = current->mm->start_data; \
75 task_thread_info(current)->l1_task_info.stack_start \
76 = (void *)current->mm->context.stack_start; \
77 task_thread_info(current)->l1_task_info.lowest_sp = (void *)(_usp); \
78 memcpy(L1_SCRATCH_TASK_INFO, &task_thread_info(current)->l1_task_info, \
79 sizeof(*L1_SCRATCH_TASK_INFO)); \
80 wrusp(_usp); \
81 } while(0)
82 #else
83 #define start_thread(_regs, _pc, _usp) \
84 do { \
85 set_fs(USER_DS); \
86 (_regs)->pc = (_pc); \
87 if (current->mm) \
88 (_regs)->p5 = current->mm->start_data; \
89 wrusp(_usp); \
90 } while (0)
91 #endif
93 /* Forward declaration, a strange C thing */
94 struct task_struct;
96 /* Free all resources held by a thread. */
97 static inline void release_thread(struct task_struct *dead_task)
101 #define prepare_to_copy(tsk) do { } while (0)
103 extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
106 * Free current thread data structures etc..
108 static inline void exit_thread(void)
113 * Return saved PC of a blocked thread.
115 #define thread_saved_pc(tsk) (tsk->thread.pc)
117 unsigned long get_wchan(struct task_struct *p);
119 #define KSTK_EIP(tsk) \
120 ({ \
121 unsigned long eip = 0; \
122 if ((tsk)->thread.esp0 > PAGE_SIZE && \
123 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
124 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
125 eip; })
126 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
128 #define cpu_relax() smp_mb()
131 /* Get the Silicon Revision of the chip */
132 static inline uint32_t __pure bfin_revid(void)
134 /* stored in the upper 4 bits */
135 uint32_t revid = bfin_read_CHIPID() >> 28;
137 #ifdef CONFIG_BF52x
138 /* ANOMALY_05000357
139 * Incorrect Revision Number in DSPID Register
141 if (revid == 0)
142 switch (bfin_read16(_BOOTROM_GET_DXE_ADDRESS_TWI)) {
143 case 0x0010:
144 revid = 0;
145 break;
146 case 0x2796:
147 revid = 1;
148 break;
149 default:
150 revid = 0xFFFF;
151 break;
153 #endif
154 return revid;
157 static inline uint16_t __pure bfin_cpuid(void)
159 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
162 static inline uint32_t __pure bfin_dspid(void)
164 return bfin_read_DSPID();
167 static inline uint32_t __pure bfin_compiled_revid(void)
169 #if defined(CONFIG_BF_REV_0_0)
170 return 0;
171 #elif defined(CONFIG_BF_REV_0_1)
172 return 1;
173 #elif defined(CONFIG_BF_REV_0_2)
174 return 2;
175 #elif defined(CONFIG_BF_REV_0_3)
176 return 3;
177 #elif defined(CONFIG_BF_REV_0_4)
178 return 4;
179 #elif defined(CONFIG_BF_REV_0_5)
180 return 5;
181 #elif defined(CONFIG_BF_REV_0_6)
182 return 6;
183 #elif defined(CONFIG_BF_REV_ANY)
184 return 0xffff;
185 #else
186 return -1;
187 #endif
190 #endif