]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
b27521d896a3b7f7dc60ad04600d0439bdf26781
[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 VOID
18 HandOffToDxeCore (
19 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
20 IN EFI_PEI_HOB_POINTERS HobList,
21 IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
22 )
23 {
24 VOID *BaseOfStack;
25 VOID *TopOfStack;
26 VOID *BspStore;
27 EFI_STATUS Status;
28
29 //
30 // Allocate 128KB for the Stack
31 //
32 BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
33 ASSERT (BaseOfStack != NULL);
34
35 //
36 // Allocate 16KB for the BspStore
37 //
38 BspStore = AllocatePages (EFI_SIZE_TO_PAGES (BSP_STORE_SIZE));
39 ASSERT (BspStore != NULL);
40 //
41 // Build BspStoreHob
42 //
43 BuildBspStoreHob ((EFI_PHYSICAL_ADDRESS) (UINTN) BspStore, BSP_STORE_SIZE, EfiBootServicesData);
44
45 //
46 // Compute the top of the stack we were allocated. Pre-allocate a UINTN
47 // for safety.
48 //
49 TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
50 TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
51
52 //
53 // End of PEI phase singal
54 //
55 Status = PeiServicesInstallPpi (EndOfPeiSignal);
56 ASSERT_EFI_ERROR (Status);
57
58 //
59 // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.
60 //
61 UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);
62
63 SwitchStack (
64 (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
65 HobList.Raw,
66 NULL,
67 TopOfStack,
68 BspStore
69 );
70 }