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