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