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

TOMOYO Linux Cross Reference
Linux/arch/sparc/include/asm/timer_64.h

Version: ~ [ linux-5.5-rc1 ] ~ [ linux-5.4.2 ] ~ [ linux-5.3.15 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.88 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.158 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.206 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.206 ] ~ [ 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.78 ] ~ [ 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-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ 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 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* timer.h: System timer definitions for sun5.
  3  *
  4  * Copyright (C) 1997, 2008 David S. Miller (davem@davemloft.net)
  5  */
  6 
  7 #ifndef _SPARC64_TIMER_H
  8 #define _SPARC64_TIMER_H
  9 
 10 #include <linux/types.h>
 11 #include <linux/init.h>
 12 
 13 /* The most frequently accessed fields should be first,
 14  * to fit into the same cacheline.
 15  */
 16 struct sparc64_tick_ops {
 17         unsigned long ticks_per_nsec_quotient;
 18         unsigned long offset;
 19         unsigned long long (*get_tick)(void);
 20         int (*add_compare)(unsigned long);
 21         unsigned long softint_mask;
 22         void (*disable_irq)(void);
 23 
 24         void (*init_tick)(void);
 25         unsigned long (*add_tick)(unsigned long);
 26         unsigned long (*get_frequency)(void);
 27         unsigned long frequency;
 28 
 29         char *name;
 30 };
 31 
 32 extern struct sparc64_tick_ops *tick_ops;
 33 
 34 unsigned long sparc64_get_clock_tick(unsigned int cpu);
 35 void setup_sparc64_timer(void);
 36 void __init time_init(void);
 37 
 38 #define TICK_PRIV_BIT           BIT(63)
 39 #define TICKCMP_IRQ_BIT         BIT(63)
 40 
 41 #define HBIRD_STICKCMP_ADDR     0x1fe0000f060UL
 42 #define HBIRD_STICK_ADDR        0x1fe0000f070UL
 43 
 44 #define GET_TICK_NINSTR         13
 45 struct get_tick_patch {
 46         unsigned int    addr;
 47         unsigned int    tick[GET_TICK_NINSTR];
 48         unsigned int    stick[GET_TICK_NINSTR];
 49 };
 50 
 51 extern struct get_tick_patch __get_tick_patch;
 52 extern struct get_tick_patch __get_tick_patch_end;
 53 
 54 static inline unsigned long get_tick(void)
 55 {
 56         unsigned long tick, tmp1, tmp2;
 57 
 58         __asm__ __volatile__(
 59         /* read hbtick 13 instructions */
 60         "661:\n"
 61         "       mov     0x1fe, %1\n"
 62         "       sllx    %1, 0x20, %1\n"
 63         "       sethi   %%hi(0xf000), %2\n"
 64         "       or      %2, 0x70, %2\n"
 65         "       or      %1, %2, %1\n"   /* %1 = HBIRD_STICK_ADDR */
 66         "       add     %1, 8, %2\n"
 67         "       ldxa    [%2]%3, %0\n"
 68         "       ldxa    [%1]%3, %1\n"
 69         "       ldxa    [%2]%3, %2\n"
 70         "       sub     %2, %0, %0\n"   /* don't modify %xcc */
 71         "       brnz,pn %0, 661b\n"     /* restart to save one register */
 72         "        sllx   %2, 32, %2\n"
 73         "       or      %2, %1, %0\n"
 74         /* Common/not patched code */
 75         "       sllx    %0, 1, %0\n"
 76         "       srlx    %0, 1, %0\n"    /* Clear TICK_PRIV_BIT */
 77         /* Beginning of patch section */
 78         "       .section .get_tick_patch, \"ax\"\n"
 79         "       .word   661b\n"
 80         /* read tick 2 instructions and 11 skipped */
 81         "       ba      1f\n"
 82         "        rd     %%tick, %0\n"
 83         "       .skip   4 * (%4 - 2)\n"
 84         "1:\n"
 85         /* read stick 2 instructions and 11 skipped */
 86         "       ba      1f\n"
 87         "        rd     %%asr24, %0\n"
 88         "       .skip   4 * (%4 - 2)\n"
 89         "1:\n"
 90         /* End of patch section */
 91         "       .previous\n"
 92         : "=&r" (tick), "=&r" (tmp1), "=&r" (tmp2)
 93         : "i" (ASI_PHYS_BYPASS_EC_E), "i" (GET_TICK_NINSTR));
 94 
 95         return tick;
 96 }
 97 
 98 #endif /* _SPARC64_TIMER_H */
 99 

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