USB: revert recovery from transient errors
[linux/fpc-iii.git] / include / asm-mn10300 / processor.h
blob73239271873da304c88fe396eda7074686c3185a
1 /* MN10300 Processor specifics
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
13 #ifndef _ASM_PROCESSOR_H
14 #define _ASM_PROCESSOR_H
16 #include <asm/page.h>
17 #include <asm/ptrace.h>
18 #include <asm/cpu-regs.h>
19 #include <linux/threads.h>
21 /* Forward declaration, a strange C thing */
22 struct task_struct;
23 struct mm_struct;
26 * Default implementation of macro that returns current
27 * instruction pointer ("program counter").
29 #define current_text_addr() \
30 ({ \
31 void *__pc; \
32 asm("mov pc,%0" : "=a"(__pc)); \
33 __pc; \
36 extern void show_registers(struct pt_regs *regs);
39 * CPU type and hardware bug flags. Kept separately for each CPU.
40 * Members of this structure are referenced in head.S, so think twice
41 * before touching them. [mj]
44 struct mn10300_cpuinfo {
45 int type;
46 unsigned long loops_per_sec;
47 char hard_math;
48 unsigned long *pgd_quick;
49 unsigned long *pte_quick;
50 unsigned long pgtable_cache_sz;
53 extern struct mn10300_cpuinfo boot_cpu_data;
55 #define cpu_data &boot_cpu_data
56 #define current_cpu_data boot_cpu_data
58 extern void identify_cpu(struct mn10300_cpuinfo *);
59 extern void print_cpu_info(struct mn10300_cpuinfo *);
60 extern void dodgy_tsc(void);
61 #define cpu_relax() barrier()
64 * User space process size: 1.75GB (default).
66 #define TASK_SIZE 0x70000000
69 * Where to put the userspace stack by default
71 #define STACK_TOP 0x70000000
72 #define STACK_TOP_MAX STACK_TOP
74 /* This decides where the kernel will search for a free chunk of vm
75 * space during mmap's.
77 #define TASK_UNMAPPED_BASE 0x30000000
79 typedef struct {
80 unsigned long seg;
81 } mm_segment_t;
83 struct fpu_state_struct {
84 unsigned long fs[32]; /* fpu registers */
85 unsigned long fpcr; /* fpu control register */
88 struct thread_struct {
89 struct pt_regs *uregs; /* userspace register frame */
90 unsigned long pc; /* kernel PC */
91 unsigned long sp; /* kernel SP */
92 unsigned long a3; /* kernel FP */
93 unsigned long wchan;
94 unsigned long usp;
95 struct pt_regs *__frame;
96 unsigned long fpu_flags;
97 #define THREAD_USING_FPU 0x00000001 /* T if this task is using the FPU */
98 struct fpu_state_struct fpu_state;
101 #define INIT_THREAD \
103 .uregs = init_uregs, \
104 .pc = 0, \
105 .sp = 0, \
106 .a3 = 0, \
107 .wchan = 0, \
108 .__frame = NULL, \
111 #define INIT_MMAP \
112 { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \
113 NULL, NULL }
116 * do necessary setup to start up a newly executed thread
117 * - need to discard the frame stacked by the kernel thread invoking the execve
118 * syscall (see RESTORE_ALL macro)
120 #define start_thread(regs, new_pc, new_sp) do { \
121 set_fs(USER_DS); \
122 __frame = current->thread.uregs; \
123 __frame->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; \
124 __frame->pc = new_pc; \
125 __frame->sp = new_sp; \
126 } while (0)
128 /* Free all resources held by a thread. */
129 extern void release_thread(struct task_struct *);
131 /* Prepare to copy thread state - unlazy all lazy status */
132 extern void prepare_to_copy(struct task_struct *tsk);
135 * create a kernel thread without removing it from tasklists
137 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
140 * Return saved PC of a blocked thread.
142 extern unsigned long thread_saved_pc(struct task_struct *tsk);
144 unsigned long get_wchan(struct task_struct *p);
146 #define task_pt_regs(task) \
147 ({ \
148 struct pt_regs *__regs__; \
149 __regs__ = (struct pt_regs *) (KSTK_TOP(task_stack_page(task)) - 8); \
150 __regs__ - 1; \
153 #define KSTK_EIP(task) (task_pt_regs(task)->pc)
154 #define KSTK_ESP(task) (task_pt_regs(task)->sp)
156 #define KSTK_TOP(info) \
157 ({ \
158 (unsigned long)(info) + THREAD_SIZE; \
161 #define ARCH_HAS_PREFETCH
162 #define ARCH_HAS_PREFETCHW
164 static inline void prefetch(const void *x)
166 #ifndef CONFIG_MN10300_CACHE_DISABLED
167 #ifdef CONFIG_MN10300_PROC_MN103E010
168 asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
169 #else
170 asm volatile ("dcpf (%0)" : : "r"(x));
171 #endif
172 #endif
175 static inline void prefetchw(const void *x)
177 #ifndef CONFIG_MN10300_CACHE_DISABLED
178 #ifdef CONFIG_MN10300_PROC_MN103E010
179 asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
180 #else
181 asm volatile ("dcpf (%0)" : : "r"(x));
182 #endif
183 #endif
186 #endif /* _ASM_PROCESSOR_H */