Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 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 <Base.h>
|
| 16 | #include <Library/DebugLib.h>
|
| 17 | #include <Library/IoLib.h>
|
| 18 | #include <Library/ArmGicLib.h>
|
| 19 |
|
| 20 | #include "GicV2/ArmGicV2Lib.h"
|
| 21 |
|
| 22 | /*
|
| 23 | * This function configures the interrupts set by the mask to be secure.
|
| 24 | *
|
| 25 | */
|
| 26 | VOID
|
| 27 | EFIAPI
|
| 28 | ArmGicSetSecureInterrupts (
|
| 29 | IN UINTN GicDistributorBase,
|
| 30 | IN UINTN* GicSecureInterruptMask,
|
| 31 | IN UINTN GicSecureInterruptMaskSize
|
| 32 | )
|
| 33 | {
|
| 34 | UINTN Index;
|
| 35 | UINT32 InterruptStatus;
|
| 36 |
|
| 37 | // We must not have more interrupts defined by the mask than the number of available interrupts
|
| 38 | ASSERT(GicSecureInterruptMaskSize <= (ArmGicGetMaxNumInterrupts (GicDistributorBase) / 32));
|
| 39 |
|
| 40 | // Set all the interrupts defined by the mask as Secure
|
| 41 | for (Index = 0; Index < GicSecureInterruptMaskSize; Index++) {
|
| 42 | InterruptStatus = MmioRead32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4));
|
| 43 | MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), InterruptStatus & (~GicSecureInterruptMask[Index]));
|
| 44 | }
|
| 45 | }
|
| 46 |
|
| 47 | VOID
|
| 48 | EFIAPI
|
| 49 | ArmGicEnableDistributor (
|
| 50 | IN INTN GicDistributorBase
|
| 51 | )
|
| 52 | {
|
| 53 | // Turn on the GIC distributor
|
| 54 | MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 1);
|
| 55 | }
|
| 56 |
|
| 57 | VOID
|
| 58 | EFIAPI
|
| 59 | ArmGicSetupNonSecure (
|
| 60 | IN UINTN MpId,
|
| 61 | IN INTN GicDistributorBase,
|
| 62 | IN INTN GicInterruptInterfaceBase
|
| 63 | )
|
| 64 | {
|
| 65 | ArmGicV2SetupNonSecure (MpId, GicDistributorBase, GicInterruptInterfaceBase);
|
| 66 | }
|