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