1#------------------------------------------------------------------------------ 2# 3# Copyright (c) 2011 - 2013, ARM Limited. All rights reserved. 4# Copyright (c) 2016, Linaro Limited. All rights reserved. 5# 6# This program and the accompanying materials 7# are licensed and made available under the terms and conditions of the BSD License 8# which accompanies this distribution. The full text of the license may be found at 9# http://opensource.org/licenses/bsd-license.php 10# 11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13# 14#------------------------------------------------------------------------------ 15 16#include <AsmMacroIoLibV8.h> 17 18ASM_FUNC(ArmReadCntFrq) 19 mrs x0, cntfrq_el0 // Read CNTFRQ 20 ret 21 22 23# NOTE - Can only write while at highest implemented EL level (EL3 on model). Else ReadOnly (EL2, EL1, EL0) 24ASM_FUNC(ArmWriteCntFrq) 25 msr cntfrq_el0, x0 // Write to CNTFRQ 26 ret 27 28 29ASM_FUNC(ArmReadCntPct) 30 mrs x0, cntpct_el0 // Read CNTPCT (Physical counter register) 31 ret 32 33 34ASM_FUNC(ArmReadCntkCtl) 35 mrs x0, cntkctl_el1 // Read CNTK_CTL (Timer PL1 Control Register) 36 ret 37 38 39ASM_FUNC(ArmWriteCntkCtl) 40 msr cntkctl_el1, x0 // Write to CNTK_CTL (Timer PL1 Control Register) 41 ret 42 43 44ASM_FUNC(ArmReadCntpTval) 45 mrs x0, cntp_tval_el0 // Read CNTP_TVAL (PL1 physical timer value register) 46 ret 47 48 49ASM_FUNC(ArmWriteCntpTval) 50 msr cntp_tval_el0, x0 // Write to CNTP_TVAL (PL1 physical timer value register) 51 ret 52 53 54ASM_FUNC(ArmReadCntpCtl) 55 mrs x0, cntp_ctl_el0 // Read CNTP_CTL (PL1 Physical Timer Control Register) 56 ret 57 58 59ASM_FUNC(ArmWriteCntpCtl) 60 msr cntp_ctl_el0, x0 // Write to CNTP_CTL (PL1 Physical Timer Control Register) 61 ret 62 63 64ASM_FUNC(ArmReadCntvTval) 65 mrs x0, cntv_tval_el0 // Read CNTV_TVAL (Virtual Timer Value register) 66 ret 67 68 69ASM_FUNC(ArmWriteCntvTval) 70 msr cntv_tval_el0, x0 // Write to CNTV_TVAL (Virtual Timer Value register) 71 ret 72 73 74ASM_FUNC(ArmReadCntvCtl) 75 mrs x0, cntv_ctl_el0 // Read CNTV_CTL (Virtual Timer Control Register) 76 ret 77 78 79ASM_FUNC(ArmWriteCntvCtl) 80 msr cntv_ctl_el0, x0 // Write to CNTV_CTL (Virtual Timer Control Register) 81 ret 82 83 84ASM_FUNC(ArmReadCntvCt) 85 mrs x0, cntvct_el0 // Read CNTVCT (Virtual Count Register) 86 ret 87 88 89ASM_FUNC(ArmReadCntpCval) 90 mrs x0, cntp_cval_el0 // Read CNTP_CTVAL (Physical Timer Compare Value Register) 91 ret 92 93 94ASM_FUNC(ArmWriteCntpCval) 95 msr cntp_cval_el0, x0 // Write to CNTP_CTVAL (Physical Timer Compare Value Register) 96 ret 97 98 99ASM_FUNC(ArmReadCntvCval) 100 mrs x0, cntv_cval_el0 // Read CNTV_CTVAL (Virtual Timer Compare Value Register) 101 ret 102 103 104ASM_FUNC(ArmWriteCntvCval) 105 msr cntv_cval_el0, x0 // write to CNTV_CTVAL (Virtual Timer Compare Value Register) 106 ret 107 108 109ASM_FUNC(ArmReadCntvOff) 110 mrs x0, cntvoff_el2 // Read CNTVOFF (virtual Offset register) 111 ret 112 113 114ASM_FUNC(ArmWriteCntvOff) 115 msr cntvoff_el2, x0 // Write to CNTVOFF (Virtual Offset register) 116 ret 117 118 119ASM_FUNCTION_REMOVE_IF_UNREFERENCED 120