2 * Copyright (C) 2004-2006 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 #ifndef __ASM_AVR32_PROCESSOR_H
9 #define __ASM_AVR32_PROCESSOR_H
12 #include <asm/cache.h>
14 #define TASK_SIZE 0x80000000
18 static inline void *current_text_addr(void)
20 register void *pc
asm("pc");
43 struct avr32_cpuinfo
{
45 unsigned long loops_per_jiffy
;
46 enum arch_type arch_type
;
47 enum cpu_type cpu_type
;
48 unsigned short arch_revision
;
49 unsigned short cpu_revision
;
50 enum tlb_config tlb_config
;
52 struct cache_info icache
;
53 struct cache_info dcache
;
56 extern struct avr32_cpuinfo boot_cpu_data
;
59 extern struct avr32_cpuinfo cpu_data
[];
60 #define current_cpu_data cpu_data[smp_processor_id()]
62 #define cpu_data (&boot_cpu_data)
63 #define current_cpu_data boot_cpu_data
66 /* This decides where the kernel will search for a free chunk of vm
69 #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
71 #define cpu_relax() barrier()
72 #define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory")
77 unsigned long ksp
; /* Kernel stack pointer */
88 /* This struct contains the CPU context as stored by switch_to() */
89 struct thread_struct
{
90 struct cpu_context cpu_context
;
91 unsigned long single_step_addr
;
95 #define INIT_THREAD { \
97 .ksp = sizeof(init_stack) + (long)&init_stack, \
102 * Do necessary setup to start up a newly executed thread.
104 #define start_thread(regs, new_pc, new_sp) \
107 memset(regs, 0, sizeof(*regs)); \
108 regs->sr = MODE_USER; \
109 regs->pc = new_pc & ~1; \
115 /* Free all resources held by a thread */
116 extern void release_thread(struct task_struct
*);
118 /* Create a kernel thread without removing it from tasklists */
119 extern int kernel_thread(int (*fn
)(void *), void *arg
, unsigned long flags
);
121 /* Prepare to copy thread state - unlazy all lazy status */
122 #define prepare_to_copy(tsk) do { } while(0)
124 /* Return saved PC of a blocked thread */
125 #define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
128 void show_trace(struct task_struct
*task
, unsigned long *stack
,
129 struct pt_regs
*regs
);
131 extern unsigned long get_wchan(struct task_struct
*p
);
133 #define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
134 #define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
136 #define ARCH_HAS_PREFETCH
138 static inline void prefetch(const void *x
)
141 asm volatile("pref %0" : : "r"(c
));
143 #define PREFETCH_STRIDE L1_CACHE_BYTES
145 #endif /* __ASSEMBLY__ */
147 #endif /* __ASM_AVR32_PROCESSOR_H */