]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c
939ca7ed6256713d4daa4457fefec0b476e1666f
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / Arm / DxeLoadFunc.c
1 /** @file
2 ARM specifc functionality for DxeLoad.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.<BR>
6
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #include "DxeIpl.h"
18
19 /**
20 Transfers control to DxeCore.
21
22 This function performs a CPU architecture specific operations to execute
23 the entry point of DxeCore with the parameters of HobList.
24 It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.
25
26 @param DxeCoreEntryPoint The entry point of DxeCore.
27 @param HobList The start of HobList passed to DxeCore.
28
29 **/
30 VOID
31 HandOffToDxeCore (
32 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
33 IN EFI_PEI_HOB_POINTERS HobList
34 )
35 {
36 VOID *BaseOfStack;
37 VOID *TopOfStack;
38 EFI_STATUS Status;
39
40 //
41 // Allocate 128KB for the Stack
42 //
43 BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
44 ASSERT (BaseOfStack != NULL);
45
46 //
47 // Compute the top of the stack we were allocated. Pre-allocate a UINTN
48 // for safety.
49 //
50 TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
51 TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
52
53 //
54 // End of PEI phase singal
55 //
56 Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
57 ASSERT_EFI_ERROR (Status);
58
59 //
60 // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.
61 //
62 UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);
63
64 SwitchStack (
65 (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
66 HobList.Raw,
67 NULL,
68 TopOfStack
69 );
70 }