2 // Copyright (c) 2011, ARM Limited. All rights reserved.
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include <AsmMacroIoLib.h>
15 #include <Library/ArmCpuLib.h>
16 #include <Library/ArmGicLib.h>
17 #include <Library/PcdLib.h>
18 #include <Chipset/ArmV7.h>
23 GCC_ASM_EXPORT(ArmCpuSynchronizeWait)
24 GCC_ASM_IMPORT(CArmCpuSynchronizeWait)
25 // Dirty hack to get the Fixed value of GicDistributorBase
26 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdGicDistributorBase)
30 // ArmCpuSynchronizeWait (
31 // IN ARM_CPU_SYNCHRONIZE_EVENT Event
33 ASM_PFX(ArmCpuSynchronizeWait):
34 cmp r0, #ARM_CPU_EVENT_BOOT_MEM_INIT
35 // The SCU enabled is the event to tell us the Init Boot Memory is initialized
36 beq ArmWaitGicDistributorEnabled
37 bx ASM_PFX(CArmCpuSynchronizeWait)
40 ArmWaitGicDistributorEnabled:
41 LoadConstantToReg (ASM_PFX(_gPcd_FixedAtBuild_PcdGicDistributorBase), r0)
44 ldr r1, [r0, #ARM_GIC_ICDDCR]
46 bne _WaitGicDistributor