3 * Copyright (c) 2011, ARM Limited. All rights reserved.
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
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.
15 #include <Library/IoLib.h>
16 #include <Library/ArmTrustZoneLib.h>
17 #include <Library/ArmPlatformLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/PcdLib.h>
20 #include <Drivers/PL310L2Cache.h>
21 #include <Drivers/SP804Timer.h>
22 #include <ArmPlatform.h>
25 Initialize the Secure peripherals and memory regions
27 If Trustzone is supported by your platform then this function makes the required initialization
28 of the secure peripherals and memory regions.
32 ArmPlatformTrustzoneInit (
36 // No TZPC or TZASC on RTSM to initialize
40 Initialize controllers that must setup at the early stage
42 Some peripherals must be initialized in Secure World.
43 For example, some L2x0 requires to be initialized in Secure World
47 ArmPlatformSecInitialize (
51 // Configure periodic timer (TIMER0) for 1MHz operation
52 MmioOr32 (SP810_CTRL_BASE
+ SP810_SYS_CTRL_REG
, SP810_SYS_CTRL_TIMER0_TIMCLK
);
53 // Configure 1MHz clock
54 MmioOr32 (SP810_CTRL_BASE
+ SP810_SYS_CTRL_REG
, SP810_SYS_CTRL_TIMER1_TIMCLK
);
55 // Configure SP810 to use 1MHz clock and disable
56 MmioAndThenOr32 (SP810_CTRL_BASE
+ SP810_SYS_CTRL_REG
, ~SP810_SYS_CTRL_TIMER2_EN
, SP810_SYS_CTRL_TIMER2_TIMCLK
);
57 // Configure SP810 to use 1MHz clock and disable
58 MmioAndThenOr32 (SP810_CTRL_BASE
+ SP810_SYS_CTRL_REG
, ~SP810_SYS_CTRL_TIMER3_EN
, SP810_SYS_CTRL_TIMER3_TIMCLK
);
62 Call before jumping to Normal World
64 This function allows the firmware platform to do extra actions before
65 jumping to the Normal World
69 ArmPlatformSecExtraAction (
71 OUT UINTN
* JumpAddress
74 *JumpAddress
= PcdGet32(PcdFvBaseAddress
);