0e31deb8e9267a03f451bf24204081edf57125bf
[reactos.git] / boot / environ / include / bl.h
1 /*
2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/include/bl.h
5 * PURPOSE: Main Boot Library Header
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 #ifndef _BL_H
10 #define _BL_H
11
12 /* INCLUDES ******************************************************************/
13
14 /* C Headers */
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <wchar.h>
18
19 /* NT Base Headers */
20 #include <ntifs.h>
21
22 /* NDK Headers */
23 #include <ntndk.h>
24
25 /* NT SafeInt Header */
26 #include <ntintsafe.h>
27
28 /* PE Headers */
29 #include <ntimage.h>
30
31 /* ACPI Headers */
32 #include <drivers/acpi/acpi.h>
33
34 /* UEFI Headers */
35 #include <Uefi.h>
36 #include <DevicePath.h>
37 #include <LoadedImage.h>
38 #include <GraphicsOutput.h>
39 #include <UgaDraw.h>
40 #include <BlockIo.h>
41 #include <Acpi.h>
42 #include <GlobalVariable.h>
43
44 /* Registry Headers */
45 #define __FREELDR_H
46 #include <cmlib.h>
47
48 /* DEFINES *******************************************************************/
49
50 DEFINE_GUID(BadMemoryGuid, 0x54B8275B, 0xD431, 0x473F, 0xAC, 0xFB, 0xE5, 0x36, 0xA0, 0x84, 0x94, 0xA3);
51
52 #define BL_APPLICATION_FLAG_CONVERTED_FROM_EFI 0x01
53
54 #define BL_APP_ENTRY_SIGNATURE "BTAPENT"
55
56 #define BOOT_APPLICATION_SIGNATURE_1 'TOOB'
57 #define BOOT_APPLICATION_SIGNATURE_2 ' PPA'
58
59 #define BOOT_MEMORY_TRANSLATION_TYPE_PHYSICAL 0
60 #define BOOT_MEMORY_TRANSLATION_TYPE_VIRTUAL 1
61
62 #define BOOT_APPLICATION_VERSION 2
63 #define BL_MEMORY_DATA_VERSION 1
64 #define BL_RETURN_ARGUMENTS_VERSION 1
65 #define BL_FIRMWARE_DESCRIPTOR_VERSION 2
66
67 #define BL_RETURN_ARGUMENTS_NO_PAE_FLAG 0x40
68
69 #define BL_APPLICATION_ENTRY_FLAG_NO_GUID 0x01
70 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL 0x02
71 #define BL_APPLICATION_ENTRY_WINLOAD 0x04
72 #define BL_APPLICATION_ENTRY_STARTUP 0x08
73 #define BL_APPLICATION_ENTRY_REBOOT_ON_ERROR 0x20
74 #define BL_APPLICATION_ENTRY_NTLDR 0x40
75 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL 0x80
76 #define BL_APPLICATION_ENTRY_WINRESUME 0x100
77 #define BL_APPLICATION_ENTRY_SETUPLDR 0x200
78 #define BL_APPLICATION_ENTRY_BOOTSECTOR 0x400
79 #define BL_APPLICATION_ENTRY_BOOTMGR 0x1000
80 #define BL_APPLICATION_ENTRY_DISPLAY_ORDER 0x800000
81 #define BL_APPLICATION_ENTRY_FIXED_SEQUENCE 0x20000000
82 #define BL_APPLICATION_ENTRY_RECOVERY 0x40000000
83
84 #define BL_CONTEXT_PAGING_ON 1
85 #define BL_CONTEXT_INTERRUPTS_ON 2
86
87 #define BL_MM_FLAG_USE_FIRMWARE_FOR_MEMORY_MAP_BUFFERS 0x01
88 #define BL_MM_FLAG_REQUEST_COALESCING 0x02
89
90 #define BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG 0x01
91 #define BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG 0x02
92 #define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG 0x10
93 #define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG 0x20
94 #define BL_MM_ADD_DESCRIPTOR_ALLOCATE_FLAG 0x1000
95 #define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG 0x2000
96
97 #define BL_MM_INCLUDE_MAPPED_ALLOCATED 0x01
98 #define BL_MM_INCLUDE_MAPPED_UNALLOCATED 0x02
99 #define BL_MM_INCLUDE_UNMAPPED_ALLOCATED 0x04
100 #define BL_MM_INCLUDE_UNMAPPED_UNALLOCATED 0x08
101 #define BL_MM_INCLUDE_RESERVED_ALLOCATED 0x10
102 #define BL_MM_INCLUDE_BAD_MEMORY 0x20
103 #define BL_MM_INCLUDE_FIRMWARE_MEMORY 0x40
104 #define BL_MM_INCLUDE_TRUNCATED_MEMORY 0x80
105 #define BL_MM_INCLUDE_PERSISTENT_MEMORY 0x100
106 #define BL_MM_INCLUDE_FIRMWARE_MEMORY_2 0x200
107
108 #define BL_MM_INCLUDE_NO_FIRMWARE_MEMORY (BL_MM_INCLUDE_PERSISTENT_MEMORY | \
109 BL_MM_INCLUDE_TRUNCATED_MEMORY | \
110 BL_MM_INCLUDE_BAD_MEMORY | \
111 BL_MM_INCLUDE_RESERVED_ALLOCATED | \
112 BL_MM_INCLUDE_UNMAPPED_UNALLOCATED | \
113 BL_MM_INCLUDE_UNMAPPED_ALLOCATED | \
114 BL_MM_INCLUDE_MAPPED_UNALLOCATED | \
115 BL_MM_INCLUDE_MAPPED_ALLOCATED)
116 C_ASSERT(BL_MM_INCLUDE_NO_FIRMWARE_MEMORY == 0x1BF);
117
118 #define BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY (BL_MM_INCLUDE_FIRMWARE_MEMORY_2 | \
119 BL_MM_INCLUDE_FIRMWARE_MEMORY)
120 C_ASSERT(BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY == 0x240);
121
122 #define BL_MM_REQUEST_DEFAULT_TYPE 1
123 #define BL_MM_REQUEST_TOP_DOWN_TYPE 2
124
125 #define BL_MM_REMOVE_PHYSICAL_REGION_FLAG 0x40000000
126 #define BL_MM_REMOVE_VIRTUAL_REGION_FLAG 0x80000000
127
128 #define BL_LIBRARY_FLAG_NO_DISPLAY 0x01
129 #define BL_LIBRARY_FLAG_REINITIALIZE 0x02
130 #define BL_LIBRARY_FLAG_REINITIALIZE_ALL 0x04
131 #define BL_LIBRARY_FLAG_ZERO_HEAP_ALLOCATIONS_ON_FREE 0x10
132 #define BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED 0x20
133 #define BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE 0x800
134
135 #define BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG 0x01
136 #define BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG 0x02
137
138 #define BL_HT_VALUE_IS_INLINE 0x01
139
140 #define BL_FS_REGISTER_AT_HEAD_FLAG 1
141
142 #define BL_BLOCK_DEVICE_REMOVABLE_FLAG 0x01
143 #define BL_BLOCK_DEVICE_PRESENT_FLAG 0x02
144 #define BL_BLOCK_DEVICE_VIRTUAL_FLAG 0x04
145
146 #define BL_MEMORY_CLASS_SHIFT 28
147
148 #define BL_FILE_READ_ACCESS 0x01
149 #define BL_FILE_WRITE_ACCESS 0x02
150 #define BL_DIRECTORY_ACCESS 0x04
151 #define BL_UNKNOWN_ACCESS 0x10
152
153 #define BL_DEVICE_READ_ACCESS 0x01
154 #define BL_DEVICE_WRITE_ACCESS 0x02
155
156 #define BL_DEVICE_ENTRY_OPENED 0x01
157 #define BL_DEVICE_ENTRY_READ_ACCESS 0x02
158 #define BL_DEVICE_ENTRY_WRITE_ACCESS 0x04
159
160 #define BL_FILE_ENTRY_OPENED 0x01
161 #define BL_FILE_ENTRY_READ_ACCESS 0x02
162 #define BL_FILE_ENTRY_WRITE_ACCESS 0x04
163 #define BL_FILE_ENTRY_UNKNOWN_ACCESS 0x10
164 #define BL_FILE_ENTRY_DIRECTORY 0x10000
165
166 #define BL_ETFS_FILE_ENTRY_DIRECTORY 0x01
167
168 #define BL_IMG_VALID_FILE 0x01
169 #define BL_IMG_MEMORY_FILE 0x02
170 #define BL_IMG_REMOTE_FILE 0x04
171
172 #define BL_LOAD_IMG_VIRTUAL_BUFFER 0x01
173 #define BL_LOAD_IMG_EXISTING_BUFFER 0x04
174 #define BL_LOAD_IMG_UNKNOWN_BUFFER_FLAG 0x08
175 #define BL_LOAD_IMG_COMPUTE_SIGNATURE 0x10
176 #define BL_LOAD_IMG_COMPUTE_HASH 0x40000
177
178 #define BL_LOAD_PE_IMG_VIRTUAL_BUFFER BL_LOAD_IMG_VIRTUAL_BUFFER
179 #define BL_LOAD_PE_IMG_CHECK_MACHINE 0x02
180 #define BL_LOAD_PE_IMG_EXISTING_BUFFER BL_LOAD_IMG_EXISTING_BUFFER
181 #define BL_LOAD_PE_IMG_COMPUTE_HASH 0x10
182 #define BL_LOAD_PE_IMG_CHECK_SUBSYSTEM 0x80
183 #define BL_LOAD_PE_IMG_SKIP_RELOCATIONS 0x100
184 #define BL_LOAD_PE_IMG_CHECK_FORCED_INTEGRITY 0x200
185 #define BL_LOAD_PE_IMG_IGNORE_CHECKSUM_MISMATCH 0x10000
186 #define BL_LOAD_PE_IMG_VALIDATE_ORIGINAL_FILENAME 0x400000
187
188 #define BL_UTL_CHECKSUM_COMPLEMENT 0x10000
189 #define BL_UTL_CHECKSUM_ROTATE 0x20000
190 #define BL_UTL_CHECKSUM_NEGATE 0x40000
191 #define BL_UTL_CHECKSUM_UCHAR_BUFFER 0x01
192 #define BL_UTL_CHECKSUM_USHORT_BUFFER 0x02
193
194 /* ENUMERATIONS **************************************************************/
195
196 typedef enum _BL_COLOR
197 {
198 Black,
199 Blue,
200 Green,
201 Cyan,
202 Red,
203 Magenta,
204 Brown,
205 LtGray,
206 Gray,
207 LtBlue,
208 LtGreen,
209 LtCyan,
210 LtRed,
211 LtMagenta,
212 Yellow,
213 White
214 } BL_COLOR, *PBL_COLOR;
215
216 typedef enum _BL_MENU_POLICY
217 {
218 MenuPolicyLegacy = 0,
219 MenuPolicyStandard = 1
220 } BL_MENU_POLICY;
221
222 typedef enum _BL_MEMORY_DESCRIPTOR_TYPE
223 {
224 BlMdPhysical,
225 BlMdVirtual,
226 BlMdTracker
227 } BL_MEMORY_DESCRIPTOR_TYPE;
228
229 typedef enum _BL_TRANSLATION_TYPE
230 {
231 BlNone,
232 BlVirtual,
233 BlPae,
234 BlMax
235 } BL_TRANSLATION_TYPE;
236
237 typedef enum _BL_ARCH_MODE
238 {
239 BlProtectedMode,
240 BlRealMode
241 } BL_ARCH_MODE;
242
243 //
244 // Boot Device Types
245 //
246 typedef enum _BL_DEVICE_TYPE
247 {
248 DiskDevice = 0,
249 LegacyPartitionDevice = 2,
250 SerialDevice = 3,
251 UdpDevice = 4,
252 BootDevice = 5,
253 PartitionDevice = 6,
254 LocateDevice = 8,
255 } BL_DEVICE_TYPE;
256
257 //
258 // Local Device Types
259 //
260 typedef enum _BL_LOCAL_DEVICE_TYPE
261 {
262 LocalDevice = 0,
263 FloppyDevice = 1,
264 CdRomDevice = 2,
265 RamDiskDevice = 3,
266 FileDevice = 5,
267 VirtualDiskDevice = 6
268 } BL_LOCAL_DEVICE_TYPE;
269
270 //
271 // Partition types
272 //
273 typedef enum _BL_PARTITION_TYPE
274 {
275 GptPartition,
276 MbrPartition,
277 RawPartition,
278 } BL_PARTITION_TYPE;
279
280 //
281 // File Path Types
282 //
283 typedef enum _BL_PATH_TYPE
284 {
285 InternalPath = 3,
286 EfiPath = 4
287 } BL_PATH_TYPE;
288
289 //
290 // Classes of Memory
291 //
292 typedef enum _BL_MEMORY_CLASS
293 {
294 BlLoaderClass = 0xD,
295 BlApplicationClass,
296 BlSystemClass
297 } BL_MEMORY_CLASS;
298
299 //
300 // Types of Memory
301 //
302 typedef enum _BL_MEMORY_TYPE
303 {
304 //
305 // Loader Memory
306 //
307 BlLoaderMemory = 0xD0000002,
308 BlLoaderDeviceMemory = 0xD0000004,
309 BlLoaderHeap = 0xD0000005,
310 BlLoaderPageDirectory = 0xD0000006,
311 BlLoaderReferencePage = 0xD0000007,
312 BlLoaderRamDisk = 0xD0000008,
313 BlLoaderArchData = 0xD0000009,
314 BlLoaderData = 0xD000000A,
315 BlLoaderRegistry = 0xD000000B,
316 BlLoaderBlockMemory = 0xD000000C,
317 BlLoaderSelfMap = 0xD000000F,
318
319 //
320 // Application Memory
321 //
322 BlApplicationReserved = 0xE0000001,
323 BlApplicationData = 0xE0000004,
324
325 //
326 // System Memory
327 //
328 BlConventionalMemory = 0xF0000001,
329 BlUnusableMemory = 0xF0000002,
330 BlReservedMemory = 0xF0000003,
331 BlEfiBootMemory = 0xF0000004,
332 BlConventionalZeroedMemory = 0xF000005,
333 BlEfiRuntimeCodeMemory = 0xF0000006,
334 BlAcpiReclaimMemory = 0xF0000008,
335 BlAcpiNvsMemory = 0xF0000009,
336 BlDeviceIoMemory = 0xF000000A,
337 BlDevicePortMemory = 0xF000000B,
338 BlPalMemory = 0xF000000C,
339 BlEfiRuntimeDataMemory = 0xF000000E,
340 } BL_MEMORY_TYPE;
341
342 typedef enum _BL_MEMORY_ATTR
343 {
344 //
345 // Memory Caching Attributes
346 //
347 BlMemoryUncached = 0x00000001,
348 BlMemoryWriteCombined = 0x00000002,
349 BlMemoryWriteThrough = 0x00000004,
350 BlMemoryWriteBack = 0x00000008,
351 BlMemoryUncachedExported = 0x00000010,
352 BlMemoryValidCacheAttributes = BlMemoryUncached | BlMemoryWriteCombined | BlMemoryWriteThrough | BlMemoryWriteBack | BlMemoryUncachedExported,
353 BlMemoryValidCacheAttributeMask = 0x000000FF,
354
355 //
356 // Memory Protection Attributes
357 //
358 BlMemoryWriteProtected = 0x00000100,
359 BlMemoryReadProtected = 0x00000200,
360 BlMemoryExecuteProtected = 0x00000400,
361 BlMemoryValidProtectionAttributes = BlMemoryWriteProtected | BlMemoryReadProtected | BlMemoryExecuteProtected,
362 BlMemoryValidProtectionAttributeMask = 0x0000FF00,
363
364 //
365 // Memory Allocation Attributes
366 //
367 BlMemoryLargePages = 0x00010000,
368 BlMemoryKernelRange = 0x00020000,
369 BlMemoryFixed = 0x00040000,
370 BlMemoryBelow1MB = 0x00080000,
371 BlMemoryValidAllocationAttributes = BlMemoryKernelRange | BlMemoryFixed | BlMemoryBelow1MB | BlMemoryLargePages,
372 BlMemoryValidAllocationAttributeMask = 0x00FF0000,
373
374 //
375 // Memory Type Attributes
376 //
377 BlMemoryRuntime = 0x01000000,
378 BlMemoryCoalesced = 0x02000000,
379 BlMemoryUpdate = 0x04000000,
380 BlMemoryNonFirmware = 0x08000000,
381 BlMemoryPersistent = 0x10000000,
382 BlMemorySpecial = 0x20000000,
383 BlMemoryFirmware = 0x80000000,
384 BlMemoryValidTypeAttributes = BlMemoryRuntime | BlMemoryCoalesced | BlMemoryUpdate | BlMemoryNonFirmware | BlMemoryPersistent | BlMemorySpecial | BlMemoryFirmware,
385 BlMemoryValidTypeAttributeMask = 0xFF000000,
386 } BL_MEMORY_ATTR;
387
388 /* CALLBACKS *****************************************************************/
389
390 struct _BL_FILE_ENTRY;
391 struct _BL_FILE_INFORMATION;
392 typedef
393 NTSTATUS
394 (*PBL_FILE_OPEN) (
395 _In_ struct _BL_FILE_ENTRY* Directory,
396 _In_ PWCHAR FileName,
397 _In_ ULONG Flags,
398 _Out_ struct _BL_FILE_ENTRY** FileEntry
399 );
400
401 typedef
402 NTSTATUS
403 (*PBL_FILE_CLOSE) (
404 _In_ struct _BL_FILE_ENTRY* FileEntry
405 );
406
407 typedef
408 NTSTATUS
409 (*PBL_FILE_READ) (
410 _In_ struct _BL_FILE_ENTRY* FileEntry,
411 _In_ PVOID Buffer,
412 _In_ ULONG Size,
413 _Out_opt_ PULONG BytesRead
414 );
415
416 typedef
417 NTSTATUS
418 (*PBL_FILE_WRITE) (
419 VOID
420 );
421
422 typedef
423 NTSTATUS
424 (*PBL_FILE_GET_NEXT) (
425 VOID
426 );
427
428 typedef
429 NTSTATUS
430 (*PBL_FILE_GET_INFO) (
431 _In_ struct _BL_FILE_ENTRY* FileEntry,
432 _Out_ struct _BL_FILE_INFORMATION* FileInfo
433 );
434
435 typedef
436 NTSTATUS
437 (*PBL_FILE_SET_INFO) (
438 _In_ struct _BL_FILE_ENTRY* FileEntry,
439 _In_ struct _BL_FILE_INFORMATION* FileInfo
440 );
441
442 typedef
443 NTSTATUS
444 (*PBL_FS_INIT_CALLBACK) (
445 VOID
446 );
447
448 typedef
449 NTSTATUS
450 (*PBL_FS_DESTROY_CALLBACK) (
451 VOID
452 );
453
454 typedef
455 NTSTATUS
456 (*PBL_FS_MOUNT_CALLBACK) (
457 _In_ ULONG DeviceId,
458 _In_ ULONG Unknown,
459 _Out_ struct _BL_FILE_ENTRY** FileEntry
460 );
461
462 typedef
463 NTSTATUS
464 (*PBL_FS_PURGE_CALLBACK) (
465 VOID
466 );
467
468 typedef
469 NTSTATUS
470 (*PBL_FILE_DESTROY_CALLBACK) (
471 _In_ PVOID Entry
472 );
473
474 struct _BL_TEXT_CONSOLE;
475 struct _BL_DISPLAY_STATE;
476 struct _BL_DISPLAY_MODE;
477 struct _BL_INPUT_CONSOLE;
478 struct _BL_REMOTE_CONSOLE;
479 struct _BL_GRAPHICS_CONSOLE;
480 typedef
481 VOID
482 (*PCONSOLE_DESTRUCT) (
483 _In_ struct _BL_TEXT_CONSOLE* Console
484 );
485
486 typedef
487 NTSTATUS
488 (*PCONSOLE_REINITIALIZE) (
489 _In_ struct _BL_TEXT_CONSOLE* Console
490 );
491
492 typedef
493 NTSTATUS
494 (*PCONSOLE_GET_TEXT_STATE) (
495 _In_ struct _BL_TEXT_CONSOLE* Console,
496 _Out_ struct _BL_DISPLAY_STATE* TextState
497 );
498
499 typedef
500 NTSTATUS
501 (*PCONSOLE_SET_TEXT_STATE) (
502 _In_ struct _BL_TEXT_CONSOLE* Console,
503 _In_ ULONG Flags,
504 _In_ struct _BL_DISPLAY_STATE* TextState
505 );
506
507 typedef
508 NTSTATUS
509 (*PCONSOLE_GET_TEXT_RESOLUTION) (
510 _In_ struct _BL_TEXT_CONSOLE* Console,
511 _Out_ PULONG TextResolution
512 );
513
514 typedef
515 NTSTATUS
516 (*PCONSOLE_SET_TEXT_RESOLUTION) (
517 _In_ struct _BL_TEXT_CONSOLE* Console,
518 _In_ ULONG NewTextResolution,
519 _Out_ PULONG OldTextResolution
520 );
521
522 typedef
523 NTSTATUS
524 (*PCONSOLE_CLEAR_TEXT) (
525 _In_ struct _BL_TEXT_CONSOLE* Console,
526 _In_ BOOLEAN LineOnly
527 );
528
529 typedef
530 BOOLEAN
531 (*PCONSOLE_IS_ENABLED) (
532 _In_ struct _BL_GRAPHICS_CONSOLE* Console
533 );
534
535 typedef
536 NTSTATUS
537 (*PCONSOLE_GET_GRAPHICAL_RESOLUTION) (
538 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
539 _Out_ struct _BL_DISPLAY_MODE* DisplayMode
540 );
541
542 typedef
543 NTSTATUS
544 (*PCONSOLE_SET_GRAPHICAL_RESOLUTION) (
545 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
546 _In_ struct _BL_DISPLAY_MODE DisplayMode
547 );
548
549 typedef
550 NTSTATUS
551 (*PCONSOLE_ENABLE) (
552 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
553 _In_ BOOLEAN Enable
554 );
555
556 typedef
557 NTSTATUS
558 (*PCONSOLE_WRITE_TEXT) (
559 _In_ struct _BL_TEXT_CONSOLE* Console,
560 _In_ PCHAR Text,
561 _In_ ULONG Attribute
562 );
563
564 typedef
565 BOOLEAN
566 (*PBL_TBL_LOOKUP_ROUTINE) (
567 _In_ PVOID Entry,
568 _In_ PVOID Argument1,
569 _In_ PVOID Argument2,
570 _In_ PVOID Argument3,
571 _In_ PVOID Argument4
572 );
573
574 typedef
575 NTSTATUS
576 (*PBL_TBL_MAP_ROUTINE) (
577 _In_ PVOID Entry,
578 _In_ ULONG EntryIndex
579 );
580
581 typedef
582 NTSTATUS
583 (*PBL_TBL_SET_ROUTINE) (
584 _In_ PVOID Entry
585 );
586
587 typedef
588 NTSTATUS
589 (*PBL_IO_DESTROY_ROUTINE) (
590 VOID
591 );
592
593 struct _BL_HASH_ENTRY;
594 typedef
595 BOOLEAN
596 (*PBL_HASH_TABLE_COMPARE_FUNCTION) (
597 _In_ struct _BL_HASH_ENTRY* Entry1,
598 _In_ struct _BL_HASH_ENTRY* Entry2
599 );
600
601 typedef
602 ULONG
603 (*PBL_HASH_TABLE_HASH_FUNCTION) (
604 _In_ struct _BL_HASH_ENTRY* Entry,
605 _In_ ULONG TableSize
606 );
607
608 struct _BL_DEVICE_ENTRY;
609 struct _BL_DEVICE_DESCRIPTOR;
610 struct _BL_DEVICE_INFORMATION;
611
612 typedef
613 NTSTATUS
614 (*PBL_DEVICE_ENUMERATE_DEVICE_CLASS) (
615 VOID
616 );
617
618 typedef
619 NTSTATUS
620 (*PBL_DEVICE_OPEN) (
621 _In_ struct _BL_DEVICE_DESCRIPTOR* Device,
622 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
623 );
624
625 typedef
626 NTSTATUS
627 (*PBL_DEVICE_CLOSE) (
628 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
629 );
630
631 typedef
632 NTSTATUS
633 (*PBL_DEVICE_READ) (
634 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
635 _In_ PVOID Buffer,
636 _In_ ULONG Size,
637 _Out_ PULONG BytesRead
638 );
639
640 typedef
641 NTSTATUS
642 (*PBL_DEVICE_WRITE) (
643 VOID
644 );
645
646 typedef
647 NTSTATUS
648 (*PBL_DEVICE_GET_INFORMATION) (
649 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
650 _Out_ struct _BL_DEVICE_INFORMATION* DeviceInformation
651 );
652
653 typedef
654 NTSTATUS
655 (*PBL_DEVICE_SET_INFORMATION) (
656 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
657 _In_ struct _BL_DEVICE_INFORMATION* DeviceInformation
658 );
659
660 typedef
661 NTSTATUS
662 (*PBL_DEVICE_RESET) (
663 VOID
664 );
665
666 typedef
667 NTSTATUS
668 (*PBL_DEVICE_FLUSH) (
669 VOID
670 );
671
672 typedef
673 NTSTATUS
674 (*PBL_DEVICE_CREATE) (
675 VOID
676 );
677
678 typedef VOID
679 (*PBL_MM_FLUSH_TLB) (
680 VOID
681 );
682
683 typedef VOID
684 (*PBL_MM_RELOCATE_SELF_MAP) (
685 VOID
686 );
687
688 typedef NTSTATUS
689 (*PBL_MM_MOVE_VIRTUAL_ADDRESS_RANGE) (
690 _In_ PVOID DestinationAddress,
691 _In_ PVOID SourceAddress,
692 _In_ ULONGLONG Size
693 );
694
695 typedef NTSTATUS
696 (*PBL_MM_ZERO_VIRTUAL_ADDRESS_RANGE) (
697 _In_ PVOID DestinationAddress,
698 _In_ ULONGLONG Size
699 );
700
701 typedef VOID
702 (*PBL_MM_DESTROY_SELF_MAP) (
703 VOID
704 );
705
706 typedef VOID
707 (*PBL_MM_FLUSH_TLB_ENTRY) (
708 _In_ PVOID VirtualAddress
709 );
710
711 typedef VOID
712 (*PBL_MM_FLUSH_TLB) (
713 VOID
714 );
715
716 typedef NTSTATUS
717 (*PBL_MM_UNMAP_VIRTUAL_ADDRESS) (
718 _In_ PVOID VirtualAddress,
719 _In_ ULONG Size
720 );
721
722 typedef NTSTATUS
723 (*PBL_MM_REMAP_VIRTUAL_ADDRESS) (
724 _In_ PPHYSICAL_ADDRESS PhysicalAddress,
725 _Out_ PVOID VirtualAddress,
726 _In_ ULONG Size,
727 _In_ ULONG CacheAttributes
728 );
729
730 typedef NTSTATUS
731 (*PBL_MM_MAP_PHYSICAL_ADDRESS) (
732 _In_ PHYSICAL_ADDRESS PhysicalAddress,
733 _Out_ PVOID VirtualAddress,
734 _In_ ULONG Size,
735 _In_ ULONG CacheAttributes
736 );
737
738 typedef BOOLEAN
739 (*PBL_MM_TRANSLATE_VIRTUAL_ADDRESS) (
740 _In_ PVOID VirtualAddress,
741 _Out_ PPHYSICAL_ADDRESS PhysicalAddress,
742 _Out_opt_ PULONG CacheAttributes
743 );
744
745 typedef NTSTATUS
746 (*PBL_STATUS_ERROR_HANDLER) (
747 _In_ ULONG ErrorCode,
748 _In_ ULONG Parameter1,
749 _In_ ULONG_PTR Parameter2,
750 _In_ ULONG_PTR Parameter3,
751 _In_ ULONG_PTR Parameter4
752 );
753
754 /* DATA STRUCTURES ***********************************************************/
755
756 typedef struct _BL_LIBRARY_PARAMETERS
757 {
758 ULONG LibraryFlags;
759 ULONG TranslationType;
760 ULONG MinimumAllocationCount;
761 ULONG MinimumHeapSize;
762 ULONG HeapAllocationAttributes;
763 PWCHAR ApplicationBaseDirectory;
764 ULONG DescriptorCount;
765 PWCHAR FontBaseDirectory;
766 } BL_LIBRARY_PARAMETERS, *PBL_LIBRARY_PARAMETERS;
767
768 /* This should eventually go into a more public header */
769 typedef struct _BOOT_APPLICATION_PARAMETER_BLOCK
770 {
771 /* This header tells the library what image we're dealing with */
772 ULONG Signature[2];
773 ULONG Version;
774 ULONG Size;
775 ULONG ImageType;
776 ULONG MemoryTranslationType;
777
778 /* Where is the image located */
779 ULONGLONG ImageBase;
780 ULONG ImageSize;
781
782 /* Offset to BL_MEMORY_DATA */
783 ULONG MemoryDataOffset;
784
785 /* Offset to BL_APPLICATION_ENTRY */
786 ULONG AppEntryOffset;
787
788 /* Offset to BL_DEVICE_DESCRPIPTOR */
789 ULONG BootDeviceOffset;
790
791 /* Offset to BL_FIRMWARE_PARAMETERS */
792 ULONG FirmwareParametersOffset;
793
794 /* Offset to BL_RETURN_ARGUMENTS */
795 ULONG ReturnArgumentsOffset;
796 } BOOT_APPLICATION_PARAMETER_BLOCK, *PBOOT_APPLICATION_PARAMETER_BLOCK;
797
798 typedef struct _BL_MEMORY_DATA
799 {
800 ULONG Version;
801 ULONG MdListOffset;
802 ULONG DescriptorCount;
803 ULONG DescriptorSize;
804 ULONG DescriptorOffset;
805 } BL_MEMORY_DATA, *PBL_MEMORY_DATA;
806
807 typedef struct _BL_FIRMWARE_DESCRIPTOR
808 {
809 ULONG Version;
810 ULONG Unknown;
811 EFI_HANDLE ImageHandle;
812 EFI_SYSTEM_TABLE *SystemTable;
813 } BL_FIRMWARE_DESCRIPTOR, *PBL_FIRMWARE_DESCRIPTOR;
814
815 typedef struct _BL_RETURN_ARGUMENTS
816 {
817 ULONG Version;
818 NTSTATUS Status;
819 ULONG Flags;
820 ULONGLONG DataSize;
821 ULONGLONG DataPage;
822 } BL_RETURN_ARGUMENTS, *PBL_RETURN_ARGUMENTS;
823
824 typedef struct _BL_MEMORY_DESCRIPTOR
825 {
826 LIST_ENTRY ListEntry;
827 union
828 {
829 struct
830 {
831 ULONGLONG BasePage;
832 ULONGLONG VirtualPage;
833 };
834 struct
835 {
836 ULONGLONG BaseAddress;
837 ULONGLONG VirtualAddress;
838 };
839 };
840 ULONGLONG PageCount;
841 ULONG Flags;
842 BL_MEMORY_TYPE Type;
843 } BL_MEMORY_DESCRIPTOR, *PBL_MEMORY_DESCRIPTOR;
844
845 typedef struct _BL_BCD_OPTION
846 {
847 ULONG Type;
848 ULONG DataOffset;
849 ULONG DataSize;
850 ULONG ListOffset;
851 ULONG NextEntryOffset;
852 ULONG Empty;
853 } BL_BCD_OPTION, *PBL_BCD_OPTION;
854
855 typedef struct _BL_APPLICATION_ENTRY
856 {
857 CHAR Signature[8];
858 ULONG Flags;
859 GUID Guid;
860 ULONG Unknown[4];
861 BL_BCD_OPTION BcdData;
862 } BL_APPLICATION_ENTRY, *PBL_APPLICATION_ENTRY;
863
864 typedef struct _BL_LOADED_APPLICATION_ENTRY
865 {
866 ULONG Flags;
867 GUID Guid;
868 PBL_BCD_OPTION BcdData;
869 } BL_LOADED_APPLICATION_ENTRY, *PBL_LOADED_APPLICATION_ENTRY;
870
871 typedef struct _BL_MENU_STATUS
872 {
873 union
874 {
875 struct
876 {
877 ULONG AnyKey : 1;
878 ULONG AdvancedOptions : 1;
879 ULONG BootOptions : 1;
880 ULONG OemKey : 1;
881 ULONG Exit : 1;
882 ULONG Reserved : 27;
883 };
884 ULONG AsULong;
885 };
886 ULONG BootIndex;
887 WCHAR KeyValue;
888 } BL_MENU_STATUS, *PL_MENU_STATUS;
889
890 typedef enum _BL_BOOT_ERROR_STATUS
891 {
892 Reboot = 1,
893 Recover = 2,
894 RecoverOem = 3,
895 OsSelection = 4,
896 NextOs = 5,
897 TryAgain = 6,
898 AdvancedOptions = 7,
899 BootOptions = 8
900 } BL_BOOT_ERROR_STATUS;
901
902 typedef struct _BL_HARDDISK_DEVICE
903 {
904 ULONG PartitionType;
905 union
906 {
907 struct
908 {
909 ULONG PartitionSignature;
910 } Mbr;
911
912 struct
913 {
914 GUID PartitionSignature;
915 } Gpt;
916
917 struct
918 {
919 ULONG DiskNumber;
920 } Raw;
921 };
922 } BL_HARDDISK_DEVICE;
923
924 typedef struct _BL_LOCAL_DEVICE
925 {
926 ULONG Type;
927 union
928 {
929 struct
930 {
931 ULONG DriveNumber;
932 } FloppyDisk;
933
934 BL_HARDDISK_DEVICE HardDisk;
935
936 struct
937 {
938 PHYSICAL_ADDRESS ImageBase;
939 LARGE_INTEGER ImageSize;
940 ULONG ImageOffset;
941 } RamDisk;
942
943 ULONG File; // unknown for now
944 };
945 } BL_LOCAL_DEVICE, *PBL_LOCAL_DEVICE;
946
947 typedef struct _BL_DEVICE_DESCRIPTOR
948 {
949 DEVICE_TYPE DeviceType;
950 ULONG Flags;
951 ULONG Size;
952 ULONG Unknown;
953 union
954 {
955 BL_LOCAL_DEVICE Local;
956
957 struct
958 {
959 ULONG Unknown;
960 } Remote;
961
962 struct
963 {
964 union
965 {
966 ULONG PartitionNumber;
967 } Mbr;
968
969 union
970 {
971 GUID PartitionGuid;
972 } Gpt;
973
974 BL_LOCAL_DEVICE Disk;
975 } Partition;
976 };
977 } BL_DEVICE_DESCRIPTOR, *PBL_DEVICE_DESCRIPTOR;
978
979 typedef struct _BL_FILE_PATH_DESCRIPTOR
980 {
981 ULONG Version;
982 ULONG Length;
983 ULONG PathType;
984 UCHAR Path[ANYSIZE_ARRAY];
985 } BL_FILE_PATH_DESCRIPTOR, *PBL_FILE_PATH_DESCRIPTOR;
986
987 typedef struct _BL_WINDOWS_LOAD_OPTIONS
988 {
989 CHAR Signature[8];
990 ULONG Version;
991 ULONG Length;
992 ULONG OsPathOffset;
993 WCHAR LoadOptions[ANYSIZE_ARRAY];
994 } BL_WINDOWS_LOAD_OPTIONS, *PBL_WINDOWS_LOAD_OPTIONS;
995
996 typedef struct _BL_ARCH_CONTEXT
997 {
998 BL_ARCH_MODE Mode;
999 BL_TRANSLATION_TYPE TranslationType;
1000 ULONG ContextFlags;
1001 } BL_ARCH_CONTEXT, *PBL_ARCH_CONTEXT;
1002
1003 typedef struct _BL_MEMORY_DESCRIPTOR_LIST
1004 {
1005 LIST_ENTRY ListHead;
1006 PLIST_ENTRY First;
1007 PLIST_ENTRY This;
1008 ULONG Type;
1009 } BL_MEMORY_DESCRIPTOR_LIST, *PBL_MEMORY_DESCRIPTOR_LIST;
1010
1011 typedef struct _BL_ADDRESS_RANGE
1012 {
1013 ULONGLONG Minimum;
1014 ULONGLONG Maximum;
1015 } BL_ADDRESS_RANGE, *PBL_ADDRESS_RANGE;
1016
1017 typedef struct _BL_FILE_INFORMATION
1018 {
1019 ULONGLONG Size;
1020 ULONGLONG Offset;
1021 PWCHAR FsName;
1022 ULONG Flags;
1023 } BL_FILE_INFORMATION, *PBL_FILE_INFORMATION;
1024
1025 typedef struct _BL_FILE_CALLBACKS
1026 {
1027 PBL_FILE_OPEN Open;
1028 PBL_FILE_CLOSE Close;
1029 PBL_FILE_READ Read;
1030 PBL_FILE_WRITE Write;
1031 PBL_FILE_GET_NEXT GetNext;
1032 PBL_FILE_GET_INFO GetInfo;
1033 PBL_FILE_SET_INFO SetInfo;
1034 } BL_FILE_CALLBACKS, *PBL_FILE_CALLBACKS;
1035
1036 typedef struct _BL_FILE_ENTRY
1037 {
1038 PWCHAR FilePath;
1039 ULONG DeviceId;
1040 ULONG FileId;
1041 ULONG Flags;
1042 ULONG ReferenceCount;
1043 ULONG Unknown;
1044 ULONGLONG TotalBytesRead;
1045 ULONGLONG Unknown2;
1046 BL_FILE_CALLBACKS Callbacks;
1047 PVOID FsSpecificData;
1048 } BL_FILE_ENTRY, *PBL_FILE_ENTRY;
1049
1050 typedef struct _BL_FILE_SYSTEM_ENTRY
1051 {
1052 LIST_ENTRY ListEntry;
1053 PBL_FS_INIT_CALLBACK InitCallback;
1054 PBL_FS_DESTROY_CALLBACK DestroyCallback;
1055 PBL_FS_MOUNT_CALLBACK MountCallback;
1056 PBL_FS_PURGE_CALLBACK PurgeCallback;
1057 } BL_FILE_SYSTEM_ENTRY, *PBL_FILE_SYSTEM_ENTRY;
1058
1059 typedef struct _BL_FILE_SYSTEM_REGISTRATION_TABLE
1060 {
1061 PBL_FS_INIT_CALLBACK Init;
1062 PBL_FS_DESTROY_CALLBACK Destroy;
1063 PBL_FS_MOUNT_CALLBACK Mount;
1064 PBL_FS_PURGE_CALLBACK Purge;
1065 } BL_FILE_SYSTEM_REGISTRATION_TABLE;
1066
1067 typedef struct _BL_DISPLAY_STATE
1068 {
1069 ULONG BgColor;
1070 ULONG FgColor;
1071 ULONG XPos;
1072 ULONG YPos;
1073 ULONG CursorVisible;
1074 } BL_DISPLAY_STATE, *PBL_DISPLAY_STATE;
1075
1076 typedef struct _BL_DISPLAY_MODE
1077 {
1078 ULONG HRes;
1079 ULONG VRes;
1080 ULONG HRes2;
1081 } BL_DISPLAY_MODE, *PBL_DISPLAY_MODE;
1082
1083 typedef struct _BL_TEXT_CONSOLE_VTABLE
1084 {
1085 PCONSOLE_DESTRUCT Destruct;
1086 PCONSOLE_REINITIALIZE Reinitialize;
1087 PCONSOLE_GET_TEXT_STATE GetTextState;
1088 PCONSOLE_SET_TEXT_STATE SetTextState;
1089 PCONSOLE_GET_TEXT_RESOLUTION GetTextResolution;
1090 PCONSOLE_SET_TEXT_RESOLUTION SetTextResolution;
1091 PCONSOLE_CLEAR_TEXT ClearText;
1092 PCONSOLE_WRITE_TEXT WriteText;
1093 } BL_TEXT_CONSOLE_VTABLE, *PBL_TEXT_CONSOLE_VTABLE;
1094
1095 typedef struct _BL_GRAPHICS_CONSOLE_VTABLE
1096 {
1097 BL_TEXT_CONSOLE_VTABLE Text;
1098 PCONSOLE_IS_ENABLED IsEnabled;
1099 PCONSOLE_ENABLE Enable;
1100 PVOID GetConsoleResolution;
1101 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetGraphicalResolution;
1102 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetOriginalResolution;
1103 PCONSOLE_SET_GRAPHICAL_RESOLUTION SetOriginalResolution;
1104 /// more for graphics ///
1105 } BL_GRAPHICS_CONSOLE_VTABLE, *PBL_GRAPHICS_CONSOLE_VTABLE;
1106
1107 typedef struct _BL_TEXT_CONSOLE
1108 {
1109 PBL_TEXT_CONSOLE_VTABLE Callbacks;
1110 BL_DISPLAY_STATE State;
1111 BL_DISPLAY_MODE DisplayMode;
1112 BOOLEAN Active;
1113 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* Protocol;
1114 ULONG Mode;
1115 EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode;
1116 } BL_TEXT_CONSOLE, *PBL_TEXT_CONSOLE;
1117
1118 typedef struct _BL_INPUT_CONSOLE_VTABLE
1119 {
1120 PCONSOLE_DESTRUCT Destruct;
1121 PCONSOLE_REINITIALIZE Reinitialize;
1122 //PCONSOLE_IS_KEY_PENDING IsKeyPending;
1123 //PCONSOLE_READ_INPUT ReadInput;
1124 //PCONSOLE_ERASE_BUFFER EraseBuffer;
1125 //PCONSOLE_FILL_BUFFER FillBuffer;
1126 } BL_INPUT_CONSOLE_VTABLE, *PBL_INPUT_CONSOLE_VTABLE;
1127
1128 typedef struct _BL_INPUT_CONSOLE
1129 {
1130 PBL_INPUT_CONSOLE_VTABLE Callbacks;
1131 PULONG Buffer;
1132 PULONG DataStart;
1133 PULONG DataEnd;
1134 PULONG EndBuffer;
1135 } BL_INPUT_CONSOLE, *PBL_INPUT_CONSOLE;
1136
1137 typedef enum _BL_GRAPHICS_CONSOLE_TYPE
1138 {
1139 BlGopConsole,
1140 BlUgaConsole
1141 } BL_GRAPHICS_CONSOLE_TYPE;
1142
1143 typedef struct _BL_GRAPHICS_CONSOLE
1144 {
1145 BL_TEXT_CONSOLE TextConsole;
1146 BL_DISPLAY_MODE DisplayMode;
1147 ULONG PixelDepth;
1148 ULONG FgColor;
1149 ULONG BgColor;
1150 BL_DISPLAY_MODE OldDisplayMode;
1151 ULONG OldPixelDepth;
1152 EFI_HANDLE Handle;
1153 BL_GRAPHICS_CONSOLE_TYPE Type;
1154 EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol;
1155 PVOID FrameBuffer;
1156 ULONG FrameBufferSize;
1157 ULONG PixelsPerScanLine;
1158 ULONG Mode;
1159 ULONG OldMode;
1160 } BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE;
1161
1162 typedef struct _BL_REMOTE_CONSOLE
1163 {
1164 BL_TEXT_CONSOLE TextConsole;
1165 } BL_REMOTE_CONSOLE, *PBL_REMOTE_CONSOLE;
1166
1167 typedef struct _BL_HASH_TABLE
1168 {
1169 PLIST_ENTRY HashLinks;
1170 ULONG Size;
1171 PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction;
1172 PBL_HASH_TABLE_HASH_FUNCTION HashFunction;
1173 } BL_HASH_TABLE, *PBL_HASH_TABLE;
1174
1175 typedef struct _BL_HASH_ENTRY
1176 {
1177 ULONG Size;
1178 ULONG Flags;
1179 PVOID Value;
1180 } BL_HASH_ENTRY, *PBL_HASH_ENTRY;
1181
1182 typedef struct _BL_HASH_VALUE
1183 {
1184 ULONG DataSize;
1185 PVOID Data;
1186 } BL_HASH_VALUE, *PBL_HASH_VALUE;
1187
1188 typedef struct _BL_HASH_NODE
1189 {
1190 LIST_ENTRY ListEntry;
1191 BL_HASH_ENTRY Entry;
1192 BL_HASH_VALUE Value;
1193 } BL_HASH_NODE, *PBL_HASH_NODE;
1194
1195 typedef struct _BL_BLOCK_DEVICE_INFORMATION
1196 {
1197 BL_LOCAL_DEVICE_TYPE Type;
1198 ULONG DeviceFlags;
1199 ULONG Unknown;
1200 BL_PARTITION_TYPE PartitionType;
1201 ULONG BlockSize;
1202 ULONG Alignment;
1203 ULONGLONG LastBlock;
1204 ULONGLONG Offset;
1205 ULONG Block;
1206 struct
1207 {
1208 union
1209 {
1210 struct
1211 {
1212 ULONG Signature;
1213 } Mbr;
1214 struct
1215 {
1216 GUID Signature;
1217 } Gpt;
1218 };
1219 } Disk;
1220 } BL_BLOCK_DEVICE_INFORMATION, *PBL_BLOCK_DEVICE_INFORMATION;
1221
1222 typedef struct _BL_DEVICE_INFORMATION
1223 {
1224 BL_DEVICE_TYPE DeviceType;
1225 union
1226 {
1227 BL_BLOCK_DEVICE_INFORMATION BlockDeviceInfo;
1228 };
1229 } BL_DEVICE_INFORMATION, *PBL_DEVICE_INFORMATION;
1230
1231 typedef struct _BL_BLOCK_DEVICE
1232 {
1233 BL_BLOCK_DEVICE_INFORMATION;
1234 ULONGLONG StartOffset;
1235 EFI_BLOCK_IO* Protocol;
1236 EFI_HANDLE Handle;
1237 } BL_BLOCK_DEVICE, *PBL_BLOCK_DEVICE;
1238
1239 typedef struct _BL_PROTOCOL_HANDLE
1240 {
1241 EFI_HANDLE Handle;
1242 PVOID Interface;
1243 } BL_PROTOCOL_HANDLE, *PBL_PROTOCOL_HANDLE;
1244
1245 typedef struct _BL_DEVICE_CALLBACKS
1246 {
1247 PBL_DEVICE_ENUMERATE_DEVICE_CLASS EnumerateDeviceClass;
1248 PBL_DEVICE_OPEN Open;
1249 PBL_DEVICE_CLOSE Close;
1250 PBL_DEVICE_READ Read;
1251 PBL_DEVICE_WRITE Write;
1252 PBL_DEVICE_GET_INFORMATION GetInformation;
1253 PBL_DEVICE_SET_INFORMATION SetInformation;
1254 PBL_DEVICE_RESET Reset;
1255 PBL_DEVICE_FLUSH Flush;
1256 PBL_DEVICE_CREATE Create;
1257 } BL_DEVICE_CALLBACKS, *PBL_DEVICE_CALLBACKS;
1258
1259 typedef struct _BL_DEVICE_ENTRY
1260 {
1261 ULONG DeviceId;
1262 ULONG Flags;
1263 ULONG Unknown;
1264 ULONG ReferenceCount;
1265 BL_DEVICE_CALLBACKS Callbacks;
1266 PVOID DeviceSpecificData;
1267 PBL_DEVICE_DESCRIPTOR DeviceDescriptor;
1268 } BL_DEVICE_ENTRY, *PBL_DEVICE_ENTRY;
1269
1270 typedef struct _BL_IMG_FILE
1271 {
1272 UCHAR Flags;
1273 union
1274 {
1275 PVOID BaseAddress;
1276 ULONG FileId;
1277 };
1278 ULONG FileSize;
1279 PWCHAR FileName;
1280 } BL_IMG_FILE, *PBL_IMG_FILE;
1281
1282 typedef struct _BL_IMAGE_APPLICATION_ENTRY
1283 {
1284 PBL_APPLICATION_ENTRY AppEntry;
1285 PVOID ImageBase;
1286 ULONG ImageSize;
1287 } BL_IMAGE_APPLICATION_ENTRY, *PBL_IMAGE_APPLICATION_ENTRY;
1288
1289 typedef struct _BL_BUFFER_DESCRIPTOR
1290 {
1291 PVOID Buffer;
1292 ULONG ActualSize;
1293 ULONG BufferSize;
1294 } BL_BUFFER_DESCRIPTOR, *PBL_BUFFER_DESCRIPTOR;
1295
1296 typedef struct _BL_DEFERRED_FONT_FILE
1297 {
1298 LIST_ENTRY ListEntry;
1299 ULONG Flags;
1300 PBL_DEVICE_DESCRIPTOR Device;
1301 PWCHAR FontPath;
1302 } BL_DEFERRED_FONT_FILE, *PBL_DEFERRED_FONT_FILE;
1303
1304 #pragma pack(push)
1305 #pragma pack(1)
1306 typedef struct _BMP_HEADER
1307 {
1308 USHORT Signature;
1309 ULONG Size;
1310 USHORT Reserved[2];
1311 ULONG Offset;
1312 } BMP_HEADER, *PBMP_HEADER;
1313
1314 typedef struct _DIB_HEADER
1315 {
1316 ULONG Size;
1317 ULONG Width;
1318 ULONG Height;
1319 USHORT Planes;
1320 USHORT BitCount;
1321 ULONG Compression;
1322 ULONG SizeImage;
1323 ULONG XPelsPerMeter;
1324 ULONG YPelsPerMEter;
1325 ULONG ClrUsed;
1326 ULONG ClrImportant;
1327 } DIB_HEADER, *PDIB_HEADER;
1328
1329 typedef struct _BITMAP
1330 {
1331 BMP_HEADER BmpHeader;
1332 DIB_HEADER DibHeader;
1333 } BITMAP, *PBITMAP;
1334 #pragma pack(pop)
1335
1336 typedef struct _COORD
1337 {
1338 ULONG X;
1339 ULONG Y;
1340 } COORD, *PCOORD;
1341
1342 typedef struct _BL_PD_DATA_BLOB
1343 {
1344 PVOID Data;
1345 ULONG DataSize;
1346 ULONG BlobSize;
1347 } BL_PD_DATA_BLOB, *PBL_PD_DATA_BLOB;
1348
1349 /* INLINE ROUTINES ***********************************************************/
1350
1351 FORCEINLINE
1352 VOID
1353 BlSetupDefaultParameters (
1354 _Out_ PBL_LIBRARY_PARAMETERS LibraryParameters
1355 )
1356 {
1357 BL_LIBRARY_PARAMETERS DefaultParameters =
1358 {
1359 0x20,
1360 BlVirtual,
1361 1024,
1362 2 * 1024 * 1024,
1363 0,
1364 NULL,
1365 0,
1366 NULL
1367 };
1368
1369 /* Copy the defaults */
1370 RtlCopyMemory(LibraryParameters, &DefaultParameters, sizeof(*LibraryParameters));
1371 }
1372
1373 FORCEINLINE
1374 VOID
1375 MmMdInitializeListHead (
1376 _In_ PBL_MEMORY_DESCRIPTOR_LIST List
1377 )
1378 {
1379 /* Initialize the list */
1380 InitializeListHead(&List->ListHead);
1381 List->First = &List->ListHead;
1382 List->This = NULL;
1383 List->Type = 0;
1384 }
1385
1386 /* INITIALIZATION ROUTINES ***************************************************/
1387
1388 NTSTATUS
1389 BlInitializeLibrary(
1390 _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters,
1391 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1392 );
1393
1394 NTSTATUS
1395 BlpArchInitialize (
1396 _In_ ULONG Phase
1397 );
1398
1399 NTSTATUS
1400 BlpFwInitialize (
1401 _In_ ULONG Phase,
1402 _In_ PBL_FIRMWARE_DESCRIPTOR FirmwareParameters
1403 );
1404
1405 NTSTATUS
1406 BlpMmInitialize (
1407 _In_ PBL_MEMORY_DATA MemoryData,
1408 _In_ BL_TRANSLATION_TYPE TranslationType,
1409 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1410 );
1411
1412 NTSTATUS
1413 MmBaInitialize (
1414 VOID
1415 );
1416
1417 NTSTATUS
1418 MmPaInitialize (
1419 _In_ PBL_MEMORY_DATA MemoryData,
1420 _In_ ULONG MinimumPages
1421 );
1422
1423 NTSTATUS
1424 MmArchInitialize (
1425 _In_ ULONG Phase,
1426 _In_ PBL_MEMORY_DATA MemoryData,
1427 _In_ BL_TRANSLATION_TYPE TranslationType,
1428 _In_ BL_TRANSLATION_TYPE LibraryTranslationType
1429 );
1430
1431 NTSTATUS
1432 MmHaInitialize (
1433 _In_ ULONG HeapSize,
1434 _In_ ULONG HeapAttributes
1435 );
1436
1437 VOID
1438 MmMdInitialize (
1439 _In_ ULONG Phase,
1440 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1441 );
1442
1443 NTSTATUS
1444 BlpDeviceInitialize (
1445 VOID
1446 );
1447
1448 NTSTATUS
1449 BlpIoInitialize (
1450 VOID
1451 );
1452
1453 NTSTATUS
1454 BlpFileInitialize (
1455 VOID
1456 );
1457
1458 NTSTATUS
1459 BlpDisplayInitialize (
1460 _In_ ULONG Flags
1461 );
1462
1463 NTSTATUS
1464 BlpDisplayReinitialize (
1465 VOID
1466 );
1467
1468 VOID
1469 BlDestroyLibrary (
1470 VOID
1471 );
1472
1473 NTSTATUS
1474 BcInitialize (
1475 VOID
1476 );
1477
1478 /* FIRMWARE ROUTINES *********************************************************/
1479
1480 VOID
1481 EfiPrintf (
1482 _In_ PWCHAR Format,
1483 ...
1484 );
1485
1486 NTSTATUS
1487 BlFwGetParameters(
1488 _In_ PBL_FIRMWARE_DESCRIPTOR Parameters
1489 );
1490
1491 NTSTATUS
1492 BlFwEnumerateDevice (
1493 _In_ PBL_DEVICE_DESCRIPTOR Device
1494 );
1495
1496 NTSTATUS
1497 EfiAllocatePages (
1498 _In_ ULONG Type,
1499 _In_ ULONG Pages,
1500 _Inout_ EFI_PHYSICAL_ADDRESS* Memory
1501 );
1502
1503 NTSTATUS
1504 EfiStall (
1505 _In_ ULONG StallTime
1506 );
1507
1508 NTSTATUS
1509 EfiConInExReset (
1510 VOID
1511 );
1512
1513 NTSTATUS
1514 EfiConInReset (
1515 VOID
1516 );
1517
1518 NTSTATUS
1519 EfiConOutOutputString (
1520 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1521 _In_ PWCHAR String
1522 );
1523
1524 NTSTATUS
1525 EfiConOutQueryMode (
1526 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1527 _In_ ULONG Mode,
1528 _In_ UINTN* Columns,
1529 _In_ UINTN* Rows
1530 );
1531
1532 NTSTATUS
1533 EfiConOutSetMode (
1534 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1535 _In_ ULONG Mode
1536 );
1537
1538 VOID
1539 EfiConOutReadCurrentMode (
1540 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1541 _Out_ EFI_SIMPLE_TEXT_OUTPUT_MODE* Mode
1542 );
1543
1544 NTSTATUS
1545 EfiConOutSetAttribute (
1546 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1547 _In_ ULONG Attribute
1548 );
1549
1550 NTSTATUS
1551 EfiConOutSetCursorPosition (
1552 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1553 _In_ ULONG Column,
1554 _In_ ULONG Row
1555 );
1556
1557 NTSTATUS
1558 EfiConOutEnableCursor (
1559 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1560 _In_ BOOLEAN Visible
1561 );
1562
1563 NTSTATUS
1564 EfiLocateHandleBuffer (
1565 _In_ EFI_LOCATE_SEARCH_TYPE SearchType,
1566 _In_ EFI_GUID *Protocol,
1567 _Inout_ PULONG HandleCount,
1568 _Inout_ EFI_HANDLE** Buffer
1569 );
1570
1571 NTSTATUS
1572 EfiOpenProtocol (
1573 _In_ EFI_HANDLE Handle,
1574 _In_ EFI_GUID *Protocol,
1575 _Out_ PVOID* Interface
1576 );
1577
1578 NTSTATUS
1579 EfiCloseProtocol (
1580 _In_ EFI_HANDLE Handle,
1581 _In_ EFI_GUID *Protocol
1582 );
1583
1584 NTSTATUS
1585 EfiGopGetCurrentMode (
1586 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1587 _Out_ UINTN* Mode,
1588 _Out_ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Information
1589 );
1590
1591 NTSTATUS
1592 EfiGopSetMode (
1593 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1594 _In_ ULONG Mode
1595 );
1596
1597 VOID
1598 EfiGopGetFrameBuffer (
1599 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1600 _Out_ PHYSICAL_ADDRESS* FrameBuffer,
1601 _Out_ UINTN *FrameBufferSize
1602 );
1603
1604 VOID
1605 EfiResetSystem (
1606 _In_ EFI_RESET_TYPE ResetType
1607 );
1608
1609 EFI_DEVICE_PATH*
1610 EfiGetLeafNode (
1611 _In_ EFI_DEVICE_PATH *DevicePath
1612 );
1613
1614 EFI_DEVICE_PATH *
1615 EfiIsDevicePathParent (
1616 _In_ EFI_DEVICE_PATH *DevicePath1,
1617 _In_ EFI_DEVICE_PATH *DevicePath2
1618 );
1619
1620 NTSTATUS
1621 EfipGetRsdt (
1622 _Out_ PPHYSICAL_ADDRESS FoundRsdt
1623 );
1624
1625 NTSTATUS
1626 EfiFreePages (
1627 _In_ ULONG Pages,
1628 _In_ EFI_PHYSICAL_ADDRESS PhysicalAddress
1629 );
1630
1631 /* PLATFORM TIMER ROUTINES ***************************************************/
1632
1633 NTSTATUS
1634 BlpTimeCalibratePerformanceCounter (
1635 VOID
1636 );
1637
1638 ULONGLONG
1639 BlTimeQueryPerformanceCounter (
1640 _Out_opt_ PLARGE_INTEGER Frequency
1641 );
1642
1643 ULONGLONG
1644 BlArchGetPerformanceCounter (
1645 VOID
1646 );
1647
1648 /* RESOURCE LOCALE INTERNATIONALIZATION ROUTINES *****************************/
1649
1650 NTSTATUS
1651 BlpDisplayRegisterLocale (
1652 _In_ PWCHAR Locale
1653 );
1654
1655 /* FONT ROUTINES *************************************************************/
1656
1657 VOID
1658 BfiFreeDeferredFontFile (
1659 _In_ PBL_DEFERRED_FONT_FILE DeferredFontFile
1660 );
1661
1662 NTSTATUS
1663 BfLoadFontFile (
1664 _In_ PBL_DEVICE_DESCRIPTOR Device,
1665 _In_ PWCHAR FontPath
1666 );
1667
1668 NTSTATUS
1669 BfLoadDeferredFontFiles (
1670 VOID
1671 );
1672
1673 NTSTATUS
1674 BfClearScreen (
1675 _In_ PBL_GRAPHICS_CONSOLE Console
1676 );
1677
1678 NTSTATUS
1679 BfClearToEndOfLine (
1680 _In_ PBL_GRAPHICS_CONSOLE Console
1681 );
1682
1683 /* FILESYSTEM ROUTINES *******************************************************/
1684
1685 NTSTATUS
1686 FatInitialize (
1687 VOID
1688 );
1689
1690 NTSTATUS
1691 FatMount (
1692 _In_ ULONG DeviceId,
1693 _In_ ULONG Unknown,
1694 _Out_ PBL_FILE_ENTRY* FileEntry
1695 );
1696
1697 NTSTATUS
1698 EtfsInitialize (
1699 VOID
1700 );
1701
1702 NTSTATUS
1703 EtfsMount (
1704 _In_ ULONG DeviceId,
1705 _In_ ULONG Unknown,
1706 _Out_ PBL_FILE_ENTRY* FileEntry
1707 );
1708
1709 /* DEBUG ROUTINES ************************************************************/
1710
1711 BOOLEAN
1712 BlBdDebuggerEnabled (
1713 VOID
1714 );
1715
1716 NTSTATUS
1717 BlBdPullRemoteFile (
1718 _In_ PWCHAR FilePath,
1719 _Out_ PVOID BaseAddress,
1720 _Out_ PULONGLONG FileSize
1721 );
1722
1723 VOID
1724 BlStatusPrint (
1725 _In_ PCWCH Format,
1726 ...
1727 );
1728
1729 VOID
1730 BlStatusError (
1731 _In_ ULONG ErrorCode,
1732 _In_ ULONG Parameter1,
1733 _In_ ULONG_PTR Parameter2,
1734 _In_ ULONG_PTR Parameter3,
1735 _In_ ULONG_PTR Parameter4
1736 );
1737
1738 /* UTILITY ROUTINES **********************************************************/
1739
1740 VOID
1741 BlArchCpuId (
1742 _In_ ULONG Function,
1743 _In_ ULONG SubFunction,
1744 _Out_ PCPU_INFO Result
1745 );
1746
1747 CPU_VENDORS
1748 BlArchGetCpuVendor (
1749 VOID
1750 );
1751
1752 BOOLEAN
1753 BlArchIsCpuIdFunctionSupported (
1754 _In_ ULONG Function
1755 );
1756
1757 VOID
1758 BlUtlUpdateProgress (
1759 _In_ ULONG Percentage,
1760 _Out_opt_ PBOOLEAN Completed
1761 );
1762
1763 NTSTATUS
1764 BlUtlGetAcpiTable (
1765 _Out_ PVOID* TableAddress,
1766 _In_ ULONG Signature
1767 );
1768
1769 NTSTATUS
1770 BlUtlInitialize (
1771 VOID
1772 );
1773
1774 NTSTATUS
1775 BlUtlRegisterProgressRoutine (
1776 VOID
1777 );
1778
1779 ULONG
1780 BlUtlCheckSum (
1781 _In_ ULONG PartialSum,
1782 _In_ PUCHAR Buffer,
1783 _In_ ULONG Length,
1784 _In_ ULONG Flags
1785 );
1786
1787 NTSTATUS
1788 BlGetApplicationBaseAndSize (
1789 _Out_ PVOID* ImageBase,
1790 _Out_ PULONG ImageSize
1791 );
1792
1793 VOID
1794 BlDestroyBootEntry (
1795 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry
1796 );
1797
1798 NTSTATUS
1799 BlPdQueryData (
1800 _In_ const GUID* DataGuid,
1801 _In_ PVOID Unknown,
1802 _Inout_ PBL_PD_DATA_BLOB DataBlob
1803 );
1804
1805 /* FIRMWARE UTILITY ROUTINES *************************************************/
1806
1807 EFI_STATUS
1808 EfiGetEfiStatusCode(
1809 _In_ NTSTATUS Status
1810 );
1811
1812 NTSTATUS
1813 EfiGetNtStatusCode (
1814 _In_ EFI_STATUS EfiStatus
1815 );
1816
1817 VOID
1818 BlFwReboot (
1819 VOID
1820 );
1821
1822 NTSTATUS
1823 MmFwFreePages (
1824 _In_ ULONG BasePage,
1825 _In_ ULONG PageCount
1826 );
1827
1828 PGUID
1829 BlGetApplicationIdentifier (
1830 VOID
1831 );
1832
1833 NTSTATUS
1834 BlpSecureBootEFIIsEnabled (
1835 VOID
1836 );
1837
1838 NTSTATUS
1839 BlSecureBootIsEnabled (
1840 _Out_ PBOOLEAN SecureBootEnabled
1841 );
1842
1843 NTSTATUS
1844 BlSecureBootCheckForFactoryReset (
1845 VOID
1846 );
1847
1848 /* RESOURCE ROUTINES *********************************************************/
1849
1850 PWCHAR
1851 BlResourceFindMessage (
1852 _In_ ULONG MsgId
1853 );
1854
1855 PWCHAR
1856 BlResourceFindHtml (
1857 VOID
1858 );
1859
1860 NTSTATUS
1861 BlpResourceInitialize (
1862 VOID
1863 );
1864
1865 /* TABLE ROUTINES ************************************************************/
1866
1867 NTSTATUS
1868 BlTblMap (
1869 _In_ PVOID *Table,
1870 _In_ ULONG Count,
1871 _In_ PBL_TBL_MAP_ROUTINE MapCallback
1872 );
1873
1874 PVOID
1875 BlTblFindEntry (
1876 _In_ PVOID *Table,
1877 _In_ ULONG Count,
1878 _Out_ PULONG EntryIndex,
1879 _In_ PBL_TBL_LOOKUP_ROUTINE Callback,
1880 _In_ PVOID Argument1,
1881 _In_ PVOID Argument2,
1882 _In_ PVOID Argument3,
1883 _In_ PVOID Argument4
1884 );
1885
1886 NTSTATUS
1887 BlTblSetEntry (
1888 _Inout_ PVOID** Table,
1889 _Inout_ PULONG Count,
1890 _In_ PVOID Entry,
1891 _Out_ PULONG EntryIndex,
1892 _In_ PBL_TBL_SET_ROUTINE Callback
1893 );
1894
1895 NTSTATUS
1896 TblDoNotPurgeEntry (
1897 _In_ PVOID Entry
1898 );
1899
1900 /* HASH TABLE ROUTINES *******************************************************/
1901
1902 NTSTATUS
1903 BlHtStore (
1904 _In_ ULONG TableId,
1905 _In_ PBL_HASH_ENTRY Entry,
1906 _In_ PVOID Data,
1907 _In_ ULONG DataSize
1908 );
1909
1910 NTSTATUS
1911 BlHtDelete (
1912 _In_ ULONG TableId,
1913 _In_ PBL_HASH_ENTRY Entry
1914 );
1915
1916 NTSTATUS
1917 BlHtLookup (
1918 _In_ ULONG TableId,
1919 _In_ PBL_HASH_ENTRY Entry,
1920 _Out_ PBL_HASH_VALUE *Value
1921 );
1922
1923 NTSTATUS
1924 BlHtCreate (
1925 _In_ ULONG Size,
1926 _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction,
1927 _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction,
1928 _Out_ PULONG Id
1929 );
1930
1931 /* BCD OPTION ROUTINES *******************************************************/
1932
1933 PBL_BCD_OPTION
1934 MiscGetBootOption (
1935 _In_ PBL_BCD_OPTION List,
1936 _In_ ULONG Type
1937 );
1938
1939 ULONG
1940 BlGetBootOptionListSize (
1941 _In_ PBL_BCD_OPTION BcdOption
1942 );
1943
1944 ULONG
1945 BlGetBootOptionSize (
1946 _In_ PBL_BCD_OPTION BcdOption
1947 );
1948
1949 NTSTATUS
1950 BlGetBootOptionString (
1951 _In_ PBL_BCD_OPTION List,
1952 _In_ ULONG Type,
1953 _Out_ PWCHAR* Value
1954 );
1955
1956 NTSTATUS
1957 BlGetBootOptionInteger (
1958 _In_ PBL_BCD_OPTION List,
1959 _In_ ULONG Type,
1960 _Out_ PULONGLONG Value
1961 );
1962
1963 NTSTATUS
1964 BlGetBootOptionBoolean (
1965 _In_ PBL_BCD_OPTION List,
1966 _In_ ULONG Type,
1967 _Out_ PBOOLEAN Value
1968 );
1969
1970 NTSTATUS
1971 BlpGetBootOptionIntegerList (
1972 _In_ PBL_BCD_OPTION List,
1973 _In_ ULONG Type,
1974 _Out_ PULONGLONG* Value,
1975 _Out_ PULONGLONG Count,
1976 _In_ BOOLEAN NoCopy
1977 );
1978
1979 NTSTATUS
1980 BlGetBootOptionDevice (
1981 _In_ PBL_BCD_OPTION List,
1982 _In_ ULONG Type,
1983 _Out_ PBL_DEVICE_DESCRIPTOR* Value,
1984 _In_opt_ PBL_BCD_OPTION* ExtraOptions
1985 );
1986
1987 NTSTATUS
1988 BlGetBootOptionGuid (
1989 _In_ PBL_BCD_OPTION List,
1990 _In_ ULONG Type,
1991 _Out_ PGUID Value
1992 );
1993
1994 NTSTATUS
1995 BlGetBootOptionGuidList (
1996 _In_ PBL_BCD_OPTION List,
1997 _In_ ULONG Type,
1998 _Out_ PGUID *Value,
1999 _In_ PULONG Count
2000 );
2001
2002 NTSTATUS
2003 BlCopyBootOptions (
2004 _In_ PBL_BCD_OPTION OptionList,
2005 _Out_ PBL_BCD_OPTION *CopiedOptions
2006 );
2007
2008 NTSTATUS
2009 BlAppendBootOptionBoolean (
2010 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
2011 _In_ ULONG OptionId
2012 );
2013
2014 NTSTATUS
2015 BlAppendBootOptionInteger (
2016 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
2017 _In_ ULONG OptionId,
2018 _In_ ULONGLONG Value
2019 );
2020
2021 NTSTATUS
2022 BlAppendBootOptionString (
2023 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
2024 _In_ PWCHAR OptionString
2025 );
2026
2027 NTSTATUS
2028 BlAppendBootOptions (
2029 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
2030 _In_ PBL_BCD_OPTION Options
2031 );
2032
2033 VOID
2034 BlRemoveBootOption (
2035 _In_ PBL_BCD_OPTION List,
2036 _In_ ULONG Type
2037 );
2038
2039 NTSTATUS
2040 BlReplaceBootOptions (
2041 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
2042 _In_ PBL_BCD_OPTION NewOptions
2043 );
2044
2045 /* BOOT REGISTRY ROUTINES ****************************************************/
2046
2047 VOID
2048 BiCloseKey (
2049 _In_ HANDLE KeyHandle
2050 );
2051
2052 NTSTATUS
2053 BiOpenKey(
2054 _In_ HANDLE ParentHandle,
2055 _In_ PWCHAR KeyName,
2056 _Out_ PHANDLE Handle
2057 );
2058
2059 NTSTATUS
2060 BiLoadHive (
2061 _In_ PBL_FILE_PATH_DESCRIPTOR FilePath,
2062 _Out_ PHANDLE HiveHandle
2063 );
2064
2065 NTSTATUS
2066 BiGetRegistryValue (
2067 _In_ HANDLE KeyHandle,
2068 _In_ PWCHAR ValueName,
2069 _In_ ULONG Type,
2070 _Out_ PVOID* Buffer,
2071 _Out_ PULONG ValueLength
2072 );
2073
2074 NTSTATUS
2075 BiEnumerateSubKeys (
2076 _In_ HANDLE KeyHandle,
2077 _Out_ PWCHAR** SubKeyList,
2078 _Out_ PULONG SubKeyCount
2079 );
2080
2081 NTSTATUS
2082 BiDeleteKey (
2083 _In_ HANDLE KeyHandle
2084 );
2085
2086 VOID
2087 BiDereferenceHive (
2088 _In_ HANDLE KeyHandle
2089 );
2090
2091 /* CONTEXT ROUTINES **********************************************************/
2092
2093 VOID
2094 BlpArchSwitchContext (
2095 _In_ BL_ARCH_MODE NewMode
2096 );
2097
2098 VOID
2099 BlpArchEnableTranslation (
2100 VOID
2101 );
2102
2103 VOID
2104 Archx86TransferTo32BitApplicationAsm (
2105 VOID
2106 );
2107
2108 /* MEMORY DESCRIPTOR ROUTINES ************************************************/
2109
2110 VOID
2111 MmMdDbgDumpList (
2112 _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList,
2113 _In_opt_ ULONG MaxCount
2114 );
2115
2116 VOID
2117 MmMdInitializeList (
2118 _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList,
2119 _In_ ULONG Type,
2120 _In_ PLIST_ENTRY ListHead
2121 );
2122
2123 PBL_MEMORY_DESCRIPTOR
2124 MmMdFindDescriptor (
2125 _In_ ULONG WhichList,
2126 _In_ ULONG Flags,
2127 _In_ ULONGLONG Page
2128 );
2129
2130 PBL_MEMORY_DESCRIPTOR
2131 MmMdFindDescriptorFromMdl (
2132 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2133 _In_ ULONG Flags,
2134 _In_ ULONGLONG Page
2135 );
2136
2137 NTSTATUS
2138 MmMdCopyList (
2139 _In_ PBL_MEMORY_DESCRIPTOR_LIST DestinationList,
2140 _In_ PBL_MEMORY_DESCRIPTOR_LIST SourceList,
2141 _In_opt_ PBL_MEMORY_DESCRIPTOR ListDescriptor,
2142 _Out_ PULONG ActualCount,
2143 _In_ ULONG Count,
2144 _In_ ULONG Flags
2145 );
2146
2147 ULONG
2148 MmMdCountList (
2149 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList
2150 );
2151
2152 VOID
2153 MmMdFreeList(
2154 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList
2155 );
2156
2157 PBL_MEMORY_DESCRIPTOR
2158 MmMdInitByteGranularDescriptor (
2159 _In_ ULONG Flags,
2160 _In_ BL_MEMORY_TYPE Type,
2161 _In_ ULONGLONG BasePage,
2162 _In_ ULONGLONG VirtualPage,
2163 _In_ ULONGLONG PageCount
2164 );
2165
2166 VOID
2167 MmMdFreeGlobalDescriptors (
2168 VOID
2169 );
2170
2171 NTSTATUS
2172 MmMdAddDescriptorToList (
2173 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2174 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor,
2175 _In_ ULONG Flags
2176 );
2177
2178 NTSTATUS
2179 MmMdTruncateDescriptors (
2180 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2181 _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
2182 _In_ ULONGLONG BasePage
2183 );
2184
2185 VOID
2186 MmMdRemoveDescriptorFromList (
2187 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2188 _In_ PBL_MEMORY_DESCRIPTOR Entry
2189 );
2190
2191 BOOLEAN
2192 MmMdFindSatisfyingRegion (
2193 _In_ PBL_MEMORY_DESCRIPTOR Descriptor,
2194 _Out_ PBL_MEMORY_DESCRIPTOR NewDescriptor,
2195 _In_ ULONGLONG Pages,
2196 _In_ PBL_ADDRESS_RANGE BaseRange,
2197 _In_ PBL_ADDRESS_RANGE VirtualRange,
2198 _In_ BOOLEAN TopDown,
2199 _In_ BL_MEMORY_TYPE MemoryType,
2200 _In_ ULONG Flags,
2201 _In_ ULONG Alignment
2202 );
2203
2204 NTSTATUS
2205 MmMdRemoveRegionFromMdlEx (
2206 __in PBL_MEMORY_DESCRIPTOR_LIST MdList,
2207 __in ULONG Flags,
2208 __in ULONGLONG BasePage,
2209 __in ULONGLONG PageCount,
2210 __in PBL_MEMORY_DESCRIPTOR_LIST NewMdList
2211 );
2212
2213 NTSTATUS
2214 MmMdFreeDescriptor (
2215 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor
2216 );
2217
2218 /* PAGE ALLOCATOR ROUTINES ***************************************************/
2219
2220 NTSTATUS
2221 MmPaTruncateMemory (
2222 _In_ ULONGLONG BasePage
2223 );
2224
2225 NTSTATUS
2226 BlMmAllocatePhysicalPages(
2227 _Inout_ PPHYSICAL_ADDRESS Address,
2228 _In_ BL_MEMORY_TYPE MemoryType,
2229 _In_ ULONGLONG PageCount,
2230 _In_ ULONG Attributes,
2231 _In_ ULONG Alignment
2232 );
2233
2234 NTSTATUS
2235 MmPapAllocatePhysicalPagesInRange (
2236 _Inout_ PPHYSICAL_ADDRESS BaseAddress,
2237 _In_ BL_MEMORY_TYPE MemoryType,
2238 _In_ ULONGLONG Pages,
2239 _In_ ULONG Attributes,
2240 _In_ ULONG Alignment,
2241 _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
2242 _In_opt_ PBL_ADDRESS_RANGE Range,
2243 _In_ ULONG RangeType
2244 );
2245
2246 NTSTATUS
2247 MmPaReleaseSelfMapPages (
2248 _In_ PHYSICAL_ADDRESS Address
2249 );
2250
2251 NTSTATUS
2252 MmPaReserveSelfMapPages (
2253 _Inout_ PPHYSICAL_ADDRESS PhysicalAddress,
2254 _In_ ULONG Alignment,
2255 _In_ ULONG PageCount
2256 );
2257
2258 NTSTATUS
2259 BlMmFreePhysicalPages (
2260 _In_ PHYSICAL_ADDRESS Address
2261 );
2262
2263 NTSTATUS
2264 MmPapFreePages (
2265 _In_ PVOID Address,
2266 _In_ ULONG WhichList
2267 );
2268
2269 NTSTATUS
2270 MmPapAllocatePagesInRange (
2271 _Inout_ PVOID* PhysicalAddress,
2272 _In_ BL_MEMORY_TYPE MemoryType,
2273 _In_ ULONGLONG Pages,
2274 _In_ ULONG Attributes,
2275 _In_ ULONG Alignment,
2276 _In_opt_ PBL_ADDRESS_RANGE Range,
2277 _In_ ULONG Type
2278 );
2279
2280 NTSTATUS
2281 MmFwGetMemoryMap (
2282 _Out_ PBL_MEMORY_DESCRIPTOR_LIST MemoryMap,
2283 _In_ ULONG Flags
2284 );
2285
2286 NTSTATUS
2287 BlpMmInitializeConstraints (
2288 VOID
2289 );
2290
2291 NTSTATUS
2292 BlMmRemoveBadMemory (
2293 VOID
2294 );
2295
2296 NTSTATUS
2297 BlMmGetMemoryMap (
2298 _In_ PLIST_ENTRY MemoryMap,
2299 _In_ PBL_BUFFER_DESCRIPTOR MemoryParameters,
2300 _In_ ULONG WhichTypes,
2301 _In_ ULONG Flags
2302 );
2303
2304 /* VIRTUAL MEMORY ROUTINES ***************************************************/
2305
2306 NTSTATUS
2307 MmSelectMappingAddress (
2308 _Out_ PVOID* MappingAddress,
2309 _In_ PVOID PreferredAddress,
2310 _In_ ULONGLONG Size,
2311 _In_ ULONG AllocationAttributes,
2312 _In_ ULONG Flags,
2313 _In_ PHYSICAL_ADDRESS PhysicalAddress
2314 );
2315
2316 NTSTATUS
2317 MmMapPhysicalAddress (
2318 _Inout_ PPHYSICAL_ADDRESS PhysicalAddress,
2319 _Out_ PVOID* VirtualAddress,
2320 _Inout_ PULONGLONG Size,
2321 _In_ ULONG CacheAttributes
2322 );
2323
2324 NTSTATUS
2325 MmUnmapVirtualAddress (
2326 _Inout_ PVOID* VirtualAddress,
2327 _Inout_ PULONGLONG Size
2328 );
2329
2330 NTSTATUS
2331 BlMmMapPhysicalAddressEx (
2332 _In_ PVOID* VirtualAddress,
2333 _In_ ULONG Attributes,
2334 _In_ ULONGLONG Size,
2335 _In_ PHYSICAL_ADDRESS PhysicalAddress
2336 );
2337
2338 NTSTATUS
2339 BlMmUnmapVirtualAddressEx (
2340 _In_ PVOID VirtualAddress,
2341 _In_ ULONGLONG Size
2342 );
2343
2344 BOOLEAN
2345 BlMmTranslateVirtualAddress (
2346 _In_ PVOID VirtualAddress,
2347 _Out_ PPHYSICAL_ADDRESS PhysicalAddress
2348 );
2349
2350 BOOLEAN
2351 MmArchTranslateVirtualAddress (
2352 _In_ PVOID VirtualAddress,
2353 _Out_opt_ PPHYSICAL_ADDRESS PhysicalAddress,
2354 _Out_opt_ PULONG CachingFlags
2355 );
2356
2357 /* BLOCK ALLOCATOR ROUTINES **************************************************/
2358
2359 NTSTATUS
2360 BlpMmCreateBlockAllocator (
2361 VOID
2362 );
2363
2364 /* HEAP ALLOCATOR ROUTINES ***************************************************/
2365
2366 PVOID
2367 BlMmAllocateHeap (
2368 _In_ ULONG Size
2369 );
2370
2371 NTSTATUS
2372 BlMmFreeHeap (
2373 _In_ PVOID Buffer
2374 );
2375
2376 /* DISPLAY ROUTINES **********************************************************/
2377
2378 VOID
2379 BlDisplayGetTextCellResolution (
2380 _Out_ PULONG TextWidth,
2381 _Out_ PULONG TextHeight
2382 );
2383
2384 NTSTATUS
2385 BlDisplaySetScreenResolution (
2386 VOID
2387 );
2388
2389 NTSTATUS
2390 BlDisplayGetScreenResolution (
2391 _Out_ PULONG HRes,
2392 _Out_ PULONG Vres
2393 );
2394
2395 VOID
2396 BlDisplayInvalidateOemBitmap (
2397 VOID
2398 );
2399
2400 PBITMAP
2401 BlDisplayGetOemBitmap (
2402 _Out_ PCOORD Offset,
2403 _Out_opt_ PULONG Flags
2404 );
2405
2406 BOOLEAN
2407 BlDisplayValidOemBitmap (
2408 VOID
2409 );
2410
2411 NTSTATUS
2412 BlDisplayClearScreen (
2413 VOID
2414 );
2415
2416 NTSTATUS
2417 BlDisplaySetCursorType (
2418 _In_ ULONG Type
2419 );
2420
2421 /* I/O ROUTINES **************************************************************/
2422
2423 NTSTATUS
2424 BlpIoRegisterDestroyRoutine (
2425 _In_ PBL_IO_DESTROY_ROUTINE DestroyRoutine
2426 );
2427
2428 NTSTATUS
2429 BlDeviceClose (
2430 _In_ ULONG DeviceId
2431 );
2432
2433 NTSTATUS
2434 BlpDeviceOpen (
2435 _In_ PBL_DEVICE_DESCRIPTOR Device,
2436 _In_ ULONG Flags,
2437 _In_ ULONG Unknown,
2438 _Out_ PULONG DeviceId
2439 );
2440
2441 NTSTATUS
2442 BlDeviceGetInformation (
2443 _In_ ULONG DeviceId,
2444 _Out_ PBL_DEVICE_INFORMATION DeviceInformation
2445 );
2446
2447 NTSTATUS
2448 BlDeviceSetInformation (
2449 _In_ ULONG DeviceId,
2450 _In_ PBL_DEVICE_INFORMATION DeviceInformation
2451 );
2452
2453 NTSTATUS
2454 BlDeviceReadAtOffset (
2455 _In_ ULONG DeviceId,
2456 _In_ ULONG Size,
2457 _In_ ULONGLONG Offset,
2458 _In_ PVOID Buffer,
2459 _Out_ PULONG BytesRead
2460 );
2461
2462 /* IMAGE ROUTINES ************************************************************/
2463
2464 NTSTATUS
2465 BlImgLoadImageWithProgress2 (
2466 _In_ ULONG DeviceId,
2467 _In_ BL_MEMORY_TYPE MemoryType,
2468 _In_ PWCHAR FileName,
2469 _Inout_ PVOID* MappedBase,
2470 _Inout_ PULONG MappedSize,
2471 _In_ ULONG ImageFlags,
2472 _In_ BOOLEAN ShowProgress,
2473 _Out_opt_ PUCHAR* HashBuffer,
2474 _Out_opt_ PULONG HashSize
2475 );
2476
2477 PIMAGE_SECTION_HEADER
2478 BlImgFindSection (
2479 _In_ PVOID ImageBase,
2480 _In_ ULONG ImageSize
2481 );
2482
2483 NTSTATUS
2484 BlImgLoadBootApplication (
2485 _In_ PBL_LOADED_APPLICATION_ENTRY BootEntry,
2486 _Out_ PULONG AppHandle
2487 );
2488
2489 NTSTATUS
2490 BlImgStartBootApplication (
2491 _In_ ULONG AppHandle,
2492 _Inout_ PBL_RETURN_ARGUMENTS ReturnArguments
2493 );
2494
2495 NTSTATUS
2496 BlImgUnloadBootApplication (
2497 _In_ ULONG AppHandle
2498 );
2499
2500 VOID
2501 BlImgQueryCodeIntegrityBootOptions (
2502 _In_ PBL_LOADED_APPLICATION_ENTRY ApplicationEntry,
2503 _Out_ PBOOLEAN IntegrityChecksDisabled,
2504 _Out_ PBOOLEAN TestSigning
2505 );
2506
2507 /* FILE I/O ROUTINES *********************************************************/
2508
2509 NTSTATUS
2510 BlFileClose (
2511 _In_ ULONG FileId
2512 );
2513
2514 NTSTATUS
2515 BlFileReadAtOffsetEx (
2516 _In_ ULONG FileId,
2517 _In_ ULONG Size,
2518 _In_ ULONGLONG ByteOffset,
2519 _In_ PVOID Buffer,
2520 _Out_ PULONG BytesReturned,
2521 _In_ ULONG Flags
2522 );
2523
2524 NTSTATUS
2525 BlFileGetInformation (
2526 _In_ ULONG FileId,
2527 _In_ PBL_FILE_INFORMATION FileInfo
2528 );
2529
2530 NTSTATUS
2531 BlFileOpen (
2532 _In_ ULONG DeviceId,
2533 _In_ PWCHAR FileName,
2534 _In_ ULONG Flags,
2535 _Out_ PULONG FileId
2536 );
2537
2538 /* BLOCK I/O ROUTINES *******************************************************/
2539
2540 NTSTATUS
2541 BlockIoEfiCompareDevice (
2542 _In_ PBL_DEVICE_DESCRIPTOR Device,
2543 _In_ EFI_HANDLE Handle
2544 );
2545
2546 /* INPUT CONSOLE ROUTINES ****************************************************/
2547
2548 VOID
2549 ConsoleInputLocalDestruct (
2550 _In_ struct _BL_INPUT_CONSOLE* Console
2551 );
2552
2553 NTSTATUS
2554 ConsoleInputBaseReinitialize (
2555 _In_ struct _BL_INPUT_CONSOLE* Console
2556 );
2557
2558 NTSTATUS
2559 ConsoleCreateLocalInputCnsole (
2560 VOID
2561 );
2562
2563 /* TEXT CONSOLE ROUTINES *****************************************************/
2564
2565 VOID
2566 ConsoleGraphicalDestruct (
2567 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2568 );
2569
2570 NTSTATUS
2571 ConsoleGraphicalClearText (
2572 _In_ PBL_GRAPHICS_CONSOLE Console,
2573 _In_ BOOLEAN LineOnly
2574 );
2575
2576 NTSTATUS
2577 ConsoleGraphicalClearPixels (
2578 _In_ PBL_GRAPHICS_CONSOLE Console,
2579 _In_ ULONG Color
2580 );
2581
2582 NTSTATUS
2583 ConsoleGraphicalReinitialize (
2584 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2585 );
2586
2587 NTSTATUS
2588 ConsoleGraphicalSetTextState (
2589 _In_ PBL_GRAPHICS_CONSOLE Console,
2590 _In_ ULONG Mask,
2591 _In_ PBL_DISPLAY_STATE TextState
2592 );
2593
2594 BOOLEAN
2595 ConsoleGraphicalIsEnabled (
2596 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2597 );
2598
2599 NTSTATUS
2600 ConsoleGraphicalGetGraphicalResolution (
2601 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2602 _In_ PBL_DISPLAY_MODE DisplayMode
2603 );
2604
2605 NTSTATUS
2606 ConsoleGraphicalGetOriginalResolution (
2607 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2608 _In_ PBL_DISPLAY_MODE DisplayMode
2609 );
2610
2611 NTSTATUS
2612 ConsoleGraphicalEnable (
2613 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2614 _In_ BOOLEAN Enable
2615 );
2616
2617 VOID
2618 ConsoleTextLocalDestruct (
2619 _In_ struct _BL_TEXT_CONSOLE* Console
2620 );
2621
2622 NTSTATUS
2623 ConsoleTextLocalReinitialize (
2624 _In_ struct _BL_TEXT_CONSOLE* Console
2625 );
2626
2627 NTSTATUS
2628 ConsoleTextBaseGetTextState (
2629 _In_ struct _BL_TEXT_CONSOLE* Console,
2630 _Out_ PBL_DISPLAY_STATE TextState
2631 );
2632
2633 NTSTATUS
2634 ConsoleTextLocalSetTextState (
2635 _In_ struct _BL_TEXT_CONSOLE* Console,
2636 _In_ ULONG Flags,
2637 _In_ PBL_DISPLAY_STATE TextState
2638 );
2639
2640 NTSTATUS
2641 ConsoleTextBaseGetTextResolution (
2642 _In_ struct _BL_TEXT_CONSOLE* Console,
2643 _Out_ PULONG TextResolution
2644 );
2645
2646 NTSTATUS
2647 ConsoleTextLocalSetTextResolution (
2648 _In_ struct _BL_TEXT_CONSOLE* Console,
2649 _In_ ULONG NewTextResolution,
2650 _Out_ PULONG OldTextResolution
2651 );
2652
2653 NTSTATUS
2654 ConsoleTextLocalClearText (
2655 _In_ struct _BL_TEXT_CONSOLE* Console,
2656 _In_ BOOLEAN LineOnly
2657 );
2658
2659 NTSTATUS
2660 ConsoleTextLocalWriteText (
2661 _In_ struct _BL_TEXT_CONSOLE* Console,
2662 _In_ PCHAR Text,
2663 _In_ ULONG Attribute
2664 );
2665
2666 NTSTATUS
2667 ConsoleTextLocalConstruct (
2668 _In_ PBL_TEXT_CONSOLE TextConsole,
2669 _In_ BOOLEAN Activate
2670 );
2671
2672 BOOLEAN
2673 ConsolepFindResolution (
2674 _In_ PBL_DISPLAY_MODE Mode,
2675 _In_ PBL_DISPLAY_MODE List,
2676 _In_ ULONG MaxIndex
2677 );
2678
2679 NTSTATUS
2680 ConsoleFirmwareTextClear (
2681 _In_ PBL_TEXT_CONSOLE Console,
2682 _In_ BOOLEAN LineOnly
2683 );
2684
2685 VOID
2686 ConsoleFirmwareTextClose (
2687 _In_ PBL_TEXT_CONSOLE TextConsole
2688 );
2689
2690 NTSTATUS
2691 ConsoleFirmwareTextOpen (
2692 _In_ PBL_TEXT_CONSOLE TextConsole
2693 );
2694
2695 NTSTATUS
2696 ConsoleFirmwareTextSetState (
2697 _In_ PBL_TEXT_CONSOLE TextConsole,
2698 _In_ UCHAR Mask,
2699 _In_ PBL_DISPLAY_STATE State
2700 );
2701
2702 NTSTATUS
2703 ConsoleGraphicalConstruct (
2704 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2705 );
2706
2707 NTSTATUS
2708 ConsoleCreateRemoteConsole (
2709 _In_ PBL_TEXT_CONSOLE* TextConsole
2710 );
2711
2712 NTSTATUS
2713 ConsoleEfiGraphicalOpenProtocol (
2714 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2715 _In_ BL_GRAPHICS_CONSOLE_TYPE Type
2716 );
2717
2718 VOID
2719 ConsoleFirmwareGraphicalClose (
2720 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2721 );
2722
2723 VOID
2724 ConsoleFirmwareGraphicalDisable (
2725 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2726 );
2727
2728 NTSTATUS
2729 ConsoleFirmwareGraphicalClear (
2730 _In_ PBL_GRAPHICS_CONSOLE Console,
2731 _In_ ULONG Color
2732 );
2733
2734 NTSTATUS
2735 ConsoleFirmwareGraphicalEnable (
2736 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2737 );
2738
2739 NTSTATUS
2740 ConsoleEfiUgaOpen (
2741 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2742 );
2743
2744 VOID
2745 ConsoleEfiUgaClose (
2746 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2747 );
2748
2749 VOID
2750 ConsoleEfiGopClose (
2751 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2752 );
2753
2754 NTSTATUS
2755 ConsoleEfiGopOpen (
2756 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2757 );
2758
2759 NTSTATUS
2760 ConsoleEfiGopEnable (
2761 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2762 );
2763
2764 NTSTATUS
2765 ConsoleEfiUgaSetResolution (
2766 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2767 _In_ PBL_DISPLAY_MODE DisplayMode,
2768 _In_ ULONG DisplayModeCount
2769 );
2770
2771 NTSTATUS
2772 ConsoleCreateLocalInputConsole (
2773 VOID
2774 );
2775
2776 NTSTATUS
2777 ConsoleInputLocalEraseBuffer (
2778 _In_ PBL_INPUT_CONSOLE Console,
2779 _In_opt_ PULONG ValueToFill
2780 );
2781
2782 VOID
2783 ConsolepClearBuffer (
2784 _In_ PUCHAR FrameBuffer,
2785 _In_ ULONG Width,
2786 _In_ PUCHAR FillColor,
2787 _In_ ULONG Height,
2788 _In_ ULONG ScanlineWidth,
2789 _In_ ULONG PixelDepth
2790 );
2791
2792 NTSTATUS
2793 ConsolepConvertColorToPixel (
2794 _In_ BL_COLOR Color,
2795 _Out_ PUCHAR Pixel
2796 );
2797
2798 extern ULONG MmDescriptorCallTreeCount;
2799 extern ULONG BlpApplicationFlags;
2800 extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
2801 extern BL_TRANSLATION_TYPE MmTranslationType;
2802 extern PBL_ARCH_CONTEXT CurrentExecutionContext;
2803 extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
2804 extern BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
2805 extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
2806 extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
2807 extern EFI_GUID EfiGraphicsOutputProtocol;
2808 extern EFI_GUID EfiUgaDrawProtocol;
2809 extern EFI_GUID EfiLoadedImageProtocol;
2810 extern EFI_GUID EfiDevicePathProtocol;
2811 extern EFI_GUID EfiBlockIoProtocol;
2812 extern EFI_GUID EfiSimpleTextInputExProtocol;
2813 extern EFI_GUID EfiRootAcpiTableGuid;
2814 extern EFI_GUID EfiRootAcpiTable10Guid;
2815 extern EFI_GUID EfiGlobalVariable;
2816 extern ULONG ConsoleGraphicalResolutionListFlags;
2817 extern BL_DISPLAY_MODE ConsoleGraphicalResolutionList[];
2818 extern BL_DISPLAY_MODE ConsoleTextResolutionList[];
2819 extern ULONG ConsoleGraphicalResolutionListSize;
2820 extern PVOID DspRemoteInputConsole;
2821 extern PVOID DspLocalInputConsole;
2822 extern WCHAR BlScratchBuffer[8192];
2823 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedAllocated;
2824 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedUnallocated;
2825 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFwAllocationTracker;
2826 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
2827 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedUnallocated;
2828 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlReservedAllocated;
2829 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlBadMemory;
2830 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlTruncatedMemory;
2831 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlPersistentMemory;
2832 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlCompleteBadMemory;
2833 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFreeVirtual;
2834 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappingTrackers;
2835 extern ULONGLONG BlpTimePerformanceFrequency;
2836 extern LIST_ENTRY RegisteredFileSystems;
2837 extern BL_ADDRESS_RANGE MmArchKsegAddressRange;
2838 extern ULONG_PTR MmArchTopOfApplicationAddressSpace;
2839 extern PBL_MM_RELOCATE_SELF_MAP BlMmRelocateSelfMap;
2840 extern PBL_MM_FLUSH_TLB BlMmFlushTlb;
2841 extern PBL_MM_MOVE_VIRTUAL_ADDRESS_RANGE BlMmMoveVirtualAddressRange;
2842 extern PBL_MM_ZERO_VIRTUAL_ADDRESS_RANGE BlMmZeroVirtualAddressRange;
2843 extern PBL_STATUS_ERROR_HANDLER BlpStatusErrorHandler;
2844
2845 #endif