ArmPlatformPkg/ArmVExpressPkg: Add support for ARM Versatile Express A9x4 Model
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12429 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#/* @file
|
||||
# Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#*/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = RTSMArmVExpressLib
|
||||
FILE_GUID = b98a6cb7-d472-4128-ad62-a7347f85ce13
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ArmPlatformLib
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
IoLib
|
||||
ArmLib
|
||||
MemoryAllocationLib
|
||||
SerialPortLib
|
||||
|
||||
[Sources.common]
|
||||
RTSM.c
|
||||
RTSMMem.c
|
||||
|
||||
[FeaturePcd]
|
||||
gEmbeddedTokenSpaceGuid.PcdCacheEnable
|
||||
gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
|
||||
gArmPlatformTokenSpaceGuid.PcdStandalone
|
||||
|
||||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdSystemMemoryBase
|
||||
gArmTokenSpaceGuid.PcdSystemMemorySize
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
@@ -0,0 +1,48 @@
|
||||
#/* @file
|
||||
# Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#*/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = RTSMArmVExpressLib
|
||||
FILE_GUID = 6352e3a0-ed14-4613-bf90-d316014dd142
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ArmPlatformLib
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
IoLib
|
||||
ArmLib
|
||||
SerialPortLib
|
||||
|
||||
[Sources.common]
|
||||
RTSMSec.c
|
||||
RTSM.c
|
||||
RTSMBoot.asm | RVCT
|
||||
RTSMBoot.S | GCC
|
||||
|
||||
[Protocols]
|
||||
|
||||
[FeaturePcd]
|
||||
gEmbeddedTokenSpaceGuid.PcdCacheEnable
|
||||
gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping
|
||||
gArmPlatformTokenSpaceGuid.PcdStandalone
|
||||
|
||||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
196
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
Normal file
196
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
#include <Drivers/SP804Timer.h>
|
||||
|
||||
#include <Ppi/ArmMpCoreInfo.h>
|
||||
|
||||
#include <ArmPlatform.h>
|
||||
|
||||
ARM_CORE_INFO mVersatileExpressMpCoreInfoTable[] = {
|
||||
{
|
||||
// Cluster 0, Core 0
|
||||
0x0, 0x0,
|
||||
|
||||
// MP Core MailBox Set/Get/Clear Addresses and Clear Value
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
|
||||
(UINT64)0xFFFFFFFF
|
||||
},
|
||||
{
|
||||
// Cluster 0, Core 1
|
||||
0x0, 0x1,
|
||||
|
||||
// MP Core MailBox Set/Get/Clear Addresses and Clear Value
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
|
||||
(UINT64)0xFFFFFFFF
|
||||
},
|
||||
{
|
||||
// Cluster 0, Core 2
|
||||
0x0, 0x2,
|
||||
|
||||
// MP Core MailBox Set/Get/Clear Addresses and Clear Value
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
|
||||
(UINT64)0xFFFFFFFF
|
||||
},
|
||||
{
|
||||
// Cluster 0, Core 3
|
||||
0x0, 0x3,
|
||||
|
||||
// MP Core MailBox Set/Get/Clear Addresses and Clear Value
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
|
||||
(EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
|
||||
(UINT64)0xFFFFFFFF
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Return if Trustzone is supported by your platform
|
||||
|
||||
A non-zero value must be returned if you want to support a Secure World on your platform.
|
||||
ArmVExpressTrustzoneInit() will later set up the secure regions.
|
||||
This function can return 0 even if Trustzone is supported by your processor. In this case,
|
||||
the platform will continue to run in Secure World.
|
||||
|
||||
@return A non-zero value if Trustzone supported.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmPlatformTrustzoneSupported (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Not supported yet but model does have Secure SRAM (but no TZPC/TZASC) so we could support it
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Return the current Boot Mode
|
||||
|
||||
This function returns the boot reason on the platform
|
||||
|
||||
@return Return the current Boot Mode of the platform
|
||||
|
||||
**/
|
||||
EFI_BOOT_MODE
|
||||
ArmPlatformGetBootMode (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return BOOT_WITH_FULL_CONFIGURATION;
|
||||
}
|
||||
|
||||
/**
|
||||
Remap the memory at 0x0
|
||||
|
||||
Some platform requires or gives the ability to remap the memory at the address 0x0.
|
||||
This function can do nothing if this feature is not relevant to your platform.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformBootRemapping (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Disable memory remapping and return to normal mapping
|
||||
MmioOr32 (SP810_CTRL_BASE, BIT8);
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize controllers that must setup in the normal world
|
||||
|
||||
This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
|
||||
in the PEI phase.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformNormalInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the system (or sometimes called permanent) memory
|
||||
|
||||
This memory is generally represented by the DRAM.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformInitializeSystemMemory (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Configure periodic timer (TIMER0) for 1MHz operation
|
||||
MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER0_TIMCLK);
|
||||
// Configure 1MHz clock
|
||||
MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER1_TIMCLK);
|
||||
// configure SP810 to use 1MHz clock and disable
|
||||
MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK);
|
||||
// Configure SP810 to use 1MHz clock and disable
|
||||
MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER3_EN, SP810_SYS_CTRL_TIMER3_TIMCLK);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PrePeiCoreGetMpCoreInfo (
|
||||
OUT UINTN *CoreCount,
|
||||
OUT ARM_CORE_INFO **ArmCoreTable
|
||||
)
|
||||
{
|
||||
UINT32 ProcType;
|
||||
|
||||
ProcType = MmioRead32 (ARM_VE_SYS_PROCID0_REG) & ARM_VE_SYS_PROC_ID_MASK;
|
||||
if (ProcType == ARM_VE_SYS_PROC_ID_CORTEX_A9) {
|
||||
// Only support one cluster
|
||||
*CoreCount = ArmGetCpuCountPerCluster ();
|
||||
*ArmCoreTable = mVersatileExpressMpCoreInfoTable;
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
|
||||
EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
|
||||
ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
|
||||
{
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI,
|
||||
&mArmMpCoreInfoPpiGuid,
|
||||
&mMpCoreInfoPpi
|
||||
}
|
||||
};
|
||||
|
||||
VOID
|
||||
ArmPlatformGetPlatformPpiList (
|
||||
OUT UINTN *PpiListSize,
|
||||
OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
|
||||
)
|
||||
{
|
||||
*PpiListSize = sizeof(gPlatformPpiTable);
|
||||
*PpiList = gPlatformPpiTable;
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
//
|
||||
|
||||
#include <AsmMacroIoLib.h>
|
||||
#include <Base.h>
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <AutoGen.h>
|
||||
#include <ArmPlatform.h>
|
||||
|
||||
.text
|
||||
.align 3
|
||||
|
||||
GCC_ASM_EXPORT(ArmPlatformSecBootAction)
|
||||
GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)
|
||||
|
||||
/**
|
||||
Call at the beginning of the platform boot up
|
||||
|
||||
This function allows the firmware platform to do extra actions at the early
|
||||
stage of the platform power up.
|
||||
|
||||
Note: This function must be implemented in assembler as there is no stack set up yet
|
||||
|
||||
**/
|
||||
ASM_PFX(ArmPlatformSecBootAction):
|
||||
bx lr
|
||||
|
||||
/**
|
||||
Initialize the memory where the initial stacks will reside
|
||||
|
||||
This memory can contain the initial stacks (Secure and Secure Monitor stacks).
|
||||
In some platform, this region is already initialized and the implementation of this function can
|
||||
do nothing. This memory can also represent the Secure RAM.
|
||||
This function is called before the satck has been set up. Its implementation must ensure the stack
|
||||
pointer is not used (probably required to use assembly language)
|
||||
|
||||
**/
|
||||
ASM_PFX(ArmPlatformInitializeBootMemory):
|
||||
// The SMC does not need to be initialized for RTSM
|
||||
bx lr
|
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
//
|
||||
|
||||
#include <AsmMacroIoLib.h>
|
||||
#include <Base.h>
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <AutoGen.h>
|
||||
#include <ArmPlatform.h>
|
||||
|
||||
INCLUDE AsmMacroIoLib.inc
|
||||
|
||||
EXPORT ArmPlatformSecBootAction
|
||||
EXPORT ArmPlatformInitializeBootMemory
|
||||
|
||||
PRESERVE8
|
||||
AREA RTSMVExpressBootMode, CODE, READONLY
|
||||
|
||||
/**
|
||||
Call at the beginning of the platform boot up
|
||||
|
||||
This function allows the firmware platform to do extra actions at the early
|
||||
stage of the platform power up.
|
||||
|
||||
Note: This function must be implemented in assembler as there is no stack set up yet
|
||||
|
||||
**/
|
||||
ArmPlatformSecBootAction
|
||||
bx lr
|
||||
|
||||
/**
|
||||
Initialize the memory where the initial stacks will reside
|
||||
|
||||
This memory can contain the initial stacks (Secure and Secure Monitor stacks).
|
||||
In some platform, this region is already initialized and the implementation of this function can
|
||||
do nothing. This memory can also represent the Secure RAM.
|
||||
This function is called before the satck has been set up. Its implementation must ensure the stack
|
||||
pointer is not used (probably required to use assembly language)
|
||||
|
||||
**/
|
||||
ArmPlatformInitializeBootMemory
|
||||
// The SMC does not need to be initialized for RTSM
|
||||
bx lr
|
@@ -0,0 +1,158 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <ArmPlatform.h>
|
||||
|
||||
// Number of Virtual Memory Map Descriptors without a Logic Tile
|
||||
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
|
||||
|
||||
// DDR attributes
|
||||
#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
|
||||
#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
|
||||
#define DDR_ATTRIBUTES_SECURE_CACHED ARM_MEMORY_REGION_ATTRIBUTE_SECURE_WRITE_BACK
|
||||
#define DDR_ATTRIBUTES_SECURE_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_SECURE_UNCACHED_UNBUFFERED
|
||||
|
||||
/**
|
||||
Return the Virtual Memory Map of your platform
|
||||
|
||||
This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
|
||||
|
||||
@param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
|
||||
Virtual Memory mapping. This array must be ended by a zero-filled
|
||||
entry
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformGetVirtualMemoryMap (
|
||||
IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
|
||||
)
|
||||
{
|
||||
ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
|
||||
BOOLEAN bTrustzoneSupport;
|
||||
UINTN Index = 0;
|
||||
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
|
||||
|
||||
ASSERT(VirtualMemoryMap != NULL);
|
||||
|
||||
VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
|
||||
if (VirtualMemoryTable == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if SMC TZASC is enabled. If Trustzone not enabled then all the entries remain in Secure World.
|
||||
// As this value can be changed in the Board Configuration file, the UEFI firmware needs to work for both case
|
||||
if (ArmPlatformTrustzoneSupported ()) {
|
||||
bTrustzoneSupport = TRUE;
|
||||
} else {
|
||||
bTrustzoneSupport = FALSE;
|
||||
}
|
||||
|
||||
if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
|
||||
CacheAttributes = (bTrustzoneSupport ? DDR_ATTRIBUTES_CACHED : DDR_ATTRIBUTES_SECURE_CACHED);
|
||||
} else {
|
||||
CacheAttributes = (bTrustzoneSupport ? DDR_ATTRIBUTES_UNCACHED : DDR_ATTRIBUTES_SECURE_UNCACHED);
|
||||
}
|
||||
|
||||
// ReMap (Either NOR Flash or DRAM)
|
||||
VirtualMemoryTable[Index].PhysicalBase = ARM_VE_REMAP_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_REMAP_BASE;
|
||||
VirtualMemoryTable[Index].Length = ARM_VE_REMAP_SZ;
|
||||
|
||||
if (FeaturePcdGet(PcdNorFlashRemapping)) {
|
||||
// Map the NOR Flash as Secure Memory
|
||||
if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
|
||||
VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_SECURE_CACHED;
|
||||
} else {
|
||||
VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_SECURE_UNCACHED;
|
||||
}
|
||||
} else {
|
||||
// DRAM mapping
|
||||
VirtualMemoryTable[Index].Attributes = CacheAttributes;
|
||||
}
|
||||
|
||||
// DDR
|
||||
VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_DRAM_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_DRAM_BASE;
|
||||
VirtualMemoryTable[Index].Length = ARM_VE_DRAM_SZ;
|
||||
VirtualMemoryTable[Index].Attributes = CacheAttributes;
|
||||
|
||||
// CPU peripherals. TRM. Manual says not all of them are implemented.
|
||||
VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_ON_CHIP_PERIPH_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_ON_CHIP_PERIPH_BASE;
|
||||
VirtualMemoryTable[Index].Length = ARM_VE_ON_CHIP_PERIPH_SZ;
|
||||
VirtualMemoryTable[Index].Attributes = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);
|
||||
|
||||
// SMB CS0-CS1 - NOR Flash 1 & 2
|
||||
VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_NOR0_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_NOR0_BASE;
|
||||
VirtualMemoryTable[Index].Length = ARM_VE_SMB_NOR0_SZ + ARM_VE_SMB_NOR1_SZ;
|
||||
VirtualMemoryTable[Index].Attributes = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);
|
||||
|
||||
// SMB CS2 - SRAM
|
||||
VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_SRAM_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_SRAM_BASE;
|
||||
VirtualMemoryTable[Index].Length = ARM_VE_SMB_SRAM_SZ;
|
||||
VirtualMemoryTable[Index].Attributes = CacheAttributes;
|
||||
|
||||
// Peripheral CS2 and CS3
|
||||
VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_SMB_PERIPH_BASE;
|
||||
VirtualMemoryTable[Index].VirtualBase = ARM_VE_SMB_PERIPH_BASE;
|
||||
VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ;
|
||||
VirtualMemoryTable[Index].Attributes = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);
|
||||
|
||||
//TODO:This should be enabled for final release. Right now, ARM VE RTSM crashes.
|
||||
// // If a Logic Tile is connected to The ARM Versatile Express Motherboard
|
||||
// if (MmioRead32(ARM_VE_SYS_PROCID1_REG) != 0) {
|
||||
// VirtualMemoryTable[++Index].PhysicalBase = ARM_VE_EXT_AXI_BASE;
|
||||
// VirtualMemoryTable[Index].VirtualBase = ARM_VE_EXT_AXI_BASE;
|
||||
// VirtualMemoryTable[Index].Length = ARM_VE_EXT_AXI_SZ;
|
||||
// VirtualMemoryTable[Index].Attributes = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);
|
||||
//
|
||||
// ASSERT((Index + 1) == (MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS + 1));
|
||||
// } else {
|
||||
// ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
||||
// }
|
||||
|
||||
// End of Table
|
||||
VirtualMemoryTable[++Index].PhysicalBase = 0;
|
||||
VirtualMemoryTable[Index].VirtualBase = 0;
|
||||
VirtualMemoryTable[Index].Length = 0;
|
||||
VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
|
||||
|
||||
*VirtualMemoryMap = VirtualMemoryTable;
|
||||
}
|
||||
|
||||
/**
|
||||
Return the EFI Memory Map provided by extension memory on your platform
|
||||
|
||||
This EFI Memory Map of the System Memory is used by MemoryInitPei module to create the Resource
|
||||
Descriptor HOBs used by DXE core.
|
||||
TODO: CompleteMe .... say this is the memory not covered by the System Memory PCDs
|
||||
|
||||
@param[out] EfiMemoryMap Array of ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR describing an
|
||||
EFI Memory region. This array must be ended by a zero-filled entry
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ArmPlatformGetAdditionalSystemMemory (
|
||||
OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
* which accompanies this distribution. The full text of the license may be found at
|
||||
* http://opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/ArmTrustZoneLib.h>
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Drivers/PL310L2Cache.h>
|
||||
|
||||
/**
|
||||
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
|
||||
)
|
||||
{
|
||||
// No TZPC or TZASC on RTSM to initialize
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize controllers that must setup at the early stage
|
||||
|
||||
Some peripherals must be initialized in Secure World.
|
||||
For example, some L2x0 requires to be initialized in Secure World
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformSecInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Call before jumping to Normal World
|
||||
|
||||
This function allows the firmware platform to do extra actions before
|
||||
jumping to the Normal World
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmPlatformSecExtraAction (
|
||||
IN UINTN MpId,
|
||||
OUT UINTN* JumpAddress
|
||||
)
|
||||
{
|
||||
*JumpAddress = PcdGet32(PcdFvBaseAddress);
|
||||
}
|
Reference in New Issue
Block a user