ArmPkg: Add CNTHCTL_EL2 support functions

Added helper functions for reading and writing the
CNTHCTL_EL2 register.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Sami Mujawar 2017-05-16 11:10:44 +01:00 committed by Leif Lindholm
parent 7320b8ed18
commit 23d6348f92
2 changed files with 21 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved.<BR> Copyright (c) 2011 - 2017, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -235,4 +235,14 @@ ArmWriteCptr (
IN UINT64 Cptr IN UINT64 Cptr
); );
UINT32
ArmReadCntHctl (
VOID
);
VOID
ArmWriteCntHctl (
IN UINT32 CntHctl
);
#endif // __AARCH64_H__ #endif // __AARCH64_H__

View File

@ -480,4 +480,14 @@ ASM_FUNC(ArmReadCurrentEL)
mrs x0, CurrentEL mrs x0, CurrentEL
ret ret
// UINT32 ArmReadCntHctl(VOID)
ASM_FUNC(ArmReadCntHctl)
mrs x0, cnthctl_el2
ret
// VOID ArmWriteCntHctl(UINT32 CntHctl)
ASM_FUNC(ArmWriteCntHctl)
msr cnthctl_el2, x0
ret
ASM_FUNCTION_REMOVE_IF_UNREFERENCED ASM_FUNCTION_REMOVE_IF_UNREFERENCED