]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c
Check the input VaraibleName for db/dbx when appending variables with formatted as...
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressSecLibRTSM / RTSMSec.c
CommitLineData
1ddb209e 1/** @file
2*
0db25ccc 3* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
1ddb209e 4*
5* This program and the accompanying materials
6* are licensed and made available under the terms and conditions of the BSD License
7* which accompanies this distribution. The full text of the license may be found at
8* http://opensource.org/licenses/bsd-license.php
9*
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12*
13**/
14
15#include <Library/IoLib.h>
1ddb209e 16#include <Library/ArmPlatformLib.h>
17#include <Library/DebugLib.h>
18#include <Library/PcdLib.h>
0db25ccc 19
1ddb209e 20#include <Drivers/PL310L2Cache.h>
d17afc8a 21#include <Drivers/SP804Timer.h>
0db25ccc 22
d17afc8a 23#include <ArmPlatform.h>
1ddb209e 24
25/**
26 Initialize the Secure peripherals and memory regions
27
28 If Trustzone is supported by your platform then this function makes the required initialization
29 of the secure peripherals and memory regions.
30
31**/
32VOID
e314d564 33ArmPlatformSecTrustzoneInit (
5e773144 34 IN UINTN MpId
1ddb209e 35 )
36{
37 // No TZPC or TZASC on RTSM to initialize
38}
39
40/**
41 Initialize controllers that must setup at the early stage
42
43 Some peripherals must be initialized in Secure World.
44 For example, some L2x0 requires to be initialized in Secure World
45
46**/
e314d564 47RETURN_STATUS
1ddb209e 48ArmPlatformSecInitialize (
e314d564 49 IN UINTN MpId
1ddb209e 50 )
51{
e314d564 52 // If it is not the primary core then there is nothing to do
53 if (!IS_PRIMARY_CORE(MpId)) {
54 return RETURN_SUCCESS;
55 }
56
d17afc8a 57 // Configure periodic timer (TIMER0) for 1MHz operation
58 MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER0_TIMCLK);
59 // Configure 1MHz clock
60 MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER1_TIMCLK);
61 // Configure SP810 to use 1MHz clock and disable
62 MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK);
63 // Configure SP810 to use 1MHz clock and disable
64 MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER3_EN, SP810_SYS_CTRL_TIMER3_TIMCLK);
e314d564 65
66 return RETURN_SUCCESS;
1ddb209e 67}
68
69/**
70 Call before jumping to Normal World
71
72 This function allows the firmware platform to do extra actions before
73 jumping to the Normal World
74
75**/
76VOID
77ArmPlatformSecExtraAction (
78 IN UINTN MpId,
79 OUT UINTN* JumpAddress
80 )
81{
82 *JumpAddress = PcdGet32(PcdFvBaseAddress);
83}