]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c
ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver
[mirror_edk2.git] / ArmPkg / Drivers / ArmGic / ArmGicNonSecLib.c
CommitLineData
1bfda055 1/** @file\r
2*\r
41fb5d46 3* Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
1bfda055 4*\r
397bdc99
OM
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
1bfda055 12*\r
13**/\r
14\r
438311a3 15#include <Uefi.h>\r
1bfda055 16#include <Library/IoLib.h>\r
55a0d64b 17#include <Library/ArmGicLib.h>\r
1bfda055 18\r
1bfda055 19VOID\r
20EFIAPI\r
55a0d64b 21ArmGicEnableDistributor (\r
1bfda055 22 IN INTN GicDistributorBase\r
23 )\r
24{\r
41fb5d46
OM
25 ARM_GIC_ARCH_REVISION Revision;\r
26\r
438311a3 27 /*\r
28 * Enable GIC distributor in Non-Secure world.\r
29 * Note: The ICDDCR register is banked when Security extensions are implemented\r
30 */\r
41fb5d46
OM
31 Revision = ArmGicGetSupportedArchRevision ();\r
32 if (Revision == ARM_GIC_ARCH_REVISION_2) {\r
33 MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);\r
34 } else {\r
152ac489 35 if (MmioRead32 (GicDistributorBase + ARM_GIC_ICDDCR) & ARM_GIC_ICDDCR_ARE) {\r
33ed33f1 36 MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x2);\r
152ac489 37 } else {\r
33ed33f1 38 MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);\r
152ac489 39 }\r
41fb5d46 40 }\r
1bfda055 41}\r