1 #ifndef __ASM_BFIN_PROCESSOR_H
2 #define __ASM_BFIN_PROCESSOR_H
5 * Default implementation of macro that returns current
6 * instruction pointer ("program counter").
8 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
10 #include <asm/ptrace.h>
11 #include <asm/blackfin.h>
13 static inline unsigned long rdusp(void)
17 __asm__
__volatile__("%0 = usp;\n\t":"=da"(usp
));
21 static inline void wrusp(unsigned long usp
)
23 __asm__
__volatile__("usp = %0;\n\t"::"da"(usp
));
26 static inline unsigned long __get_SP(void)
30 __asm__
__volatile__("%0 = sp;\n\t" : "=da"(sp
));
35 * User space process size: 1st byte beyond user address space.
36 * Fairly meaningless on nommu. Parts of user programs can be scattered
37 * in a lot of places, so just disable this by setting it to 0xFFFFFFFF.
39 #define TASK_SIZE 0xFFFFFFFF
42 #define STACK_TOP TASK_SIZE
45 #define TASK_UNMAPPED_BASE 0
47 struct thread_struct
{
48 unsigned long ksp
; /* kernel stack pointer */
49 unsigned long usp
; /* user stack pointer */
50 unsigned short seqstat
; /* saved status register */
51 unsigned long esp0
; /* points to SR of stack frame pt_regs */
52 unsigned long pc
; /* instruction pointer */
56 #define INIT_THREAD { \
57 sizeof(init_stack) + (unsigned long) init_stack, 0, \
61 extern void start_thread(struct pt_regs
*regs
, unsigned long new_ip
,
62 unsigned long new_sp
);
64 /* Forward declaration, a strange C thing */
67 /* Free all resources held by a thread. */
68 static inline void release_thread(struct task_struct
*dead_task
)
72 #define prepare_to_copy(tsk) do { } while (0)
74 extern int kernel_thread(int (*fn
) (void *), void *arg
, unsigned long flags
);
77 * Free current thread data structures etc..
79 static inline void exit_thread(void)
84 * Return saved PC of a blocked thread.
86 #define thread_saved_pc(tsk) (tsk->thread.pc)
88 unsigned long get_wchan(struct task_struct
*p
);
90 #define KSTK_EIP(tsk) \
92 unsigned long eip = 0; \
93 if ((tsk)->thread.esp0 > PAGE_SIZE && \
94 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
95 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
97 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
99 #define cpu_relax() smp_mb()
102 /* Get the Silicon Revision of the chip */
103 static inline uint32_t __pure
bfin_revid(void)
105 /* Always use CHIPID, to work around ANOMALY_05000234 */
106 uint32_t revid
= (bfin_read_CHIPID() & CHIPID_VERSION
) >> 28;
108 #ifdef _BOOTROM_GET_DXE_ADDRESS_TWI
111 * Incorrect Revision Number in DSPID Register
113 if (ANOMALY_05000364
&&
114 bfin_read16(_BOOTROM_GET_DXE_ADDRESS_TWI
) == 0x2796)
121 static inline uint16_t __pure
bfin_cpuid(void)
123 return (bfin_read_CHIPID() & CHIPID_FAMILY
) >> 12;
126 static inline uint32_t __pure
bfin_dspid(void)
128 return bfin_read_DSPID();
131 static inline uint32_t __pure
bfin_compiled_revid(void)
133 #if defined(CONFIG_BF_REV_0_0)
135 #elif defined(CONFIG_BF_REV_0_1)
137 #elif defined(CONFIG_BF_REV_0_2)
139 #elif defined(CONFIG_BF_REV_0_3)
141 #elif defined(CONFIG_BF_REV_0_4)
143 #elif defined(CONFIG_BF_REV_0_5)
145 #elif defined(CONFIG_BF_REV_0_6)
147 #elif defined(CONFIG_BF_REV_ANY)