ArmPkg: Add ARM Architectural Timer support

ARM Architectural Timer support is defined by the ARM Generic Timer Specification.



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12455 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin
2011-09-27 16:35:16 +00:00
parent 0c0e7ef451
commit da9675a241
15 changed files with 1468 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
#define __ARM_V7_H__
#include <Chipset/ArmV7Mmu.h>
#include <Chipset/ArmV7ArchTimer.h>
// Domain Access Control Register
#define DOMAIN_ACCESS_CONTROL_MASK(a) (3UL << (2 * (a)))
@@ -80,6 +81,12 @@ ArmWriteTpidrurw (
UINTN Value
);
UINTN
EFIAPI
ArmIsArchTimerImplemented (
VOID
);
UINTN
EFIAPI
ArmReadIdPfr1 (

View File

@@ -0,0 +1,138 @@
/** @file
*
* Copyright (c) 2011, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
* which accompanies this distribution. The full text of the license may be found at
* http://opensource.org/licenses/bsd-license.php
*
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
**/
#ifndef __ARMV7_ARCH_TIMER_H_
#define __ARMV7_ARCH_TIMER_H_
UINTN
EFIAPI
ArmReadCntFrq (
VOID
);
VOID
EFIAPI
ArmWriteCntFrq (
UINTN FreqInHz
);
UINT64
EFIAPI
ArmReadCntPct (
VOID
);
UINTN
EFIAPI
ArmReadCntkCtl (
VOID
);
VOID
EFIAPI
ArmWriteCntkCtl (
UINTN Val
);
UINTN
EFIAPI
ArmReadCntpTval (
VOID
);
VOID
EFIAPI
ArmWriteCntpTval (
UINTN Val
);
UINTN
EFIAPI
ArmReadCntpCtl (
VOID
);
VOID
EFIAPI
ArmWriteCntpCtl (
UINTN Val
);
UINTN
EFIAPI
ArmReadCntvTval (
VOID
);
VOID
EFIAPI
ArmWriteCntvTval (
UINTN Val
);
UINTN
EFIAPI
ArmReadCntvCtl (
VOID
);
VOID
EFIAPI
ArmWriteCntvCtl (
UINTN Val
);
UINT64
EFIAPI
ArmReadCntvCt (
VOID
);
UINT64
EFIAPI
ArmReadCntpCval (
VOID
);
VOID
EFIAPI
ArmWriteCntpCval (
UINT64 Val
);
UINT64
EFIAPI
ArmReadCntvCval (
VOID
);
VOID
EFIAPI
ArmWriteCntvCval (
UINT64 Val
);
UINT64
EFIAPI
ArmReadCntvOff (
VOID
);
VOID
EFIAPI
ArmWriteCntvOff (
UINT64 Val
);
#endif

View File

@@ -167,7 +167,7 @@ Cp15CacheInfo (
BOOLEAN
EFIAPI
ArmIsMPCore (
ArmIsMpCore (
VOID
);

View File

@@ -0,0 +1,115 @@
/** @file
Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __ARM_V7_ARCH_TIMER_LIB_H__
#define __ARM_V7_ARCH_TIMER_LIB_H__
#define ARM_ARCH_TIMER_ENABLE (1 << 0)
#define ARM_ARCH_TIMER_IMASK (1 << 1)
#define ARM_ARCH_TIMER_ISTATUS (1 << 2)
typedef enum {
CntFrq = 0,
CntPct,
CntkCtl,
CntpTval,
CntpCtl,
CntvTval,
CntvCtl,
CntvCt,
CntpCval,
CntvCval,
CntvOff,
CnthCtl,
CnthpTval,
CnthpCtl,
CnthpCval,
RegMaximum
}ARM_ARCH_TIMER_REGS;
VOID
EFIAPI
ArmArchTimerReadReg (
IN ARM_ARCH_TIMER_REGS Reg,
OUT VOID *DstBuf
);
VOID
EFIAPI
ArmArchTimerWriteReg (
IN ARM_ARCH_TIMER_REGS Reg,
IN VOID *SrcBuf
);
VOID
EFIAPI
ArmArchTimerEnableTimer (
VOID
);
VOID
EFIAPI
ArmArchTimerDisableTimer (
VOID
);
VOID
EFIAPI
ArmArchTimerSetTimerFreq (
IN UINTN FreqInHz
);
UINTN
EFIAPI
ArmArchTimerGetTimerFreq (
VOID
);
VOID
EFIAPI
ArmArchTimerSetTimerVal (
IN UINTN Val
);
UINTN
EFIAPI
ArmArchTimerGetTimerVal (
VOID
);
UINT64
EFIAPI
ArmArchTimerGetSystemCount (
VOID
);
UINTN
EFIAPI
ArmArchTimerGetTimerCtrlReg (
VOID
);
VOID
EFIAPI
ArmArchTimerSetTimerCtrlReg (
UINTN Val
);
VOID
EFIAPI
ArmArchTimerSetCompareVal (
IN UINT64 Val
);
#endif // __ARM_V7_ARCH_TIMER_LIB_H__