ArmPkg: Create MpCoreInfo PPI and HOB to describe CPU Cores on a MPCore platform
These info are: - ClusterId, CoreId - MailBox Set/Get/Clear address git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12423 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
77de7e5372
commit
44788bae6f
|
@ -2,6 +2,7 @@
|
||||||
# ARM processor package.
|
# ARM processor package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
|
# Copyright (c) 2011, 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
|
||||||
|
@ -41,6 +42,14 @@
|
||||||
[Guids.common]
|
[Guids.common]
|
||||||
gArmTokenSpaceGuid = { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA6, 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } }
|
gArmTokenSpaceGuid = { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA6, 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } }
|
||||||
|
|
||||||
|
## ARM MPCore table
|
||||||
|
# Include/Guid/ArmMpCoreInfo.h
|
||||||
|
gArmMpCoreInfoGuid = { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }
|
||||||
|
|
||||||
|
[Ppis]
|
||||||
|
## Include/Ppi/ArmMpCoreInfo.h
|
||||||
|
gArmMpCoreInfoPpiGuid = { 0x6847cc74, 0xe9ec, 0x4f8f, {0xa2, 0x9d, 0xab, 0x44, 0xe7, 0x54, 0xa8, 0xfc} }
|
||||||
|
|
||||||
[Protocols.common]
|
[Protocols.common]
|
||||||
gVirtualUncachedPagesProtocolGuid = { 0xAD651C7D, 0x3C22, 0x4DBF, { 0x92, 0xe8, 0x38, 0xa7, 0xcd, 0xae, 0x87, 0xb2 } }
|
gVirtualUncachedPagesProtocolGuid = { 0xAD651C7D, 0x3C22, 0x4DBF, { 0x92, 0xe8, 0x38, 0xa7, 0xcd, 0xae, 0x87, 0xb2 } }
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,12 @@ CpuDxeInitialize (
|
||||||
//
|
//
|
||||||
SyncCacheConfig (&mCpu);
|
SyncCacheConfig (&mCpu);
|
||||||
|
|
||||||
|
// If the platform is a MPCore system then install the Configuration Table describing the
|
||||||
|
// secondary core states
|
||||||
|
if (ArmIsMPCore()) {
|
||||||
|
PublishArmProcessorTable();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setup a callback for idle events
|
// Setup a callback for idle events
|
||||||
//
|
//
|
||||||
|
|
|
@ -124,6 +124,20 @@ ConvertSectionToPages (
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress
|
IN EFI_PHYSICAL_ADDRESS BaseAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish ARM Processor Data table in UEFI SYSTEM Table.
|
||||||
|
* @param HobStart Pointer to the beginning of the HOB List from PEI.
|
||||||
|
*
|
||||||
|
* Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.
|
||||||
|
* If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory
|
||||||
|
* and a pointer is assigned to it in ARM processor table. Then the ARM processor table is
|
||||||
|
* installed in EFI configuration table.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PublishArmProcessorTable(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
extern VIRTUAL_UNCACHED_PAGES_PROTOCOL gVirtualUncachedPages;
|
extern VIRTUAL_UNCACHED_PAGES_PROTOCOL gVirtualUncachedPages;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
[Sources.ARM]
|
[Sources.ARM]
|
||||||
CpuDxe.c
|
CpuDxe.c
|
||||||
CpuDxe.h
|
CpuDxe.h
|
||||||
|
CpuMpCore.c
|
||||||
Exception.c
|
Exception.c
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
#
|
#
|
||||||
ExceptionSupport.ARMv6.asm | RVCT
|
ExceptionSupport.ARMv6.asm | RVCT
|
||||||
ExceptionSupport.ARMv6.S | GCC
|
ExceptionSupport.ARMv6.S | GCC
|
||||||
Mmu.c
|
Mmu.c
|
||||||
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
|
@ -50,13 +51,16 @@
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
ArmLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
CacheMaintenanceLib
|
CacheMaintenanceLib
|
||||||
CpuLib
|
CpuLib
|
||||||
DebugLib
|
DebugLib
|
||||||
DefaultExceptionHandlerLib
|
DefaultExceptionHandlerLib
|
||||||
DxeServicesTableLib
|
DxeServicesTableLib
|
||||||
|
HobLib
|
||||||
PeCoffGetEntryPointLib
|
PeCoffGetEntryPointLib
|
||||||
|
UefiDriverEntryPoint
|
||||||
UefiLib
|
UefiLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
|
@ -66,6 +70,7 @@
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiDebugImageInfoTableGuid
|
gEfiDebugImageInfoTableGuid
|
||||||
|
gArmMpCoreInfoGuid
|
||||||
gIdleLoopEventGuid
|
gIdleLoopEventGuid
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/** @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/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
|
#include <Guid/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
|
ARM_PROCESSOR_TABLE mArmProcessorTableTemplate = {
|
||||||
|
{
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_SIGNATURE,
|
||||||
|
0,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_REVISION,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_OEM_ID,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_OEM_TABLE_ID,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_OEM_REVISION,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_CREATOR_ID,
|
||||||
|
EFI_ARM_PROCESSOR_TABLE_CREATOR_REVISION,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
}, //ARM Processor table header
|
||||||
|
0, // Number of entries in ARM processor Table
|
||||||
|
NULL // ARM Processor Table
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Publish ARM Processor Data table in UEFI SYSTEM Table.
|
||||||
|
* @param: HobStart Pointer to the beginning of the HOB List from PEI.
|
||||||
|
*
|
||||||
|
* Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.
|
||||||
|
* If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory
|
||||||
|
* and a pointer is assigned to it in ARM processor table. Then the ARM processor table is
|
||||||
|
* installed in EFI configuration table.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PublishArmProcessorTable (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
|
|
||||||
|
Hob.Raw = GetHobList ();
|
||||||
|
|
||||||
|
// Iterate through the HOBs and find if there is ARM PROCESSOR ENTRY HOB
|
||||||
|
for (; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
|
||||||
|
// Check for Correct HOB type
|
||||||
|
if ((GET_HOB_TYPE (Hob)) == EFI_HOB_TYPE_GUID_EXTENSION) {
|
||||||
|
// Check for correct GUID type
|
||||||
|
if (CompareGuid(&(Hob.Guid->Name), &gArmMpCoreInfoGuid)) {
|
||||||
|
ARM_PROCESSOR_TABLE *ArmProcessorTable;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
// Allocate Runtime memory for ARM processor table
|
||||||
|
ArmProcessorTable = (ARM_PROCESSOR_TABLE*)AllocateRuntimePool(sizeof(ARM_PROCESSOR_TABLE));
|
||||||
|
|
||||||
|
// Check if the memory allocation is succesful or not
|
||||||
|
ASSERT(NULL != ArmProcessorTable);
|
||||||
|
|
||||||
|
// Set ARM processor table to default values
|
||||||
|
CopyMem(ArmProcessorTable,&mArmProcessorTableTemplate,sizeof(ARM_PROCESSOR_TABLE));
|
||||||
|
|
||||||
|
// Fill in Length fields of ARM processor table
|
||||||
|
ArmProcessorTable->Header.Length = sizeof(ARM_PROCESSOR_TABLE);
|
||||||
|
ArmProcessorTable->Header.DataLen = GET_GUID_HOB_DATA_SIZE(Hob);
|
||||||
|
|
||||||
|
// Fill in Identifier(ARM processor table GUID)
|
||||||
|
ArmProcessorTable->Header.Identifier = gArmMpCoreInfoGuid;
|
||||||
|
|
||||||
|
// Set Number of ARM core entries in the Table
|
||||||
|
ArmProcessorTable->NumberOfEntries = GET_GUID_HOB_DATA_SIZE(Hob)/sizeof(ARM_CORE_INFO);
|
||||||
|
|
||||||
|
// Allocate runtime memory for ARM processor Table entries
|
||||||
|
ArmProcessorTable->ArmCpus = (ARM_CORE_INFO*)AllocateRuntimePool (
|
||||||
|
ArmProcessorTable->NumberOfEntries * sizeof(ARM_CORE_INFO));
|
||||||
|
|
||||||
|
// Check if the memory allocation is succesful or not
|
||||||
|
ASSERT(NULL != ArmProcessorTable->ArmCpus);
|
||||||
|
|
||||||
|
// Copy ARM Processor Table data from HOB list to newly allocated memory
|
||||||
|
CopyMem(ArmProcessorTable->ArmCpus,GET_GUID_HOB_DATA(Hob), ArmProcessorTable->Header.DataLen);
|
||||||
|
|
||||||
|
// Install the ARM Processor table into EFI system configuration table
|
||||||
|
Status = gBS->InstallConfigurationTable (&gArmMpCoreInfoGuid, ArmProcessorTable);
|
||||||
|
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||||
Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2011, ARM Limited. All rights reserved.<BR>
|
||||||
|
|
||||||
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
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -29,12 +31,14 @@ Abstract:
|
||||||
//
|
//
|
||||||
// The protocols, PPI and GUID defintions for this module
|
// The protocols, PPI and GUID defintions for this module
|
||||||
//
|
//
|
||||||
|
#include <Ppi/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Library classes this module consumes
|
// The Library classes this module consumes
|
||||||
//
|
//
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/PeimEntryPoint.h>
|
#include <Library/PeimEntryPoint.h>
|
||||||
|
#include <Library/PeiServicesLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
#include <Library/ArmLib.h>
|
#include <Library/ArmLib.h>
|
||||||
|
@ -54,7 +58,7 @@ FindMainMemory (
|
||||||
{
|
{
|
||||||
EFI_PEI_HOB_POINTERS NextHob;
|
EFI_PEI_HOB_POINTERS NextHob;
|
||||||
|
|
||||||
// look at the resource descriptor hobs, choose the first system memory one
|
// Look at the resource descriptor hobs, choose the first system memory one
|
||||||
NextHob.Raw = GetHobList ();
|
NextHob.Raw = GetHobList ();
|
||||||
while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) {
|
while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) {
|
||||||
if(NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY)
|
if(NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY)
|
||||||
|
@ -75,7 +79,7 @@ ConfigureMmu (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
UINT32 CacheAttributes;
|
UINT32 CacheAttributes;
|
||||||
UINT32 SystemMemoryBase;
|
UINT32 SystemMemoryBase;
|
||||||
|
@ -99,7 +103,7 @@ ConfigureMmu (
|
||||||
|
|
||||||
SystemMemoryLastAddress = SystemMemoryBase + (SystemMemoryLength-1);
|
SystemMemoryLastAddress = SystemMemoryBase + (SystemMemoryLength-1);
|
||||||
|
|
||||||
// if system memory does not begin at 0
|
// If system memory does not begin at 0
|
||||||
if(SystemMemoryBase > 0) {
|
if(SystemMemoryBase > 0) {
|
||||||
MemoryTable[Idx].PhysicalBase = 0;
|
MemoryTable[Idx].PhysicalBase = 0;
|
||||||
MemoryTable[Idx].VirtualBase = 0;
|
MemoryTable[Idx].VirtualBase = 0;
|
||||||
|
@ -114,7 +118,7 @@ ConfigureMmu (
|
||||||
MemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;
|
MemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;
|
||||||
Idx++;
|
Idx++;
|
||||||
|
|
||||||
// if system memory does not go to the last address (0xFFFFFFFF)
|
// If system memory does not go to the last address (0xFFFFFFFF)
|
||||||
if( SystemMemoryLastAddress < MAX_ADDRESS ) {
|
if( SystemMemoryLastAddress < MAX_ADDRESS ) {
|
||||||
MemoryTable[Idx].PhysicalBase = SystemMemoryLastAddress + 1;
|
MemoryTable[Idx].PhysicalBase = SystemMemoryLastAddress + 1;
|
||||||
MemoryTable[Idx].VirtualBase = MemoryTable[Idx].PhysicalBase;
|
MemoryTable[Idx].VirtualBase = MemoryTable[Idx].PhysicalBase;
|
||||||
|
@ -138,13 +142,6 @@ ConfigureMmu (
|
||||||
BuildMemoryAllocationHob((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData);
|
BuildMemoryAllocationHob((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InitializeCpuPeim (
|
|
||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
|
||||||
)
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -161,14 +158,37 @@ Returns:
|
||||||
Status - EFI_SUCCESS if the boot mode could be set
|
Status - EFI_SUCCESS if the boot mode could be set
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitializeCpuPeim (
|
||||||
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
|
||||||
|
UINTN ArmCoreCount;
|
||||||
|
ARM_CORE_INFO *ArmCoreInfoTable;
|
||||||
|
|
||||||
// Enable program flow prediction, if supported.
|
// Enable program flow prediction, if supported.
|
||||||
ArmEnableBranchPrediction ();
|
ArmEnableBranchPrediction ();
|
||||||
|
|
||||||
// publish the CPU memory and io spaces sizes
|
// Publish the CPU memory and io spaces sizes
|
||||||
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
|
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
|
||||||
|
|
||||||
ConfigureMmu();
|
//ConfigureMmu();
|
||||||
|
|
||||||
|
// Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
|
||||||
|
Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID**)&ArmMpCoreInfoPpi);
|
||||||
|
if (!EFI_ERROR(Status)) {
|
||||||
|
// Build the MP Core Info Table
|
||||||
|
ArmCoreCount = 0;
|
||||||
|
Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
|
||||||
|
if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {
|
||||||
|
// Build MPCore Info HOB
|
||||||
|
BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
ArmLib
|
ArmLib
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
|
gArmMpCoreInfoPpiGuid
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gArmMpCoreInfoGuid
|
||||||
|
|
||||||
[FixedPcd]
|
[FixedPcd]
|
||||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
|
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/** @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.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __ARM_MP_CORE_INFO_GUID_H_
|
||||||
|
#define __ARM_MP_CORE_INFO_GUID_H_
|
||||||
|
|
||||||
|
#define MAX_CPUS_PER_MPCORE_SYSTEM 0x04
|
||||||
|
#define SCU_CONFIG_REG_OFFSET 0x04
|
||||||
|
#define MPIDR_U_BIT_MASK 0x40000000
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 ClusterId;
|
||||||
|
UINT32 CoreId;
|
||||||
|
|
||||||
|
// MP Core Mailbox
|
||||||
|
EFI_PHYSICAL_ADDRESS MailboxSetAddress;
|
||||||
|
EFI_PHYSICAL_ADDRESS MailboxGetAddress;
|
||||||
|
EFI_PHYSICAL_ADDRESS MailboxClearAddress;
|
||||||
|
UINT64 MailboxClearValue;
|
||||||
|
} ARM_CORE_INFO;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
UINT64 Signature;
|
||||||
|
UINT32 Length;
|
||||||
|
UINT32 Revision;
|
||||||
|
UINT64 OemId;
|
||||||
|
UINT64 OemTableId;
|
||||||
|
UINTN OemRevision;
|
||||||
|
UINTN CreatorId;
|
||||||
|
UINTN CreatorRevision;
|
||||||
|
EFI_GUID Identifier;
|
||||||
|
UINTN DataLen;
|
||||||
|
} ARM_PROCESSOR_TABLE_HEADER;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ARM_PROCESSOR_TABLE_HEADER Header;
|
||||||
|
UINTN NumberOfEntries;
|
||||||
|
ARM_CORE_INFO *ArmCpus;
|
||||||
|
} ARM_PROCESSOR_TABLE;
|
||||||
|
|
||||||
|
|
||||||
|
#define ARM_MP_CORE_INFO_GUID \
|
||||||
|
{ 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }
|
||||||
|
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_SIGNATURE SIGNATURE_64 ('C', 'P', 'U', 'T', 'A', 'B', 'L', 'E')
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_REVISION 0x00010000 //1.0
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_OEM_ID SIGNATURE_64('A','R','M',' ', 'L', 't', 'd', ' ')
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_OEM_TABLE_ID SIGNATURE_64('V', 'E', 'R', 'S', 'A', 'T', 'I', 'L')
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_OEM_REVISION 0x00000001
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_CREATOR_ID 0xA5A5A5A5
|
||||||
|
#define EFI_ARM_PROCESSOR_TABLE_CREATOR_REVISION 0x01000001
|
||||||
|
|
||||||
|
extern EFI_GUID gArmMpCoreInfoGuid;
|
||||||
|
|
||||||
|
#endif /* MPCOREINFO_H_ */
|
|
@ -0,0 +1,58 @@
|
||||||
|
/** @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.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __ARM_MP_CORE_INFO_PPI_H__
|
||||||
|
#define __ARM_MP_CORE_INFO_PPI_H_
|
||||||
|
|
||||||
|
#include <Guid/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
|
#define ARM_MP_CORE_INFO_PPI_GUID \
|
||||||
|
{ 0x6847cc74, 0xe9ec, 0x4f8f, {0xa2, 0x9d, 0xab, 0x44, 0xe7, 0x54, 0xa8, 0xfc} }
|
||||||
|
|
||||||
|
/**
|
||||||
|
This service of the EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
|
||||||
|
permanent memory.
|
||||||
|
|
||||||
|
@param PeiServices Pointer to the PEI Services Table.
|
||||||
|
@param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
|
||||||
|
Temporary RAM contents.
|
||||||
|
@param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
|
||||||
|
Temporary RAM contents.
|
||||||
|
@param CopySize Amount of memory to migrate from temporary to permanent memory.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The data was successfully returned.
|
||||||
|
@retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
|
||||||
|
TemporaryMemoryBase > PermanentMemoryBase.
|
||||||
|
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
EFI_STATUS
|
||||||
|
(EFIAPI * ARM_MP_CORE_INFO_GET) (
|
||||||
|
OUT UINTN *ArmCoreCount,
|
||||||
|
OUT ARM_CORE_INFO **ArmCoreTable
|
||||||
|
);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This service abstracts the ability to migrate contents of the platform early memory store.
|
||||||
|
/// Note: The name EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI is different from the current PI 1.2 spec.
|
||||||
|
/// This PPI was optional.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
ARM_MP_CORE_INFO_GET GetMpCoreInfo;
|
||||||
|
} ARM_MP_CORE_INFO_PPI;
|
||||||
|
|
||||||
|
extern EFI_GUID gArmMpCoreInfoPpiGuid;
|
||||||
|
extern EFI_GUID gArmMpCoreInfoGuid;
|
||||||
|
|
||||||
|
#endif
|
|
@ -452,6 +452,7 @@
|
||||||
}
|
}
|
||||||
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
Nt32Pkg/BootModePei/BootModePei.inf
|
Nt32Pkg/BootModePei/BootModePei.inf
|
||||||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -460,6 +460,7 @@
|
||||||
}
|
}
|
||||||
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
Nt32Pkg/BootModePei/BootModePei.inf
|
Nt32Pkg/BootModePei/BootModePei.inf
|
||||||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -194,6 +194,7 @@ READ_LOCK_STATUS = TRUE
|
||||||
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
||||||
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
INF ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||||
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -194,6 +194,7 @@ READ_LOCK_STATUS = TRUE
|
||||||
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
||||||
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
INF ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||||
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -119,6 +119,9 @@
|
||||||
// L2x0 Cache Controller Base Address
|
// L2x0 Cache Controller Base Address
|
||||||
//#define ARM_EB_L2x0_CTLR_BASE 0x1E00A000*/
|
//#define ARM_EB_L2x0_CTLR_BASE 0x1E00A000*/
|
||||||
|
|
||||||
|
#define ARM_EB_SYS_PROC_ID_MASK (0xFF << 24)
|
||||||
|
#define ARM_EB_SYS_PROC_ID_CORTEX_A8 (0x0E << 24)
|
||||||
|
#define ARM_EB_SYS_PROC_ID_CORTEX_A9 (0x0C << 24)
|
||||||
|
|
||||||
/*******************************************
|
/*******************************************
|
||||||
// EFI Memory Map in Permanent Memory (DRAM)
|
// EFI Memory Map in Permanent Memory (DRAM)
|
||||||
|
|
|
@ -20,8 +20,33 @@
|
||||||
#include <Drivers/PL341Dmc.h>
|
#include <Drivers/PL341Dmc.h>
|
||||||
#include <Drivers/SP804Timer.h>
|
#include <Drivers/SP804Timer.h>
|
||||||
|
|
||||||
|
#include <Ppi/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
#include <ArmPlatform.h>
|
#include <ArmPlatform.h>
|
||||||
|
|
||||||
|
ARM_CORE_INFO mRealViewEbMpCoreInfoTable[] = {
|
||||||
|
{
|
||||||
|
// Cluster 0, Core 0
|
||||||
|
0x0, 0x0,
|
||||||
|
|
||||||
|
// MP Core MailBox Set/Get/Clear Addresses and Clear Value
|
||||||
|
(EFI_PHYSICAL_ADDRESS)ARM_EB_SYS_FLAGS_REG,
|
||||||
|
(EFI_PHYSICAL_ADDRESS)ARM_EB_SYS_FLAGS_SET_REG,
|
||||||
|
(EFI_PHYSICAL_ADDRESS)ARM_EB_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_EB_SYS_FLAGS_REG,
|
||||||
|
(EFI_PHYSICAL_ADDRESS)ARM_EB_SYS_FLAGS_SET_REG,
|
||||||
|
(EFI_PHYSICAL_ADDRESS)ARM_EB_SYS_FLAGS_CLR_REG,
|
||||||
|
(UINT64)0xFFFFFFFF
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return if Trustzone is supported by your platform
|
Return if Trustzone is supported by your platform
|
||||||
|
|
||||||
|
@ -107,13 +132,41 @@ ArmPlatformInitializeSystemMemory (
|
||||||
{
|
{
|
||||||
// We do not need to initialize the System Memory on RTSM
|
// We do not need to initialize the System Memory on RTSM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
PrePeiCoreGetMpCoreInfo (
|
||||||
|
OUT UINTN *CoreCount,
|
||||||
|
OUT ARM_CORE_INFO **ArmCoreTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if ((MmioRead32 (ARM_EB_SYS_PROCID0_REG) & ARM_EB_SYS_PROC_ID_MASK) == ARM_EB_SYS_PROC_ID_CORTEX_A9) {
|
||||||
|
*CoreCount = sizeof(mRealViewEbMpCoreInfoTable) / sizeof(ARM_CORE_INFO);
|
||||||
|
*ArmCoreTable = mRealViewEbMpCoreInfoTable;
|
||||||
|
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
|
VOID
|
||||||
ArmPlatformGetPlatformPpiList (
|
ArmPlatformGetPlatformPpiList (
|
||||||
OUT UINTN *PpiListSize,
|
OUT UINTN *PpiListSize,
|
||||||
OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
|
OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*PpiListSize = 0;
|
*PpiListSize = sizeof(gPlatformPpiTable);
|
||||||
*PpiList = NULL;
|
*PpiList = gPlatformPpiTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,7 @@
|
||||||
}
|
}
|
||||||
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
Nt32Pkg/BootModePei/BootModePei.inf
|
Nt32Pkg/BootModePei/BootModePei.inf
|
||||||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -226,6 +226,7 @@ READ_LOCK_STATUS = TRUE
|
||||||
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
||||||
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
|
||||||
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
|
INF ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||||
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||||
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||||
|
|
|
@ -62,8 +62,11 @@
|
||||||
// VRAM offset for the PL111 Colour LCD Controller on the motherboard
|
// VRAM offset for the PL111 Colour LCD Controller on the motherboard
|
||||||
#define VRAM_MOTHERBOARD_BASE (ARM_VE_SMB_PERIPH_BASE + 0x00000)
|
#define VRAM_MOTHERBOARD_BASE (ARM_VE_SMB_PERIPH_BASE + 0x00000)
|
||||||
|
|
||||||
#define SYS_PROC_ID_UNSUPPORTED 0xFF
|
#define ARM_VE_SYS_PROC_ID_MASK (0xFF << 24)
|
||||||
#define SYS_PROC_ID_CORTEX_A9 0x0C
|
#define ARM_VE_SYS_PROC_ID_UNSUPPORTED (0xFF << 24)
|
||||||
|
#define ARM_VE_SYS_PROC_ID_CORTEX_A9 (0x0C << 24)
|
||||||
|
#define ARM_VE_SYS_PROC_ID_CORTEX_A5 (0x12 << 24)
|
||||||
|
#define ARM_VE_SYS_PROC_ID_CORTEX_A15 (0x14 << 24)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sites where the peripheral is fitted
|
// Sites where the peripheral is fitted
|
||||||
|
|
|
@ -23,10 +23,55 @@
|
||||||
#include <Drivers/PL301Axi.h>
|
#include <Drivers/PL301Axi.h>
|
||||||
#include <Drivers/SP804Timer.h>
|
#include <Drivers/SP804Timer.h>
|
||||||
|
|
||||||
|
#include <Ppi/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
#include <ArmPlatform.h>
|
#include <ArmPlatform.h>
|
||||||
|
|
||||||
#define SerialPrint(txt) SerialPortWrite ((UINT8*)(txt), AsciiStrLen(txt)+1);
|
#define SerialPrint(txt) SerialPortWrite ((UINT8*)(txt), AsciiStrLen(txt)+1);
|
||||||
|
|
||||||
|
ARM_CORE_INFO mVersatileExpressMpCoreInfoCTA9x4[] = {
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// DDR2 timings
|
// DDR2 timings
|
||||||
PL341_DMC_CONFIG DDRTimings = {
|
PL341_DMC_CONFIG DDRTimings = {
|
||||||
.MaxChip = 1,
|
.MaxChip = 1,
|
||||||
|
@ -154,13 +199,38 @@ ArmPlatformInitializeSystemMemory (
|
||||||
PL341DmcInit(ARM_VE_DMC_BASE, &DDRTimings);
|
PL341DmcInit(ARM_VE_DMC_BASE, &DDRTimings);
|
||||||
PL301AxiInit(ARM_VE_FAXI_BASE);
|
PL301AxiInit(ARM_VE_FAXI_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
PrePeiCoreGetMpCoreInfo (
|
||||||
|
OUT UINTN *CoreCount,
|
||||||
|
OUT ARM_CORE_INFO **ArmCoreTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*CoreCount = sizeof(mVersatileExpressMpCoreInfoCTA9x4) / sizeof(ARM_CORE_INFO);
|
||||||
|
*ArmCoreTable = mVersatileExpressMpCoreInfoCTA9x4;
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
VOID
|
||||||
ArmPlatformGetPlatformPpiList (
|
ArmPlatformGetPlatformPpiList (
|
||||||
OUT UINTN *PpiListSize,
|
OUT UINTN *PpiListSize,
|
||||||
OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
|
OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*PpiListSize = 0;
|
*PpiListSize = sizeof(gPlatformPpiTable);
|
||||||
*PpiList = NULL;
|
*PpiList = gPlatformPpiTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ PlatformPeim (
|
||||||
// Initialize the platform specific controllers
|
// Initialize the platform specific controllers
|
||||||
ArmPlatformNormalInitialize ();
|
ArmPlatformNormalInitialize ();
|
||||||
|
|
||||||
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
|
|
||||||
|
|
||||||
BuildFvHob (PcdGet32(PcdFvBaseAddress), PcdGet32(PcdFvSize));
|
BuildFvHob (PcdGet32(PcdFvBaseAddress), PcdGet32(PcdFvSize));
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Library/ArmGicLib.h>
|
#include <Library/ArmGicLib.h>
|
||||||
#include <Library/ArmMPCoreMailBoxLib.h>
|
|
||||||
|
#include <Ppi/ArmMpCoreInfo.h>
|
||||||
|
|
||||||
#include <Chipset/ArmV7.h>
|
#include <Chipset/ArmV7.h>
|
||||||
|
|
||||||
#include "PrePeiCore.h"
|
#include "PrePeiCore.h"
|
||||||
|
@ -33,23 +35,63 @@ SecondaryMain (
|
||||||
IN UINTN MpId
|
IN UINTN MpId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Function pointer to Secondary Core entry point
|
EFI_STATUS Status;
|
||||||
VOID (*secondary_start)(VOID);
|
UINTN PpiListSize;
|
||||||
UINTN secondary_entry_addr=0;
|
UINTN PpiListCount;
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR *PpiList;
|
||||||
|
ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
|
||||||
|
UINTN Index;
|
||||||
|
UINTN ArmCoreCount;
|
||||||
|
ARM_CORE_INFO *ArmCoreInfoTable;
|
||||||
|
UINT32 ClusterId;
|
||||||
|
UINT32 CoreId;
|
||||||
|
VOID (*SecondaryStart)(VOID);
|
||||||
|
UINTN SecondaryEntryAddr;
|
||||||
|
|
||||||
|
ClusterId = GET_CLUSTER_ID(MpId);
|
||||||
|
CoreId = GET_CORE_ID(MpId);
|
||||||
|
|
||||||
|
// Get the gArmMpCoreInfoPpiGuid
|
||||||
|
PpiListSize = 0;
|
||||||
|
ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);
|
||||||
|
PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);
|
||||||
|
for (Index = 0; Index < PpiListCount; Index++, PpiList++) {
|
||||||
|
if (CompareGuid (PpiList->Guid, &gArmMpCoreInfoPpiGuid) == TRUE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On MP Core Platform we must implement the ARM MP Core Info PPI
|
||||||
|
ASSERT (Index != PpiListCount);
|
||||||
|
|
||||||
|
ArmMpCoreInfoPpi = PpiList->Ppi;
|
||||||
|
ArmCoreCount = 0;
|
||||||
|
Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
// Find the core in the ArmCoreTable
|
||||||
|
for (Index = 0; Index < ArmCoreCount; Index++) {
|
||||||
|
if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ARM Core Info Table must define every core
|
||||||
|
ASSERT (Index != ArmCoreCount);
|
||||||
|
|
||||||
// Clear Secondary cores MailBox
|
// Clear Secondary cores MailBox
|
||||||
ArmClearMPCoreMailbox();
|
MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue);
|
||||||
|
|
||||||
while (secondary_entry_addr = ArmGetMPCoreMailbox(), secondary_entry_addr == 0) {
|
SecondaryEntryAddr = 0;
|
||||||
ArmCallWFI();
|
while (SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress), SecondaryEntryAddr == 0) {
|
||||||
|
ArmCallWFI ();
|
||||||
// Acknowledge the interrupt and send End of Interrupt signal.
|
// Acknowledge the interrupt and send End of Interrupt signal.
|
||||||
ArmGicAcknowledgeSgiFrom (PcdGet32(PcdGicInterruptInterfaceBase), PRIMARY_CORE_ID);
|
ArmGicAcknowledgeSgiFrom (PcdGet32(PcdGicInterruptInterfaceBase), PRIMARY_CORE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
secondary_start = (VOID (*)())secondary_entry_addr;
|
|
||||||
|
|
||||||
// Jump to secondary core entry point.
|
// Jump to secondary core entry point.
|
||||||
secondary_start();
|
SecondaryStart = (VOID (*)())SecondaryEntryAddr;
|
||||||
|
SecondaryStart();
|
||||||
|
|
||||||
// The secondaries shouldn't reach here
|
// The secondaries shouldn't reach here
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiTemporaryRamSupportPpiGuid
|
gEfiTemporaryRamSupportPpiGuid
|
||||||
gArmGlobalVariablePpiGuid
|
gArmGlobalVariablePpiGuid
|
||||||
|
gArmMpCoreInfoPpiGuid
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
|
gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores
|
||||||
|
|
|
@ -131,6 +131,9 @@ PrePiMain (
|
||||||
// Declare the Global Variable HOB
|
// Declare the Global Variable HOB
|
||||||
BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));
|
BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));
|
||||||
|
|
||||||
|
//TODO: Call CpuPei as a library
|
||||||
|
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
|
||||||
|
|
||||||
// Set the Boot Mode
|
// Set the Boot Mode
|
||||||
SetBootMode (ArmPlatformGetBootMode ());
|
SetBootMode (ArmPlatformGetBootMode ());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue