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

TOMOYO Linux Cross Reference
Linux/arch/microblaze/kernel/cpu/pvr.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ 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  * Support for MicroBlaze PVR (processor version register)
  3  *
  4  * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
  5  * Copyright (C) 2007-2009 PetaLogix
  6  * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
  7  *
  8  * This file is subject to the terms and conditions of the GNU General Public
  9  * License. See the file "COPYING" in the main directory of this archive
 10  * for more details.
 11  */
 12 
 13 #include <linux/kernel.h>
 14 #include <linux/compiler.h>
 15 #include <asm/exceptions.h>
 16 #include <asm/pvr.h>
 17 #include <linux/irqflags.h>
 18 
 19 /*
 20  * Until we get an assembler that knows about the pvr registers,
 21  * this horrible cruft will have to do.
 22  * That hardcoded opcode is mfs r3, rpvrNN
 23  */
 24 
 25 #define get_single_pvr(pvrid, val)                              \
 26 {                                                               \
 27         register unsigned tmp __asm__("r3");                    \
 28         tmp = 0x0;      /* Prevent warning about unused */      \
 29         __asm__ __volatile__ (                                  \
 30                         "mfs    %0, rpvr" #pvrid ";"            \
 31                         : "=r" (tmp) : : "memory");             \
 32         val = tmp;                                              \
 33 }
 34 
 35 /*
 36  * Does the CPU support the PVR register?
 37  * return value:
 38  * 0: no PVR
 39  * 1: simple PVR
 40  * 2: full PVR
 41  *
 42  * This must work on all CPU versions, including those before the
 43  * PVR was even an option.
 44  */
 45 
 46 int cpu_has_pvr(void)
 47 {
 48         unsigned long flags;
 49         unsigned pvr0;
 50 
 51         local_save_flags(flags);
 52 
 53         /* PVR bit in MSR tells us if there is any support */
 54         if (!(flags & PVR_MSR_BIT))
 55                 return 0;
 56 
 57         get_single_pvr(0, pvr0);
 58         pr_debug("%s: pvr0 is 0x%08x\n", __func__, pvr0);
 59 
 60         if (pvr0 & PVR0_PVR_FULL_MASK)
 61                 return 1;
 62 
 63         /* for partial PVR use static cpuinfo */
 64         return 2;
 65 }
 66 
 67 void get_pvr(struct pvr_s *p)
 68 {
 69         get_single_pvr(0, p->pvr[0]);
 70         get_single_pvr(1, p->pvr[1]);
 71         get_single_pvr(2, p->pvr[2]);
 72         get_single_pvr(3, p->pvr[3]);
 73         get_single_pvr(4, p->pvr[4]);
 74         get_single_pvr(5, p->pvr[5]);
 75         get_single_pvr(6, p->pvr[6]);
 76         get_single_pvr(7, p->pvr[7]);
 77         get_single_pvr(8, p->pvr[8]);
 78         get_single_pvr(9, p->pvr[9]);
 79         get_single_pvr(10, p->pvr[10]);
 80         get_single_pvr(11, p->pvr[11]);
 81 }
 82 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php