]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkPlatformPkg/Platform/Pei/PlatformInit/PlatformEarlyInit.h
6792538d427f79ceed61431e9458f94e172f6ddf
[mirror_edk2.git] / QuarkPlatformPkg / Platform / Pei / PlatformInit / PlatformEarlyInit.h
1 /** @file
2 The header file of Platform PEIM.
3
4 Copyright (c) 2013 Intel Corporation.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10
11 #ifndef __PLATFORM_EARLY_INIT_H__
12 #define __PLATFORM_EARLY_INIT_H__
13
14 #define PEI_STALL_RESOLUTION 1
15 #define STALL_PEIM_SIGNATURE SIGNATURE_32('p','p','u','s')
16
17 typedef struct {
18 UINT32 Signature;
19 EFI_FFS_FILE_HEADER *FfsHeader;
20 EFI_PEI_NOTIFY_DESCRIPTOR StallNotify;
21 } STALL_CALLBACK_STATE_INFORMATION;
22
23 #define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, StallNotify, STALL_PEIM_SIGNATURE)
24
25 //
26 // USB Phy Registers
27 //
28 #define USB2_GLOBAL_PORT 0x4001
29 #define USB2_PLL1 0x7F02
30 #define USB2_PLL2 0x7F03
31 #define USB2_COMPBG 0x7F04
32
33 /**
34 Peform the boot mode determination logic
35 If the box is closed, then
36 1. If it's first time to boot, it's boot with full config .
37 2. If the ChassisIntrution is selected, force to be a boot with full config
38 3. Otherwise it's boot with no change.
39
40 @param PeiServices General purpose services available to every PEIM.
41
42 @param BootMode The detected boot mode.
43
44 @retval EFI_SUCCESS if the boot mode could be set
45 **/
46 EFI_STATUS
47 UpdateBootMode (
48 IN EFI_PEI_SERVICES **PeiServices,
49 OUT EFI_BOOT_MODE *BootMode
50 );
51
52 /**
53 This function reset the entire platform, including all processor and devices, and
54 reboots the system.
55
56 @param PeiServices General purpose services available to every PEIM.
57
58 @retval EFI_SUCCESS if it completed successfully.
59 **/
60 EFI_STATUS
61 EFIAPI
62 ResetSystem (
63 IN CONST EFI_PEI_SERVICES **PeiServices
64 );
65
66 /**
67 This function will be called when MRC is done.
68
69 @param PeiServices General purpose services available to every PEIM.
70
71 @param NotifyDescriptor Information about the notify event..
72
73 @param Ppi The notify context.
74
75 @retval EFI_SUCCESS If the function completed successfully.
76 **/
77 EFI_STATUS
78 EFIAPI
79 MemoryDiscoveredPpiNotifyCallback (
80 IN EFI_PEI_SERVICES **PeiServices,
81 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
82 IN VOID *Ppi
83 );
84
85 /**
86 This is the callback function notified by FvFileLoader PPI, it depends on FvFileLoader PPI to load
87 the PEIM into memory.
88
89 @param PeiServices General purpose services available to every PEIM.
90 @param NotifyDescriptor The context of notification.
91 @param Ppi The notify PPI.
92
93 @retval EFI_SUCCESS if it completed successfully.
94 **/
95 EFI_STATUS
96 EFIAPI
97 FvFileLoaderPpiNotifyCallback (
98 IN EFI_PEI_SERVICES **PeiServices,
99 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
100 IN VOID *Ppi
101 );
102
103 /**
104 This function provides a blocking stall for reset at least the given number of microseconds
105 stipulated in the final argument.
106
107 @param PeiServices General purpose services available to every PEIM.
108
109 @param this Pointer to the local data for the interface.
110
111 @param Microseconds number of microseconds for which to stall.
112
113 @retval EFI_SUCCESS the function provided at least the required stall.
114 **/
115 EFI_STATUS
116 EFIAPI
117 Stall (
118 IN CONST EFI_PEI_SERVICES **PeiServices,
119 IN CONST EFI_PEI_STALL_PPI *This,
120 IN UINTN Microseconds
121 );
122
123 /**
124 This function initialize recovery functionality by installing the recovery PPI.
125
126 @param PeiServices General purpose services available to every PEIM.
127
128 @retval EFI_SUCCESS if the interface could be successfully installed.
129 **/
130 EFI_STATUS
131 EFIAPI
132 PeimInitializeRecovery (
133 IN EFI_PEI_SERVICES **PeiServices
134 );
135
136 /**
137 This function
138 1. Calling MRC to initialize memory.
139 2. Install EFI Memory.
140 3. Create HOB of system memory.
141
142 @param PeiServices Pointer to the PEI Service Table
143
144 @retval EFI_SUCCESS If it completes successfully.
145
146 **/
147 EFI_STATUS
148 MemoryInit (
149 IN EFI_PEI_SERVICES **PeiServices
150 );
151
152 /** Return info derived from Installing Memory by MemoryInit.
153
154 @param[out] RmuMainBaseAddressPtr Return RmuMainBaseAddress to this location.
155 @param[out] SmramDescriptorPtr Return start of Smram descriptor list to this location.
156 @param[out] NumSmramRegionsPtr Return numbers of Smram regions to this location.
157
158 @return Address of RMU shadow region at the top of available memory.
159 @return List of Smram descriptors for each Smram region.
160 @return Numbers of Smram regions.
161 **/
162 VOID
163 EFIAPI
164 InfoPostInstallMemory (
165 OUT UINT32 *RmuMainBaseAddressPtr OPTIONAL,
166 OUT EFI_SMRAM_DESCRIPTOR **SmramDescriptorPtr OPTIONAL,
167 OUT UINTN *NumSmramRegionsPtr OPTIONAL
168 );
169
170 /**
171 This function provides the implementation of AtaController PPI Enable Channel function.
172
173 @param PeiServices General purpose services available to every PEIM.
174 @param this Pointer to the local data for the interface.
175 @param ChannelMask This parameter is used to specify primary or slavery IDE channel.
176
177 @retval EFI_SUCCESS Procedure returned successfully.
178 **/
179
180 EFI_STATUS
181 EnableAtaChannel (
182 IN EFI_PEI_SERVICES **PeiServices,
183 IN PEI_ATA_CONTROLLER_PPI *This,
184 IN UINT8 ChannelMask
185 );
186
187 /**
188 This function provides the implementation of AtaController PPI Get IDE channel Register Base Address
189
190 @param PeiServices General purpose services available to every PEIM.
191 @param this Pointer to the local data for the interface.
192 @param IdeRegsBaseAddr Pointer to IDE_REGS_BASE_ADDR struct, which is used to record
193 IDE Command and Control regeisters Base Address.
194
195 @retval EFI_SUCCESS Procedure returned successfully.
196 **/
197
198 EFI_STATUS
199 GetIdeRegsBaseAddr (
200 IN EFI_PEI_SERVICES **PeiServices,
201 IN PEI_ATA_CONTROLLER_PPI *This,
202 IN IDE_REGS_BASE_ADDR *IdeRegsBaseAddr
203 );
204
205 VOID
206 EFIAPI
207 InitializeUSBPhy (
208 VOID
209 );
210
211 /**
212 This function provides early platform initialisation.
213
214 @param PlatformInfo Pointer to platform Info structure.
215
216 **/
217 VOID
218 EFIAPI
219 EarlyPlatformInit (
220 VOID
221 );
222
223 /**
224 This function provides early platform GPIO initialisation.
225
226 @param PlatformType Platform type for GPIO init.
227
228 **/
229 VOID
230 EFIAPI
231 EarlyPlatformLegacyGpioInit (
232 IN CONST EFI_PLATFORM_TYPE PlatformType
233 );
234
235 /**
236 Performs any early platform specific GPIO manipulation.
237
238 @param PlatformType Platform type GPIO manipulation.
239
240 **/
241 VOID
242 EFIAPI
243 EarlyPlatformLegacyGpioManipulation (
244 IN CONST EFI_PLATFORM_TYPE PlatformType
245 );
246
247 /**
248 Performs any early platform specific GPIO Controller init & manipulation.
249
250 @param PlatformType Platform type for GPIO init & manipulation.
251
252 **/
253 VOID
254 EFIAPI
255 EarlyPlatformGpioCtrlerInitAndManipulation (
256 IN CONST EFI_PLATFORM_TYPE PlatformType
257 );
258
259 /**
260 Performs any early platform init of SoC Ethernet Mac devices.
261
262 @param IohMac0Address Mac address to program into Mac0 device.
263 @param IohMac1Address Mac address to program into Mac1 device.
264
265 **/
266 VOID
267 EFIAPI
268 EarlyPlatformMacInit (
269 IN CONST UINT8 *IohMac0Address,
270 IN CONST UINT8 *IohMac1Address
271 );
272
273 /**
274 Find security headers using EFI_CAPSULE_VARIABLE_NAME variables and build Hobs.
275
276 @param PeiServices General purpose services available to every PEIM.
277
278 @retval 0 if no security headers found.
279 @return number of security header hobs built.
280 **/
281 UINTN
282 EFIAPI
283 FindCapsuleSecurityHeadersAndBuildHobs (
284 IN EFI_PEI_SERVICES **PeiServices
285 );
286
287 /**
288 Build capsule security header hob.
289
290 @param SecHdr Pointer to security header.
291
292 @retval NULL if failure to build HOB.
293 @return pointer to built hob.
294 **/
295 VOID *
296 EFIAPI
297 BuildCapsuleSecurityHeaderHob (
298 IN VOID *SecHdr
299 );
300
301 #endif