aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-avr32/thread_info.h
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2006-09-26 02:32:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:54 -0400
commit5f97f7f9400de47ae837170bb274e90ad3934386 (patch)
tree514451e6dc6b46253293a00035d375e77b1c65ed /include/asm-avr32/thread_info.h
parent53e62d3aaa60590d4a69b4e07c29f448b5151047 (diff)
[PATCH] avr32 architecture
This adds support for the Atmel AVR32 architecture as well as the AT32AP7000 CPU and the AT32STK1000 development board. AVR32 is a new high-performance 32-bit RISC microprocessor core, designed for cost-sensitive embedded applications, with particular emphasis on low power consumption and high code density. The AVR32 architecture is not binary compatible with earlier 8-bit AVR architectures. The AVR32 architecture, including the instruction set, is described by the AVR32 Architecture Manual, available from http://www.atmel.com/dyn/resources/prod_documents/doc32000.pdf The Atmel AT32AP7000 is the first CPU implementing the AVR32 architecture. It features a 7-stage pipeline, 16KB instruction and data caches and a full Memory Management Unit. It also comes with a large set of integrated peripherals, many of which are shared with the AT91 ARM-based controllers from Atmel. Full data sheet is available from http://www.atmel.com/dyn/resources/prod_documents/doc32003.pdf while the CPU core implementation including caches and MMU is documented by the AVR32 AP Technical Reference, available from http://www.atmel.com/dyn/resources/prod_documents/doc32001.pdf Information about the AT32STK1000 development board can be found at http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3918 including a BSP CD image with an earlier version of this patch, development tools (binaries and source/patches) and a root filesystem image suitable for booting from SD card. Alternatively, there's a preliminary "getting started" guide available at http://avr32linux.org/twiki/bin/view/Main/GettingStarted which provides links to the sources and patches you will need in order to set up a cross-compiling environment for avr32-linux. This patch, as well as the other patches included with the BSP and the toolchain patches, is actively supported by Atmel Corporation. [dmccr@us.ibm.com: Fix more pxx_page macro locations] [bunk@stusta.de: fix `make defconfig'] Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Dave McCracken <dmccr@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-avr32/thread_info.h')
-rw-r--r--include/asm-avr32/thread_info.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
new file mode 100644
index 000000000000..d1f5b35ebd54
--- /dev/null
+++ b/include/asm-avr32/thread_info.h
@@ -0,0 +1,106 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
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.
7 */
8#ifndef __ASM_AVR32_THREAD_INFO_H
9#define __ASM_AVR32_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#define THREAD_SIZE_ORDER 1
14#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
15
16#ifndef __ASSEMBLY__
17#include <asm/types.h>
18
19struct task_struct;
20struct exec_domain;
21
22struct thread_info {
23 struct task_struct *task; /* main task structure */
24 struct exec_domain *exec_domain; /* execution domain */
25 unsigned long flags; /* low level flags */
26 __u32 cpu;
27 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
28 struct restart_block restart_block;
29 __u8 supervisor_stack[0];
30};
31
32#define INIT_THREAD_INFO(tsk) \
33{ \
34 .task = &tsk, \
35 .exec_domain = &default_exec_domain, \
36 .flags = 0, \
37 .cpu = 0, \
38 .preempt_count = 1, \
39 .restart_block = { \
40 .fn = do_no_restart_syscall \
41 } \
42}
43
44#define init_thread_info (init_thread_union.thread_info)
45#define init_stack (init_thread_union.stack)
46
47/*
48 * Get the thread information struct from C.
49 * We do the usual trick and use the lower end of the stack for this
50 */
51static inline struct thread_info *current_thread_info(void)
52{
53 unsigned long addr = ~(THREAD_SIZE - 1);
54
55 asm("and %0, sp" : "=r"(addr) : "0"(addr));
56 return (struct thread_info *)addr;
57}
58
59/* thread information allocation */
60#define alloc_thread_info(ti) \
61 ((struct thread_info *) __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
62#define free_thread_info(ti) free_pages((unsigned long)(ti), 1)
63#define get_thread_info(ti) get_task_struct((ti)->task)
64#define put_thread_info(ti) put_task_struct((ti)->task)
65
66#endif /* !__ASSEMBLY__ */
67
68#define PREEMPT_ACTIVE 0x40000000
69
70/*
71 * Thread information flags
72 * - these are process state flags that various assembly files may need to access
73 * - pending work-to-be-done flags are in LSW
74 * - other flags in MSW
75 */
76#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
77#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
78#define TIF_SIGPENDING 2 /* signal pending */
79#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
80#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
81 TIF_NEED_RESCHED */
82#define TIF_BREAKPOINT 5 /* true if we should break after return */
83#define TIF_SINGLE_STEP 6 /* single step after next break */
84#define TIF_MEMDIE 7
85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */
86#define TIF_USERSPACE 31 /* true if FS sets userspace */
87
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
89#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
90#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
91#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
92#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
93#define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT)
94#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
95#define _TIF_MEMDIE (1 << TIF_MEMDIE)
96#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
97
98/* XXX: These two masks must never span more than 16 bits! */
99/* work to do on interrupt/exception return */
100#define _TIF_WORK_MASK 0x0000013e
101/* work to do on any return to userspace */
102#define _TIF_ALLWORK_MASK 0x0000013f
103/* work to do on return from debug mode */
104#define _TIF_DBGWORK_MASK 0x0000017e
105
106#endif /* __ASM_AVR32_THREAD_INFO_H */