2011-02-01 06:41:42 +01:00
|
|
|
//
|
2013-05-10 14:41:27 +02:00
|
|
|
// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
|
2011-02-01 06:41:42 +01:00
|
|
|
//
|
2014-08-19 15:29:52 +02:00
|
|
|
// 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.
|
2011-02-01 06:41:42 +01:00
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <AutoGen.h>
|
|
|
|
|
|
|
|
INCLUDE AsmMacroIoLib.inc
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
IMPORT CEntryPoint
|
2013-05-10 14:46:11 +02:00
|
|
|
IMPORT ArmPlatformGetCorePosition
|
2013-05-10 14:41:27 +02:00
|
|
|
IMPORT ArmPlatformIsPrimaryCore
|
2011-09-23 01:01:13 +02:00
|
|
|
IMPORT ArmReadMpidr
|
2013-05-10 14:49:10 +02:00
|
|
|
IMPORT ArmPlatformPeiBootAction
|
2011-02-01 06:41:42 +01:00
|
|
|
EXPORT _ModuleEntryPoint
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
PRESERVE8
|
|
|
|
AREA PrePeiCoreEntryPoint, CODE, READONLY
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
StartupAddr DCD CEntryPoint
|
|
|
|
|
|
|
|
_ModuleEntryPoint
|
2013-05-10 14:49:10 +02:00
|
|
|
// Do early platform specific actions
|
|
|
|
bl ArmPlatformPeiBootAction
|
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
// Identify CPU ID
|
2011-09-23 01:01:13 +02:00
|
|
|
bl ArmReadMpidr
|
2013-05-10 14:41:27 +02:00
|
|
|
// Keep a copy of the MpId register value
|
|
|
|
mov r5, r0
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2013-05-10 14:41:27 +02:00
|
|
|
// Is it the Primary Core ?
|
ARM Packages: Replace tabs by spaces for indentation
Replace tabs by spaces for indentation to comply to EDK2 coding standards.
Done in files with extension ".S", ".c", ".h", ".asm", ".dsc", ".inc", "*.inf",
"*.dec" or ".fdf" and located in ArmPkg, ArmPlatformPkg, EmbeddedPkg,
BeagleBoardPkg or Omap35xxPkg.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15901 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 12:14:17 +02:00
|
|
|
bl ArmPlatformIsPrimaryCore
|
2013-05-10 14:41:27 +02:00
|
|
|
|
2012-02-28 18:23:53 +01:00
|
|
|
// Get the top of the primary stacks (and the base of the secondary stacks)
|
2016-08-10 15:50:25 +02:00
|
|
|
mov32 r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)
|
2011-09-23 01:05:20 +02:00
|
|
|
|
2013-05-10 14:41:27 +02:00
|
|
|
// r0 is equal to 1 if I am the primary core
|
|
|
|
cmp r0, #1
|
2011-09-23 01:05:20 +02:00
|
|
|
beq _SetupPrimaryCoreStack
|
|
|
|
|
|
|
|
_SetupSecondaryCoreStack
|
2012-02-28 18:23:53 +01:00
|
|
|
// r1 contains the base of the secondary stacks
|
2011-09-23 01:05:20 +02:00
|
|
|
|
2013-05-10 14:46:11 +02:00
|
|
|
// Get the Core Position
|
|
|
|
mov r6, r1 // Save base of the secondary stacks
|
|
|
|
mov r0, r5
|
|
|
|
bl ArmPlatformGetCorePosition
|
2011-09-23 01:05:20 +02:00
|
|
|
// The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
|
2012-02-28 18:23:53 +01:00
|
|
|
add r0, r0, #1
|
2011-02-01 06:41:42 +01:00
|
|
|
|
2011-09-23 01:05:20 +02:00
|
|
|
// StackOffset = CorePos * StackSize
|
2016-08-10 15:50:25 +02:00
|
|
|
mov32 r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)
|
2012-02-28 18:23:53 +01:00
|
|
|
mul r0, r0, r2
|
2011-09-23 01:05:20 +02:00
|
|
|
// SP = StackBase + StackOffset
|
2013-05-10 14:46:11 +02:00
|
|
|
add sp, r6, r0
|
2011-06-11 14:03:00 +02:00
|
|
|
|
|
|
|
_PrepareArguments
|
2011-02-01 06:41:42 +01:00
|
|
|
// The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
|
2016-08-10 15:50:25 +02:00
|
|
|
mov32 r2, FixedPcdGet32(PcdFvBaseAddress)
|
|
|
|
ldr r1, [r2, #4]
|
2011-02-01 06:41:42 +01:00
|
|
|
|
2012-02-28 18:23:53 +01:00
|
|
|
// Move sec startup address into a data register
|
|
|
|
// Ensure we're jumping to FV version of the code (not boot remapped alias)
|
|
|
|
ldr r3, StartupAddr
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2012-02-28 18:23:53 +01:00
|
|
|
// Jump to PrePeiCore C code
|
2011-09-23 01:01:13 +02:00
|
|
|
// r0 = mp_id
|
2011-02-01 06:41:42 +01:00
|
|
|
// r1 = pei_core_address
|
2012-02-28 18:23:53 +01:00
|
|
|
mov r0, r5
|
|
|
|
blx r3
|
|
|
|
|
|
|
|
_SetupPrimaryCoreStack
|
2015-11-27 18:07:31 +01:00
|
|
|
mov sp, r1
|
2012-02-28 18:23:53 +01:00
|
|
|
b _PrepareArguments
|
2011-02-01 06:41:42 +01:00
|
|
|
|
2011-09-23 01:05:20 +02:00
|
|
|
_NeverReturn
|
|
|
|
b _NeverReturn
|
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
END
|