uboot/include/asm-avr32/processor.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2006 Atmel Corporation
   3 *
   4 * See file CREDITS for list of people who contributed to this
   5 * project.
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public License as
   9 * published by the Free Software Foundation; either version 2 of
  10 * the License, or (at your option) any later version.
  11 *
  12 * This program is distributed in the hope that it will be useful,
  13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15 * GNU General Public License for more details.
  16 *
  17 * You should have received a copy of the GNU General Public License
  18 * along with this program; if not, write to the Free Software
  19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20 * MA 02111-1307 USA
  21 */
  22#ifndef __ASM_AVR32_PROCESSOR_H
  23#define __ASM_AVR32_PROCESSOR_H
  24
  25#ifndef __ASSEMBLY__
  26
  27#define current_text_addr() ({ void *pc; __asm__("mov %0,pc" : "=r"(pc)); pc; })
  28
  29struct avr32_cpuinfo {
  30        unsigned long loops_per_jiffy;
  31};
  32
  33extern struct avr32_cpuinfo boot_cpu_data;
  34
  35#ifdef CONFIG_SMP
  36extern struct avr32_cpuinfo cpu_data[];
  37#define current_cpu_data cpu_data[smp_processor_id()]
  38#else
  39#define cpu_data (&boot_cpu_data)
  40#define current_cpu_data boot_cpu_data
  41#endif
  42
  43/* TODO: Make configurable (2GB will serve as a reasonable default) */
  44#define TASK_SIZE       0x80000000
  45
  46/* This decides where the kernel will search for a free chunk of vm
  47 * space during mmap's
  48 */
  49#define TASK_UNMAPPED_BASE      (TASK_SIZE / 3)
  50
  51#define cpu_relax()             barrier()
  52#define cpu_sync_pipeline()     asm volatile("sub pc, -2" : : : "memory")
  53
  54/* This struct contains the CPU context as stored by switch_to() */
  55struct thread_struct {
  56        unsigned long pc;
  57        unsigned long ksp;      /* Kernel stack pointer */
  58        unsigned long r7;
  59        unsigned long r6;
  60        unsigned long r5;
  61        unsigned long r4;
  62        unsigned long r3;
  63        unsigned long r2;
  64        unsigned long r1;
  65        unsigned long r0;
  66};
  67
  68#define INIT_THREAD {                                           \
  69        .ksp = sizeof(init_stack) + (long)&init_stack,          \
  70}
  71
  72/*
  73 * Do necessary setup to start up a newly executed thread.
  74 */
  75#define start_thread(regs, new_pc, new_sp)       \
  76        set_fs(USER_DS);                         \
  77        regs->sr = 0;           /* User mode. */ \
  78        regs->gr[REG_PC] = new_pc;               \
  79        regs->gr[REG_SP] = new_sp
  80
  81struct task_struct;
  82
  83/* Free all resources held by a thread */
  84extern void release_thread(struct task_struct *);
  85
  86/* Create a kernel thread without removing it from tasklists */
  87extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  88
  89/* Prepare to copy thread state - unlazy all lazy status */
  90#define prepare_to_copy(tsk) do { } while(0)
  91
  92/* Return saved PC of a blocked thread */
  93#define thread_saved_pc(tsk)    (tsk->thread.pc)
  94
  95#endif /* __ASSEMBLY__ */
  96
  97#endif /* __ASM_AVR32_PROCESSOR_H */
  98