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

TOMOYO Linux Cross Reference
Linux/arch/arm/kernel/thumbee.c

Version: ~ [ linux-5.8 ] ~ [ linux-5.7.14 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.57 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.138 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.193 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.232 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.232 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * arch/arm/kernel/thumbee.c
  3  *
  4  * Copyright (C) 2008 ARM Limited
  5  *
  6  * This program is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Public License version 2 as
  8  * published by the Free Software Foundation.
  9  *
 10  * This program is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU General Public License
 16  * along with this program; if not, write to the Free Software
 17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 18  */
 19 
 20 #include <linux/kernel.h>
 21 #include <linux/init.h>
 22 
 23 #include <asm/cputype.h>
 24 #include <asm/system_info.h>
 25 #include <asm/thread_notify.h>
 26 
 27 /*
 28  * Access to the ThumbEE Handler Base register
 29  */
 30 static inline unsigned long teehbr_read(void)
 31 {
 32         unsigned long v;
 33         asm("mrc        p14, 6, %0, c1, c0, 0\n" : "=r" (v));
 34         return v;
 35 }
 36 
 37 static inline void teehbr_write(unsigned long v)
 38 {
 39         asm("mcr        p14, 6, %0, c1, c0, 0\n" : : "r" (v));
 40 }
 41 
 42 static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void *t)
 43 {
 44         struct thread_info *thread = t;
 45 
 46         switch (cmd) {
 47         case THREAD_NOTIFY_FLUSH:
 48                 thread->thumbee_state = 0;
 49                 break;
 50         case THREAD_NOTIFY_SWITCH:
 51                 current_thread_info()->thumbee_state = teehbr_read();
 52                 teehbr_write(thread->thumbee_state);
 53                 break;
 54         }
 55 
 56         return NOTIFY_DONE;
 57 }
 58 
 59 static struct notifier_block thumbee_notifier_block = {
 60         .notifier_call  = thumbee_notifier,
 61 };
 62 
 63 static int __init thumbee_init(void)
 64 {
 65         unsigned long pfr0;
 66         unsigned int cpu_arch = cpu_architecture();
 67 
 68         if (cpu_arch < CPU_ARCH_ARMv7)
 69                 return 0;
 70 
 71         pfr0 = read_cpuid_ext(CPUID_EXT_PFR0);
 72         if ((pfr0 & 0x0000f000) != 0x00001000)
 73                 return 0;
 74 
 75         printk(KERN_INFO "ThumbEE CPU extension supported.\n");
 76         elf_hwcap |= HWCAP_THUMBEE;
 77         thread_register_notifier(&thumbee_notifier_block);
 78 
 79         return 0;
 80 }
 81 
 82 late_initcall(thumbee_init);
 83 

~ [ 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