mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
ArmPlatformPkg/Sec: Allowed the Secondary Cores to set the Secure/Non Secure bits to their PPIs
The GICD_IGROUPR0 is banked for each connected processor. It means the Non-Secure bits for the PPIs (Private Peripheral Interrupts) must be configured for every processor. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13135 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
18029bb911
commit
5e7731443c
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are licensed and made available under the terms and conditions of the BSD License
|
* are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -13,6 +13,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
|
#include <Library/ArmLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
#include <Library/ArmGicLib.h>
|
#include <Library/ArmGicLib.h>
|
||||||
@ -24,6 +25,7 @@
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ArmGicSetupNonSecure (
|
ArmGicSetupNonSecure (
|
||||||
|
IN UINTN MpId,
|
||||||
IN INTN GicDistributorBase,
|
IN INTN GicDistributorBase,
|
||||||
IN INTN GicInterruptInterfaceBase
|
IN INTN GicInterruptInterfaceBase
|
||||||
)
|
)
|
||||||
@ -47,9 +49,15 @@ ArmGicSetupNonSecure (
|
|||||||
MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, InterruptId);
|
MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, InterruptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure all GIC interrupts are Non-Secure
|
// Only the primary core should set the Non Secure bit to the SPIs (Shared Peripheral Interrupt).
|
||||||
for (Index = 0; Index < (PcdGet32(PcdGicNumInterrupts) / 32); Index++) {
|
if (IS_PRIMARY_CORE(MpId)) {
|
||||||
MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), 0xffffffff);
|
// Ensure all GIC interrupts are Non-Secure
|
||||||
|
for (Index = 0; Index < (PcdGet32(PcdGicNumInterrupts) / 32); Index++) {
|
||||||
|
MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), 0xffffffff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// The secondary cores only set the Non Secure bit to their banked PPIs
|
||||||
|
MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR, 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure all interrupts can get through the priority mask
|
// Ensure all interrupts can get through the priority mask
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#/* @file
|
#/* @file
|
||||||
# Copyright (c) 2011, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -28,6 +28,7 @@
|
|||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
ArmLib
|
||||||
DebugLib
|
DebugLib
|
||||||
IoLib
|
IoLib
|
||||||
PcdLib
|
PcdLib
|
||||||
@ -35,3 +36,6 @@
|
|||||||
[FixedPcd.common]
|
[FixedPcd.common]
|
||||||
gArmTokenSpaceGuid.PcdGicNumInterrupts
|
gArmTokenSpaceGuid.PcdGicNumInterrupts
|
||||||
gArmTokenSpaceGuid.PcdGicSgiIntId
|
gArmTokenSpaceGuid.PcdGicSgiIntId
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCore
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are licensed and made available under the terms and conditions of the BSD License
|
* are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -77,6 +77,7 @@
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ArmGicSetupNonSecure (
|
ArmGicSetupNonSecure (
|
||||||
|
IN UINTN MpId,
|
||||||
IN INTN GicDistributorBase,
|
IN INTN GicDistributorBase,
|
||||||
IN INTN GicInterruptInterfaceBase
|
IN INTN GicInterruptInterfaceBase
|
||||||
);
|
);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ArmPlatformTrustzoneInit (
|
ArmPlatformTrustzoneInit (
|
||||||
VOID
|
IN UINTN MpId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
|
@ -52,3 +52,6 @@
|
|||||||
gArmTokenSpaceGuid.PcdTrustzoneSupport
|
gArmTokenSpaceGuid.PcdTrustzoneSupport
|
||||||
|
|
||||||
gArmTokenSpaceGuid.PcdL2x0ControllerBase
|
gArmTokenSpaceGuid.PcdL2x0ControllerBase
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCore
|
||||||
|
@ -32,9 +32,14 @@
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ArmPlatformTrustzoneInit (
|
ArmPlatformTrustzoneInit (
|
||||||
VOID
|
IN UINTN MpId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Nothing to do
|
||||||
|
if (!IS_PRIMARY_CORE(MpId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setup TZ Protection Controller
|
// Setup TZ Protection Controller
|
||||||
//
|
//
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ArmPlatformTrustzoneInit (
|
ArmPlatformTrustzoneInit (
|
||||||
VOID
|
IN UINTN MpId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// No TZPC or TZASC on RTSM to initialize
|
// No TZPC or TZASC on RTSM to initialize
|
||||||
|
@ -140,7 +140,7 @@ ArmPlatformInitializeSystemMemory (
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ArmPlatformTrustzoneInit (
|
ArmPlatformTrustzoneInit (
|
||||||
VOID
|
IN UINTN MpId
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,9 +25,14 @@
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ArmPlatformTrustzoneInit (
|
ArmPlatformTrustzoneInit (
|
||||||
VOID
|
IN UINTN MpId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Secondary cores might have to set the Secure SGIs into the GICD_IGROUPR0
|
||||||
|
if (!IS_PRIMARY_CORE(MpId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#/* @file
|
#/* @file
|
||||||
# Copyright (c) 2011, ARM Limited. All rights reserved.
|
# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -37,3 +37,6 @@
|
|||||||
|
|
||||||
[FixedPcd]
|
[FixedPcd]
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
|
||||||
|
gArmTokenSpaceGuid.PcdArmPrimaryCore
|
||||||
|
@ -144,14 +144,14 @@ TrustedWorldInitialization (
|
|||||||
// Set up Monitor World (Vector Table, etc)
|
// Set up Monitor World (Vector Table, etc)
|
||||||
ArmSecureMonitorWorldInitialize ();
|
ArmSecureMonitorWorldInitialize ();
|
||||||
|
|
||||||
|
// Transfer the interrupt to Non-secure World
|
||||||
|
ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase));
|
||||||
|
|
||||||
|
// Initialize platform specific security policy
|
||||||
|
ArmPlatformTrustzoneInit (MpId);
|
||||||
|
|
||||||
// Setup the Trustzone Chipsets
|
// Setup the Trustzone Chipsets
|
||||||
if (IS_PRIMARY_CORE(MpId)) {
|
if (IS_PRIMARY_CORE(MpId)) {
|
||||||
// Transfer the interrupt to Non-secure World
|
|
||||||
ArmGicSetupNonSecure (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase));
|
|
||||||
|
|
||||||
// Initialize platform specific security policy
|
|
||||||
ArmPlatformTrustzoneInit ();
|
|
||||||
|
|
||||||
if (ArmIsMpCore()) {
|
if (ArmIsMpCore()) {
|
||||||
// Waiting for the Primary Core to have finished to initialize the Secure World
|
// Waiting for the Primary Core to have finished to initialize the Secure World
|
||||||
ArmCpuSynchronizeSignal (ARM_CPU_EVENT_SECURE_INIT);
|
ArmCpuSynchronizeSignal (ARM_CPU_EVENT_SECURE_INIT);
|
||||||
|
@ -74,21 +74,6 @@ ArmPlatformTrustzoneSupported (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize the Secure peripherals and memory regions
|
|
||||||
|
|
||||||
If Trustzone is supported by your platform then this function makes the required initialization
|
|
||||||
of the secure peripherals and memory regions.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
ArmPlatformTrustzoneInit (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ASSERT(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remap the memory at 0x0
|
Remap the memory at 0x0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user