]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimerSupport.S
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmLib / AArch64 / AArch64ArchTimerSupport.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
4 # Copyright (c) 2016, Linaro Limited. All rights reserved.
5 #
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #
8 #------------------------------------------------------------------------------
9
10 #include <AsmMacroIoLibV8.h>
11
12 ASM_FUNC(ArmReadCntFrq)
13 mrs x0, cntfrq_el0 // Read CNTFRQ
14 ret
15
16
17 # NOTE - Can only write while at highest implemented EL level (EL3 on model). Else ReadOnly (EL2, EL1, EL0)
18 ASM_FUNC(ArmWriteCntFrq)
19 msr cntfrq_el0, x0 // Write to CNTFRQ
20 ret
21
22
23 ASM_FUNC(ArmReadCntPct)
24 mrs x0, cntpct_el0 // Read CNTPCT (Physical counter register)
25 ret
26
27
28 ASM_FUNC(ArmReadCntkCtl)
29 mrs x0, cntkctl_el1 // Read CNTK_CTL (Timer PL1 Control Register)
30 ret
31
32
33 ASM_FUNC(ArmWriteCntkCtl)
34 msr cntkctl_el1, x0 // Write to CNTK_CTL (Timer PL1 Control Register)
35 ret
36
37
38 ASM_FUNC(ArmReadCntpTval)
39 mrs x0, cntp_tval_el0 // Read CNTP_TVAL (PL1 physical timer value register)
40 ret
41
42
43 ASM_FUNC(ArmWriteCntpTval)
44 msr cntp_tval_el0, x0 // Write to CNTP_TVAL (PL1 physical timer value register)
45 ret
46
47
48 ASM_FUNC(ArmReadCntpCtl)
49 mrs x0, cntp_ctl_el0 // Read CNTP_CTL (PL1 Physical Timer Control Register)
50 ret
51
52
53 ASM_FUNC(ArmWriteCntpCtl)
54 msr cntp_ctl_el0, x0 // Write to CNTP_CTL (PL1 Physical Timer Control Register)
55 ret
56
57
58 ASM_FUNC(ArmReadCntvTval)
59 mrs x0, cntv_tval_el0 // Read CNTV_TVAL (Virtual Timer Value register)
60 ret
61
62
63 ASM_FUNC(ArmWriteCntvTval)
64 msr cntv_tval_el0, x0 // Write to CNTV_TVAL (Virtual Timer Value register)
65 ret
66
67
68 ASM_FUNC(ArmReadCntvCtl)
69 mrs x0, cntv_ctl_el0 // Read CNTV_CTL (Virtual Timer Control Register)
70 ret
71
72
73 ASM_FUNC(ArmWriteCntvCtl)
74 msr cntv_ctl_el0, x0 // Write to CNTV_CTL (Virtual Timer Control Register)
75 ret
76
77
78 ASM_FUNC(ArmReadCntvCt)
79 mrs x0, cntvct_el0 // Read CNTVCT (Virtual Count Register)
80 ret
81
82
83 ASM_FUNC(ArmReadCntpCval)
84 mrs x0, cntp_cval_el0 // Read CNTP_CTVAL (Physical Timer Compare Value Register)
85 ret
86
87
88 ASM_FUNC(ArmWriteCntpCval)
89 msr cntp_cval_el0, x0 // Write to CNTP_CTVAL (Physical Timer Compare Value Register)
90 ret
91
92
93 ASM_FUNC(ArmReadCntvCval)
94 mrs x0, cntv_cval_el0 // Read CNTV_CTVAL (Virtual Timer Compare Value Register)
95 ret
96
97
98 ASM_FUNC(ArmWriteCntvCval)
99 msr cntv_cval_el0, x0 // write to CNTV_CTVAL (Virtual Timer Compare Value Register)
100 ret
101
102
103 ASM_FUNC(ArmReadCntvOff)
104 mrs x0, cntvoff_el2 // Read CNTVOFF (virtual Offset register)
105 ret
106
107
108 ASM_FUNC(ArmWriteCntvOff)
109 msr cntvoff_el2, x0 // Write to CNTVOFF (Virtual Offset register)
110 ret
111
112
113 ASM_FUNCTION_REMOVE_IF_UNREFERENCED