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