]>
Commit | Line | Data |
---|---|---|
1bfda055 | 1 | /** @file\r |
2 | *\r | |
793ca69f | 3 | * Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r |
1bfda055 | 4 | *\r |
793ca69f 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 | |
92534106 | 15 | #include <Base.h>\r |
16 | #include <Library/DebugLib.h>\r | |
1bfda055 | 17 | #include <Library/IoLib.h>\r |
55a0d64b | 18 | #include <Library/ArmGicLib.h>\r |
1bfda055 | 19 | \r |
92534106 | 20 | /*\r |
21 | * This function configures the interrupts set by the mask to be secure.\r | |
22 | *\r | |
23 | */\r | |
24 | VOID\r | |
25 | EFIAPI\r | |
26 | ArmGicSetSecureInterrupts (\r | |
27 | IN UINTN GicDistributorBase,\r | |
28 | IN UINTN* GicSecureInterruptMask,\r | |
29 | IN UINTN GicSecureInterruptMaskSize\r | |
30 | )\r | |
31 | {\r | |
32 | UINTN Index;\r | |
33 | UINT32 InterruptStatus;\r | |
34 | \r | |
35 | // We must not have more interrupts defined by the mask than the number of available interrupts\r | |
e9f7c58f | 36 | ASSERT(GicSecureInterruptMaskSize <= (ArmGicGetMaxNumInterrupts (GicDistributorBase) / 32));\r |
92534106 | 37 | \r |
38 | // Set all the interrupts defined by the mask as Secure\r | |
39 | for (Index = 0; Index < GicSecureInterruptMaskSize; Index++) {\r | |
40 | InterruptStatus = MmioRead32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4));\r | |
41 | MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), InterruptStatus & (~GicSecureInterruptMask[Index]));\r | |
42 | }\r | |
43 | }\r | |
44 | \r | |
1bfda055 | 45 | VOID\r |
46 | EFIAPI\r | |
793ca69f OM |
47 | ArmGicEnableDistributor (\r |
48 | IN INTN GicDistributorBase\r | |
1bfda055 | 49 | )\r |
50 | {\r | |
793ca69f OM |
51 | // Turn on the GIC distributor\r |
52 | MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 1);\r | |
1bfda055 | 53 | }\r |
54 | \r | |
9736c297 | 55 | VOID\r |
56 | EFIAPI\r | |
793ca69f OM |
57 | ArmGicSetupNonSecure (\r |
58 | IN UINTN MpId,\r | |
59 | IN INTN GicDistributorBase,\r | |
9736c297 | 60 | IN INTN GicInterruptInterfaceBase\r |
61 | )\r | |
62 | {\r | |
793ca69f | 63 | ArmGicV2SetupNonSecure (MpId, GicDistributorBase, GicInterruptInterfaceBase);\r |
1bfda055 | 64 | }\r |