~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/blackfin/include/asm/processor.h

Version: ~ [ linux-6.4-rc3 ] ~ [ linux-6.3.4 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.30 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.113 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.180 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.243 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.283 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.315 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright 2004-2009 Analog Devices Inc.
  3  *
  4  * Licensed under the GPL-2 or later.
  5  */
  6 
  7 #ifndef __ASM_BFIN_PROCESSOR_H
  8 #define __ASM_BFIN_PROCESSOR_H
  9 
 10 /*
 11  * Default implementation of macro that returns current
 12  * instruction pointer ("program counter").
 13  */
 14 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
 15 
 16 #include <asm/ptrace.h>
 17 #include <mach/blackfin.h>
 18 
 19 static inline unsigned long rdusp(void)
 20 {
 21         unsigned long usp;
 22 
 23         __asm__ __volatile__("%0 = usp;\n\t":"=da"(usp));
 24         return usp;
 25 }
 26 
 27 static inline void wrusp(unsigned long usp)
 28 {
 29         __asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
 30 }
 31 
 32 static inline unsigned long __get_SP(void)
 33 {
 34         unsigned long sp;
 35 
 36         __asm__ __volatile__("%0 = sp;\n\t" : "=da"(sp));
 37         return sp;
 38 }
 39 
 40 /*
 41  * User space process size: 1st byte beyond user address space.
 42  * Fairly meaningless on nommu.  Parts of user programs can be scattered
 43  * in a lot of places, so just disable this by setting it to 0xFFFFFFFF.
 44  */
 45 #define TASK_SIZE       0xFFFFFFFF
 46 
 47 #ifdef __KERNEL__
 48 #define STACK_TOP       TASK_SIZE
 49 #endif
 50 
 51 #define TASK_UNMAPPED_BASE      0
 52 
 53 struct thread_struct {
 54         unsigned long ksp;      /* kernel stack pointer */
 55         unsigned long usp;      /* user stack pointer */
 56         unsigned short seqstat; /* saved status register */
 57         unsigned long esp0;     /* points to SR of stack frame pt_regs */
 58         unsigned long pc;       /* instruction pointer */
 59         void *        debuggerinfo;
 60 };
 61 
 62 #define INIT_THREAD  {                                          \
 63         sizeof(init_stack) + (unsigned long) init_stack, 0,     \
 64         PS_S, 0, 0                                              \
 65 }
 66 
 67 extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 68                                                unsigned long new_sp);
 69 
 70 /* Forward declaration, a strange C thing */
 71 struct task_struct;
 72 
 73 /* Free all resources held by a thread. */
 74 static inline void release_thread(struct task_struct *dead_task)
 75 {
 76 }
 77 
 78 unsigned long get_wchan(struct task_struct *p);
 79 
 80 #define KSTK_EIP(tsk)                                                   \
 81     ({                                                                  \
 82         unsigned long eip = 0;                                          \
 83         if ((tsk)->thread.esp0 > PAGE_SIZE &&                           \
 84             MAP_NR((tsk)->thread.esp0) < max_mapnr)                     \
 85               eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc;        \
 86         eip; })
 87 #define KSTK_ESP(tsk)   ((tsk) == current ? rdusp() : (tsk)->thread.usp)
 88 
 89 #define cpu_relax()     smp_mb()
 90 
 91 /* Get the Silicon Revision of the chip */
 92 static inline uint32_t __pure bfin_revid(void)
 93 {
 94         /* Always use CHIPID, to work around ANOMALY_05000234 */
 95         uint32_t revid = (bfin_read_CHIPID() & CHIPID_VERSION) >> 28;
 96 
 97 #ifdef _BOOTROM_GET_DXE_ADDRESS_TWI
 98         /*
 99          * ANOMALY_05000364
100          * Incorrect Revision Number in DSPID Register
101          */
102         if (ANOMALY_05000364 &&
103             bfin_read16(_BOOTROM_GET_DXE_ADDRESS_TWI) == 0x2796)
104                 revid = 1;
105 #endif
106 
107         return revid;
108 }
109 
110 static inline uint16_t __pure bfin_cpuid(void)
111 {
112         return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
113 }
114 
115 static inline uint32_t __pure bfin_dspid(void)
116 {
117         return bfin_read_DSPID();
118 }
119 
120 #define blackfin_core_id() (bfin_dspid() & 0xff)
121 
122 static inline uint32_t __pure bfin_compiled_revid(void)
123 {
124 #if defined(CONFIG_BF_REV_0_0)
125         return 0;
126 #elif defined(CONFIG_BF_REV_0_1)
127         return 1;
128 #elif defined(CONFIG_BF_REV_0_2)
129         return 2;
130 #elif defined(CONFIG_BF_REV_0_3)
131         return 3;
132 #elif defined(CONFIG_BF_REV_0_4)
133         return 4;
134 #elif defined(CONFIG_BF_REV_0_5)
135         return 5;
136 #elif defined(CONFIG_BF_REV_0_6)
137         return 6;
138 #elif defined(CONFIG_BF_REV_ANY)
139         return 0xffff;
140 #else
141         return -1;
142 #endif
143 }
144 
145 #endif
146 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp