git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1436 6f19259b...
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / DxeIpl.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 DxeIpl.h
15
16 Abstract:
17
18 --*/
19
20 #ifndef __PEI_DXEIPL_H__
21 #define __PEI_DXEIPL_H__
22
23 #define STACK_SIZE 0x20000
24 #define BSP_STORE_SIZE 0x4000
25
26 extern BOOLEAN gInMemory;
27
28 /**
29 Transfers control to a function starting with a new stack.
30
31 Transfers control to the function specified by EntryPoint using the new stack
32 specified by NewStack and passing in the parameters specified by Context1 and
33 Context2. Context1 and Context2 are optional and may be NULL. The function
34 EntryPoint must never return.
35
36 If EntryPoint is NULL, then ASSERT().
37 If NewStack is NULL, then ASSERT().
38
39 @param EntryPoint A pointer to function to call with the new stack.
40 @param Context1 A pointer to the context to pass into the EntryPoint
41 function.
42 @param Context2 A pointer to the context to pass into the EntryPoint
43 function.
44 @param NewStack A pointer to the new stack to use for the EntryPoint
45 function.
46 @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
47 Reserved on other architectures.
48
49 **/
50 VOID
51 EFIAPI
52 SwitchIplStacks (
53 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
54 IN VOID *Context1, OPTIONAL
55 IN VOID *Context2, OPTIONAL
56 IN VOID *NewStack,
57 IN VOID *NewBsp
58 );
59
60 EFI_STATUS
61 PeiFindFile (
62 IN UINT8 Type,
63 IN UINT16 SectionType,
64 OUT EFI_GUID *FileName,
65 OUT VOID **Pe32Data
66 )
67 ;
68
69 EFI_STATUS
70 PeiLoadFile (
71 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader,
72 IN VOID *Pe32Data,
73 OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
74 OUT UINT64 *ImageSize,
75 OUT EFI_PHYSICAL_ADDRESS *EntryPoint
76 )
77 ;
78
79
80 EFI_STATUS
81 CreateArchSpecificHobs (
82 OUT EFI_PHYSICAL_ADDRESS *BspStore
83 )
84 ;
85
86 EFI_STATUS
87 GetImageReadFunction (
88 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
89 )
90 ;
91
92 EFI_STATUS
93 PeiImageRead (
94 IN VOID *FileHandle,
95 IN UINTN FileOffset,
96 IN OUT UINTN *ReadSize,
97 OUT VOID *Buffer
98 )
99 ;
100
101 EFI_STATUS
102 EFIAPI
103 DxeIplLoadFile (
104 IN EFI_PEI_FV_FILE_LOADER_PPI *This,
105 IN EFI_FFS_FILE_HEADER *FfsHeader,
106 OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
107 OUT UINT64 *ImageSize,
108 OUT EFI_PHYSICAL_ADDRESS *EntryPoint
109 );
110
111 EFI_STATUS
112 ShadowDxeIpl (
113 IN EFI_FFS_FILE_HEADER *DxeIpl,
114 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader
115 );
116
117 EFI_STATUS
118 EFIAPI
119 DxeLoadCore (
120 IN EFI_DXE_IPL_PPI *This,
121 IN EFI_PEI_SERVICES **PeiServices,
122 IN EFI_PEI_HOB_POINTERS HobList
123 );
124
125 EFI_STATUS
126 PeiProcessFile (
127 IN UINT16 SectionType,
128 IN OUT EFI_FFS_FILE_HEADER **RealFfsFileHeader,
129 OUT VOID **Pe32Data
130 );
131
132 EFI_STATUS
133 EFIAPI
134 PeimInitializeDxeIpl (
135 IN EFI_FFS_FILE_HEADER *FfsHeader,
136 IN EFI_PEI_SERVICES **PeiServices
137 );
138
139 EFI_STATUS
140 PeiLoadx64File (
141 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader,
142 IN VOID *Pe32Data,
143 IN EFI_MEMORY_TYPE MemoryType,
144 OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
145 OUT UINT64 *ImageSize,
146 OUT EFI_PHYSICAL_ADDRESS *EntryPoint
147 )
148 ;
149
150 EFI_PHYSICAL_ADDRESS
151 CreateIdentityMappingPageTables (
152 IN UINT32 NumberOfProcessorPhysicalAddressBits
153 )
154 ;
155
156 VOID
157 ActivateLongMode (
158 IN EFI_PHYSICAL_ADDRESS PageTables,
159 IN EFI_PHYSICAL_ADDRESS HobStart,
160 IN EFI_PHYSICAL_ADDRESS Stack,
161 IN EFI_PHYSICAL_ADDRESS CodeEntryPoint1,
162 IN EFI_PHYSICAL_ADDRESS CodeEntryPoint2
163 );
164
165 VOID
166 LoadGo64Gdt();
167
168 #endif