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