]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | The internal header file includes the common header files, defines\r | |
3 | internal structure and functions used by DxeCore module.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _DXE_MAIN_H_\r | |
17 | #define _DXE_MAIN_H_\r | |
18 | \r | |
19 | \r | |
20 | \r | |
21 | #include <PiDxe.h>\r | |
22 | \r | |
23 | #include <Protocol/LoadedImage.h>\r | |
24 | #include <Protocol/GuidedSectionExtraction.h>\r | |
25 | #include <Protocol/DevicePath.h>\r | |
26 | #include <Protocol/Runtime.h>\r | |
27 | #include <Protocol/LoadFile.h>\r | |
28 | #include <Protocol/LoadFile2.h>\r | |
29 | #include <Protocol/DriverBinding.h>\r | |
30 | #include <Protocol/VariableWrite.h>\r | |
31 | #include <Protocol/PlatformDriverOverride.h>\r | |
32 | #include <Protocol/Variable.h>\r | |
33 | #include <Protocol/Timer.h>\r | |
34 | #include <Protocol/SimpleFileSystem.h>\r | |
35 | #include <Protocol/Bds.h>\r | |
36 | #include <Protocol/RealTimeClock.h>\r | |
37 | #include <Protocol/WatchdogTimer.h>\r | |
38 | #include <Protocol/FirmwareVolume2.h>\r | |
39 | #include <Protocol/MonotonicCounter.h>\r | |
40 | #include <Protocol/StatusCode.h>\r | |
41 | #include <Protocol/Decompress.h>\r | |
42 | #include <Protocol/LoadPe32Image.h>\r | |
43 | #include <Protocol/Security.h>\r | |
44 | #include <Protocol/Security2.h>\r | |
45 | #include <Protocol/Ebc.h>\r | |
46 | #include <Protocol/Reset.h>\r | |
47 | #include <Protocol/Cpu.h>\r | |
48 | #include <Protocol/Metronome.h>\r | |
49 | #include <Protocol/FirmwareVolumeBlock.h>\r | |
50 | #include <Protocol/Capsule.h>\r | |
51 | #include <Protocol/BusSpecificDriverOverride.h>\r | |
52 | #include <Protocol/DriverFamilyOverride.h>\r | |
53 | #include <Protocol/TcgService.h>\r | |
54 | #include <Protocol/HiiPackageList.h>\r | |
55 | #include <Protocol/SmmBase2.h>\r | |
56 | #include <Guid/MemoryTypeInformation.h>\r | |
57 | #include <Guid/FirmwareFileSystem2.h>\r | |
58 | #include <Guid/FirmwareFileSystem3.h>\r | |
59 | #include <Guid/HobList.h>\r | |
60 | #include <Guid/DebugImageInfoTable.h>\r | |
61 | #include <Guid/FileInfo.h>\r | |
62 | #include <Guid/Apriori.h>\r | |
63 | #include <Guid/DxeServices.h>\r | |
64 | #include <Guid/MemoryAllocationHob.h>\r | |
65 | #include <Guid/EventLegacyBios.h>\r | |
66 | #include <Guid/EventGroup.h>\r | |
67 | #include <Guid/EventExitBootServiceFailed.h>\r | |
68 | #include <Guid/LoadModuleAtFixedAddress.h>\r | |
69 | #include <Guid/IdleLoopEvent.h>\r | |
70 | #include <Guid/VectorHandoffTable.h>\r | |
71 | #include <Ppi/VectorHandoffInfo.h>\r | |
72 | #include <Guid/MemoryProfile.h>\r | |
73 | \r | |
74 | #include <Library/DxeCoreEntryPoint.h>\r | |
75 | #include <Library/DebugLib.h>\r | |
76 | #include <Library/UefiLib.h>\r | |
77 | #include <Library/BaseLib.h>\r | |
78 | #include <Library/HobLib.h>\r | |
79 | #include <Library/PerformanceLib.h>\r | |
80 | #include <Library/UefiDecompressLib.h>\r | |
81 | #include <Library/ExtractGuidedSectionLib.h>\r | |
82 | #include <Library/CacheMaintenanceLib.h>\r | |
83 | #include <Library/BaseMemoryLib.h>\r | |
84 | #include <Library/PeCoffLib.h>\r | |
85 | #include <Library/PeCoffGetEntryPointLib.h>\r | |
86 | #include <Library/PeCoffExtraActionLib.h>\r | |
87 | #include <Library/PcdLib.h>\r | |
88 | #include <Library/MemoryAllocationLib.h>\r | |
89 | #include <Library/DevicePathLib.h>\r | |
90 | #include <Library/UefiBootServicesTableLib.h>\r | |
91 | #include <Library/ReportStatusCodeLib.h>\r | |
92 | #include <Library/DxeServicesLib.h>\r | |
93 | #include <Library/DebugAgentLib.h>\r | |
94 | #include <Library/CpuExceptionHandlerLib.h>\r | |
95 | \r | |
96 | \r | |
97 | //\r | |
98 | // attributes for reserved memory before it is promoted to system memory\r | |
99 | //\r | |
100 | #define EFI_MEMORY_PRESENT 0x0100000000000000ULL\r | |
101 | #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL\r | |
102 | #define EFI_MEMORY_TESTED 0x0400000000000000ULL\r | |
103 | \r | |
104 | //\r | |
105 | // range for memory mapped port I/O on IPF\r | |
106 | //\r | |
107 | #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL\r | |
108 | \r | |
109 | \r | |
110 | ///\r | |
111 | /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression\r | |
112 | /// to save time. A EFI_DEP_PUSH is evaluated one an\r | |
113 | /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r | |
114 | /// Driver Execution Environment Core Interface use 0xff\r | |
115 | /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r | |
116 | /// defined to a new value that is not conflicting with PI spec.\r | |
117 | ///\r | |
118 | #define EFI_DEP_REPLACE_TRUE 0xff\r | |
119 | \r | |
120 | ///\r | |
121 | /// Define the initial size of the dependency expression evaluation stack\r | |
122 | ///\r | |
123 | #define DEPEX_STACK_SIZE_INCREMENT 0x1000\r | |
124 | \r | |
125 | typedef struct {\r | |
126 | EFI_GUID *ProtocolGuid;\r | |
127 | VOID **Protocol;\r | |
128 | EFI_EVENT Event;\r | |
129 | VOID *Registration;\r | |
130 | BOOLEAN Present;\r | |
131 | } EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r | |
132 | \r | |
133 | //\r | |
134 | // DXE Dispatcher Data structures\r | |
135 | //\r | |
136 | \r | |
137 | #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')\r | |
138 | typedef struct {\r | |
139 | UINTN Signature;\r | |
140 | LIST_ENTRY Link; // mFvHandleList\r | |
141 | EFI_HANDLE Handle;\r | |
142 | EFI_GUID FvNameGuid;\r | |
143 | } KNOWN_HANDLE;\r | |
144 | \r | |
145 | \r | |
146 | #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r | |
147 | typedef struct {\r | |
148 | UINTN Signature;\r | |
149 | LIST_ENTRY Link; // mDriverList\r | |
150 | \r | |
151 | LIST_ENTRY ScheduledLink; // mScheduledQueue\r | |
152 | \r | |
153 | EFI_HANDLE FvHandle;\r | |
154 | EFI_GUID FileName;\r | |
155 | EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;\r | |
156 | EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r | |
157 | \r | |
158 | VOID *Depex;\r | |
159 | UINTN DepexSize;\r | |
160 | \r | |
161 | BOOLEAN Before;\r | |
162 | BOOLEAN After;\r | |
163 | EFI_GUID BeforeAfterGuid;\r | |
164 | \r | |
165 | BOOLEAN Dependent;\r | |
166 | BOOLEAN Unrequested;\r | |
167 | BOOLEAN Scheduled;\r | |
168 | BOOLEAN Untrusted;\r | |
169 | BOOLEAN Initialized;\r | |
170 | BOOLEAN DepexProtocolError;\r | |
171 | \r | |
172 | EFI_HANDLE ImageHandle;\r | |
173 | BOOLEAN IsFvImage;\r | |
174 | \r | |
175 | } EFI_CORE_DRIVER_ENTRY;\r | |
176 | \r | |
177 | //\r | |
178 | //The data structure of GCD memory map entry\r | |
179 | //\r | |
180 | #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')\r | |
181 | typedef struct {\r | |
182 | UINTN Signature;\r | |
183 | LIST_ENTRY Link;\r | |
184 | EFI_PHYSICAL_ADDRESS BaseAddress;\r | |
185 | UINT64 EndAddress;\r | |
186 | UINT64 Capabilities;\r | |
187 | UINT64 Attributes;\r | |
188 | EFI_GCD_MEMORY_TYPE GcdMemoryType;\r | |
189 | EFI_GCD_IO_TYPE GcdIoType;\r | |
190 | EFI_HANDLE ImageHandle;\r | |
191 | EFI_HANDLE DeviceHandle;\r | |
192 | } EFI_GCD_MAP_ENTRY;\r | |
193 | \r | |
194 | \r | |
195 | #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')\r | |
196 | \r | |
197 | typedef struct {\r | |
198 | UINTN Signature;\r | |
199 | /// Image handle\r | |
200 | EFI_HANDLE Handle;\r | |
201 | /// Image type\r | |
202 | UINTN Type;\r | |
203 | /// If entrypoint has been called\r | |
204 | BOOLEAN Started;\r | |
205 | /// The image's entry point\r | |
206 | EFI_IMAGE_ENTRY_POINT EntryPoint;\r | |
207 | /// loaded image protocol\r | |
208 | EFI_LOADED_IMAGE_PROTOCOL Info;\r | |
209 | /// Location in memory\r | |
210 | EFI_PHYSICAL_ADDRESS ImageBasePage;\r | |
211 | /// Number of pages\r | |
212 | UINTN NumberOfPages;\r | |
213 | /// Original fixup data\r | |
214 | CHAR8 *FixupData;\r | |
215 | /// Tpl of started image\r | |
216 | EFI_TPL Tpl;\r | |
217 | /// Status returned by started image\r | |
218 | EFI_STATUS Status;\r | |
219 | /// Size of ExitData from started image\r | |
220 | UINTN ExitDataSize;\r | |
221 | /// Pointer to exit data from started image\r | |
222 | VOID *ExitData;\r | |
223 | /// Pointer to pool allocation for context save/restore\r | |
224 | VOID *JumpBuffer;\r | |
225 | /// Pointer to buffer for context save/restore\r | |
226 | BASE_LIBRARY_JUMP_BUFFER *JumpContext;\r | |
227 | /// Machine type from PE image\r | |
228 | UINT16 Machine;\r | |
229 | /// EBC Protocol pointer\r | |
230 | EFI_EBC_PROTOCOL *Ebc;\r | |
231 | /// Runtime image list\r | |
232 | EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;\r | |
233 | /// Pointer to Loaded Image Device Path Protocol\r | |
234 | EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;\r | |
235 | /// PeCoffLoader ImageContext\r | |
236 | PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;\r | |
237 | /// Status returned by LoadImage() service.\r | |
238 | EFI_STATUS LoadImageStatus;\r | |
239 | } LOADED_IMAGE_PRIVATE_DATA;\r | |
240 | \r | |
241 | #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r | |
242 | CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r | |
243 | \r | |
244 | #define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')\r | |
245 | \r | |
246 | typedef struct {\r | |
247 | UINT32 Signature;\r | |
248 | LIST_ENTRY Link;\r | |
249 | EFI_PHYSICAL_ADDRESS CodeSegmentBase;\r | |
250 | UINT64 CodeSegmentSize;\r | |
251 | } IMAGE_PROPERTIES_RECORD_CODE_SECTION;\r | |
252 | \r | |
253 | #define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')\r | |
254 | \r | |
255 | typedef struct {\r | |
256 | UINT32 Signature;\r | |
257 | LIST_ENTRY Link;\r | |
258 | EFI_PHYSICAL_ADDRESS ImageBase;\r | |
259 | UINT64 ImageSize;\r | |
260 | UINTN CodeSegmentCount;\r | |
261 | LIST_ENTRY CodeSegmentList;\r | |
262 | } IMAGE_PROPERTIES_RECORD;\r | |
263 | \r | |
264 | //\r | |
265 | // DXE Core Global Variables\r | |
266 | //\r | |
267 | extern EFI_SYSTEM_TABLE *gDxeCoreST;\r | |
268 | extern EFI_RUNTIME_SERVICES *gDxeCoreRT;\r | |
269 | extern EFI_DXE_SERVICES *gDxeCoreDS;\r | |
270 | extern EFI_HANDLE gDxeCoreImageHandle;\r | |
271 | \r | |
272 | extern BOOLEAN gMemoryMapTerminated;\r | |
273 | \r | |
274 | extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;\r | |
275 | \r | |
276 | extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;\r | |
277 | extern EFI_CPU_ARCH_PROTOCOL *gCpu;\r | |
278 | extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer;\r | |
279 | extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;\r | |
280 | extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r | |
281 | extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r | |
282 | extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;\r | |
283 | extern EFI_BDS_ARCH_PROTOCOL *gBds;\r | |
284 | extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;\r | |
285 | \r | |
286 | extern EFI_TPL gEfiCurrentTpl;\r | |
287 | \r | |
288 | extern EFI_GUID *gDxeCoreFileName;\r | |
289 | extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r | |
290 | \r | |
291 | extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];\r | |
292 | \r | |
293 | extern BOOLEAN gDispatcherRunning;\r | |
294 | extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;\r | |
295 | \r | |
296 | extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;\r | |
297 | extern BOOLEAN gLoadFixedAddressCodeMemoryReady;\r | |
298 | //\r | |
299 | // Service Initialization Functions\r | |
300 | //\r | |
301 | \r | |
302 | \r | |
303 | \r | |
304 | /**\r | |
305 | Called to initialize the pool.\r | |
306 | \r | |
307 | **/\r | |
308 | VOID\r | |
309 | CoreInitializePool (\r | |
310 | VOID\r | |
311 | );\r | |
312 | \r | |
313 | \r | |
314 | /**\r | |
315 | Called to initialize the memory map and add descriptors to\r | |
316 | the current descriptor list.\r | |
317 | The first descriptor that is added must be general usable\r | |
318 | memory as the addition allocates heap.\r | |
319 | \r | |
320 | @param Type The type of memory to add\r | |
321 | @param Start The starting address in the memory range Must be\r | |
322 | page aligned\r | |
323 | @param NumberOfPages The number of pages in the range\r | |
324 | @param Attribute Attributes of the memory to add\r | |
325 | \r | |
326 | @return None. The range is added to the memory map\r | |
327 | \r | |
328 | **/\r | |
329 | VOID\r | |
330 | CoreAddMemoryDescriptor (\r | |
331 | IN EFI_MEMORY_TYPE Type,\r | |
332 | IN EFI_PHYSICAL_ADDRESS Start,\r | |
333 | IN UINT64 NumberOfPages,\r | |
334 | IN UINT64 Attribute\r | |
335 | );\r | |
336 | \r | |
337 | \r | |
338 | /**\r | |
339 | Release memory lock on mGcdMemorySpaceLock.\r | |
340 | \r | |
341 | **/\r | |
342 | VOID\r | |
343 | CoreReleaseGcdMemoryLock (\r | |
344 | VOID\r | |
345 | );\r | |
346 | \r | |
347 | \r | |
348 | /**\r | |
349 | Acquire memory lock on mGcdMemorySpaceLock.\r | |
350 | \r | |
351 | **/\r | |
352 | VOID\r | |
353 | CoreAcquireGcdMemoryLock (\r | |
354 | VOID\r | |
355 | );\r | |
356 | \r | |
357 | \r | |
358 | /**\r | |
359 | External function. Initializes memory services based on the memory\r | |
360 | descriptor HOBs. This function is responsible for priming the memory\r | |
361 | map, so memory allocations and resource allocations can be made.\r | |
362 | The first part of this function can not depend on any memory services\r | |
363 | until at least one memory descriptor is provided to the memory services.\r | |
364 | \r | |
365 | @param HobStart The start address of the HOB.\r | |
366 | @param MemoryBaseAddress Start address of memory region found to init DXE\r | |
367 | core.\r | |
368 | @param MemoryLength Length of memory region found to init DXE core.\r | |
369 | \r | |
370 | @retval EFI_SUCCESS Memory services successfully initialized.\r | |
371 | \r | |
372 | **/\r | |
373 | EFI_STATUS\r | |
374 | CoreInitializeMemoryServices (\r | |
375 | IN VOID **HobStart,\r | |
376 | OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,\r | |
377 | OUT UINT64 *MemoryLength\r | |
378 | );\r | |
379 | \r | |
380 | \r | |
381 | \r | |
382 | /**\r | |
383 | External function. Initializes the GCD and memory services based on the memory\r | |
384 | descriptor HOBs. This function is responsible for priming the GCD map and the\r | |
385 | memory map, so memory allocations and resource allocations can be made. The\r | |
386 | HobStart will be relocated to a pool buffer.\r | |
387 | \r | |
388 | @param HobStart The start address of the HOB\r | |
389 | @param MemoryBaseAddress Start address of memory region found to init DXE\r | |
390 | core.\r | |
391 | @param MemoryLength Length of memory region found to init DXE core.\r | |
392 | \r | |
393 | @retval EFI_SUCCESS GCD services successfully initialized.\r | |
394 | \r | |
395 | **/\r | |
396 | EFI_STATUS\r | |
397 | CoreInitializeGcdServices (\r | |
398 | IN OUT VOID **HobStart,\r | |
399 | IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,\r | |
400 | IN UINT64 MemoryLength\r | |
401 | );\r | |
402 | \r | |
403 | \r | |
404 | /**\r | |
405 | Initializes "event" support.\r | |
406 | \r | |
407 | @retval EFI_SUCCESS Always return success\r | |
408 | \r | |
409 | **/\r | |
410 | EFI_STATUS\r | |
411 | CoreInitializeEventServices (\r | |
412 | VOID\r | |
413 | );\r | |
414 | \r | |
415 | \r | |
416 | /**\r | |
417 | Add the Image Services to EFI Boot Services Table and install the protocol\r | |
418 | interfaces for this image.\r | |
419 | \r | |
420 | @param HobStart The HOB to initialize\r | |
421 | \r | |
422 | @return Status code.\r | |
423 | \r | |
424 | **/\r | |
425 | EFI_STATUS\r | |
426 | CoreInitializeImageServices (\r | |
427 | IN VOID *HobStart\r | |
428 | );\r | |
429 | \r | |
430 | \r | |
431 | /**\r | |
432 | Creates an event that is fired everytime a Protocol of a specific type is installed.\r | |
433 | \r | |
434 | **/\r | |
435 | VOID\r | |
436 | CoreNotifyOnProtocolInstallation (\r | |
437 | VOID\r | |
438 | );\r | |
439 | \r | |
440 | \r | |
441 | /**\r | |
442 | Return TRUE if all AP services are available.\r | |
443 | \r | |
444 | @retval EFI_SUCCESS All AP services are available\r | |
445 | @retval EFI_NOT_FOUND At least one AP service is not available\r | |
446 | \r | |
447 | **/\r | |
448 | EFI_STATUS\r | |
449 | CoreAllEfiServicesAvailable (\r | |
450 | VOID\r | |
451 | );\r | |
452 | \r | |
453 | \r | |
454 | /**\r | |
455 | Calcualte the 32-bit CRC in a EFI table using the service provided by the\r | |
456 | gRuntime service.\r | |
457 | \r | |
458 | @param Hdr Pointer to an EFI standard header\r | |
459 | \r | |
460 | **/\r | |
461 | VOID\r | |
462 | CalculateEfiHdrCrc (\r | |
463 | IN OUT EFI_TABLE_HEADER *Hdr\r | |
464 | );\r | |
465 | \r | |
466 | \r | |
467 | /**\r | |
468 | Called by the platform code to process a tick.\r | |
469 | \r | |
470 | @param Duration The number of 100ns elapsed since the last call\r | |
471 | to TimerTick\r | |
472 | \r | |
473 | **/\r | |
474 | VOID\r | |
475 | EFIAPI\r | |
476 | CoreTimerTick (\r | |
477 | IN UINT64 Duration\r | |
478 | );\r | |
479 | \r | |
480 | \r | |
481 | /**\r | |
482 | Initialize the dispatcher. Initialize the notification function that runs when\r | |
483 | an FV2 protocol is added to the system.\r | |
484 | \r | |
485 | **/\r | |
486 | VOID\r | |
487 | CoreInitializeDispatcher (\r | |
488 | VOID\r | |
489 | );\r | |
490 | \r | |
491 | \r | |
492 | /**\r | |
493 | This is the POSTFIX version of the dependency evaluator. This code does\r | |
494 | not need to handle Before or After, as it is not valid to call this\r | |
495 | routine in this case. The SOR is just ignored and is a nop in the grammer.\r | |
496 | POSTFIX means all the math is done on top of the stack.\r | |
497 | \r | |
498 | @param DriverEntry DriverEntry element to update.\r | |
499 | \r | |
500 | @retval TRUE If driver is ready to run.\r | |
501 | @retval FALSE If driver is not ready to run or some fatal error\r | |
502 | was found.\r | |
503 | \r | |
504 | **/\r | |
505 | BOOLEAN\r | |
506 | CoreIsSchedulable (\r | |
507 | IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r | |
508 | );\r | |
509 | \r | |
510 | \r | |
511 | /**\r | |
512 | Preprocess dependency expression and update DriverEntry to reflect the\r | |
513 | state of Before, After, and SOR dependencies. If DriverEntry->Before\r | |
514 | or DriverEntry->After is set it will never be cleared. If SOR is set\r | |
515 | it will be cleared by CoreSchedule(), and then the driver can be\r | |
516 | dispatched.\r | |
517 | \r | |
518 | @param DriverEntry DriverEntry element to update .\r | |
519 | \r | |
520 | @retval EFI_SUCCESS It always works.\r | |
521 | \r | |
522 | **/\r | |
523 | EFI_STATUS\r | |
524 | CorePreProcessDepex (\r | |
525 | IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r | |
526 | );\r | |
527 | \r | |
528 | \r | |
529 | \r | |
530 | /**\r | |
531 | Terminates all boot services.\r | |
532 | \r | |
533 | @param ImageHandle Handle that identifies the exiting image.\r | |
534 | @param MapKey Key to the latest memory map.\r | |
535 | \r | |
536 | @retval EFI_SUCCESS Boot Services terminated\r | |
537 | @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r | |
538 | \r | |
539 | **/\r | |
540 | EFI_STATUS\r | |
541 | EFIAPI\r | |
542 | CoreExitBootServices (\r | |
543 | IN EFI_HANDLE ImageHandle,\r | |
544 | IN UINTN MapKey\r | |
545 | );\r | |
546 | \r | |
547 | \r | |
548 | /**\r | |
549 | Make sure the memory map is following all the construction rules,\r | |
550 | it is the last time to check memory map error before exit boot services.\r | |
551 | \r | |
552 | @param MapKey Memory map key\r | |
553 | \r | |
554 | @retval EFI_INVALID_PARAMETER Memory map not consistent with construction\r | |
555 | rules.\r | |
556 | @retval EFI_SUCCESS Valid memory map.\r | |
557 | \r | |
558 | **/\r | |
559 | EFI_STATUS\r | |
560 | CoreTerminateMemoryMap (\r | |
561 | IN UINTN MapKey\r | |
562 | );\r | |
563 | \r | |
564 | \r | |
565 | /**\r | |
566 | Signals all events in the EventGroup.\r | |
567 | \r | |
568 | @param EventGroup The list to signal\r | |
569 | \r | |
570 | **/\r | |
571 | VOID\r | |
572 | CoreNotifySignalList (\r | |
573 | IN EFI_GUID *EventGroup\r | |
574 | );\r | |
575 | \r | |
576 | \r | |
577 | \r | |
578 | /**\r | |
579 | Boot Service called to add, modify, or remove a system configuration table from\r | |
580 | the EFI System Table.\r | |
581 | \r | |
582 | @param Guid Pointer to the GUID for the entry to add, update, or\r | |
583 | remove\r | |
584 | @param Table Pointer to the configuration table for the entry to add,\r | |
585 | update, or remove, may be NULL.\r | |
586 | \r | |
587 | @return EFI_SUCCESS Guid, Table pair added, updated, or removed.\r | |
588 | @return EFI_INVALID_PARAMETER Input GUID not valid.\r | |
589 | @return EFI_NOT_FOUND Attempted to delete non-existant entry\r | |
590 | @return EFI_OUT_OF_RESOURCES Not enough memory available\r | |
591 | \r | |
592 | **/\r | |
593 | EFI_STATUS\r | |
594 | EFIAPI\r | |
595 | CoreInstallConfigurationTable (\r | |
596 | IN EFI_GUID *Guid,\r | |
597 | IN VOID *Table\r | |
598 | );\r | |
599 | \r | |
600 | \r | |
601 | \r | |
602 | /**\r | |
603 | Raise the task priority level to the new level.\r | |
604 | High level is implemented by disabling processor interrupts.\r | |
605 | \r | |
606 | @param NewTpl New task priority level\r | |
607 | \r | |
608 | @return The previous task priority level\r | |
609 | \r | |
610 | **/\r | |
611 | EFI_TPL\r | |
612 | EFIAPI\r | |
613 | CoreRaiseTpl (\r | |
614 | IN EFI_TPL NewTpl\r | |
615 | );\r | |
616 | \r | |
617 | \r | |
618 | \r | |
619 | /**\r | |
620 | Lowers the task priority to the previous value. If the new\r | |
621 | priority unmasks events at a higher priority, they are dispatched.\r | |
622 | \r | |
623 | @param NewTpl New, lower, task priority\r | |
624 | \r | |
625 | **/\r | |
626 | VOID\r | |
627 | EFIAPI\r | |
628 | CoreRestoreTpl (\r | |
629 | IN EFI_TPL NewTpl\r | |
630 | );\r | |
631 | \r | |
632 | \r | |
633 | \r | |
634 | /**\r | |
635 | Introduces a fine-grained stall.\r | |
636 | \r | |
637 | @param Microseconds The number of microseconds to stall execution.\r | |
638 | \r | |
639 | @retval EFI_SUCCESS Execution was stalled for at least the requested\r | |
640 | amount of microseconds.\r | |
641 | @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet\r | |
642 | \r | |
643 | **/\r | |
644 | EFI_STATUS\r | |
645 | EFIAPI\r | |
646 | CoreStall (\r | |
647 | IN UINTN Microseconds\r | |
648 | );\r | |
649 | \r | |
650 | \r | |
651 | \r | |
652 | /**\r | |
653 | Sets the system's watchdog timer.\r | |
654 | \r | |
655 | @param Timeout The number of seconds to set the watchdog timer to.\r | |
656 | A value of zero disables the timer.\r | |
657 | @param WatchdogCode The numeric code to log on a watchdog timer timeout\r | |
658 | event. The firmware reserves codes 0x0000 to 0xFFFF.\r | |
659 | Loaders and operating systems may use other timeout\r | |
660 | codes.\r | |
661 | @param DataSize The size, in bytes, of WatchdogData.\r | |
662 | @param WatchdogData A data buffer that includes a Null-terminated Unicode\r | |
663 | string, optionally followed by additional binary data.\r | |
664 | The string is a description that the call may use to\r | |
665 | further indicate the reason to be logged with a\r | |
666 | watchdog event.\r | |
667 | \r | |
668 | @return EFI_SUCCESS Timeout has been set\r | |
669 | @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet\r | |
670 | @return EFI_UNSUPPORTED System does not have a timer (currently not used)\r | |
671 | @return EFI_DEVICE_ERROR Could not complete due to hardware error\r | |
672 | \r | |
673 | **/\r | |
674 | EFI_STATUS\r | |
675 | EFIAPI\r | |
676 | CoreSetWatchdogTimer (\r | |
677 | IN UINTN Timeout,\r | |
678 | IN UINT64 WatchdogCode,\r | |
679 | IN UINTN DataSize,\r | |
680 | IN CHAR16 *WatchdogData OPTIONAL\r | |
681 | );\r | |
682 | \r | |
683 | \r | |
684 | \r | |
685 | /**\r | |
686 | Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which\r | |
687 | Calls the private one which contains a BOOLEAN parameter for notifications\r | |
688 | \r | |
689 | @param UserHandle The handle to install the protocol handler on,\r | |
690 | or NULL if a new handle is to be allocated\r | |
691 | @param Protocol The protocol to add to the handle\r | |
692 | @param InterfaceType Indicates whether Interface is supplied in\r | |
693 | native form.\r | |
694 | @param Interface The interface for the protocol being added\r | |
695 | \r | |
696 | @return Status code\r | |
697 | \r | |
698 | **/\r | |
699 | EFI_STATUS\r | |
700 | EFIAPI\r | |
701 | CoreInstallProtocolInterface (\r | |
702 | IN OUT EFI_HANDLE *UserHandle,\r | |
703 | IN EFI_GUID *Protocol,\r | |
704 | IN EFI_INTERFACE_TYPE InterfaceType,\r | |
705 | IN VOID *Interface\r | |
706 | );\r | |
707 | \r | |
708 | \r | |
709 | /**\r | |
710 | Installs a protocol interface into the boot services environment.\r | |
711 | \r | |
712 | @param UserHandle The handle to install the protocol handler on,\r | |
713 | or NULL if a new handle is to be allocated\r | |
714 | @param Protocol The protocol to add to the handle\r | |
715 | @param InterfaceType Indicates whether Interface is supplied in\r | |
716 | native form.\r | |
717 | @param Interface The interface for the protocol being added\r | |
718 | @param Notify indicates whether notify the notification list\r | |
719 | for this protocol\r | |
720 | \r | |
721 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
722 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
723 | @retval EFI_SUCCESS Protocol interface successfully installed\r | |
724 | \r | |
725 | **/\r | |
726 | EFI_STATUS\r | |
727 | CoreInstallProtocolInterfaceNotify (\r | |
728 | IN OUT EFI_HANDLE *UserHandle,\r | |
729 | IN EFI_GUID *Protocol,\r | |
730 | IN EFI_INTERFACE_TYPE InterfaceType,\r | |
731 | IN VOID *Interface,\r | |
732 | IN BOOLEAN Notify\r | |
733 | );\r | |
734 | \r | |
735 | \r | |
736 | \r | |
737 | /**\r | |
738 | Installs a list of protocol interface into the boot services environment.\r | |
739 | This function calls InstallProtocolInterface() in a loop. If any error\r | |
740 | occures all the protocols added by this function are removed. This is\r | |
741 | basically a lib function to save space.\r | |
742 | \r | |
743 | @param Handle The handle to install the protocol handlers on,\r | |
744 | or NULL if a new handle is to be allocated\r | |
745 | @param ... EFI_GUID followed by protocol instance. A NULL\r | |
746 | terminates the list. The pairs are the\r | |
747 | arguments to InstallProtocolInterface(). All the\r | |
748 | protocols are added to Handle.\r | |
749 | \r | |
750 | @retval EFI_SUCCESS All the protocol interface was installed.\r | |
751 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r | |
752 | @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r | |
753 | the handle database.\r | |
754 | @retval EFI_INVALID_PARAMETER Handle is NULL.\r | |
755 | @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r | |
756 | \r | |
757 | **/\r | |
758 | EFI_STATUS\r | |
759 | EFIAPI\r | |
760 | CoreInstallMultipleProtocolInterfaces (\r | |
761 | IN OUT EFI_HANDLE *Handle,\r | |
762 | ...\r | |
763 | );\r | |
764 | \r | |
765 | \r | |
766 | \r | |
767 | /**\r | |
768 | Uninstalls a list of protocol interface in the boot services environment.\r | |
769 | This function calls UnisatllProtocolInterface() in a loop. This is\r | |
770 | basically a lib function to save space.\r | |
771 | \r | |
772 | @param Handle The handle to uninstall the protocol\r | |
773 | @param ... EFI_GUID followed by protocol instance. A NULL\r | |
774 | terminates the list. The pairs are the\r | |
775 | arguments to UninstallProtocolInterface(). All\r | |
776 | the protocols are added to Handle.\r | |
777 | \r | |
778 | @return Status code\r | |
779 | \r | |
780 | **/\r | |
781 | EFI_STATUS\r | |
782 | EFIAPI\r | |
783 | CoreUninstallMultipleProtocolInterfaces (\r | |
784 | IN EFI_HANDLE Handle,\r | |
785 | ...\r | |
786 | );\r | |
787 | \r | |
788 | \r | |
789 | \r | |
790 | /**\r | |
791 | Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r | |
792 | \r | |
793 | @param UserHandle Handle on which the interface is to be\r | |
794 | reinstalled\r | |
795 | @param Protocol The numeric ID of the interface\r | |
796 | @param OldInterface A pointer to the old interface\r | |
797 | @param NewInterface A pointer to the new interface\r | |
798 | \r | |
799 | @retval EFI_SUCCESS The protocol interface was installed\r | |
800 | @retval EFI_NOT_FOUND The OldInterface on the handle was not found\r | |
801 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r | |
802 | \r | |
803 | **/\r | |
804 | EFI_STATUS\r | |
805 | EFIAPI\r | |
806 | CoreReinstallProtocolInterface (\r | |
807 | IN EFI_HANDLE UserHandle,\r | |
808 | IN EFI_GUID *Protocol,\r | |
809 | IN VOID *OldInterface,\r | |
810 | IN VOID *NewInterface\r | |
811 | );\r | |
812 | \r | |
813 | \r | |
814 | \r | |
815 | /**\r | |
816 | Uninstalls all instances of a protocol:interfacer from a handle.\r | |
817 | If the last protocol interface is remove from the handle, the\r | |
818 | handle is freed.\r | |
819 | \r | |
820 | @param UserHandle The handle to remove the protocol handler from\r | |
821 | @param Protocol The protocol, of protocol:interface, to remove\r | |
822 | @param Interface The interface, of protocol:interface, to remove\r | |
823 | \r | |
824 | @retval EFI_INVALID_PARAMETER Protocol is NULL.\r | |
825 | @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r | |
826 | \r | |
827 | **/\r | |
828 | EFI_STATUS\r | |
829 | EFIAPI\r | |
830 | CoreUninstallProtocolInterface (\r | |
831 | IN EFI_HANDLE UserHandle,\r | |
832 | IN EFI_GUID *Protocol,\r | |
833 | IN VOID *Interface\r | |
834 | );\r | |
835 | \r | |
836 | \r | |
837 | \r | |
838 | /**\r | |
839 | Queries a handle to determine if it supports a specified protocol.\r | |
840 | \r | |
841 | @param UserHandle The handle being queried.\r | |
842 | @param Protocol The published unique identifier of the protocol.\r | |
843 | @param Interface Supplies the address where a pointer to the\r | |
844 | corresponding Protocol Interface is returned.\r | |
845 | \r | |
846 | @return The requested protocol interface for the handle\r | |
847 | \r | |
848 | **/\r | |
849 | EFI_STATUS\r | |
850 | EFIAPI\r | |
851 | CoreHandleProtocol (\r | |
852 | IN EFI_HANDLE UserHandle,\r | |
853 | IN EFI_GUID *Protocol,\r | |
854 | OUT VOID **Interface\r | |
855 | );\r | |
856 | \r | |
857 | \r | |
858 | \r | |
859 | /**\r | |
860 | Locates the installed protocol handler for the handle, and\r | |
861 | invokes it to obtain the protocol interface. Usage information\r | |
862 | is registered in the protocol data base.\r | |
863 | \r | |
864 | @param UserHandle The handle to obtain the protocol interface on\r | |
865 | @param Protocol The ID of the protocol\r | |
866 | @param Interface The location to return the protocol interface\r | |
867 | @param ImageHandle The handle of the Image that is opening the\r | |
868 | protocol interface specified by Protocol and\r | |
869 | Interface.\r | |
870 | @param ControllerHandle The controller handle that is requiring this\r | |
871 | interface.\r | |
872 | @param Attributes The open mode of the protocol interface\r | |
873 | specified by Handle and Protocol.\r | |
874 | \r | |
875 | @retval EFI_INVALID_PARAMETER Protocol is NULL.\r | |
876 | @retval EFI_SUCCESS Get the protocol interface.\r | |
877 | \r | |
878 | **/\r | |
879 | EFI_STATUS\r | |
880 | EFIAPI\r | |
881 | CoreOpenProtocol (\r | |
882 | IN EFI_HANDLE UserHandle,\r | |
883 | IN EFI_GUID *Protocol,\r | |
884 | OUT VOID **Interface OPTIONAL,\r | |
885 | IN EFI_HANDLE ImageHandle,\r | |
886 | IN EFI_HANDLE ControllerHandle,\r | |
887 | IN UINT32 Attributes\r | |
888 | );\r | |
889 | \r | |
890 | \r | |
891 | \r | |
892 | /**\r | |
893 | Return information about Opened protocols in the system\r | |
894 | \r | |
895 | @param UserHandle The handle to close the protocol interface on\r | |
896 | @param Protocol The ID of the protocol\r | |
897 | @param EntryBuffer A pointer to a buffer of open protocol\r | |
898 | information in the form of\r | |
899 | EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r | |
900 | @param EntryCount Number of EntryBuffer entries\r | |
901 | \r | |
902 | **/\r | |
903 | EFI_STATUS\r | |
904 | EFIAPI\r | |
905 | CoreOpenProtocolInformation (\r | |
906 | IN EFI_HANDLE UserHandle,\r | |
907 | IN EFI_GUID *Protocol,\r | |
908 | OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r | |
909 | OUT UINTN *EntryCount\r | |
910 | );\r | |
911 | \r | |
912 | \r | |
913 | \r | |
914 | /**\r | |
915 | Closes a protocol on a handle that was opened using OpenProtocol().\r | |
916 | \r | |
917 | @param UserHandle The handle for the protocol interface that was\r | |
918 | previously opened with OpenProtocol(), and is\r | |
919 | now being closed.\r | |
920 | @param Protocol The published unique identifier of the protocol.\r | |
921 | It is the caller's responsibility to pass in a\r | |
922 | valid GUID.\r | |
923 | @param AgentHandle The handle of the agent that is closing the\r | |
924 | protocol interface.\r | |
925 | @param ControllerHandle If the agent that opened a protocol is a driver\r | |
926 | that follows the EFI Driver Model, then this\r | |
927 | parameter is the controller handle that required\r | |
928 | the protocol interface. If the agent does not\r | |
929 | follow the EFI Driver Model, then this parameter\r | |
930 | is optional and may be NULL.\r | |
931 | \r | |
932 | @retval EFI_SUCCESS The protocol instance was closed.\r | |
933 | @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a\r | |
934 | valid EFI_HANDLE.\r | |
935 | @retval EFI_NOT_FOUND Can not find the specified protocol or\r | |
936 | AgentHandle.\r | |
937 | \r | |
938 | **/\r | |
939 | EFI_STATUS\r | |
940 | EFIAPI\r | |
941 | CoreCloseProtocol (\r | |
942 | IN EFI_HANDLE UserHandle,\r | |
943 | IN EFI_GUID *Protocol,\r | |
944 | IN EFI_HANDLE AgentHandle,\r | |
945 | IN EFI_HANDLE ControllerHandle\r | |
946 | );\r | |
947 | \r | |
948 | \r | |
949 | \r | |
950 | /**\r | |
951 | Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r | |
952 | from pool.\r | |
953 | \r | |
954 | @param UserHandle The handle from which to retrieve the list of\r | |
955 | protocol interface GUIDs.\r | |
956 | @param ProtocolBuffer A pointer to the list of protocol interface GUID\r | |
957 | pointers that are installed on Handle.\r | |
958 | @param ProtocolBufferCount A pointer to the number of GUID pointers present\r | |
959 | in ProtocolBuffer.\r | |
960 | \r | |
961 | @retval EFI_SUCCESS The list of protocol interface GUIDs installed\r | |
962 | on Handle was returned in ProtocolBuffer. The\r | |
963 | number of protocol interface GUIDs was returned\r | |
964 | in ProtocolBufferCount.\r | |
965 | @retval EFI_INVALID_PARAMETER Handle is NULL.\r | |
966 | @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r | |
967 | @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r | |
968 | @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r | |
969 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r | |
970 | results.\r | |
971 | \r | |
972 | **/\r | |
973 | EFI_STATUS\r | |
974 | EFIAPI\r | |
975 | CoreProtocolsPerHandle (\r | |
976 | IN EFI_HANDLE UserHandle,\r | |
977 | OUT EFI_GUID ***ProtocolBuffer,\r | |
978 | OUT UINTN *ProtocolBufferCount\r | |
979 | );\r | |
980 | \r | |
981 | \r | |
982 | \r | |
983 | /**\r | |
984 | Add a new protocol notification record for the request protocol.\r | |
985 | \r | |
986 | @param Protocol The requested protocol to add the notify\r | |
987 | registration\r | |
988 | @param Event The event to signal\r | |
989 | @param Registration Returns the registration record\r | |
990 | \r | |
991 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
992 | @retval EFI_SUCCESS Successfully returned the registration record\r | |
993 | that has been added\r | |
994 | \r | |
995 | **/\r | |
996 | EFI_STATUS\r | |
997 | EFIAPI\r | |
998 | CoreRegisterProtocolNotify (\r | |
999 | IN EFI_GUID *Protocol,\r | |
1000 | IN EFI_EVENT Event,\r | |
1001 | OUT VOID **Registration\r | |
1002 | );\r | |
1003 | \r | |
1004 | \r | |
1005 | /**\r | |
1006 | Removes all the events in the protocol database that match Event.\r | |
1007 | \r | |
1008 | @param Event The event to search for in the protocol\r | |
1009 | database.\r | |
1010 | \r | |
1011 | @return EFI_SUCCESS when done searching the entire database.\r | |
1012 | \r | |
1013 | **/\r | |
1014 | EFI_STATUS\r | |
1015 | CoreUnregisterProtocolNotify (\r | |
1016 | IN EFI_EVENT Event\r | |
1017 | );\r | |
1018 | \r | |
1019 | \r | |
1020 | /**\r | |
1021 | Locates the requested handle(s) and returns them in Buffer.\r | |
1022 | \r | |
1023 | @param SearchType The type of search to perform to locate the\r | |
1024 | handles\r | |
1025 | @param Protocol The protocol to search for\r | |
1026 | @param SearchKey Dependant on SearchType\r | |
1027 | @param BufferSize On input the size of Buffer. On output the\r | |
1028 | size of data returned.\r | |
1029 | @param Buffer The buffer to return the results in\r | |
1030 | \r | |
1031 | @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r | |
1032 | returned in BufferSize.\r | |
1033 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
1034 | @retval EFI_SUCCESS Successfully found the requested handle(s) and\r | |
1035 | returns them in Buffer.\r | |
1036 | \r | |
1037 | **/\r | |
1038 | EFI_STATUS\r | |
1039 | EFIAPI\r | |
1040 | CoreLocateHandle (\r | |
1041 | IN EFI_LOCATE_SEARCH_TYPE SearchType,\r | |
1042 | IN EFI_GUID *Protocol OPTIONAL,\r | |
1043 | IN VOID *SearchKey OPTIONAL,\r | |
1044 | IN OUT UINTN *BufferSize,\r | |
1045 | OUT EFI_HANDLE *Buffer\r | |
1046 | );\r | |
1047 | \r | |
1048 | \r | |
1049 | \r | |
1050 | /**\r | |
1051 | Locates the handle to a device on the device path that best matches the specified protocol.\r | |
1052 | \r | |
1053 | @param Protocol The protocol to search for.\r | |
1054 | @param DevicePath On input, a pointer to a pointer to the device\r | |
1055 | path. On output, the device path pointer is\r | |
1056 | modified to point to the remaining part of the\r | |
1057 | devicepath.\r | |
1058 | @param Device A pointer to the returned device handle.\r | |
1059 | \r | |
1060 | @retval EFI_SUCCESS The resulting handle was returned.\r | |
1061 | @retval EFI_NOT_FOUND No handles matched the search.\r | |
1062 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r | |
1063 | \r | |
1064 | **/\r | |
1065 | EFI_STATUS\r | |
1066 | EFIAPI\r | |
1067 | CoreLocateDevicePath (\r | |
1068 | IN EFI_GUID *Protocol,\r | |
1069 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r | |
1070 | OUT EFI_HANDLE *Device\r | |
1071 | );\r | |
1072 | \r | |
1073 | \r | |
1074 | \r | |
1075 | /**\r | |
1076 | Function returns an array of handles that support the requested protocol\r | |
1077 | in a buffer allocated from pool. This is a version of CoreLocateHandle()\r | |
1078 | that allocates a buffer for the caller.\r | |
1079 | \r | |
1080 | @param SearchType Specifies which handle(s) are to be returned.\r | |
1081 | @param Protocol Provides the protocol to search by. This\r | |
1082 | parameter is only valid for SearchType\r | |
1083 | ByProtocol.\r | |
1084 | @param SearchKey Supplies the search key depending on the\r | |
1085 | SearchType.\r | |
1086 | @param NumberHandles The number of handles returned in Buffer.\r | |
1087 | @param Buffer A pointer to the buffer to return the requested\r | |
1088 | array of handles that support Protocol.\r | |
1089 | \r | |
1090 | @retval EFI_SUCCESS The result array of handles was returned.\r | |
1091 | @retval EFI_NOT_FOUND No handles match the search.\r | |
1092 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r | |
1093 | matching results.\r | |
1094 | @retval EFI_INVALID_PARAMETER One or more parameters are not valid.\r | |
1095 | \r | |
1096 | **/\r | |
1097 | EFI_STATUS\r | |
1098 | EFIAPI\r | |
1099 | CoreLocateHandleBuffer (\r | |
1100 | IN EFI_LOCATE_SEARCH_TYPE SearchType,\r | |
1101 | IN EFI_GUID *Protocol OPTIONAL,\r | |
1102 | IN VOID *SearchKey OPTIONAL,\r | |
1103 | IN OUT UINTN *NumberHandles,\r | |
1104 | OUT EFI_HANDLE **Buffer\r | |
1105 | );\r | |
1106 | \r | |
1107 | \r | |
1108 | \r | |
1109 | /**\r | |
1110 | Return the first Protocol Interface that matches the Protocol GUID. If\r | |
1111 | Registration is passed in, return a Protocol Instance that was just add\r | |
1112 | to the system. If Registration is NULL return the first Protocol Interface\r | |
1113 | you find.\r | |
1114 | \r | |
1115 | @param Protocol The protocol to search for\r | |
1116 | @param Registration Optional Registration Key returned from\r | |
1117 | RegisterProtocolNotify()\r | |
1118 | @param Interface Return the Protocol interface (instance).\r | |
1119 | \r | |
1120 | @retval EFI_SUCCESS If a valid Interface is returned\r | |
1121 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
1122 | @retval EFI_NOT_FOUND Protocol interface not found\r | |
1123 | \r | |
1124 | **/\r | |
1125 | EFI_STATUS\r | |
1126 | EFIAPI\r | |
1127 | CoreLocateProtocol (\r | |
1128 | IN EFI_GUID *Protocol,\r | |
1129 | IN VOID *Registration OPTIONAL,\r | |
1130 | OUT VOID **Interface\r | |
1131 | );\r | |
1132 | \r | |
1133 | \r | |
1134 | /**\r | |
1135 | return handle database key.\r | |
1136 | \r | |
1137 | \r | |
1138 | @return Handle database key.\r | |
1139 | \r | |
1140 | **/\r | |
1141 | UINT64\r | |
1142 | CoreGetHandleDatabaseKey (\r | |
1143 | VOID\r | |
1144 | );\r | |
1145 | \r | |
1146 | \r | |
1147 | /**\r | |
1148 | Go connect any handles that were created or modified while a image executed.\r | |
1149 | \r | |
1150 | @param Key The Key to show that the handle has been\r | |
1151 | created/modified\r | |
1152 | \r | |
1153 | **/\r | |
1154 | VOID\r | |
1155 | CoreConnectHandlesByKey (\r | |
1156 | UINT64 Key\r | |
1157 | );\r | |
1158 | \r | |
1159 | \r | |
1160 | \r | |
1161 | /**\r | |
1162 | Connects one or more drivers to a controller.\r | |
1163 | \r | |
1164 | @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r | |
1165 | @param DriverImageHandle A pointer to an ordered list handles that support the\r | |
1166 | EFI_DRIVER_BINDING_PROTOCOL.\r | |
1167 | @param RemainingDevicePath A pointer to the device path that specifies a child of the\r | |
1168 | controller specified by ControllerHandle.\r | |
1169 | @param Recursive If TRUE, then ConnectController() is called recursively\r | |
1170 | until the entire tree of controllers below the controller specified\r | |
1171 | by ControllerHandle have been created. If FALSE, then\r | |
1172 | the tree of controllers is only expanded one level.\r | |
1173 | \r | |
1174 | @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r | |
1175 | 2) No drivers were connected to ControllerHandle, but\r | |
1176 | RemainingDevicePath is not NULL, and it is an End Device\r | |
1177 | Path Node.\r | |
1178 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
1179 | @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r | |
1180 | present in the system.\r | |
1181 | 2) No drivers were connected to ControllerHandle.\r | |
1182 | @retval EFI_SECURITY_VIOLATION\r | |
1183 | The user has no permission to start UEFI device drivers on the device path\r | |
1184 | associated with the ControllerHandle or specified by the RemainingDevicePath.\r | |
1185 | \r | |
1186 | **/\r | |
1187 | EFI_STATUS\r | |
1188 | EFIAPI\r | |
1189 | CoreConnectController (\r | |
1190 | IN EFI_HANDLE ControllerHandle,\r | |
1191 | IN EFI_HANDLE *DriverImageHandle OPTIONAL,\r | |
1192 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,\r | |
1193 | IN BOOLEAN Recursive\r | |
1194 | );\r | |
1195 | \r | |
1196 | \r | |
1197 | \r | |
1198 | /**\r | |
1199 | Disonnects a controller from a driver\r | |
1200 | \r | |
1201 | @param ControllerHandle ControllerHandle The handle of\r | |
1202 | the controller from which\r | |
1203 | driver(s) are to be\r | |
1204 | disconnected.\r | |
1205 | @param DriverImageHandle DriverImageHandle The driver to\r | |
1206 | disconnect from ControllerHandle.\r | |
1207 | @param ChildHandle ChildHandle The handle of the\r | |
1208 | child to destroy.\r | |
1209 | \r | |
1210 | @retval EFI_SUCCESS One or more drivers were\r | |
1211 | disconnected from the controller.\r | |
1212 | @retval EFI_SUCCESS On entry, no drivers are managing\r | |
1213 | ControllerHandle.\r | |
1214 | @retval EFI_SUCCESS DriverImageHandle is not NULL,\r | |
1215 | and on entry DriverImageHandle is\r | |
1216 | not managing ControllerHandle.\r | |
1217 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
1218 | @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r | |
1219 | and it is not a valid EFI_HANDLE.\r | |
1220 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r | |
1221 | is not a valid EFI_HANDLE.\r | |
1222 | @retval EFI_OUT_OF_RESOURCES There are not enough resources\r | |
1223 | available to disconnect any\r | |
1224 | drivers from ControllerHandle.\r | |
1225 | @retval EFI_DEVICE_ERROR The controller could not be\r | |
1226 | disconnected because of a device\r | |
1227 | error.\r | |
1228 | \r | |
1229 | **/\r | |
1230 | EFI_STATUS\r | |
1231 | EFIAPI\r | |
1232 | CoreDisconnectController (\r | |
1233 | IN EFI_HANDLE ControllerHandle,\r | |
1234 | IN EFI_HANDLE DriverImageHandle OPTIONAL,\r | |
1235 | IN EFI_HANDLE ChildHandle OPTIONAL\r | |
1236 | );\r | |
1237 | \r | |
1238 | \r | |
1239 | \r | |
1240 | /**\r | |
1241 | Allocates pages from the memory map.\r | |
1242 | \r | |
1243 | @param Type The type of allocation to perform\r | |
1244 | @param MemoryType The type of memory to turn the allocated pages\r | |
1245 | into\r | |
1246 | @param NumberOfPages The number of pages to allocate\r | |
1247 | @param Memory A pointer to receive the base allocated memory\r | |
1248 | address\r | |
1249 | \r | |
1250 | @return Status. On success, Memory is filled in with the base address allocated\r | |
1251 | @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in\r | |
1252 | spec.\r | |
1253 | @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r | |
1254 | @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r | |
1255 | @retval EFI_SUCCESS Pages successfully allocated.\r | |
1256 | \r | |
1257 | **/\r | |
1258 | EFI_STATUS\r | |
1259 | EFIAPI\r | |
1260 | CoreAllocatePages (\r | |
1261 | IN EFI_ALLOCATE_TYPE Type,\r | |
1262 | IN EFI_MEMORY_TYPE MemoryType,\r | |
1263 | IN UINTN NumberOfPages,\r | |
1264 | IN OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
1265 | );\r | |
1266 | \r | |
1267 | /**\r | |
1268 | Frees previous allocated pages.\r | |
1269 | \r | |
1270 | @param Memory Base address of memory being freed\r | |
1271 | @param NumberOfPages The number of pages to free\r | |
1272 | \r | |
1273 | @retval EFI_NOT_FOUND Could not find the entry that covers the range\r | |
1274 | @retval EFI_INVALID_PARAMETER Address not aligned\r | |
1275 | @return EFI_SUCCESS -Pages successfully freed.\r | |
1276 | \r | |
1277 | **/\r | |
1278 | EFI_STATUS\r | |
1279 | EFIAPI\r | |
1280 | CoreFreePages (\r | |
1281 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
1282 | IN UINTN NumberOfPages\r | |
1283 | );\r | |
1284 | \r | |
1285 | /**\r | |
1286 | This function returns a copy of the current memory map. The map is an array of\r | |
1287 | memory descriptors, each of which describes a contiguous block of memory.\r | |
1288 | \r | |
1289 | @param MemoryMapSize A pointer to the size, in bytes, of the\r | |
1290 | MemoryMap buffer. On input, this is the size of\r | |
1291 | the buffer allocated by the caller. On output,\r | |
1292 | it is the size of the buffer returned by the\r | |
1293 | firmware if the buffer was large enough, or the\r | |
1294 | size of the buffer needed to contain the map if\r | |
1295 | the buffer was too small.\r | |
1296 | @param MemoryMap A pointer to the buffer in which firmware places\r | |
1297 | the current memory map.\r | |
1298 | @param MapKey A pointer to the location in which firmware\r | |
1299 | returns the key for the current memory map.\r | |
1300 | @param DescriptorSize A pointer to the location in which firmware\r | |
1301 | returns the size, in bytes, of an individual\r | |
1302 | EFI_MEMORY_DESCRIPTOR.\r | |
1303 | @param DescriptorVersion A pointer to the location in which firmware\r | |
1304 | returns the version number associated with the\r | |
1305 | EFI_MEMORY_DESCRIPTOR.\r | |
1306 | \r | |
1307 | @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r | |
1308 | buffer.\r | |
1309 | @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r | |
1310 | buffer size needed to hold the memory map is\r | |
1311 | returned in MemoryMapSize.\r | |
1312 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r | |
1313 | \r | |
1314 | **/\r | |
1315 | EFI_STATUS\r | |
1316 | EFIAPI\r | |
1317 | CoreGetMemoryMap (\r | |
1318 | IN OUT UINTN *MemoryMapSize,\r | |
1319 | IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r | |
1320 | OUT UINTN *MapKey,\r | |
1321 | OUT UINTN *DescriptorSize,\r | |
1322 | OUT UINT32 *DescriptorVersion\r | |
1323 | );\r | |
1324 | \r | |
1325 | \r | |
1326 | \r | |
1327 | /**\r | |
1328 | Allocate pool of a particular type.\r | |
1329 | \r | |
1330 | @param PoolType Type of pool to allocate\r | |
1331 | @param Size The amount of pool to allocate\r | |
1332 | @param Buffer The address to return a pointer to the allocated\r | |
1333 | pool\r | |
1334 | \r | |
1335 | @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r | |
1336 | @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r | |
1337 | @retval EFI_SUCCESS Pool successfully allocated.\r | |
1338 | \r | |
1339 | **/\r | |
1340 | EFI_STATUS\r | |
1341 | EFIAPI\r | |
1342 | CoreAllocatePool (\r | |
1343 | IN EFI_MEMORY_TYPE PoolType,\r | |
1344 | IN UINTN Size,\r | |
1345 | OUT VOID **Buffer\r | |
1346 | );\r | |
1347 | \r | |
1348 | /**\r | |
1349 | Allocate pool of a particular type.\r | |
1350 | \r | |
1351 | @param PoolType Type of pool to allocate\r | |
1352 | @param Size The amount of pool to allocate\r | |
1353 | @param Buffer The address to return a pointer to the allocated\r | |
1354 | pool\r | |
1355 | \r | |
1356 | @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r | |
1357 | @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r | |
1358 | @retval EFI_SUCCESS Pool successfully allocated.\r | |
1359 | \r | |
1360 | **/\r | |
1361 | EFI_STATUS\r | |
1362 | EFIAPI\r | |
1363 | CoreInternalAllocatePool (\r | |
1364 | IN EFI_MEMORY_TYPE PoolType,\r | |
1365 | IN UINTN Size,\r | |
1366 | OUT VOID **Buffer\r | |
1367 | );\r | |
1368 | \r | |
1369 | /**\r | |
1370 | Frees pool.\r | |
1371 | \r | |
1372 | @param Buffer The allocated pool entry to free\r | |
1373 | \r | |
1374 | @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r | |
1375 | @retval EFI_SUCCESS Pool successfully freed.\r | |
1376 | \r | |
1377 | **/\r | |
1378 | EFI_STATUS\r | |
1379 | EFIAPI\r | |
1380 | CoreFreePool (\r | |
1381 | IN VOID *Buffer\r | |
1382 | );\r | |
1383 | \r | |
1384 | /**\r | |
1385 | Frees pool.\r | |
1386 | \r | |
1387 | @param Buffer The allocated pool entry to free\r | |
1388 | @param PoolType Pointer to pool type\r | |
1389 | \r | |
1390 | @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r | |
1391 | @retval EFI_SUCCESS Pool successfully freed.\r | |
1392 | \r | |
1393 | **/\r | |
1394 | EFI_STATUS\r | |
1395 | EFIAPI\r | |
1396 | CoreInternalFreePool (\r | |
1397 | IN VOID *Buffer,\r | |
1398 | OUT EFI_MEMORY_TYPE *PoolType OPTIONAL\r | |
1399 | );\r | |
1400 | \r | |
1401 | /**\r | |
1402 | Loads an EFI image into memory and returns a handle to the image.\r | |
1403 | \r | |
1404 | @param BootPolicy If TRUE, indicates that the request originates\r | |
1405 | from the boot manager, and that the boot\r | |
1406 | manager is attempting to load FilePath as a\r | |
1407 | boot selection.\r | |
1408 | @param ParentImageHandle The caller's image handle.\r | |
1409 | @param FilePath The specific file path from which the image is\r | |
1410 | loaded.\r | |
1411 | @param SourceBuffer If not NULL, a pointer to the memory location\r | |
1412 | containing a copy of the image to be loaded.\r | |
1413 | @param SourceSize The size in bytes of SourceBuffer.\r | |
1414 | @param ImageHandle Pointer to the returned image handle that is\r | |
1415 | created when the image is successfully loaded.\r | |
1416 | \r | |
1417 | @retval EFI_SUCCESS The image was loaded into memory.\r | |
1418 | @retval EFI_NOT_FOUND The FilePath was not found.\r | |
1419 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r | |
1420 | @retval EFI_UNSUPPORTED The image type is not supported, or the device\r | |
1421 | path cannot be parsed to locate the proper\r | |
1422 | protocol for loading the file.\r | |
1423 | @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r | |
1424 | resources.\r | |
1425 | @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r | |
1426 | understood.\r | |
1427 | @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r | |
1428 | @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the\r | |
1429 | image from being loaded. NULL is returned in *ImageHandle.\r | |
1430 | @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a\r | |
1431 | valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r | |
1432 | platform policy specifies that the image should not be started.\r | |
1433 | \r | |
1434 | **/\r | |
1435 | EFI_STATUS\r | |
1436 | EFIAPI\r | |
1437 | CoreLoadImage (\r | |
1438 | IN BOOLEAN BootPolicy,\r | |
1439 | IN EFI_HANDLE ParentImageHandle,\r | |
1440 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
1441 | IN VOID *SourceBuffer OPTIONAL,\r | |
1442 | IN UINTN SourceSize,\r | |
1443 | OUT EFI_HANDLE *ImageHandle\r | |
1444 | );\r | |
1445 | \r | |
1446 | \r | |
1447 | \r | |
1448 | /**\r | |
1449 | Unloads an image.\r | |
1450 | \r | |
1451 | @param ImageHandle Handle that identifies the image to be\r | |
1452 | unloaded.\r | |
1453 | \r | |
1454 | @retval EFI_SUCCESS The image has been unloaded.\r | |
1455 | @retval EFI_UNSUPPORTED The image has been started, and does not support\r | |
1456 | unload.\r | |
1457 | @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r | |
1458 | \r | |
1459 | **/\r | |
1460 | EFI_STATUS\r | |
1461 | EFIAPI\r | |
1462 | CoreUnloadImage (\r | |
1463 | IN EFI_HANDLE ImageHandle\r | |
1464 | );\r | |
1465 | \r | |
1466 | \r | |
1467 | \r | |
1468 | /**\r | |
1469 | Transfer control to a loaded image's entry point.\r | |
1470 | \r | |
1471 | @param ImageHandle Handle of image to be started.\r | |
1472 | @param ExitDataSize Pointer of the size to ExitData\r | |
1473 | @param ExitData Pointer to a pointer to a data buffer that\r | |
1474 | includes a Null-terminated string,\r | |
1475 | optionally followed by additional binary data.\r | |
1476 | The string is a description that the caller may\r | |
1477 | use to further indicate the reason for the\r | |
1478 | image's exit.\r | |
1479 | \r | |
1480 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
1481 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
1482 | @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r | |
1483 | @retval EFI_SUCCESS Successfully transfer control to the image's\r | |
1484 | entry point.\r | |
1485 | \r | |
1486 | **/\r | |
1487 | EFI_STATUS\r | |
1488 | EFIAPI\r | |
1489 | CoreStartImage (\r | |
1490 | IN EFI_HANDLE ImageHandle,\r | |
1491 | OUT UINTN *ExitDataSize,\r | |
1492 | OUT CHAR16 **ExitData OPTIONAL\r | |
1493 | );\r | |
1494 | \r | |
1495 | \r | |
1496 | \r | |
1497 | /**\r | |
1498 | Terminates the currently loaded EFI image and returns control to boot services.\r | |
1499 | \r | |
1500 | @param ImageHandle Handle that identifies the image. This\r | |
1501 | parameter is passed to the image on entry.\r | |
1502 | @param Status The image's exit code.\r | |
1503 | @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r | |
1504 | ExitStatus is EFI_SUCCESS.\r | |
1505 | @param ExitData Pointer to a data buffer that includes a\r | |
1506 | Null-terminated Unicode string, optionally\r | |
1507 | followed by additional binary data. The string\r | |
1508 | is a description that the caller may use to\r | |
1509 | further indicate the reason for the image's\r | |
1510 | exit.\r | |
1511 | \r | |
1512 | @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r | |
1513 | image.\r | |
1514 | @retval EFI_SUCCESS Successfully terminates the currently loaded\r | |
1515 | EFI image.\r | |
1516 | @retval EFI_ACCESS_DENIED Should never reach there.\r | |
1517 | @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r | |
1518 | \r | |
1519 | **/\r | |
1520 | EFI_STATUS\r | |
1521 | EFIAPI\r | |
1522 | CoreExit (\r | |
1523 | IN EFI_HANDLE ImageHandle,\r | |
1524 | IN EFI_STATUS Status,\r | |
1525 | IN UINTN ExitDataSize,\r | |
1526 | IN CHAR16 *ExitData OPTIONAL\r | |
1527 | );\r | |
1528 | \r | |
1529 | \r | |
1530 | \r | |
1531 | /**\r | |
1532 | Creates an event.\r | |
1533 | \r | |
1534 | @param Type The type of event to create and its mode and\r | |
1535 | attributes\r | |
1536 | @param NotifyTpl The task priority level of event notifications\r | |
1537 | @param NotifyFunction Pointer to the events notification function\r | |
1538 | @param NotifyContext Pointer to the notification functions context;\r | |
1539 | corresponds to parameter "Context" in the\r | |
1540 | notification function\r | |
1541 | @param Event Pointer to the newly created event if the call\r | |
1542 | succeeds; undefined otherwise\r | |
1543 | \r | |
1544 | @retval EFI_SUCCESS The event structure was created\r | |
1545 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r | |
1546 | @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r | |
1547 | \r | |
1548 | **/\r | |
1549 | EFI_STATUS\r | |
1550 | EFIAPI\r | |
1551 | CoreCreateEvent (\r | |
1552 | IN UINT32 Type,\r | |
1553 | IN EFI_TPL NotifyTpl,\r | |
1554 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
1555 | IN VOID *NotifyContext, OPTIONAL\r | |
1556 | OUT EFI_EVENT *Event\r | |
1557 | );\r | |
1558 | \r | |
1559 | \r | |
1560 | \r | |
1561 | /**\r | |
1562 | Creates an event in a group.\r | |
1563 | \r | |
1564 | @param Type The type of event to create and its mode and\r | |
1565 | attributes\r | |
1566 | @param NotifyTpl The task priority level of event notifications\r | |
1567 | @param NotifyFunction Pointer to the events notification function\r | |
1568 | @param NotifyContext Pointer to the notification functions context;\r | |
1569 | corresponds to parameter "Context" in the\r | |
1570 | notification function\r | |
1571 | @param EventGroup GUID for EventGroup if NULL act the same as\r | |
1572 | gBS->CreateEvent().\r | |
1573 | @param Event Pointer to the newly created event if the call\r | |
1574 | succeeds; undefined otherwise\r | |
1575 | \r | |
1576 | @retval EFI_SUCCESS The event structure was created\r | |
1577 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r | |
1578 | @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r | |
1579 | \r | |
1580 | **/\r | |
1581 | EFI_STATUS\r | |
1582 | EFIAPI\r | |
1583 | CoreCreateEventEx (\r | |
1584 | IN UINT32 Type,\r | |
1585 | IN EFI_TPL NotifyTpl,\r | |
1586 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
1587 | IN CONST VOID *NotifyContext, OPTIONAL\r | |
1588 | IN CONST EFI_GUID *EventGroup, OPTIONAL\r | |
1589 | OUT EFI_EVENT *Event\r | |
1590 | );\r | |
1591 | \r | |
1592 | /**\r | |
1593 | Creates a general-purpose event structure\r | |
1594 | \r | |
1595 | @param Type The type of event to create and its mode and\r | |
1596 | attributes\r | |
1597 | @param NotifyTpl The task priority level of event notifications\r | |
1598 | @param NotifyFunction Pointer to the events notification function\r | |
1599 | @param NotifyContext Pointer to the notification functions context;\r | |
1600 | corresponds to parameter "Context" in the\r | |
1601 | notification function\r | |
1602 | @param EventGroup GUID for EventGroup if NULL act the same as\r | |
1603 | gBS->CreateEvent().\r | |
1604 | @param Event Pointer to the newly created event if the call\r | |
1605 | succeeds; undefined otherwise\r | |
1606 | \r | |
1607 | @retval EFI_SUCCESS The event structure was created\r | |
1608 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r | |
1609 | @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r | |
1610 | \r | |
1611 | **/\r | |
1612 | EFI_STATUS\r | |
1613 | EFIAPI\r | |
1614 | CoreCreateEventInternal (\r | |
1615 | IN UINT32 Type,\r | |
1616 | IN EFI_TPL NotifyTpl,\r | |
1617 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
1618 | IN CONST VOID *NotifyContext, OPTIONAL\r | |
1619 | IN CONST EFI_GUID *EventGroup, OPTIONAL\r | |
1620 | OUT EFI_EVENT *Event\r | |
1621 | );\r | |
1622 | \r | |
1623 | /**\r | |
1624 | Sets the type of timer and the trigger time for a timer event.\r | |
1625 | \r | |
1626 | @param UserEvent The timer event that is to be signaled at the\r | |
1627 | specified time\r | |
1628 | @param Type The type of time that is specified in\r | |
1629 | TriggerTime\r | |
1630 | @param TriggerTime The number of 100ns units until the timer\r | |
1631 | expires\r | |
1632 | \r | |
1633 | @retval EFI_SUCCESS The event has been set to be signaled at the\r | |
1634 | requested time\r | |
1635 | @retval EFI_INVALID_PARAMETER Event or Type is not valid\r | |
1636 | \r | |
1637 | **/\r | |
1638 | EFI_STATUS\r | |
1639 | EFIAPI\r | |
1640 | CoreSetTimer (\r | |
1641 | IN EFI_EVENT UserEvent,\r | |
1642 | IN EFI_TIMER_DELAY Type,\r | |
1643 | IN UINT64 TriggerTime\r | |
1644 | );\r | |
1645 | \r | |
1646 | \r | |
1647 | \r | |
1648 | /**\r | |
1649 | Signals the event. Queues the event to be notified if needed.\r | |
1650 | \r | |
1651 | @param UserEvent The event to signal .\r | |
1652 | \r | |
1653 | @retval EFI_INVALID_PARAMETER Parameters are not valid.\r | |
1654 | @retval EFI_SUCCESS The event was signaled.\r | |
1655 | \r | |
1656 | **/\r | |
1657 | EFI_STATUS\r | |
1658 | EFIAPI\r | |
1659 | CoreSignalEvent (\r | |
1660 | IN EFI_EVENT UserEvent\r | |
1661 | );\r | |
1662 | \r | |
1663 | \r | |
1664 | \r | |
1665 | /**\r | |
1666 | Stops execution until an event is signaled.\r | |
1667 | \r | |
1668 | @param NumberOfEvents The number of events in the UserEvents array\r | |
1669 | @param UserEvents An array of EFI_EVENT\r | |
1670 | @param UserIndex Pointer to the index of the event which\r | |
1671 | satisfied the wait condition\r | |
1672 | \r | |
1673 | @retval EFI_SUCCESS The event indicated by Index was signaled.\r | |
1674 | @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r | |
1675 | function or Event was not a valid type\r | |
1676 | @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r | |
1677 | \r | |
1678 | **/\r | |
1679 | EFI_STATUS\r | |
1680 | EFIAPI\r | |
1681 | CoreWaitForEvent (\r | |
1682 | IN UINTN NumberOfEvents,\r | |
1683 | IN EFI_EVENT *UserEvents,\r | |
1684 | OUT UINTN *UserIndex\r | |
1685 | );\r | |
1686 | \r | |
1687 | \r | |
1688 | \r | |
1689 | /**\r | |
1690 | Closes an event and frees the event structure.\r | |
1691 | \r | |
1692 | @param UserEvent Event to close\r | |
1693 | \r | |
1694 | @retval EFI_INVALID_PARAMETER Parameters are not valid.\r | |
1695 | @retval EFI_SUCCESS The event has been closed\r | |
1696 | \r | |
1697 | **/\r | |
1698 | EFI_STATUS\r | |
1699 | EFIAPI\r | |
1700 | CoreCloseEvent (\r | |
1701 | IN EFI_EVENT UserEvent\r | |
1702 | );\r | |
1703 | \r | |
1704 | \r | |
1705 | \r | |
1706 | /**\r | |
1707 | Check the status of an event.\r | |
1708 | \r | |
1709 | @param UserEvent The event to check\r | |
1710 | \r | |
1711 | @retval EFI_SUCCESS The event is in the signaled state\r | |
1712 | @retval EFI_NOT_READY The event is not in the signaled state\r | |
1713 | @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r | |
1714 | \r | |
1715 | **/\r | |
1716 | EFI_STATUS\r | |
1717 | EFIAPI\r | |
1718 | CoreCheckEvent (\r | |
1719 | IN EFI_EVENT UserEvent\r | |
1720 | );\r | |
1721 | \r | |
1722 | \r | |
1723 | /**\r | |
1724 | Adds reserved memory, system memory, or memory-mapped I/O resources to the\r | |
1725 | global coherency domain of the processor.\r | |
1726 | \r | |
1727 | @param GcdMemoryType Memory type of the memory space.\r | |
1728 | @param BaseAddress Base address of the memory space.\r | |
1729 | @param Length Length of the memory space.\r | |
1730 | @param Capabilities alterable attributes of the memory space.\r | |
1731 | \r | |
1732 | @retval EFI_SUCCESS Merged this memory space into GCD map.\r | |
1733 | \r | |
1734 | **/\r | |
1735 | EFI_STATUS\r | |
1736 | EFIAPI\r | |
1737 | CoreAddMemorySpace (\r | |
1738 | IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r | |
1739 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1740 | IN UINT64 Length,\r | |
1741 | IN UINT64 Capabilities\r | |
1742 | );\r | |
1743 | \r | |
1744 | \r | |
1745 | /**\r | |
1746 | Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r | |
1747 | I/O resources from the global coherency domain of the processor.\r | |
1748 | \r | |
1749 | @param GcdAllocateType The type of allocate operation\r | |
1750 | @param GcdMemoryType The desired memory type\r | |
1751 | @param Alignment Align with 2^Alignment\r | |
1752 | @param Length Length to allocate\r | |
1753 | @param BaseAddress Base address to allocate\r | |
1754 | @param ImageHandle The image handle consume the allocated space.\r | |
1755 | @param DeviceHandle The device handle consume the allocated space.\r | |
1756 | \r | |
1757 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1758 | @retval EFI_NOT_FOUND No descriptor contains the desired space.\r | |
1759 | @retval EFI_SUCCESS Memory space successfully allocated.\r | |
1760 | \r | |
1761 | **/\r | |
1762 | EFI_STATUS\r | |
1763 | EFIAPI\r | |
1764 | CoreAllocateMemorySpace (\r | |
1765 | IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r | |
1766 | IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r | |
1767 | IN UINTN Alignment,\r | |
1768 | IN UINT64 Length,\r | |
1769 | IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r | |
1770 | IN EFI_HANDLE ImageHandle,\r | |
1771 | IN EFI_HANDLE DeviceHandle OPTIONAL\r | |
1772 | );\r | |
1773 | \r | |
1774 | \r | |
1775 | /**\r | |
1776 | Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r | |
1777 | I/O resources from the global coherency domain of the processor.\r | |
1778 | \r | |
1779 | @param BaseAddress Base address of the memory space.\r | |
1780 | @param Length Length of the memory space.\r | |
1781 | \r | |
1782 | @retval EFI_SUCCESS Space successfully freed.\r | |
1783 | \r | |
1784 | **/\r | |
1785 | EFI_STATUS\r | |
1786 | EFIAPI\r | |
1787 | CoreFreeMemorySpace (\r | |
1788 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1789 | IN UINT64 Length\r | |
1790 | );\r | |
1791 | \r | |
1792 | \r | |
1793 | /**\r | |
1794 | Removes reserved memory, system memory, or memory-mapped I/O resources from\r | |
1795 | the global coherency domain of the processor.\r | |
1796 | \r | |
1797 | @param BaseAddress Base address of the memory space.\r | |
1798 | @param Length Length of the memory space.\r | |
1799 | \r | |
1800 | @retval EFI_SUCCESS Successfully remove a segment of memory space.\r | |
1801 | \r | |
1802 | **/\r | |
1803 | EFI_STATUS\r | |
1804 | EFIAPI\r | |
1805 | CoreRemoveMemorySpace (\r | |
1806 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1807 | IN UINT64 Length\r | |
1808 | );\r | |
1809 | \r | |
1810 | \r | |
1811 | /**\r | |
1812 | Retrieves the descriptor for a memory region containing a specified address.\r | |
1813 | \r | |
1814 | @param BaseAddress Specified start address\r | |
1815 | @param Descriptor Specified length\r | |
1816 | \r | |
1817 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
1818 | @retval EFI_SUCCESS Successfully get memory space descriptor.\r | |
1819 | \r | |
1820 | **/\r | |
1821 | EFI_STATUS\r | |
1822 | EFIAPI\r | |
1823 | CoreGetMemorySpaceDescriptor (\r | |
1824 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1825 | OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r | |
1826 | );\r | |
1827 | \r | |
1828 | \r | |
1829 | /**\r | |
1830 | Modifies the attributes for a memory region in the global coherency domain of the\r | |
1831 | processor.\r | |
1832 | \r | |
1833 | @param BaseAddress Specified start address\r | |
1834 | @param Length Specified length\r | |
1835 | @param Attributes Specified attributes\r | |
1836 | \r | |
1837 | @retval EFI_SUCCESS The attributes were set for the memory region.\r | |
1838 | @retval EFI_INVALID_PARAMETER Length is zero.\r | |
1839 | @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r | |
1840 | resource range specified by BaseAddress and Length.\r | |
1841 | @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r | |
1842 | range specified by BaseAddress and Length.\r | |
1843 | @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by\r | |
1844 | BaseAddress and Length cannot be modified.\r | |
1845 | @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r | |
1846 | the memory resource range.\r | |
1847 | @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r | |
1848 | not available yet.\r | |
1849 | \r | |
1850 | **/\r | |
1851 | EFI_STATUS\r | |
1852 | EFIAPI\r | |
1853 | CoreSetMemorySpaceAttributes (\r | |
1854 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1855 | IN UINT64 Length,\r | |
1856 | IN UINT64 Attributes\r | |
1857 | );\r | |
1858 | \r | |
1859 | \r | |
1860 | /**\r | |
1861 | Modifies the capabilities for a memory region in the global coherency domain of the\r | |
1862 | processor.\r | |
1863 | \r | |
1864 | @param BaseAddress The physical address that is the start address of a memory region.\r | |
1865 | @param Length The size in bytes of the memory region.\r | |
1866 | @param Capabilities The bit mask of capabilities that the memory region supports.\r | |
1867 | \r | |
1868 | @retval EFI_SUCCESS The capabilities were set for the memory region.\r | |
1869 | @retval EFI_INVALID_PARAMETER Length is zero.\r | |
1870 | @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the\r | |
1871 | memory region attributes currently in use.\r | |
1872 | @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by\r | |
1873 | BaseAddress and Length cannot be modified.\r | |
1874 | @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities\r | |
1875 | of the memory resource range.\r | |
1876 | **/\r | |
1877 | EFI_STATUS\r | |
1878 | EFIAPI\r | |
1879 | CoreSetMemorySpaceCapabilities (\r | |
1880 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1881 | IN UINT64 Length,\r | |
1882 | IN UINT64 Capabilities\r | |
1883 | );\r | |
1884 | \r | |
1885 | \r | |
1886 | /**\r | |
1887 | Returns a map of the memory resources in the global coherency domain of the\r | |
1888 | processor.\r | |
1889 | \r | |
1890 | @param NumberOfDescriptors Number of descriptors.\r | |
1891 | @param MemorySpaceMap Descriptor array\r | |
1892 | \r | |
1893 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
1894 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
1895 | @retval EFI_SUCCESS Successfully get memory space map.\r | |
1896 | \r | |
1897 | **/\r | |
1898 | EFI_STATUS\r | |
1899 | EFIAPI\r | |
1900 | CoreGetMemorySpaceMap (\r | |
1901 | OUT UINTN *NumberOfDescriptors,\r | |
1902 | OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r | |
1903 | );\r | |
1904 | \r | |
1905 | \r | |
1906 | /**\r | |
1907 | Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r | |
1908 | \r | |
1909 | @param GcdIoType IO type of the segment.\r | |
1910 | @param BaseAddress Base address of the segment.\r | |
1911 | @param Length Length of the segment.\r | |
1912 | \r | |
1913 | @retval EFI_SUCCESS Merged this segment into GCD map.\r | |
1914 | @retval EFI_INVALID_PARAMETER Parameter not valid\r | |
1915 | \r | |
1916 | **/\r | |
1917 | EFI_STATUS\r | |
1918 | EFIAPI\r | |
1919 | CoreAddIoSpace (\r | |
1920 | IN EFI_GCD_IO_TYPE GcdIoType,\r | |
1921 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1922 | IN UINT64 Length\r | |
1923 | );\r | |
1924 | \r | |
1925 | \r | |
1926 | /**\r | |
1927 | Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r | |
1928 | domain of the processor.\r | |
1929 | \r | |
1930 | @param GcdAllocateType The type of allocate operation\r | |
1931 | @param GcdIoType The desired IO type\r | |
1932 | @param Alignment Align with 2^Alignment\r | |
1933 | @param Length Length to allocate\r | |
1934 | @param BaseAddress Base address to allocate\r | |
1935 | @param ImageHandle The image handle consume the allocated space.\r | |
1936 | @param DeviceHandle The device handle consume the allocated space.\r | |
1937 | \r | |
1938 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
1939 | @retval EFI_NOT_FOUND No descriptor contains the desired space.\r | |
1940 | @retval EFI_SUCCESS IO space successfully allocated.\r | |
1941 | \r | |
1942 | **/\r | |
1943 | EFI_STATUS\r | |
1944 | EFIAPI\r | |
1945 | CoreAllocateIoSpace (\r | |
1946 | IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r | |
1947 | IN EFI_GCD_IO_TYPE GcdIoType,\r | |
1948 | IN UINTN Alignment,\r | |
1949 | IN UINT64 Length,\r | |
1950 | IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r | |
1951 | IN EFI_HANDLE ImageHandle,\r | |
1952 | IN EFI_HANDLE DeviceHandle OPTIONAL\r | |
1953 | );\r | |
1954 | \r | |
1955 | \r | |
1956 | /**\r | |
1957 | Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r | |
1958 | domain of the processor.\r | |
1959 | \r | |
1960 | @param BaseAddress Base address of the segment.\r | |
1961 | @param Length Length of the segment.\r | |
1962 | \r | |
1963 | @retval EFI_SUCCESS Space successfully freed.\r | |
1964 | \r | |
1965 | **/\r | |
1966 | EFI_STATUS\r | |
1967 | EFIAPI\r | |
1968 | CoreFreeIoSpace (\r | |
1969 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1970 | IN UINT64 Length\r | |
1971 | );\r | |
1972 | \r | |
1973 | \r | |
1974 | /**\r | |
1975 | Removes reserved I/O or I/O resources from the global coherency domain of the\r | |
1976 | processor.\r | |
1977 | \r | |
1978 | @param BaseAddress Base address of the segment.\r | |
1979 | @param Length Length of the segment.\r | |
1980 | \r | |
1981 | @retval EFI_SUCCESS Successfully removed a segment of IO space.\r | |
1982 | \r | |
1983 | **/\r | |
1984 | EFI_STATUS\r | |
1985 | EFIAPI\r | |
1986 | CoreRemoveIoSpace (\r | |
1987 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
1988 | IN UINT64 Length\r | |
1989 | );\r | |
1990 | \r | |
1991 | \r | |
1992 | /**\r | |
1993 | Retrieves the descriptor for an I/O region containing a specified address.\r | |
1994 | \r | |
1995 | @param BaseAddress Specified start address\r | |
1996 | @param Descriptor Specified length\r | |
1997 | \r | |
1998 | @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r | |
1999 | @retval EFI_SUCCESS Successfully get the IO space descriptor.\r | |
2000 | \r | |
2001 | **/\r | |
2002 | EFI_STATUS\r | |
2003 | EFIAPI\r | |
2004 | CoreGetIoSpaceDescriptor (\r | |
2005 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
2006 | OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r | |
2007 | );\r | |
2008 | \r | |
2009 | \r | |
2010 | /**\r | |
2011 | Returns a map of the I/O resources in the global coherency domain of the processor.\r | |
2012 | \r | |
2013 | @param NumberOfDescriptors Number of descriptors.\r | |
2014 | @param IoSpaceMap Descriptor array\r | |
2015 | \r | |
2016 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
2017 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
2018 | @retval EFI_SUCCESS Successfully get IO space map.\r | |
2019 | \r | |
2020 | **/\r | |
2021 | EFI_STATUS\r | |
2022 | EFIAPI\r | |
2023 | CoreGetIoSpaceMap (\r | |
2024 | OUT UINTN *NumberOfDescriptors,\r | |
2025 | OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r | |
2026 | );\r | |
2027 | \r | |
2028 | \r | |
2029 | /**\r | |
2030 | This is the main Dispatcher for DXE and it exits when there are no more\r | |
2031 | drivers to run. Drain the mScheduledQueue and load and start a PE\r | |
2032 | image for each driver. Search the mDiscoveredList to see if any driver can\r | |
2033 | be placed on the mScheduledQueue. If no drivers are placed on the\r | |
2034 | mScheduledQueue exit the function. On exit it is assumed the Bds()\r | |
2035 | will be called, and when the Bds() exits the Dispatcher will be called\r | |
2036 | again.\r | |
2037 | \r | |
2038 | @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r | |
2039 | @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r | |
2040 | @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r | |
2041 | \r | |
2042 | **/\r | |
2043 | EFI_STATUS\r | |
2044 | EFIAPI\r | |
2045 | CoreDispatcher (\r | |
2046 | VOID\r | |
2047 | );\r | |
2048 | \r | |
2049 | /**\r | |
2050 | Check every driver and locate a matching one. If the driver is found, the Unrequested\r | |
2051 | state flag is cleared.\r | |
2052 | \r | |
2053 | @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r | |
2054 | the firmware file specified by DriverName.\r | |
2055 | @param DriverName The Driver name to put in the Dependent state.\r | |
2056 | \r | |
2057 | @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r | |
2058 | cleared\r | |
2059 | @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r | |
2060 | not set.\r | |
2061 | \r | |
2062 | **/\r | |
2063 | EFI_STATUS\r | |
2064 | EFIAPI\r | |
2065 | CoreSchedule (\r | |
2066 | IN EFI_HANDLE FirmwareVolumeHandle,\r | |
2067 | IN EFI_GUID *DriverName\r | |
2068 | );\r | |
2069 | \r | |
2070 | \r | |
2071 | /**\r | |
2072 | Convert a driver from the Untrused back to the Scheduled state.\r | |
2073 | \r | |
2074 | @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r | |
2075 | the firmware file specified by DriverName.\r | |
2076 | @param DriverName The Driver name to put in the Scheduled state\r | |
2077 | \r | |
2078 | @retval EFI_SUCCESS The file was found in the untrusted state, and it\r | |
2079 | was promoted to the trusted state.\r | |
2080 | @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r | |
2081 | \r | |
2082 | **/\r | |
2083 | EFI_STATUS\r | |
2084 | EFIAPI\r | |
2085 | CoreTrust (\r | |
2086 | IN EFI_HANDLE FirmwareVolumeHandle,\r | |
2087 | IN EFI_GUID *DriverName\r | |
2088 | );\r | |
2089 | \r | |
2090 | \r | |
2091 | /**\r | |
2092 | This routine is the driver initialization entry point. It initializes the\r | |
2093 | libraries, and registers two notification functions. These notification\r | |
2094 | functions are responsible for building the FV stack dynamically.\r | |
2095 | \r | |
2096 | @param ImageHandle The image handle.\r | |
2097 | @param SystemTable The system table.\r | |
2098 | \r | |
2099 | @retval EFI_SUCCESS Function successfully returned.\r | |
2100 | \r | |
2101 | **/\r | |
2102 | EFI_STATUS\r | |
2103 | EFIAPI\r | |
2104 | FwVolDriverInit (\r | |
2105 | IN EFI_HANDLE ImageHandle,\r | |
2106 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
2107 | );\r | |
2108 | \r | |
2109 | \r | |
2110 | /**\r | |
2111 | Entry point of the section extraction code. Initializes an instance of the\r | |
2112 | section extraction interface and installs it on a new handle.\r | |
2113 | \r | |
2114 | @param ImageHandle A handle for the image that is initializing this driver\r | |
2115 | @param SystemTable A pointer to the EFI system table\r | |
2116 | \r | |
2117 | @retval EFI_SUCCESS Driver initialized successfully\r | |
2118 | @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r | |
2119 | \r | |
2120 | **/\r | |
2121 | EFI_STATUS\r | |
2122 | EFIAPI\r | |
2123 | InitializeSectionExtraction (\r | |
2124 | IN EFI_HANDLE ImageHandle,\r | |
2125 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
2126 | );\r | |
2127 | \r | |
2128 | \r | |
2129 | /**\r | |
2130 | This DXE service routine is used to process a firmware volume. In\r | |
2131 | particular, it can be called by BDS to process a single firmware\r | |
2132 | volume found in a capsule.\r | |
2133 | \r | |
2134 | @param FvHeader pointer to a firmware volume header\r | |
2135 | @param Size the size of the buffer pointed to by FvHeader\r | |
2136 | @param FVProtocolHandle the handle on which a firmware volume protocol\r | |
2137 | was produced for the firmware volume passed in.\r | |
2138 | \r | |
2139 | @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r | |
2140 | system resources\r | |
2141 | @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r | |
2142 | @retval EFI_SUCCESS a firmware volume protocol was produced for the\r | |
2143 | firmware volume\r | |
2144 | \r | |
2145 | **/\r | |
2146 | EFI_STATUS\r | |
2147 | EFIAPI\r | |
2148 | CoreProcessFirmwareVolume (\r | |
2149 | IN VOID *FvHeader,\r | |
2150 | IN UINTN Size,\r | |
2151 | OUT EFI_HANDLE *FVProtocolHandle\r | |
2152 | );\r | |
2153 | \r | |
2154 | //\r | |
2155 | //Functions used during debug buils\r | |
2156 | //\r | |
2157 | \r | |
2158 | /**\r | |
2159 | Displays Architectural protocols that were not loaded and are required for DXE\r | |
2160 | core to function. Only used in Debug Builds.\r | |
2161 | \r | |
2162 | **/\r | |
2163 | VOID\r | |
2164 | CoreDisplayMissingArchProtocols (\r | |
2165 | VOID\r | |
2166 | );\r | |
2167 | \r | |
2168 | \r | |
2169 | /**\r | |
2170 | Traverse the discovered list for any drivers that were discovered but not loaded\r | |
2171 | because the dependency experessions evaluated to false.\r | |
2172 | \r | |
2173 | **/\r | |
2174 | VOID\r | |
2175 | CoreDisplayDiscoveredNotDispatched (\r | |
2176 | VOID\r | |
2177 | );\r | |
2178 | \r | |
2179 | \r | |
2180 | \r | |
2181 | /**\r | |
2182 | Place holder function until all the Boot Services and Runtime Services are\r | |
2183 | available.\r | |
2184 | \r | |
2185 | @param Arg1 Undefined\r | |
2186 | \r | |
2187 | @return EFI_NOT_AVAILABLE_YET\r | |
2188 | \r | |
2189 | **/\r | |
2190 | EFI_STATUS\r | |
2191 | EFIAPI\r | |
2192 | CoreEfiNotAvailableYetArg1 (\r | |
2193 | UINTN Arg1\r | |
2194 | );\r | |
2195 | \r | |
2196 | \r | |
2197 | /**\r | |
2198 | Place holder function until all the Boot Services and Runtime Services are available.\r | |
2199 | \r | |
2200 | @param Arg1 Undefined\r | |
2201 | @param Arg2 Undefined\r | |
2202 | \r | |
2203 | @return EFI_NOT_AVAILABLE_YET\r | |
2204 | \r | |
2205 | **/\r | |
2206 | EFI_STATUS\r | |
2207 | EFIAPI\r | |
2208 | CoreEfiNotAvailableYetArg2 (\r | |
2209 | UINTN Arg1,\r | |
2210 | UINTN Arg2\r | |
2211 | );\r | |
2212 | \r | |
2213 | \r | |
2214 | /**\r | |
2215 | Place holder function until all the Boot Services and Runtime Services are available.\r | |
2216 | \r | |
2217 | @param Arg1 Undefined\r | |
2218 | @param Arg2 Undefined\r | |
2219 | @param Arg3 Undefined\r | |
2220 | \r | |
2221 | @return EFI_NOT_AVAILABLE_YET\r | |
2222 | \r | |
2223 | **/\r | |
2224 | EFI_STATUS\r | |
2225 | EFIAPI\r | |
2226 | CoreEfiNotAvailableYetArg3 (\r | |
2227 | UINTN Arg1,\r | |
2228 | UINTN Arg2,\r | |
2229 | UINTN Arg3\r | |
2230 | );\r | |
2231 | \r | |
2232 | \r | |
2233 | /**\r | |
2234 | Place holder function until all the Boot Services and Runtime Services are available.\r | |
2235 | \r | |
2236 | @param Arg1 Undefined\r | |
2237 | @param Arg2 Undefined\r | |
2238 | @param Arg3 Undefined\r | |
2239 | @param Arg4 Undefined\r | |
2240 | \r | |
2241 | @return EFI_NOT_AVAILABLE_YET\r | |
2242 | \r | |
2243 | **/\r | |
2244 | EFI_STATUS\r | |
2245 | EFIAPI\r | |
2246 | CoreEfiNotAvailableYetArg4 (\r | |
2247 | UINTN Arg1,\r | |
2248 | UINTN Arg2,\r | |
2249 | UINTN Arg3,\r | |
2250 | UINTN Arg4\r | |
2251 | );\r | |
2252 | \r | |
2253 | \r | |
2254 | /**\r | |
2255 | Place holder function until all the Boot Services and Runtime Services are available.\r | |
2256 | \r | |
2257 | @param Arg1 Undefined\r | |
2258 | @param Arg2 Undefined\r | |
2259 | @param Arg3 Undefined\r | |
2260 | @param Arg4 Undefined\r | |
2261 | @param Arg5 Undefined\r | |
2262 | \r | |
2263 | @return EFI_NOT_AVAILABLE_YET\r | |
2264 | \r | |
2265 | **/\r | |
2266 | EFI_STATUS\r | |
2267 | EFIAPI\r | |
2268 | CoreEfiNotAvailableYetArg5 (\r | |
2269 | UINTN Arg1,\r | |
2270 | UINTN Arg2,\r | |
2271 | UINTN Arg3,\r | |
2272 | UINTN Arg4,\r | |
2273 | UINTN Arg5\r | |
2274 | );\r | |
2275 | \r | |
2276 | \r | |
2277 | /**\r | |
2278 | Given a compressed source buffer, this function retrieves the size of the\r | |
2279 | uncompressed buffer and the size of the scratch buffer required to decompress\r | |
2280 | the compressed source buffer.\r | |
2281 | \r | |
2282 | The GetInfo() function retrieves the size of the uncompressed buffer and the\r | |
2283 | temporary scratch buffer required to decompress the buffer specified by Source\r | |
2284 | and SourceSize. If the size of the uncompressed buffer or the size of the\r | |
2285 | scratch buffer cannot be determined from the compressed data specified by\r | |
2286 | Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r | |
2287 | size of the uncompressed buffer is returned in DestinationSize, the size of\r | |
2288 | the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r | |
2289 | The GetInfo() function does not have scratch buffer available to perform a\r | |
2290 | thorough checking of the validity of the source data. It just retrieves the\r | |
2291 | "Original Size" field from the beginning bytes of the source data and output\r | |
2292 | it as DestinationSize. And ScratchSize is specific to the decompression\r | |
2293 | implementation.\r | |
2294 | \r | |
2295 | @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r | |
2296 | @param Source The source buffer containing the compressed data.\r | |
2297 | @param SourceSize The size, in bytes, of the source buffer.\r | |
2298 | @param DestinationSize A pointer to the size, in bytes, of the\r | |
2299 | uncompressed buffer that will be generated when the\r | |
2300 | compressed buffer specified by Source and\r | |
2301 | SourceSize is decompressed.\r | |
2302 | @param ScratchSize A pointer to the size, in bytes, of the scratch\r | |
2303 | buffer that is required to decompress the\r | |
2304 | compressed buffer specified by Source and\r | |
2305 | SourceSize.\r | |
2306 | \r | |
2307 | @retval EFI_SUCCESS The size of the uncompressed data was returned in\r | |
2308 | DestinationSize and the size of the scratch buffer\r | |
2309 | was returned in ScratchSize.\r | |
2310 | @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r | |
2311 | the scratch buffer cannot be determined from the\r | |
2312 | compressed data specified by Source and\r | |
2313 | SourceSize.\r | |
2314 | \r | |
2315 | **/\r | |
2316 | EFI_STATUS\r | |
2317 | EFIAPI\r | |
2318 | DxeMainUefiDecompressGetInfo (\r | |
2319 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
2320 | IN VOID *Source,\r | |
2321 | IN UINT32 SourceSize,\r | |
2322 | OUT UINT32 *DestinationSize,\r | |
2323 | OUT UINT32 *ScratchSize\r | |
2324 | );\r | |
2325 | \r | |
2326 | \r | |
2327 | /**\r | |
2328 | Decompresses a compressed source buffer.\r | |
2329 | \r | |
2330 | The Decompress() function extracts decompressed data to its original form.\r | |
2331 | This protocol is designed so that the decompression algorithm can be\r | |
2332 | implemented without using any memory services. As a result, the Decompress()\r | |
2333 | Function is not allowed to call AllocatePool() or AllocatePages() in its\r | |
2334 | implementation. It is the caller's responsibility to allocate and free the\r | |
2335 | Destination and Scratch buffers.\r | |
2336 | If the compressed source data specified by Source and SourceSize is\r | |
2337 | sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r | |
2338 | the compressed source data specified by Source and SourceSize is not in a\r | |
2339 | valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r | |
2340 | \r | |
2341 | @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r | |
2342 | @param Source The source buffer containing the compressed data.\r | |
2343 | @param SourceSize SourceSizeThe size of source data.\r | |
2344 | @param Destination On output, the destination buffer that contains\r | |
2345 | the uncompressed data.\r | |
2346 | @param DestinationSize The size of the destination buffer. The size of\r | |
2347 | the destination buffer needed is obtained from\r | |
2348 | EFI_DECOMPRESS_PROTOCOL.GetInfo().\r | |
2349 | @param Scratch A temporary scratch buffer that is used to perform\r | |
2350 | the decompression.\r | |
2351 | @param ScratchSize The size of scratch buffer. The size of the\r | |
2352 | scratch buffer needed is obtained from GetInfo().\r | |
2353 | \r | |
2354 | @retval EFI_SUCCESS Decompression completed successfully, and the\r | |
2355 | uncompressed buffer is returned in Destination.\r | |
2356 | @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r | |
2357 | SourceSize is corrupted (not in a valid\r | |
2358 | compressed format).\r | |
2359 | \r | |
2360 | **/\r | |
2361 | EFI_STATUS\r | |
2362 | EFIAPI\r | |
2363 | DxeMainUefiDecompress (\r | |
2364 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
2365 | IN VOID *Source,\r | |
2366 | IN UINT32 SourceSize,\r | |
2367 | IN OUT VOID *Destination,\r | |
2368 | IN UINT32 DestinationSize,\r | |
2369 | IN OUT VOID *Scratch,\r | |
2370 | IN UINT32 ScratchSize\r | |
2371 | );\r | |
2372 | \r | |
2373 | /**\r | |
2374 | SEP member function. This function creates and returns a new section stream\r | |
2375 | handle to represent the new section stream.\r | |
2376 | \r | |
2377 | @param SectionStreamLength Size in bytes of the section stream.\r | |
2378 | @param SectionStream Buffer containing the new section stream.\r | |
2379 | @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r | |
2380 | output contains the new section stream handle.\r | |
2381 | \r | |
2382 | @retval EFI_SUCCESS The section stream is created successfully.\r | |
2383 | @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r | |
2384 | @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r | |
2385 | of last section.\r | |
2386 | \r | |
2387 | **/\r | |
2388 | EFI_STATUS\r | |
2389 | EFIAPI\r | |
2390 | OpenSectionStream (\r | |
2391 | IN UINTN SectionStreamLength,\r | |
2392 | IN VOID *SectionStream,\r | |
2393 | OUT UINTN *SectionStreamHandle\r | |
2394 | );\r | |
2395 | \r | |
2396 | \r | |
2397 | \r | |
2398 | /**\r | |
2399 | SEP member function. Retrieves requested section from section stream.\r | |
2400 | \r | |
2401 | @param SectionStreamHandle The section stream from which to extract the\r | |
2402 | requested section.\r | |
2403 | @param SectionType A pointer to the type of section to search for.\r | |
2404 | @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r | |
2405 | then SectionDefinitionGuid indicates which of\r | |
2406 | these types of sections to search for.\r | |
2407 | @param SectionInstance Indicates which instance of the requested\r | |
2408 | section to return.\r | |
2409 | @param Buffer Double indirection to buffer. If *Buffer is\r | |
2410 | non-null on input, then the buffer is caller\r | |
2411 | allocated. If Buffer is NULL, then the buffer\r | |
2412 | is callee allocated. In either case, the\r | |
2413 | required buffer size is returned in *BufferSize.\r | |
2414 | @param BufferSize On input, indicates the size of *Buffer if\r | |
2415 | *Buffer is non-null on input. On output,\r | |
2416 | indicates the required size (allocated size if\r | |
2417 | callee allocated) of *Buffer.\r | |
2418 | @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r | |
2419 | indicates the authentication status of the\r | |
2420 | output buffer. If the input section's\r | |
2421 | GuidedSectionHeader.Attributes field\r | |
2422 | has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r | |
2423 | bit as clear, AuthenticationStatus must return\r | |
2424 | zero. Both local bits (19:16) and aggregate\r | |
2425 | bits (3:0) in AuthenticationStatus are returned\r | |
2426 | by ExtractSection(). These bits reflect the\r | |
2427 | status of the extraction operation. The bit\r | |
2428 | pattern in both regions must be the same, as\r | |
2429 | the local and aggregate authentication statuses\r | |
2430 | have equivalent meaning at this level. If the\r | |
2431 | function returns anything other than\r | |
2432 | EFI_SUCCESS, the value of *AuthenticationStatus\r | |
2433 | is undefined.\r | |
2434 | @param IsFfs3Fv Indicates the FV format.\r | |
2435 | \r | |
2436 | @retval EFI_SUCCESS Section was retrieved successfully\r | |
2437 | @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r | |
2438 | section stream with its\r | |
2439 | EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r | |
2440 | but there was no corresponding GUIDed Section\r | |
2441 | Extraction Protocol in the handle database.\r | |
2442 | *Buffer is unmodified.\r | |
2443 | @retval EFI_NOT_FOUND An error was encountered when parsing the\r | |
2444 | SectionStream. This indicates the SectionStream\r | |
2445 | is not correctly formatted.\r | |
2446 | @retval EFI_NOT_FOUND The requested section does not exist.\r | |
2447 | @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r | |
2448 | the request.\r | |
2449 | @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r | |
2450 | @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r | |
2451 | insufficient to contain the requested section.\r | |
2452 | The input buffer is filled and section contents\r | |
2453 | are truncated.\r | |
2454 | \r | |
2455 | **/\r | |
2456 | EFI_STATUS\r | |
2457 | EFIAPI\r | |
2458 | GetSection (\r | |
2459 | IN UINTN SectionStreamHandle,\r | |
2460 | IN EFI_SECTION_TYPE *SectionType,\r | |
2461 | IN EFI_GUID *SectionDefinitionGuid,\r | |
2462 | IN UINTN SectionInstance,\r | |
2463 | IN VOID **Buffer,\r | |
2464 | IN OUT UINTN *BufferSize,\r | |
2465 | OUT UINT32 *AuthenticationStatus,\r | |
2466 | IN BOOLEAN IsFfs3Fv\r | |
2467 | );\r | |
2468 | \r | |
2469 | \r | |
2470 | /**\r | |
2471 | SEP member function. Deletes an existing section stream\r | |
2472 | \r | |
2473 | @param StreamHandleToClose Indicates the stream to close\r | |
2474 | @param FreeStreamBuffer TRUE - Need to free stream buffer;\r | |
2475 | FALSE - No need to free stream buffer.\r | |
2476 | \r | |
2477 | @retval EFI_SUCCESS The section stream is closed sucessfully.\r | |
2478 | @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r | |
2479 | @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r | |
2480 | of last section.\r | |
2481 | \r | |
2482 | **/\r | |
2483 | EFI_STATUS\r | |
2484 | EFIAPI\r | |
2485 | CloseSectionStream (\r | |
2486 | IN UINTN StreamHandleToClose,\r | |
2487 | IN BOOLEAN FreeStreamBuffer\r | |
2488 | );\r | |
2489 | \r | |
2490 | /**\r | |
2491 | Creates and initializes the DebugImageInfo Table. Also creates the configuration\r | |
2492 | table and registers it into the system table.\r | |
2493 | \r | |
2494 | Note:\r | |
2495 | This function allocates memory, frees it, and then allocates memory at an\r | |
2496 | address within the initial allocation. Since this function is called early\r | |
2497 | in DXE core initialization (before drivers are dispatched), this should not\r | |
2498 | be a problem.\r | |
2499 | \r | |
2500 | **/\r | |
2501 | VOID\r | |
2502 | CoreInitializeDebugImageInfoTable (\r | |
2503 | VOID\r | |
2504 | );\r | |
2505 | \r | |
2506 | \r | |
2507 | /**\r | |
2508 | Update the CRC32 in the Debug Table.\r | |
2509 | Since the CRC32 service is made available by the Runtime driver, we have to\r | |
2510 | wait for the Runtime Driver to be installed before the CRC32 can be computed.\r | |
2511 | This function is called elsewhere by the core when the runtime architectural\r | |
2512 | protocol is produced.\r | |
2513 | \r | |
2514 | **/\r | |
2515 | VOID\r | |
2516 | CoreUpdateDebugTableCrc32 (\r | |
2517 | VOID\r | |
2518 | );\r | |
2519 | \r | |
2520 | \r | |
2521 | /**\r | |
2522 | Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r | |
2523 | the table if it's not large enough to accomidate another entry.\r | |
2524 | \r | |
2525 | @param ImageInfoType type of debug image information\r | |
2526 | @param LoadedImage pointer to the loaded image protocol for the image being\r | |
2527 | loaded\r | |
2528 | @param ImageHandle image handle for the image being loaded\r | |
2529 | \r | |
2530 | **/\r | |
2531 | VOID\r | |
2532 | CoreNewDebugImageInfoEntry (\r | |
2533 | IN UINT32 ImageInfoType,\r | |
2534 | IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r | |
2535 | IN EFI_HANDLE ImageHandle\r | |
2536 | );\r | |
2537 | \r | |
2538 | \r | |
2539 | /**\r | |
2540 | Removes and frees an entry from the DebugImageInfo Table.\r | |
2541 | \r | |
2542 | @param ImageHandle image handle for the image being unloaded\r | |
2543 | \r | |
2544 | **/\r | |
2545 | VOID\r | |
2546 | CoreRemoveDebugImageInfoEntry (\r | |
2547 | EFI_HANDLE ImageHandle\r | |
2548 | );\r | |
2549 | \r | |
2550 | \r | |
2551 | /**\r | |
2552 | This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r | |
2553 | \r | |
2554 | @param ImageHandle The image handle.\r | |
2555 | @param SystemTable The system table.\r | |
2556 | \r | |
2557 | @retval EFI_SUCCESS Successfully initialized firmware volume block\r | |
2558 | driver.\r | |
2559 | \r | |
2560 | **/\r | |
2561 | EFI_STATUS\r | |
2562 | EFIAPI\r | |
2563 | FwVolBlockDriverInit (\r | |
2564 | IN EFI_HANDLE ImageHandle,\r | |
2565 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
2566 | );\r | |
2567 | \r | |
2568 | /**\r | |
2569 | \r | |
2570 | Get FVB authentication status\r | |
2571 | \r | |
2572 | @param FvbProtocol FVB protocol.\r | |
2573 | \r | |
2574 | @return Authentication status.\r | |
2575 | \r | |
2576 | **/\r | |
2577 | UINT32\r | |
2578 | GetFvbAuthenticationStatus (\r | |
2579 | IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r | |
2580 | );\r | |
2581 | \r | |
2582 | /**\r | |
2583 | This routine produces a firmware volume block protocol on a given\r | |
2584 | buffer.\r | |
2585 | \r | |
2586 | @param BaseAddress base address of the firmware volume image\r | |
2587 | @param Length length of the firmware volume image\r | |
2588 | @param ParentHandle handle of parent firmware volume, if this image\r | |
2589 | came from an FV image file and section in another firmware\r | |
2590 | volume (ala capsules)\r | |
2591 | @param AuthenticationStatus Authentication status inherited, if this image\r | |
2592 | came from an FV image file and section in another firmware volume.\r | |
2593 | @param FvProtocol Firmware volume block protocol produced.\r | |
2594 | \r | |
2595 | @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r | |
2596 | @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r | |
2597 | @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r | |
2598 | buffer.\r | |
2599 | \r | |
2600 | **/\r | |
2601 | EFI_STATUS\r | |
2602 | ProduceFVBProtocolOnBuffer (\r | |
2603 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
2604 | IN UINT64 Length,\r | |
2605 | IN EFI_HANDLE ParentHandle,\r | |
2606 | IN UINT32 AuthenticationStatus,\r | |
2607 | OUT EFI_HANDLE *FvProtocol OPTIONAL\r | |
2608 | );\r | |
2609 | \r | |
2610 | \r | |
2611 | /**\r | |
2612 | Raising to the task priority level of the mutual exclusion\r | |
2613 | lock, and then acquires ownership of the lock.\r | |
2614 | \r | |
2615 | @param Lock The lock to acquire\r | |
2616 | \r | |
2617 | @return Lock owned\r | |
2618 | \r | |
2619 | **/\r | |
2620 | VOID\r | |
2621 | CoreAcquireLock (\r | |
2622 | IN EFI_LOCK *Lock\r | |
2623 | );\r | |
2624 | \r | |
2625 | \r | |
2626 | /**\r | |
2627 | Initialize a basic mutual exclusion lock. Each lock\r | |
2628 | provides mutual exclusion access at it's task priority\r | |
2629 | level. Since there is no-premption (at any TPL) or\r | |
2630 | multiprocessor support, acquiring the lock only consists\r | |
2631 | of raising to the locks TPL.\r | |
2632 | \r | |
2633 | @param Lock The EFI_LOCK structure to initialize\r | |
2634 | \r | |
2635 | @retval EFI_SUCCESS Lock Owned.\r | |
2636 | @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r | |
2637 | \r | |
2638 | **/\r | |
2639 | EFI_STATUS\r | |
2640 | CoreAcquireLockOrFail (\r | |
2641 | IN EFI_LOCK *Lock\r | |
2642 | );\r | |
2643 | \r | |
2644 | \r | |
2645 | /**\r | |
2646 | Releases ownership of the mutual exclusion lock, and\r | |
2647 | restores the previous task priority level.\r | |
2648 | \r | |
2649 | @param Lock The lock to release\r | |
2650 | \r | |
2651 | @return Lock unowned\r | |
2652 | \r | |
2653 | **/\r | |
2654 | VOID\r | |
2655 | CoreReleaseLock (\r | |
2656 | IN EFI_LOCK *Lock\r | |
2657 | );\r | |
2658 | \r | |
2659 | /**\r | |
2660 | Read data from Firmware Block by FVB protocol Read.\r | |
2661 | The data may cross the multi block ranges.\r | |
2662 | \r | |
2663 | @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r | |
2664 | @param StartLba Pointer to StartLba.\r | |
2665 | On input, the start logical block index from which to read.\r | |
2666 | On output,the end logical block index after reading.\r | |
2667 | @param Offset Pointer to Offset\r | |
2668 | On input, offset into the block at which to begin reading.\r | |
2669 | On output, offset into the end block after reading.\r | |
2670 | @param DataSize Size of data to be read.\r | |
2671 | @param Data Pointer to Buffer that the data will be read into.\r | |
2672 | \r | |
2673 | @retval EFI_SUCCESS Successfully read data from firmware block.\r | |
2674 | @retval others\r | |
2675 | **/\r | |
2676 | EFI_STATUS\r | |
2677 | ReadFvbData (\r | |
2678 | IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r | |
2679 | IN OUT EFI_LBA *StartLba,\r | |
2680 | IN OUT UINTN *Offset,\r | |
2681 | IN UINTN DataSize,\r | |
2682 | OUT UINT8 *Data\r | |
2683 | );\r | |
2684 | \r | |
2685 | /**\r | |
2686 | Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r | |
2687 | copy the real length volume header into it.\r | |
2688 | \r | |
2689 | @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r | |
2690 | read the volume header\r | |
2691 | @param FwVolHeader Pointer to pointer to allocated buffer in which\r | |
2692 | the volume header is returned.\r | |
2693 | \r | |
2694 | @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r | |
2695 | @retval EFI_SUCCESS Successfully read volume header to the allocated\r | |
2696 | buffer.\r | |
2697 | @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or\r | |
2698 | the file system could not be understood.\r | |
2699 | \r | |
2700 | **/\r | |
2701 | EFI_STATUS\r | |
2702 | GetFwVolHeader (\r | |
2703 | IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r | |
2704 | OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r | |
2705 | );\r | |
2706 | \r | |
2707 | /**\r | |
2708 | Verify checksum of the firmware volume header.\r | |
2709 | \r | |
2710 | @param FvHeader Points to the firmware volume header to be checked\r | |
2711 | \r | |
2712 | @retval TRUE Checksum verification passed\r | |
2713 | @retval FALSE Checksum verification failed\r | |
2714 | \r | |
2715 | **/\r | |
2716 | BOOLEAN\r | |
2717 | VerifyFvHeaderChecksum (\r | |
2718 | IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r | |
2719 | );\r | |
2720 | \r | |
2721 | /**\r | |
2722 | Initialize memory profile.\r | |
2723 | \r | |
2724 | @param HobStart The start address of the HOB.\r | |
2725 | \r | |
2726 | **/\r | |
2727 | VOID\r | |
2728 | MemoryProfileInit (\r | |
2729 | IN VOID *HobStart\r | |
2730 | );\r | |
2731 | \r | |
2732 | /**\r | |
2733 | Install memory profile protocol.\r | |
2734 | \r | |
2735 | **/\r | |
2736 | VOID\r | |
2737 | MemoryProfileInstallProtocol (\r | |
2738 | VOID\r | |
2739 | );\r | |
2740 | \r | |
2741 | /**\r | |
2742 | Register image to memory profile.\r | |
2743 | \r | |
2744 | @param DriverEntry Image info.\r | |
2745 | @param FileType Image file type.\r | |
2746 | \r | |
2747 | @return EFI_SUCCESS Register successfully.\r | |
2748 | @return EFI_UNSUPPORTED Memory profile unsupported,\r | |
2749 | or memory profile for the image is not required.\r | |
2750 | @return EFI_OUT_OF_RESOURCES No enough resource for this register.\r | |
2751 | \r | |
2752 | **/\r | |
2753 | EFI_STATUS\r | |
2754 | RegisterMemoryProfileImage (\r | |
2755 | IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry,\r | |
2756 | IN EFI_FV_FILETYPE FileType\r | |
2757 | );\r | |
2758 | \r | |
2759 | /**\r | |
2760 | Unregister image from memory profile.\r | |
2761 | \r | |
2762 | @param DriverEntry Image info.\r | |
2763 | \r | |
2764 | @return EFI_SUCCESS Unregister successfully.\r | |
2765 | @return EFI_UNSUPPORTED Memory profile unsupported,\r | |
2766 | or memory profile for the image is not required.\r | |
2767 | @return EFI_NOT_FOUND The image is not found.\r | |
2768 | \r | |
2769 | **/\r | |
2770 | EFI_STATUS\r | |
2771 | UnregisterMemoryProfileImage (\r | |
2772 | IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry\r | |
2773 | );\r | |
2774 | \r | |
2775 | /**\r | |
2776 | Update memory profile information.\r | |
2777 | \r | |
2778 | @param CallerAddress Address of caller who call Allocate or Free.\r | |
2779 | @param Action This Allocate or Free action.\r | |
2780 | @param MemoryType Memory type.\r | |
2781 | EfiMaxMemoryType means the MemoryType is unknown.\r | |
2782 | @param Size Buffer size.\r | |
2783 | @param Buffer Buffer address.\r | |
2784 | @param ActionString String for memory profile action.\r | |
2785 | Only needed for user defined allocate action.\r | |
2786 | \r | |
2787 | @return EFI_SUCCESS Memory profile is updated.\r | |
2788 | @return EFI_UNSUPPORTED Memory profile is unsupported,\r | |
2789 | or memory profile for the image is not required,\r | |
2790 | or memory profile for the memory type is not required.\r | |
2791 | @return EFI_ACCESS_DENIED It is during memory profile data getting.\r | |
2792 | @return EFI_ABORTED Memory profile recording is not enabled.\r | |
2793 | @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.\r | |
2794 | @return EFI_NOT_FOUND No matched allocate info found for free action.\r | |
2795 | \r | |
2796 | **/\r | |
2797 | EFI_STATUS\r | |
2798 | EFIAPI\r | |
2799 | CoreUpdateProfile (\r | |
2800 | IN EFI_PHYSICAL_ADDRESS CallerAddress,\r | |
2801 | IN MEMORY_PROFILE_ACTION Action,\r | |
2802 | IN EFI_MEMORY_TYPE MemoryType,\r | |
2803 | IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool\r | |
2804 | IN VOID *Buffer,\r | |
2805 | IN CHAR8 *ActionString OPTIONAL\r | |
2806 | );\r | |
2807 | \r | |
2808 | /**\r | |
2809 | Internal function. Converts a memory range to use new attributes.\r | |
2810 | \r | |
2811 | @param Start The first address of the range Must be page\r | |
2812 | aligned\r | |
2813 | @param NumberOfPages The number of pages to convert\r | |
2814 | @param NewAttributes The new attributes value for the range.\r | |
2815 | \r | |
2816 | **/\r | |
2817 | VOID\r | |
2818 | CoreUpdateMemoryAttributes (\r | |
2819 | IN EFI_PHYSICAL_ADDRESS Start,\r | |
2820 | IN UINT64 NumberOfPages,\r | |
2821 | IN UINT64 NewAttributes\r | |
2822 | );\r | |
2823 | \r | |
2824 | /**\r | |
2825 | Initialize PropertiesTable support.\r | |
2826 | **/\r | |
2827 | VOID\r | |
2828 | EFIAPI\r | |
2829 | CoreInitializePropertiesTable (\r | |
2830 | VOID\r | |
2831 | );\r | |
2832 | \r | |
2833 | /**\r | |
2834 | Initialize MemoryAttrubutesTable support.\r | |
2835 | **/\r | |
2836 | VOID\r | |
2837 | EFIAPI\r | |
2838 | CoreInitializeMemoryAttributesTable (\r | |
2839 | VOID\r | |
2840 | );\r | |
2841 | \r | |
2842 | /**\r | |
2843 | Initialize Memory Protection support.\r | |
2844 | **/\r | |
2845 | VOID\r | |
2846 | EFIAPI\r | |
2847 | CoreInitializeMemoryProtection (\r | |
2848 | VOID\r | |
2849 | );\r | |
2850 | \r | |
2851 | /**\r | |
2852 | Install MemoryAttributesTable on memory allocation.\r | |
2853 | \r | |
2854 | @param[in] MemoryType EFI memory type.\r | |
2855 | **/\r | |
2856 | VOID\r | |
2857 | InstallMemoryAttributesTableOnMemoryAllocation (\r | |
2858 | IN EFI_MEMORY_TYPE MemoryType\r | |
2859 | );\r | |
2860 | \r | |
2861 | /**\r | |
2862 | Insert image record.\r | |
2863 | \r | |
2864 | @param RuntimeImage Runtime image information\r | |
2865 | **/\r | |
2866 | VOID\r | |
2867 | InsertImageRecord (\r | |
2868 | IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r | |
2869 | );\r | |
2870 | \r | |
2871 | /**\r | |
2872 | Remove Image record.\r | |
2873 | \r | |
2874 | @param RuntimeImage Runtime image information\r | |
2875 | **/\r | |
2876 | VOID\r | |
2877 | RemoveImageRecord (\r | |
2878 | IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r | |
2879 | );\r | |
2880 | \r | |
2881 | /**\r | |
2882 | Protect UEFI image.\r | |
2883 | \r | |
2884 | @param[in] LoadedImage The loaded image protocol\r | |
2885 | @param[in] LoadedImageDevicePath The loaded image device path protocol\r | |
2886 | **/\r | |
2887 | VOID\r | |
2888 | ProtectUefiImage (\r | |
2889 | IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r | |
2890 | IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath\r | |
2891 | );\r | |
2892 | \r | |
2893 | /**\r | |
2894 | Unprotect UEFI image.\r | |
2895 | \r | |
2896 | @param[in] LoadedImage The loaded image protocol\r | |
2897 | @param[in] LoadedImageDevicePath The loaded image device path protocol\r | |
2898 | **/\r | |
2899 | VOID\r | |
2900 | UnprotectUefiImage (\r | |
2901 | IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r | |
2902 | IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath\r | |
2903 | );\r | |
2904 | \r | |
2905 | /**\r | |
2906 | ExitBootServices Callback function for memory protection.\r | |
2907 | **/\r | |
2908 | VOID\r | |
2909 | MemoryProtectionExitBootServicesCallback (\r | |
2910 | VOID\r | |
2911 | );\r | |
2912 | \r | |
2913 | /**\r | |
2914 | Manage memory permission attributes on a memory range, according to the\r | |
2915 | configured DXE memory protection policy.\r | |
2916 | \r | |
2917 | @param OldType The old memory type of the range\r | |
2918 | @param NewType The new memory type of the range\r | |
2919 | @param Memory The base address of the range\r | |
2920 | @param Length The size of the range (in bytes)\r | |
2921 | \r | |
2922 | @return EFI_SUCCESS If the the CPU arch protocol is not installed yet\r | |
2923 | @return EFI_SUCCESS If no DXE memory protection policy has been configured\r | |
2924 | @return EFI_SUCCESS If OldType and NewType use the same permission attributes\r | |
2925 | @return other Return value of gCpu->SetMemoryAttributes()\r | |
2926 | \r | |
2927 | **/\r | |
2928 | EFI_STATUS\r | |
2929 | EFIAPI\r | |
2930 | ApplyMemoryProtectionPolicy (\r | |
2931 | IN EFI_MEMORY_TYPE OldType,\r | |
2932 | IN EFI_MEMORY_TYPE NewType,\r | |
2933 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
2934 | IN UINT64 Length\r | |
2935 | );\r | |
2936 | \r | |
2937 | /**\r | |
2938 | Merge continous memory map entries whose have same attributes.\r | |
2939 | \r | |
2940 | @param MemoryMap A pointer to the buffer in which firmware places\r | |
2941 | the current memory map.\r | |
2942 | @param MemoryMapSize A pointer to the size, in bytes, of the\r | |
2943 | MemoryMap buffer. On input, this is the size of\r | |
2944 | the current memory map. On output,\r | |
2945 | it is the size of new memory map after merge.\r | |
2946 | @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.\r | |
2947 | **/\r | |
2948 | VOID\r | |
2949 | MergeMemoryMap (\r | |
2950 | IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r | |
2951 | IN OUT UINTN *MemoryMapSize,\r | |
2952 | IN UINTN DescriptorSize\r | |
2953 | );\r | |
2954 | \r | |
2955 | #endif\r |