1 /** @file
2 *
3 *  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
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/ArmPlatformLib.h>
16 #include <Library/DebugLib.h>
17 #include <Library/PcdLib.h>
18 
19 /**
20   Initialize the Secure peripherals and memory regions
21 
22   If Trustzone is supported by your platform then this function makes the required initialization
23   of the secure peripherals and memory regions.
24 
25 **/
26 VOID
ArmPlatformSecTrustzoneInit(IN UINTN MpId)27 ArmPlatformSecTrustzoneInit (
28   IN  UINTN                     MpId
29   )
30 {
31   // Secondary cores might have to set the Secure SGIs into the GICD_IGROUPR0
32   if (!ArmPlatformIsPrimaryCore (MpId)) {
33     return;
34   }
35 
36   ASSERT(FALSE);
37 }
38 
39 /**
40   Initialize controllers that must setup at the early stage
41 
42   Some peripherals must be initialized in Secure World.
43   For example, some L2x0 requires to be initialized in Secure World
44 
45 **/
46 RETURN_STATUS
ArmPlatformSecInitialize(IN UINTN MpId)47 ArmPlatformSecInitialize (
48   IN  UINTN                     MpId
49   )
50 {
51   // If it is not the primary core then there is nothing to do
52   if (!ArmPlatformIsPrimaryCore (MpId)) {
53     return RETURN_SUCCESS;
54   }
55 
56   // Do nothing yet
57   return RETURN_SUCCESS;
58 }
59 
60 /**
61   Call before jumping to Normal World
62 
63   This function allows the firmware platform to do extra actions before
64   jumping to the Normal World
65 
66 **/
67 VOID
ArmPlatformSecExtraAction(IN UINTN MpId,OUT UINTN * JumpAddress)68 ArmPlatformSecExtraAction (
69   IN  UINTN         MpId,
70   OUT UINTN*        JumpAddress
71   )
72 {
73   *JumpAddress = PcdGet64 (PcdFvBaseAddress);
74 }
75