summaryrefslogtreecommitdiff
path: root/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Helper.asm
blob: 886c00b61aab18e31ab52b9c4dc3c6984a6b6bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
//  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.
//
//

#include <AsmMacroIoLib.h>
#include <Library/ArmCpuLib.h>
#include <Library/ArmGicLib.h>
#include <Library/PcdLib.h>
#include <Chipset/ArmV7.h>

  INCLUDE AsmMacroIoLib.inc

  EXPORT  ArmCpuSynchronizeWait
  IMPORT  CArmCpuSynchronizeWait
  // Dirty hack to get the Fixed value of GicDistributorBase
  IMPORT  _gPcd_FixedAtBuild_PcdGicDistributorBase

  PRESERVE8
  AREA    ArmCortexA15Helper, CODE, READONLY

// VOID
// ArmCpuSynchronizeWait (
//   IN ARM_CPU_SYNCHRONIZE_EVENT   Event
//   );
ArmCpuSynchronizeWait
  cmp   r0, #ARM_CPU_EVENT_BOOT_MEM_INIT
  // The SCU enabled is the event to tell us the Init Boot Memory is initialized
  beq   ArmWaitGicDistributorEnabled
  // Case when the stack has been set up
  push	{r1,lr}
  LoadConstantToReg (CArmCpuSynchronizeWait, r1)
  blx   r1
  pop	{r1,lr}
  bx	lr


// IN  None
ArmWaitGicDistributorEnabled
  LoadConstantToReg (_gPcd_FixedAtBuild_PcdGicDistributorBase, r0)
  ldr   r0, [r0]
_WaitGicDistributor
  ldr   r1, [r0, #ARM_GIC_ICDDCR]
  cmp   r1, #1
  bne   _WaitGicDistributor
  bx    lr

  END