1b24b402710947ad4228a1be11352a58c3223e14
[reactos.git] / reactos / 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 BL_APPLICATION_FLAG_CONVERTED_FROM_EFI 0x01
51
52 #define BL_APP_ENTRY_SIGNATURE "BTAPENT"
53
54 #define BOOT_APPLICATION_SIGNATURE_1 'TOOB'
55 #define BOOT_APPLICATION_SIGNATURE_2 ' PPA'
56
57 #define BOOT_MEMORY_TRANSLATION_TYPE_PHYSICAL 0
58 #define BOOT_MEMORY_TRANSLATION_TYPE_VIRTUAL 1
59
60 #define BOOT_APPLICATION_VERSION 2
61 #define BL_MEMORY_DATA_VERSION 1
62 #define BL_RETURN_ARGUMENTS_VERSION 1
63 #define BL_FIRMWARE_DESCRIPTOR_VERSION 2
64
65 #define BL_APPLICATION_ENTRY_FLAG_NO_GUID 0x01
66 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL 0x02
67 #define BL_APPLICATION_ENTRY_REBOOT_ON_ERROR 0x20
68 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL 0x80
69
70 #define BL_CONTEXT_PAGING_ON 1
71 #define BL_CONTEXT_INTERRUPTS_ON 2
72
73 #define BL_MM_FLAG_USE_FIRMWARE_FOR_MEMORY_MAP_BUFFERS 0x01
74 #define BL_MM_FLAG_REQUEST_COALESCING 0x02
75
76 #define BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG 0x01
77 #define BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG 0x02
78 #define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG 0x10
79 #define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG 0x20
80 #define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG 0x2000
81
82 #define BL_MM_REQUEST_DEFAULT_TYPE 1
83 #define BL_MM_REQUEST_TOP_DOWN_TYPE 2
84
85 #define BL_MM_REMOVE_VIRTUAL_REGION_FLAG 0x80000000
86
87 #define BL_LIBRARY_FLAG_NO_DISPLAY 0x01
88 #define BL_LIBRARY_FLAG_REINITIALIZE 0x02
89 #define BL_LIBRARY_FLAG_REINITIALIZE_ALL 0x04
90 #define BL_LIBRARY_FLAG_ZERO_HEAP_ALLOCATIONS_ON_FREE 0x10
91 #define BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED 0x20
92 #define BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE 0x800
93
94 #define BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG 0x01
95 #define BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG 0x02
96
97 #define BL_HT_VALUE_IS_INLINE 0x01
98
99 #define BL_FS_REGISTER_AT_HEAD_FLAG 1
100
101 #define BL_BLOCK_DEVICE_REMOVABLE_FLAG 0x01
102
103 #define BL_MEMORY_CLASS_SHIFT 28
104
105 #define BL_FILE_READ_ACCESS 0x01
106 #define BL_FILE_WRITE_ACCESS 0x02
107 #define BL_DIRECTORY_ACCESS 0x04
108 #define BL_UNKNOWN_ACCESS 0x10
109
110 #define BL_DEVICE_READ_ACCESS 0x01
111 #define BL_DEVICE_WRITE_ACCESS 0x02
112
113 #define BL_DEVICE_ENTRY_OPENED 0x01
114 #define BL_DEVICE_ENTRY_READ_ACCESS 0x02
115 #define BL_DEVICE_ENTRY_WRITE_ACCESS 0x04
116
117 #define BL_FILE_ENTRY_OPENED 0x01
118 #define BL_FILE_ENTRY_READ_ACCESS 0x02
119 #define BL_FILE_ENTRY_WRITE_ACCESS 0x04
120 #define BL_FILE_ENTRY_UNKNOWN_ACCESS 0x10
121
122 #define BL_IMG_VALID_FILE 0x01
123 #define BL_IMG_MEMORY_FILE 0x02
124 #define BL_IMG_REMOTE_FILE 0x04
125
126 #define BL_LOAD_IMG_VIRTUAL_BUFFER 0x01
127 #define BL_LOAD_IMG_EXISTING_BUFFER 0x04
128 #define BL_LOAD_IMG_UNKNOWN_BUFFER_FLAG 0x08
129 #define BL_LOAD_IMG_COMPUTE_SIGNATURE 0x10
130 #define BL_LOAD_IMG_COMPUTE_HASH 0x40000
131
132 /* ENUMERATIONS **************************************************************/
133
134 typedef enum _BL_COLOR
135 {
136 Black,
137 Blue,
138 Green,
139 Cyan,
140 Red,
141 Magenta,
142 Brown,
143 LtGray,
144 Gray,
145 LtBlue,
146 LtGreen,
147 LtCyan,
148 LtRed,
149 LtMagenta,
150 Yellow,
151 White
152 } BL_COLOR, *PBL_COLOR;
153
154 typedef enum _BL_MEMORY_DESCRIPTOR_TYPE
155 {
156 BlMdPhysical,
157 BlMdVirtual,
158 } BL_MEMORY_DESCRIPTOR_TYPE;
159
160 typedef enum _BL_TRANSLATION_TYPE
161 {
162 BlNone,
163 BlVirtual,
164 BlPae,
165 BlMax
166 } BL_TRANSLATION_TYPE;
167
168 typedef enum _BL_ARCH_MODE
169 {
170 BlProtectedMode,
171 BlRealMode
172 } BL_ARCH_MODE;
173
174 //
175 // Boot Device Types
176 //
177 typedef enum _BL_DEVICE_TYPE
178 {
179 DiskDevice = 0,
180 LegacyPartitionDevice = 2,
181 SerialDevice = 3,
182 UdpDevice = 4,
183 BootDevice = 5,
184 PartitionDevice = 6,
185 LocateDevice = 8,
186 } BL_DEVICE_TYPE;
187
188 //
189 // Local Device Types
190 //
191 typedef enum _BL_LOCAL_DEVICE_TYPE
192 {
193 LocalDevice = 0,
194 FloppyDevice = 1,
195 CdRomDevice = 2,
196 RamDiskDevice = 3,
197 FileDevice = 5,
198 VirtualDiskDevice = 6
199 } BL_LOCAL_DEVICE_TYPE;
200
201 //
202 // Partition types
203 //
204 typedef enum _BL_PARTITION_TYPE
205 {
206 GptPartition,
207 MbrPartition,
208 RawPartition,
209 } BL_PARTITION_TYPE;
210
211 //
212 // File Path Types
213 //
214 typedef enum _BL_PATH_TYPE
215 {
216 InternalPath = 3,
217 EfiPath = 4
218 } BL_PATH_TYPE;
219
220 //
221 // Classes of Memory
222 //
223 typedef enum _BL_MEMORY_CLASS
224 {
225 BlLoaderClass = 0xD,
226 BlApplicationClass,
227 BlSystemClass
228 } BL_MEMORY_CLASS;
229
230 //
231 // Types of Memory
232 //
233 typedef enum _BL_MEMORY_TYPE
234 {
235 //
236 // Loader Memory
237 //
238 BlLoaderMemory = 0xD0000002,
239 BlLoaderDeviceMemory = 0xD0000004,
240 BlLoaderHeap = 0xD0000005,
241 BlLoaderPageDirectory = 0xD0000006,
242 BlLoaderReferencePage = 0xD0000007,
243 BlLoaderRamDisk = 0xD0000008,
244 BlLoaderData = 0xD000000A,
245 BlLoaderRegistry = 0xD000000B,
246 BlLoaderBlockMemory = 0xD000000C,
247 BlLoaderSelfMap = 0xD000000F,
248
249 //
250 // Application Memory
251 //
252 BlApplicationReserved = 0xE0000001,
253 BlApplicationData = 0xE0000004,
254
255 //
256 // System Memory
257 //
258 BlConventionalMemory = 0xF0000001,
259 BlUnusableMemory = 0xF0000002,
260 BlReservedMemory = 0xF0000003,
261 BlEfiBootMemory = 0xF0000004,
262 BlEfiRuntimeMemory = 0xF0000006,
263 BlAcpiReclaimMemory = 0xF0000008,
264 BlAcpiNvsMemory = 0xF0000009,
265 BlDeviceIoMemory = 0xF000000A,
266 BlDevicePortMemory = 0xF000000B,
267 BlPalMemory = 0xF000000C,
268 } BL_MEMORY_TYPE;
269
270 typedef enum _BL_MEMORY_ATTR
271 {
272 //
273 // Memory Caching Attributes
274 //
275 BlMemoryUncached = 0x00000001,
276 BlMemoryWriteCombined = 0x00000002,
277 BlMemoryWriteThrough = 0x00000004,
278 BlMemoryWriteBack = 0x00000008,
279 BlMemoryUncachedExported = 0x00000010,
280 BlMemoryValidCacheAttributes = BlMemoryUncached | BlMemoryWriteCombined | BlMemoryWriteThrough | BlMemoryWriteBack | BlMemoryUncachedExported,
281 BlMemoryValidCacheAttributeMask = 0x000000FF,
282
283 //
284 // Memory Protection Attributes
285 //
286 BlMemoryWriteProtected = 0x00000100,
287 BlMemoryReadProtected = 0x00000200,
288 BlMemoryExecuteProtected = 0x00000400,
289 BlMemoryValidProtectionAttributes = BlMemoryWriteProtected | BlMemoryReadProtected | BlMemoryExecuteProtected,
290 BlMemoryValidProtectionAttributeMask = 0x0000FF00,
291
292 //
293 // Memory Allocation Attributes
294 //
295 BlMemoryUnknown = 0x00010000,
296 BlMemoryNonFixed = 0x00020000,
297 BlMemoryFixed = 0x00040000,
298 BlMemoryReserved = 0x00080000,
299 BlMemoryValidAllocationAttributes = BlMemoryNonFixed | BlMemoryFixed | BlMemoryReserved | BlMemoryUnknown,
300 BlMemoryValidAllocationAttributeMask = 0x00FF0000,
301
302 //
303 // Memory Type Attributes
304 //
305 BlMemoryRuntime = 0x01000000,
306 BlMemoryCoalesced = 0x02000000,
307 BlMemoryUpdate = 0x04000000,
308 BlMemoryNonFirmware = 0x08000000,
309 BlMemorySpecial = 0x20000000,
310 BlMemoryFirmware = 0x80000000,
311 BlMemoryValidTypeAttributes = BlMemoryRuntime | BlMemoryCoalesced | BlMemoryUpdate | BlMemoryNonFirmware | BlMemorySpecial | BlMemoryFirmware,
312 BlMemoryValidTypeAttributeMask = 0xFF000000,
313 } BL_MEMORY_ATTR;
314
315 /* CALLBACKS *****************************************************************/
316
317 struct _BL_FILE_ENTRY;
318 struct _BL_FILE_INFORMATION;
319 typedef
320 NTSTATUS
321 (*PBL_FILE_OPEN) (
322 _In_ struct _BL_FILE_ENTRY* Directory,
323 _In_ PWCHAR FileName,
324 _In_ ULONG Flags,
325 _Out_ struct _BL_FILE_ENTRY** FileEntry
326 );
327
328 typedef
329 NTSTATUS
330 (*PBL_FILE_CLOSE) (
331 _In_ struct _BL_FILE_ENTRY* FileEntry
332 );
333
334 typedef
335 NTSTATUS
336 (*PBL_FILE_READ) (
337 _In_ struct _BL_FILE_ENTRY* FileEntry,
338 _In_ PVOID Buffer,
339 _In_ ULONG Size,
340 _Out_opt_ PULONG BytesRead
341 );
342
343 typedef
344 NTSTATUS
345 (*PBL_FILE_WRITE) (
346 VOID
347 );
348
349 typedef
350 NTSTATUS
351 (*PBL_FILE_GET_NEXT) (
352 VOID
353 );
354
355 typedef
356 NTSTATUS
357 (*PBL_FILE_GET_INFO) (
358 _In_ struct _BL_FILE_ENTRY* FileEntry,
359 _Out_ struct _BL_FILE_INFORMATION* FileInfo
360 );
361
362 typedef
363 NTSTATUS
364 (*PBL_FILE_SET_INFO) (
365 _In_ struct _BL_FILE_ENTRY* FileEntry,
366 _In_ struct _BL_FILE_INFORMATION* FileInfo
367 );
368
369 typedef
370 NTSTATUS
371 (*PBL_FS_INIT_CALLBACK) (
372 VOID
373 );
374
375 typedef
376 NTSTATUS
377 (*PBL_FS_DESTROY_CALLBACK) (
378 VOID
379 );
380
381 typedef
382 NTSTATUS
383 (*PBL_FS_MOUNT_CALLBACK) (
384 _In_ ULONG DeviceId,
385 _In_ ULONG Unknown,
386 _Out_ struct _BL_FILE_ENTRY** FileEntry
387 );
388
389 typedef
390 NTSTATUS
391 (*PBL_FS_PURGE_CALLBACK) (
392 VOID
393 );
394
395 typedef
396 NTSTATUS
397 (*PBL_FILE_DESTROY_CALLBACK) (
398 _In_ PVOID Entry
399 );
400
401 struct _BL_TEXT_CONSOLE;
402 struct _BL_DISPLAY_STATE;
403 struct _BL_DISPLAY_MODE;
404 struct _BL_INPUT_CONSOLE;
405 struct _BL_REMOTE_CONSOLE;
406 struct _BL_GRAPHICS_CONSOLE;
407 typedef
408 VOID
409 (*PCONSOLE_DESTRUCT) (
410 _In_ struct _BL_TEXT_CONSOLE* Console
411 );
412
413 typedef
414 NTSTATUS
415 (*PCONSOLE_REINITIALIZE) (
416 _In_ struct _BL_TEXT_CONSOLE* Console
417 );
418
419 typedef
420 NTSTATUS
421 (*PCONSOLE_GET_TEXT_STATE) (
422 _In_ struct _BL_TEXT_CONSOLE* Console,
423 _Out_ struct _BL_DISPLAY_STATE* TextState
424 );
425
426 typedef
427 NTSTATUS
428 (*PCONSOLE_SET_TEXT_STATE) (
429 _In_ struct _BL_TEXT_CONSOLE* Console,
430 _In_ ULONG Flags,
431 _In_ struct _BL_DISPLAY_STATE* TextState
432 );
433
434 typedef
435 NTSTATUS
436 (*PCONSOLE_GET_TEXT_RESOLUTION) (
437 _In_ struct _BL_TEXT_CONSOLE* Console,
438 _Out_ PULONG TextResolution
439 );
440
441 typedef
442 NTSTATUS
443 (*PCONSOLE_SET_TEXT_RESOLUTION) (
444 _In_ struct _BL_TEXT_CONSOLE* Console,
445 _In_ ULONG NewTextResolution,
446 _Out_ PULONG OldTextResolution
447 );
448
449 typedef
450 NTSTATUS
451 (*PCONSOLE_CLEAR_TEXT) (
452 _In_ struct _BL_TEXT_CONSOLE* Console,
453 _In_ BOOLEAN LineOnly
454 );
455
456 typedef
457 BOOLEAN
458 (*PCONSOLE_IS_ENABLED) (
459 _In_ struct _BL_GRAPHICS_CONSOLE* Console
460 );
461
462 typedef
463 NTSTATUS
464 (*PCONSOLE_GET_GRAPHICAL_RESOLUTION) (
465 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
466 _Out_ struct _BL_DISPLAY_MODE* DisplayMode
467 );
468
469 typedef
470 NTSTATUS
471 (*PCONSOLE_SET_GRAPHICAL_RESOLUTION) (
472 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
473 _In_ struct _BL_DISPLAY_MODE DisplayMode
474 );
475
476 typedef
477 NTSTATUS
478 (*PCONSOLE_ENABLE) (
479 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
480 _In_ BOOLEAN Enable
481 );
482
483 typedef
484 NTSTATUS
485 (*PCONSOLE_WRITE_TEXT) (
486 _In_ struct _BL_TEXT_CONSOLE* Console,
487 _In_ PCHAR Text,
488 _In_ ULONG Attribute
489 );
490
491 typedef
492 BOOLEAN
493 (*PBL_TBL_LOOKUP_ROUTINE) (
494 _In_ PVOID Entry,
495 _In_ PVOID Argument1,
496 _In_ PVOID Argument2,
497 _In_ PVOID Argument3,
498 _In_ PVOID Argument4
499 );
500
501 typedef
502 NTSTATUS
503 (*PBL_TBL_MAP_ROUTINE) (
504 _In_ PVOID Entry,
505 _In_ ULONG EntryIndex
506 );
507
508 typedef
509 NTSTATUS
510 (*PBL_TBL_SET_ROUTINE) (
511 _In_ PVOID Entry
512 );
513
514 typedef
515 NTSTATUS
516 (*PBL_IO_DESTROY_ROUTINE) (
517 VOID
518 );
519
520 struct _BL_HASH_ENTRY;
521 typedef
522 BOOLEAN
523 (*PBL_HASH_TABLE_COMPARE_FUNCTION) (
524 _In_ struct _BL_HASH_ENTRY* Entry1,
525 _In_ struct _BL_HASH_ENTRY* Entry2
526 );
527
528 typedef
529 ULONG
530 (*PBL_HASH_TABLE_HASH_FUNCTION) (
531 _In_ struct _BL_HASH_ENTRY* Entry,
532 _In_ ULONG TableSize
533 );
534
535 struct _BL_DEVICE_ENTRY;
536 struct _BL_DEVICE_DESCRIPTOR;
537 struct _BL_DEVICE_INFORMATION;
538
539 typedef
540 NTSTATUS
541 (*PBL_DEVICE_ENUMERATE_DEVICE_CLASS) (
542 VOID
543 );
544
545 typedef
546 NTSTATUS
547 (*PBL_DEVICE_OPEN) (
548 _In_ struct _BL_DEVICE_DESCRIPTOR* Device,
549 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
550 );
551
552 typedef
553 NTSTATUS
554 (*PBL_DEVICE_CLOSE) (
555 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
556 );
557
558 typedef
559 NTSTATUS
560 (*PBL_DEVICE_READ) (
561 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
562 _In_ PVOID Buffer,
563 _In_ ULONG Size,
564 _Out_ PULONG BytesRead
565 );
566
567 typedef
568 NTSTATUS
569 (*PBL_DEVICE_WRITE) (
570 VOID
571 );
572
573 typedef
574 NTSTATUS
575 (*PBL_DEVICE_GET_INFORMATION) (
576 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
577 _Out_ struct _BL_DEVICE_INFORMATION* DeviceInformation
578 );
579
580 typedef
581 NTSTATUS
582 (*PBL_DEVICE_SET_INFORMATION) (
583 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
584 _In_ struct _BL_DEVICE_INFORMATION* DeviceInformation
585 );
586
587 typedef
588 NTSTATUS
589 (*PBL_DEVICE_RESET) (
590 VOID
591 );
592
593 typedef
594 NTSTATUS
595 (*PBL_DEVICE_FLUSH) (
596 VOID
597 );
598
599 typedef
600 NTSTATUS
601 (*PBL_DEVICE_CREATE) (
602 VOID
603 );
604
605
606 /* DATA STRUCTURES ***********************************************************/
607
608 typedef struct _BL_LIBRARY_PARAMETERS
609 {
610 ULONG LibraryFlags;
611 ULONG TranslationType;
612 ULONG MinimumAllocationCount;
613 ULONG MinimumHeapSize;
614 ULONG HeapAllocationAttributes;
615 PWCHAR ApplicationBaseDirectory;
616 ULONG DescriptorCount;
617 PWCHAR FontBaseDirectory;
618 } BL_LIBRARY_PARAMETERS, *PBL_LIBRARY_PARAMETERS;
619
620 /* This should eventually go into a more public header */
621 typedef struct _BOOT_APPLICATION_PARAMETER_BLOCK
622 {
623 /* This header tells the library what image we're dealing with */
624 ULONG Signature[2];
625 ULONG Version;
626 ULONG Size;
627 ULONG ImageType;
628 ULONG MemoryTranslationType;
629
630 /* Where is the image located */
631 ULONGLONG ImageBase;
632 ULONG ImageSize;
633
634 /* Offset to BL_MEMORY_DATA */
635 ULONG MemoryDataOffset;
636
637 /* Offset to BL_APPLICATION_ENTRY */
638 ULONG AppEntryOffset;
639
640 /* Offset to BL_DEVICE_DESCRPIPTOR */
641 ULONG BootDeviceOffset;
642
643 /* Offset to BL_FIRMWARE_PARAMETERS */
644 ULONG FirmwareParametersOffset;
645
646 /* Offset to BL_RETURN_ARGUMENTS */
647 ULONG ReturnArgumentsOffset;
648 } BOOT_APPLICATION_PARAMETER_BLOCK, *PBOOT_APPLICATION_PARAMETER_BLOCK;
649
650 typedef struct _BL_MEMORY_DATA
651 {
652 ULONG Version;
653 ULONG MdListOffset;
654 ULONG DescriptorCount;
655 ULONG DescriptorSize;
656 ULONG DescriptorOffset;
657 } BL_MEMORY_DATA, *PBL_MEMORY_DATA;
658
659 typedef struct _BL_FIRMWARE_DESCRIPTOR
660 {
661 ULONG Version;
662 ULONG Unknown;
663 EFI_HANDLE ImageHandle;
664 EFI_SYSTEM_TABLE *SystemTable;
665 } BL_FIRMWARE_DESCRIPTOR, *PBL_FIRMWARE_DESCRIPTOR;
666
667 typedef struct _BL_RETURN_ARGUMENTS
668 {
669 ULONG Version;
670 NTSTATUS Status;
671 ULONG ReturnArgumentData[5];
672 } BL_RETURN_ARGUMENTS, *PBL_RETURN_ARGUMENTS;
673
674 typedef struct _BL_MEMORY_DESCRIPTOR
675 {
676 LIST_ENTRY ListEntry;
677 union
678 {
679 struct
680 {
681 ULONGLONG BasePage;
682 ULONGLONG VirtualPage;
683 };
684 struct
685 {
686 ULONGLONG BaseAddress;
687 ULONGLONG VirtualAddress;
688 };
689 };
690 ULONGLONG PageCount;
691 ULONG Flags;
692 BL_MEMORY_TYPE Type;
693 } BL_MEMORY_DESCRIPTOR, *PBL_MEMORY_DESCRIPTOR;
694
695 typedef struct _BL_BCD_OPTION
696 {
697 ULONG Type;
698 ULONG DataOffset;
699 ULONG DataSize;
700 ULONG ListOffset;
701 ULONG NextEntryOffset;
702 ULONG Empty;
703 } BL_BCD_OPTION, *PBL_BCD_OPTION;
704
705 typedef struct _BL_APPLICATION_ENTRY
706 {
707 CHAR Signature[8];
708 ULONG Flags;
709 GUID Guid;
710 ULONG Unknown[4];
711 BL_BCD_OPTION BcdData;
712 } BL_APPLICATION_ENTRY, *PBL_APPLICATION_ENTRY;
713
714 typedef struct _BL_LOADED_APPLICATION_ENTRY
715 {
716 ULONG Flags;
717 GUID Guid;
718 PBL_BCD_OPTION BcdData;
719 } BL_LOADED_APPLICATION_ENTRY, *PBL_LOADED_APPLICATION_ENTRY;
720
721 typedef struct _BL_HARDDISK_DEVICE
722 {
723 ULONG PartitionType;
724 union
725 {
726 struct
727 {
728 ULONG PartitionSignature;
729 } Mbr;
730
731 struct
732 {
733 GUID PartitionSignature;
734 } Gpt;
735
736 struct
737 {
738 ULONG DiskNumber;
739 } Raw;
740 };
741 } BL_HARDDISK_DEVICE;
742
743 typedef struct _BL_LOCAL_DEVICE
744 {
745 ULONG Type;
746 union
747 {
748 struct
749 {
750 ULONG DriveNumber;
751 } FloppyDisk;
752
753 BL_HARDDISK_DEVICE HardDisk;
754
755 struct
756 {
757 PHYSICAL_ADDRESS ImageBase;
758 LARGE_INTEGER ImageSize;
759 ULONG ImageOffset;
760 } RamDisk;
761 };
762 } BL_LOCAL_DEVICE;
763
764 typedef struct _BL_DEVICE_DESCRIPTOR
765 {
766 DEVICE_TYPE DeviceType;
767 ULONG Flags;
768 ULONG Size;
769 ULONG Unknown;
770 union
771 {
772 BL_LOCAL_DEVICE Local;
773
774 struct
775 {
776 ULONG Unknown;
777 } Remote;
778
779 struct
780 {
781 union
782 {
783 ULONG PartitionNumber;
784 } Mbr;
785
786 union
787 {
788 GUID PartitionGuid;
789 } Gpt;
790
791 BL_LOCAL_DEVICE Disk;
792 } Partition;
793 };
794 } BL_DEVICE_DESCRIPTOR, *PBL_DEVICE_DESCRIPTOR;
795
796 typedef struct _BL_FILE_PATH_DESCRIPTOR
797 {
798 ULONG Version;
799 ULONG Length;
800 ULONG PathType;
801 UCHAR Path[ANYSIZE_ARRAY];
802 } BL_FILE_PATH_DESCRIPTOR, *PBL_FILE_PATH_DESCRIPTOR;
803
804 typedef struct _BL_WINDOWS_LOAD_OPTIONS
805 {
806 CHAR Signature[8];
807 ULONG Version;
808 ULONG Length;
809 ULONG OsPathOffset;
810 WCHAR LoadOptions[ANYSIZE_ARRAY];
811 } BL_WINDOWS_LOAD_OPTIONS, *PBL_WINDOWS_LOAD_OPTIONS;
812
813 typedef struct _BL_ARCH_CONTEXT
814 {
815 BL_ARCH_MODE Mode;
816 BL_TRANSLATION_TYPE TranslationType;
817 ULONG ContextFlags;
818 } BL_ARCH_CONTEXT, *PBL_ARCH_CONTEXT;
819
820 typedef struct _BL_MEMORY_DESCRIPTOR_LIST
821 {
822 LIST_ENTRY ListHead;
823 PLIST_ENTRY First;
824 PLIST_ENTRY This;
825 ULONG Type;
826 } BL_MEMORY_DESCRIPTOR_LIST, *PBL_MEMORY_DESCRIPTOR_LIST;
827
828 typedef struct _BL_ADDRESS_RANGE
829 {
830 ULONGLONG Minimum;
831 ULONGLONG Maximum;
832 } BL_ADDRESS_RANGE, *PBL_ADDRESS_RANGE;
833
834 typedef struct _BL_FILE_INFORMATION
835 {
836 ULONGLONG Size;
837 ULONGLONG Offset;
838 PWCHAR FsName;
839 ULONG Flags;
840 } BL_FILE_INFORMATION, *PBL_FILE_INFORMATION;
841
842 typedef struct _BL_FILE_CALLBACKS
843 {
844 PBL_FILE_OPEN Open;
845 PBL_FILE_CLOSE Close;
846 PBL_FILE_READ Read;
847 PBL_FILE_WRITE Write;
848 PBL_FILE_GET_NEXT GetNext;
849 PBL_FILE_GET_INFO GetInfo;
850 PBL_FILE_SET_INFO SetInfo;
851 } BL_FILE_CALLBACKS, *PBL_FILE_CALLBACKS;
852
853 typedef struct _BL_FILE_ENTRY
854 {
855 PWCHAR FilePath;
856 ULONG DeviceId;
857 ULONG FileId;
858 ULONG Flags;
859 ULONG ReferenceCount;
860 ULONG Unknown;
861 ULONGLONG TotalBytesRead;
862 ULONGLONG Unknown2;
863 BL_FILE_CALLBACKS Callbacks;
864 PVOID FsSpecificData;
865 } BL_FILE_ENTRY, *PBL_FILE_ENTRY;
866
867 typedef struct _BL_FILE_SYSTEM_ENTRY
868 {
869 LIST_ENTRY ListEntry;
870 PBL_FS_INIT_CALLBACK InitCallback;
871 PBL_FS_DESTROY_CALLBACK DestroyCallback;
872 PBL_FS_MOUNT_CALLBACK MountCallback;
873 PBL_FS_PURGE_CALLBACK PurgeCallback;
874 } BL_FILE_SYSTEM_ENTRY, *PBL_FILE_SYSTEM_ENTRY;
875
876 typedef struct _BL_FILE_SYSTEM_REGISTRATION_TABLE
877 {
878 PBL_FS_INIT_CALLBACK Init;
879 PBL_FS_DESTROY_CALLBACK Destroy;
880 PBL_FS_MOUNT_CALLBACK Mount;
881 PBL_FS_PURGE_CALLBACK Purge;
882 } BL_FILE_SYSTEM_REGISTRATION_TABLE;
883
884 typedef struct _BL_DISPLAY_STATE
885 {
886 ULONG BgColor;
887 ULONG FgColor;
888 ULONG XPos;
889 ULONG YPos;
890 ULONG CursorVisible;
891 } BL_DISPLAY_STATE, *PBL_DISPLAY_STATE;
892
893 typedef struct _BL_DISPLAY_MODE
894 {
895 ULONG HRes;
896 ULONG VRes;
897 ULONG HRes2;
898 } BL_DISPLAY_MODE, *PBL_DISPLAY_MODE;
899
900 typedef struct _BL_TEXT_CONSOLE_VTABLE
901 {
902 PCONSOLE_DESTRUCT Destruct;
903 PCONSOLE_REINITIALIZE Reinitialize;
904 PCONSOLE_GET_TEXT_STATE GetTextState;
905 PCONSOLE_SET_TEXT_STATE SetTextState;
906 PCONSOLE_GET_TEXT_RESOLUTION GetTextResolution;
907 PCONSOLE_SET_TEXT_RESOLUTION SetTextResolution;
908 PCONSOLE_CLEAR_TEXT ClearText;
909 PCONSOLE_WRITE_TEXT WriteText;
910 } BL_TEXT_CONSOLE_VTABLE, *PBL_TEXT_CONSOLE_VTABLE;
911
912 typedef struct _BL_GRAPHICS_CONSOLE_VTABLE
913 {
914 BL_TEXT_CONSOLE_VTABLE Text;
915 PCONSOLE_IS_ENABLED IsEnabled;
916 PCONSOLE_ENABLE Enable;
917 PVOID GetConsoleResolution;
918 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetGraphicalResolution;
919 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetOriginalResolution;
920 PCONSOLE_SET_GRAPHICAL_RESOLUTION SetOriginalResolution;
921 /// more for graphics ///
922 } BL_GRAPHICS_CONSOLE_VTABLE, *PBL_GRAPHICS_CONSOLE_VTABLE;
923
924 typedef struct _BL_TEXT_CONSOLE
925 {
926 PBL_TEXT_CONSOLE_VTABLE Callbacks;
927 BL_DISPLAY_STATE State;
928 BL_DISPLAY_MODE DisplayMode;
929 BOOLEAN Active;
930 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* Protocol;
931 ULONG Mode;
932 EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode;
933 } BL_TEXT_CONSOLE, *PBL_TEXT_CONSOLE;
934
935 typedef struct _BL_INPUT_CONSOLE_VTABLE
936 {
937 PCONSOLE_DESTRUCT Destruct;
938 PCONSOLE_REINITIALIZE Reinitialize;
939 //PCONSOLE_IS_KEY_PENDING IsKeyPending;
940 //PCONSOLE_READ_INPUT ReadInput;
941 //PCONSOLE_ERASE_BUFFER EraseBuffer;
942 //PCONSOLE_FILL_BUFFER FillBuffer;
943 } BL_INPUT_CONSOLE_VTABLE, *PBL_INPUT_CONSOLE_VTABLE;
944
945 typedef struct _BL_INPUT_CONSOLE
946 {
947 PBL_INPUT_CONSOLE_VTABLE Callbacks;
948 PULONG Buffer;
949 PULONG DataStart;
950 PULONG DataEnd;
951 PULONG EndBuffer;
952 } BL_INPUT_CONSOLE, *PBL_INPUT_CONSOLE;
953
954 typedef enum _BL_GRAPHICS_CONSOLE_TYPE
955 {
956 BlGopConsole,
957 BlUgaConsole
958 } BL_GRAPHICS_CONSOLE_TYPE;
959
960 typedef struct _BL_GRAPHICS_CONSOLE
961 {
962 BL_TEXT_CONSOLE TextConsole;
963 BL_DISPLAY_MODE DisplayMode;
964 ULONG PixelDepth;
965 ULONG FgColor;
966 ULONG BgColor;
967 BL_DISPLAY_MODE OldDisplayMode;
968 ULONG OldPixelDepth;
969 EFI_HANDLE Handle;
970 BL_GRAPHICS_CONSOLE_TYPE Type;
971 EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol;
972 PVOID FrameBuffer;
973 ULONG FrameBufferSize;
974 ULONG PixelsPerScanLine;
975 ULONG Mode;
976 ULONG OldMode;
977 } BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE;
978
979 typedef struct _BL_REMOTE_CONSOLE
980 {
981 BL_TEXT_CONSOLE TextConsole;
982 } BL_REMOTE_CONSOLE, *PBL_REMOTE_CONSOLE;
983
984 typedef struct _BL_HASH_TABLE
985 {
986 PLIST_ENTRY HashLinks;
987 ULONG Size;
988 PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction;
989 PBL_HASH_TABLE_HASH_FUNCTION HashFunction;
990 } BL_HASH_TABLE, *PBL_HASH_TABLE;
991
992 typedef struct _BL_HASH_ENTRY
993 {
994 ULONG Size;
995 ULONG Flags;
996 PVOID Value;
997 } BL_HASH_ENTRY, *PBL_HASH_ENTRY;
998
999 typedef struct _BL_HASH_VALUE
1000 {
1001 ULONG DataSize;
1002 PVOID Data;
1003 } BL_HASH_VALUE, *PBL_HASH_VALUE;
1004
1005 typedef struct _BL_HASH_NODE
1006 {
1007 LIST_ENTRY ListEntry;
1008 BL_HASH_ENTRY Entry;
1009 BL_HASH_VALUE Value;
1010 } BL_HASH_NODE, *PBL_HASH_NODE;
1011
1012 typedef struct _BL_BLOCK_DEVICE_INFORMATION
1013 {
1014 BL_LOCAL_DEVICE_TYPE Type;
1015 ULONG DeviceFlags;
1016 ULONG Unknown;
1017 BL_PARTITION_TYPE PartitionType;
1018 ULONG BlockSize;
1019 ULONG Alignment;
1020 ULONGLONG LastBlock;
1021 ULONGLONG Offset;
1022 ULONG Block;
1023 struct
1024 {
1025 union
1026 {
1027 struct
1028 {
1029 ULONG Signature;
1030 } Mbr;
1031 struct
1032 {
1033 GUID Signature;
1034 } Gpt;
1035 };
1036 } Disk;
1037 } BL_BLOCK_DEVICE_INFORMATION, *PBL_BLOCK_DEVICE_INFORMATION;
1038
1039 typedef struct _BL_DEVICE_INFORMATION
1040 {
1041 BL_DEVICE_TYPE DeviceType;
1042 union
1043 {
1044 BL_BLOCK_DEVICE_INFORMATION BlockDeviceInfo;
1045 };
1046 } BL_DEVICE_INFORMATION, *PBL_DEVICE_INFORMATION;
1047
1048 typedef struct _BL_BLOCK_DEVICE
1049 {
1050 BL_BLOCK_DEVICE_INFORMATION;
1051 ULONGLONG StartOffset;
1052 EFI_BLOCK_IO* Protocol;
1053 EFI_HANDLE Handle;
1054 } BL_BLOCK_DEVICE, *PBL_BLOCK_DEVICE;
1055
1056 typedef struct _BL_PROTOCOL_HANDLE
1057 {
1058 EFI_HANDLE Handle;
1059 PVOID Interface;
1060 } BL_PROTOCOL_HANDLE, *PBL_PROTOCOL_HANDLE;
1061
1062 typedef struct _BL_DEVICE_CALLBACKS
1063 {
1064 PBL_DEVICE_ENUMERATE_DEVICE_CLASS EnumerateDeviceClass;
1065 PBL_DEVICE_OPEN Open;
1066 PBL_DEVICE_CLOSE Close;
1067 PBL_DEVICE_READ Read;
1068 PBL_DEVICE_WRITE Write;
1069 PBL_DEVICE_GET_INFORMATION GetInformation;
1070 PBL_DEVICE_SET_INFORMATION SetInformation;
1071 PBL_DEVICE_RESET Reset;
1072 PBL_DEVICE_FLUSH Flush;
1073 PBL_DEVICE_CREATE Create;
1074 } BL_DEVICE_CALLBACKS, *PBL_DEVICE_CALLBACKS;
1075
1076 typedef struct _BL_DEVICE_ENTRY
1077 {
1078 ULONG DeviceId;
1079 ULONG Flags;
1080 ULONG Unknown;
1081 ULONG ReferenceCount;
1082 BL_DEVICE_CALLBACKS Callbacks;
1083 PVOID DeviceSpecificData;
1084 PBL_DEVICE_DESCRIPTOR DeviceDescriptor;
1085 } BL_DEVICE_ENTRY, *PBL_DEVICE_ENTRY;
1086
1087 typedef struct _BL_IMG_FILE
1088 {
1089 UCHAR Flags;
1090 union
1091 {
1092 PVOID BaseAddress;
1093 ULONG FileId;
1094 };
1095 ULONG FileSize;
1096 PWCHAR FileName;
1097 } BL_IMG_FILE, *PBL_IMG_FILE;
1098
1099 typedef struct _BL_DEFERRED_FONT_FILE
1100 {
1101 LIST_ENTRY ListEntry;
1102 ULONG Flags;
1103 PBL_DEVICE_DESCRIPTOR Device;
1104 PWCHAR FontPath;
1105 } BL_DEFERRED_FONT_FILE, *PBL_DEFERRED_FONT_FILE;
1106
1107 #pragma pack(push)
1108 #pragma pack(1)
1109 typedef struct _BMP_HEADER
1110 {
1111 USHORT Signature;
1112 ULONG Size;
1113 USHORT Reserved[2];
1114 ULONG Offset;
1115 } BMP_HEADER, *PBMP_HEADER;
1116
1117 typedef struct _DIB_HEADER
1118 {
1119 ULONG Size;
1120 ULONG Width;
1121 ULONG Height;
1122 USHORT Planes;
1123 USHORT BitCount;
1124 ULONG Compression;
1125 ULONG SizeImage;
1126 ULONG XPelsPerMeter;
1127 ULONG YPelsPerMEter;
1128 ULONG ClrUsed;
1129 ULONG ClrImportant;
1130 } DIB_HEADER, *PDIB_HEADER;
1131
1132 typedef struct _BITMAP
1133 {
1134 BMP_HEADER BmpHeader;
1135 DIB_HEADER DibHeader;
1136 } BITMAP, *PBITMAP;
1137 #pragma pack(pop)
1138
1139 typedef struct _COORD
1140 {
1141 ULONG X;
1142 ULONG Y;
1143 } COORD, *PCOORD;
1144
1145 /* INLINE ROUTINES ***********************************************************/
1146
1147 FORCEINLINE
1148 VOID
1149 BlSetupDefaultParameters (
1150 _Out_ PBL_LIBRARY_PARAMETERS LibraryParameters
1151 )
1152 {
1153 BL_LIBRARY_PARAMETERS DefaultParameters =
1154 {
1155 0x20,
1156 BlVirtual,
1157 1024,
1158 2 * 1024 * 1024,
1159 0,
1160 NULL,
1161 0,
1162 NULL
1163 };
1164
1165 /* Copy the defaults */
1166 RtlCopyMemory(LibraryParameters, &DefaultParameters, sizeof(*LibraryParameters));
1167 }
1168
1169 FORCEINLINE
1170 VOID
1171 MmMdInitializeListHead (
1172 _In_ PBL_MEMORY_DESCRIPTOR_LIST List
1173 )
1174 {
1175 /* Initialize the list */
1176 InitializeListHead(&List->ListHead);
1177 List->First = &List->ListHead;
1178 List->This = NULL;
1179 }
1180
1181 /* INITIALIZATION ROUTINES ***************************************************/
1182
1183 NTSTATUS
1184 BlInitializeLibrary(
1185 _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters,
1186 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1187 );
1188
1189 NTSTATUS
1190 BlpArchInitialize (
1191 _In_ ULONG Phase
1192 );
1193
1194 NTSTATUS
1195 BlpFwInitialize (
1196 _In_ ULONG Phase,
1197 _In_ PBL_FIRMWARE_DESCRIPTOR FirmwareParameters
1198 );
1199
1200 NTSTATUS
1201 BlpMmInitialize (
1202 _In_ PBL_MEMORY_DATA MemoryData,
1203 _In_ BL_TRANSLATION_TYPE TranslationType,
1204 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1205 );
1206
1207 NTSTATUS
1208 MmBaInitialize (
1209 VOID
1210 );
1211
1212 NTSTATUS
1213 MmPaInitialize (
1214 _In_ PBL_MEMORY_DATA MemoryData,
1215 _In_ ULONG MinimumPages
1216 );
1217
1218 NTSTATUS
1219 MmArchInitialize (
1220 _In_ ULONG Phase,
1221 _In_ PBL_MEMORY_DATA MemoryData,
1222 _In_ BL_TRANSLATION_TYPE TranslationType,
1223 _In_ BL_TRANSLATION_TYPE LibraryTranslationType
1224 );
1225
1226 NTSTATUS
1227 MmHaInitialize (
1228 _In_ ULONG HeapSize,
1229 _In_ ULONG HeapAttributes
1230 );
1231
1232 VOID
1233 MmMdInitialize (
1234 _In_ ULONG Phase,
1235 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1236 );
1237
1238 NTSTATUS
1239 BlpDeviceInitialize (
1240 VOID
1241 );
1242
1243 NTSTATUS
1244 BlpIoInitialize (
1245 VOID
1246 );
1247
1248 NTSTATUS
1249 BlpFileInitialize (
1250 VOID
1251 );
1252
1253 NTSTATUS
1254 BlpDisplayInitialize (
1255 _In_ ULONG Flags
1256 );
1257
1258 VOID
1259 BlDestroyLibrary (
1260 VOID
1261 );
1262
1263 NTSTATUS
1264 BcInitialize (
1265 VOID
1266 );
1267
1268 /* FIRMWARE ROUTINES *********************************************************/
1269
1270 VOID
1271 EfiPrintf (
1272 _In_ PWCHAR Format,
1273 ...
1274 );
1275
1276 NTSTATUS
1277 EfiAllocatePages (
1278 _In_ ULONG Type,
1279 _In_ ULONG Pages,
1280 _Inout_ EFI_PHYSICAL_ADDRESS* Memory
1281 );
1282
1283 NTSTATUS
1284 EfiStall (
1285 _In_ ULONG StallTime
1286 );
1287
1288 NTSTATUS
1289 EfiConInExReset (
1290 VOID
1291 );
1292
1293 NTSTATUS
1294 EfiConInReset (
1295 VOID
1296 );
1297
1298 NTSTATUS
1299 EfiConOutOutputString (
1300 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1301 _In_ PWCHAR String
1302 );
1303
1304 NTSTATUS
1305 EfiConOutQueryMode (
1306 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1307 _In_ ULONG Mode,
1308 _In_ UINTN* Columns,
1309 _In_ UINTN* Rows
1310 );
1311
1312 NTSTATUS
1313 EfiConOutSetMode (
1314 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1315 _In_ ULONG Mode
1316 );
1317
1318 VOID
1319 EfiConOutReadCurrentMode (
1320 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1321 _Out_ EFI_SIMPLE_TEXT_OUTPUT_MODE* Mode
1322 );
1323
1324 NTSTATUS
1325 EfiConOutSetAttribute (
1326 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1327 _In_ ULONG Attribute
1328 );
1329
1330 NTSTATUS
1331 EfiConOutSetCursorPosition (
1332 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1333 _In_ ULONG Column,
1334 _In_ ULONG Row
1335 );
1336
1337 NTSTATUS
1338 EfiConOutEnableCursor (
1339 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1340 _In_ BOOLEAN Visible
1341 );
1342
1343 NTSTATUS
1344 EfiLocateHandleBuffer (
1345 _In_ EFI_LOCATE_SEARCH_TYPE SearchType,
1346 _In_ EFI_GUID *Protocol,
1347 _Inout_ PULONG HandleCount,
1348 _Inout_ EFI_HANDLE** Buffer
1349 );
1350
1351 NTSTATUS
1352 EfiOpenProtocol (
1353 _In_ EFI_HANDLE Handle,
1354 _In_ EFI_GUID *Protocol,
1355 _Out_ PVOID* Interface
1356 );
1357
1358 NTSTATUS
1359 EfiCloseProtocol (
1360 _In_ EFI_HANDLE Handle,
1361 _In_ EFI_GUID *Protocol
1362 );
1363
1364 NTSTATUS
1365 EfiGopGetCurrentMode (
1366 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1367 _Out_ UINTN* Mode,
1368 _Out_ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Information
1369 );
1370
1371 NTSTATUS
1372 EfiGopSetMode (
1373 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1374 _In_ ULONG Mode
1375 );
1376
1377 VOID
1378 EfiGopGetFrameBuffer (
1379 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1380 _Out_ PHYSICAL_ADDRESS* FrameBuffer,
1381 _Out_ UINTN *FrameBufferSize
1382 );
1383
1384 VOID
1385 EfiResetSystem (
1386 _In_ EFI_RESET_TYPE ResetType
1387 );
1388
1389 EFI_DEVICE_PATH*
1390 EfiGetLeafNode (
1391 _In_ EFI_DEVICE_PATH *DevicePath
1392 );
1393
1394 EFI_DEVICE_PATH *
1395 EfiIsDevicePathParent (
1396 _In_ EFI_DEVICE_PATH *DevicePath1,
1397 _In_ EFI_DEVICE_PATH *DevicePath2
1398 );
1399
1400 NTSTATUS
1401 EfipGetRsdt (
1402 _Out_ PPHYSICAL_ADDRESS FoundRsdt
1403 );
1404
1405 /* PLATFORM TIMER ROUTINES ***************************************************/
1406
1407 NTSTATUS
1408 BlpTimeCalibratePerformanceCounter (
1409 VOID
1410 );
1411
1412 /* RESOURCE LOCALE INTERNATIONALIZATION ROUTINES *****************************/
1413
1414 NTSTATUS
1415 BlpDisplayRegisterLocale (
1416 _In_ PWCHAR Locale
1417 );
1418
1419 /* FONT ROUTINES *************************************************************/
1420
1421 VOID
1422 BfiFreeDeferredFontFile (
1423 _In_ PBL_DEFERRED_FONT_FILE DeferredFontFile
1424 );
1425
1426 NTSTATUS
1427 BfLoadFontFile (
1428 _In_ PBL_DEVICE_DESCRIPTOR Device,
1429 _In_ PWCHAR FontPath
1430 );
1431
1432 NTSTATUS
1433 BfLoadDeferredFontFiles (
1434 VOID
1435 );
1436
1437 NTSTATUS
1438 BfClearScreen (
1439 _In_ PBL_GRAPHICS_CONSOLE Console
1440 );
1441
1442 NTSTATUS
1443 BfClearToEndOfLine (
1444 _In_ PBL_GRAPHICS_CONSOLE Console
1445 );
1446
1447 /* FILESYSTEM ROUTINES *******************************************************/
1448
1449 NTSTATUS
1450 FatInitialize (
1451 VOID
1452 );
1453
1454 NTSTATUS
1455 FatMount (
1456 _In_ ULONG DeviceId,
1457 _In_ ULONG Unknown,
1458 _Out_ PBL_FILE_ENTRY* FileEntry
1459 );
1460
1461 NTSTATUS
1462 EtfsInitialize (
1463 VOID
1464 );
1465
1466 NTSTATUS
1467 EtfsMount (
1468 _In_ ULONG DeviceId,
1469 _In_ ULONG Unknown,
1470 _Out_ PBL_FILE_ENTRY* FileEntry
1471 );
1472
1473 /* DEBUG ROUTINES ************************************************************/
1474
1475
1476 BOOLEAN
1477 BlBdDebuggerEnabled (
1478 VOID
1479 );
1480
1481 NTSTATUS
1482 BlBdPullRemoteFile (
1483 _In_ PWCHAR FilePath,
1484 _Out_ PVOID BaseAddress,
1485 _Out_ PULONGLONG FileSize
1486 );
1487
1488 VOID
1489 BlStatusPrint (
1490 _In_ PCWCH Format,
1491 ...
1492 );
1493
1494 VOID
1495 BlStatusError (
1496 _In_ ULONG ErrorCode,
1497 _In_ ULONG Parameter1,
1498 _In_ ULONG_PTR Parameter2,
1499 _In_ ULONG_PTR Parameter3,
1500 _In_ ULONG_PTR Parameter4
1501 );
1502
1503 /* UTILITY ROUTINES **********************************************************/
1504
1505 VOID
1506 BlUtlUpdateProgress (
1507 _In_ ULONG Percentage,
1508 _Out_opt_ PBOOLEAN Completed
1509 );
1510
1511 NTSTATUS
1512 BlUtlGetAcpiTable (
1513 _Out_ PVOID* TableAddress,
1514 _In_ ULONG Signature
1515 );
1516
1517 EFI_STATUS
1518 EfiGetEfiStatusCode(
1519 _In_ NTSTATUS Status
1520 );
1521
1522 NTSTATUS
1523 EfiGetNtStatusCode (
1524 _In_ EFI_STATUS EfiStatus
1525 );
1526
1527 NTSTATUS
1528 BlUtlInitialize (
1529 VOID
1530 );
1531
1532 NTSTATUS
1533 BlUtlRegisterProgressRoutine (
1534 VOID
1535 );
1536
1537 VOID
1538 BlFwReboot (
1539 VOID
1540 );
1541
1542 PGUID
1543 BlGetApplicationIdentifier (
1544 VOID
1545 );
1546
1547 NTSTATUS
1548 BlpSecureBootEFIIsEnabled (
1549 VOID
1550 );
1551
1552 NTSTATUS
1553 BlSecureBootIsEnabled (
1554 _Out_ PBOOLEAN SecureBootEnabled
1555 );
1556
1557 NTSTATUS
1558 BlSecureBootCheckForFactoryReset (
1559 VOID
1560 );
1561
1562 NTSTATUS
1563 BlGetApplicationBaseAndSize (
1564 _Out_ PVOID* ImageBase,
1565 _Out_ PULONG ImageSize
1566 );
1567
1568 PWCHAR
1569 BlResourceFindMessage (
1570 _In_ ULONG MsgId
1571 );
1572
1573 PWCHAR
1574 BlResourceFindHtml (
1575 VOID
1576 );
1577
1578 NTSTATUS
1579 BlpResourceInitialize (
1580 VOID
1581 );
1582
1583 /* TABLE ROUTINES ************************************************************/
1584
1585 NTSTATUS
1586 BlTblMap (
1587 _In_ PVOID *Table,
1588 _In_ ULONG Count,
1589 _In_ PBL_TBL_MAP_ROUTINE MapCallback
1590 );
1591
1592 PVOID
1593 BlTblFindEntry (
1594 _In_ PVOID *Table,
1595 _In_ ULONG Count,
1596 _Out_ PULONG EntryIndex,
1597 _In_ PBL_TBL_LOOKUP_ROUTINE Callback,
1598 _In_ PVOID Argument1,
1599 _In_ PVOID Argument2,
1600 _In_ PVOID Argument3,
1601 _In_ PVOID Argument4
1602 );
1603
1604 NTSTATUS
1605 BlTblSetEntry (
1606 _Inout_ PVOID** Table,
1607 _Inout_ PULONG Count,
1608 _In_ PVOID Entry,
1609 _Out_ PULONG EntryIndex,
1610 _In_ PBL_TBL_SET_ROUTINE Callback
1611 );
1612
1613 NTSTATUS
1614 TblDoNotPurgeEntry (
1615 _In_ PVOID Entry
1616 );
1617
1618 /* HASH TABLE ROUTINES *******************************************************/
1619
1620 NTSTATUS
1621 BlHtStore (
1622 _In_ ULONG TableId,
1623 _In_ PBL_HASH_ENTRY Entry,
1624 _In_ PVOID Data,
1625 _In_ ULONG DataSize
1626 );
1627
1628 NTSTATUS
1629 BlHtLookup (
1630 _In_ ULONG TableId,
1631 _In_ PBL_HASH_ENTRY Entry,
1632 _Out_ PBL_HASH_VALUE *Value
1633 );
1634
1635 NTSTATUS
1636 BlHtCreate (
1637 _In_ ULONG Size,
1638 _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction,
1639 _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction,
1640 _Out_ PULONG Id
1641 );
1642
1643 /* BCD OPTION ROUTINES *******************************************************/
1644
1645 PBL_BCD_OPTION
1646 MiscGetBootOption (
1647 _In_ PBL_BCD_OPTION List,
1648 _In_ ULONG Type
1649 );
1650
1651 ULONG
1652 BlGetBootOptionListSize (
1653 _In_ PBL_BCD_OPTION BcdOption
1654 );
1655
1656 ULONG
1657 BlGetBootOptionSize (
1658 _In_ PBL_BCD_OPTION BcdOption
1659 );
1660
1661 NTSTATUS
1662 BlGetBootOptionString (
1663 _In_ PBL_BCD_OPTION List,
1664 _In_ ULONG Type,
1665 _Out_ PWCHAR* Value
1666 );
1667
1668 NTSTATUS
1669 BlGetBootOptionInteger (
1670 _In_ PBL_BCD_OPTION List,
1671 _In_ ULONG Type,
1672 _Out_ PULONGLONG Value
1673 );
1674
1675 NTSTATUS
1676 BlGetBootOptionBoolean (
1677 _In_ PBL_BCD_OPTION List,
1678 _In_ ULONG Type,
1679 _Out_ PBOOLEAN Value
1680 );
1681
1682 NTSTATUS
1683 BlpGetBootOptionIntegerList (
1684 _In_ PBL_BCD_OPTION List,
1685 _In_ ULONG Type,
1686 _Out_ PULONGLONG* Value,
1687 _Out_ PULONGLONG Count,
1688 _In_ BOOLEAN NoCopy
1689 );
1690
1691 NTSTATUS
1692 BlGetBootOptionDevice (
1693 _In_ PBL_BCD_OPTION List,
1694 _In_ ULONG Type,
1695 _Out_ PBL_DEVICE_DESCRIPTOR* Value,
1696 _In_opt_ PBL_BCD_OPTION* ExtraOptions
1697 );
1698
1699 NTSTATUS
1700 BlGetBootOptionGuidList (
1701 _In_ PBL_BCD_OPTION List,
1702 _In_ ULONG Type,
1703 _Out_ PGUID *Value,
1704 _In_ PULONG Count
1705 );
1706
1707 NTSTATUS
1708 BlCopyBootOptions (
1709 _In_ PBL_BCD_OPTION OptionList,
1710 _Out_ PBL_BCD_OPTION *CopiedOptions
1711 );
1712
1713 NTSTATUS
1714 BlAppendBootOptions (
1715 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1716 _In_ PBL_BCD_OPTION Options
1717 );
1718
1719 /* BOOT REGISTRY ROUTINES ****************************************************/
1720
1721 VOID
1722 BiCloseKey (
1723 _In_ HANDLE KeyHandle
1724 );
1725
1726 NTSTATUS
1727 BiOpenKey(
1728 _In_ HANDLE ParentHandle,
1729 _In_ PWCHAR KeyName,
1730 _Out_ PHANDLE Handle
1731 );
1732
1733 NTSTATUS
1734 BiLoadHive (
1735 _In_ PBL_FILE_PATH_DESCRIPTOR FilePath,
1736 _Out_ PHANDLE HiveHandle
1737 );
1738
1739 NTSTATUS
1740 BiGetRegistryValue (
1741 _In_ HANDLE KeyHandle,
1742 _In_ PWCHAR ValueName,
1743 _In_ PWCHAR KeyName,
1744 _In_ ULONG Type,
1745 _Out_ PVOID* Buffer,
1746 _Out_ PULONG ValueLength
1747 );
1748
1749 NTSTATUS
1750 BiEnumerateSubKeys (
1751 _In_ HANDLE KeyHandle,
1752 _Out_ PWCHAR** SubKeyList,
1753 _Out_ PULONG SubKeyCount
1754 );
1755
1756 VOID
1757 BiDereferenceHive (
1758 _In_ HANDLE KeyHandle
1759 );
1760
1761 /* CONTEXT ROUTINES **********************************************************/
1762
1763 VOID
1764 BlpArchSwitchContext (
1765 _In_ BL_ARCH_MODE NewMode
1766 );
1767
1768 /* MEMORY DESCRIPTOR ROUTINES ************************************************/
1769
1770 VOID
1771 MmMdFreeList(
1772 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList
1773 );
1774
1775 PBL_MEMORY_DESCRIPTOR
1776 MmMdInitByteGranularDescriptor (
1777 _In_ ULONG Flags,
1778 _In_ BL_MEMORY_TYPE Type,
1779 _In_ ULONGLONG BasePage,
1780 _In_ ULONGLONG VirtualPage,
1781 _In_ ULONGLONG PageCount
1782 );
1783
1784 VOID
1785 MmMdFreeGlobalDescriptors (
1786 VOID
1787 );
1788
1789 NTSTATUS
1790 MmMdAddDescriptorToList (
1791 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
1792 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor,
1793 _In_ ULONG Flags
1794 );
1795
1796 VOID
1797 MmMdRemoveDescriptorFromList (
1798 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
1799 _In_ PBL_MEMORY_DESCRIPTOR Entry
1800 );
1801
1802 BOOLEAN
1803 MmMdFindSatisfyingRegion (
1804 _In_ PBL_MEMORY_DESCRIPTOR Descriptor,
1805 _Out_ PBL_MEMORY_DESCRIPTOR NewDescriptor,
1806 _In_ ULONGLONG Pages,
1807 _In_ PBL_ADDRESS_RANGE BaseRange,
1808 _In_ PBL_ADDRESS_RANGE VirtualRange,
1809 _In_ BOOLEAN TopDown,
1810 _In_ BL_MEMORY_TYPE MemoryType,
1811 _In_ ULONG Flags,
1812 _In_ ULONG Alignment
1813 );
1814
1815 NTSTATUS
1816 MmMdRemoveRegionFromMdlEx (
1817 __in PBL_MEMORY_DESCRIPTOR_LIST MdList,
1818 __in ULONG Flags,
1819 __in ULONGLONG BasePage,
1820 __in ULONGLONG PageCount,
1821 __in PBL_MEMORY_DESCRIPTOR_LIST NewMdList
1822 );
1823
1824 NTSTATUS
1825 MmMdFreeDescriptor (
1826 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor
1827 );
1828
1829 /* PAGE ALLOCATOR ROUTINES ***************************************************/
1830
1831 NTSTATUS
1832 BlMmAllocatePhysicalPages(
1833 _Inout_ PPHYSICAL_ADDRESS Address,
1834 _In_ BL_MEMORY_TYPE MemoryType,
1835 _In_ ULONGLONG PageCount,
1836 _In_ ULONG Attributes,
1837 _In_ ULONG Alignment
1838 );
1839
1840 NTSTATUS
1841 MmPapAllocatePhysicalPagesInRange (
1842 _Inout_ PPHYSICAL_ADDRESS BaseAddress,
1843 _In_ BL_MEMORY_TYPE MemoryType,
1844 _In_ ULONGLONG Pages,
1845 _In_ ULONG Attributes,
1846 _In_ ULONG Alignment,
1847 _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
1848 _In_opt_ PBL_ADDRESS_RANGE Range,
1849 _In_ ULONG RangeType
1850 );
1851
1852 NTSTATUS
1853 BlMmFreePhysicalPages (
1854 _In_ PHYSICAL_ADDRESS Address
1855 );
1856
1857 NTSTATUS
1858 MmPapAllocatePagesInRange (
1859 _Inout_ PVOID* PhysicalAddress,
1860 _In_ BL_MEMORY_TYPE MemoryType,
1861 _In_ ULONGLONG Pages,
1862 _In_ ULONG Attributes,
1863 _In_ ULONG Alignment,
1864 _In_opt_ PBL_ADDRESS_RANGE Range,
1865 _In_ ULONG Type
1866 );
1867
1868 NTSTATUS
1869 MmFwGetMemoryMap (
1870 _Out_ PBL_MEMORY_DESCRIPTOR_LIST MemoryMap,
1871 _In_ ULONG Flags
1872 );
1873
1874 NTSTATUS
1875 BlpMmInitializeConstraints (
1876 VOID
1877 );
1878
1879 NTSTATUS
1880 BlMmRemoveBadMemory (
1881 VOID
1882 );
1883
1884 /* VIRTUAL MEMORY ROUTINES ***************************************************/
1885
1886 NTSTATUS
1887 BlMmMapPhysicalAddressEx (
1888 _In_ PVOID* VirtualAddress,
1889 _In_ ULONG Attributes,
1890 _In_ ULONGLONG Size,
1891 _In_ PHYSICAL_ADDRESS PhysicalAddress
1892 );
1893
1894 NTSTATUS
1895 BlMmUnmapVirtualAddressEx (
1896 _In_ PVOID VirtualAddress,
1897 _In_ ULONGLONG Size
1898 );
1899
1900 /* BLOCK ALLOCATOR ROUTINES **************************************************/
1901
1902 NTSTATUS
1903 BlpMmCreateBlockAllocator (
1904 VOID
1905 );
1906
1907 /* HEAP ALLOCATOR ROUTINES ***************************************************/
1908
1909 PVOID
1910 BlMmAllocateHeap (
1911 _In_ ULONG Size
1912 );
1913
1914 NTSTATUS
1915 BlMmFreeHeap (
1916 _In_ PVOID Buffer
1917 );
1918
1919 /* DISPLAY ROUTINES **********************************************************/
1920
1921 VOID
1922 BlDisplayGetTextCellResolution (
1923 _Out_ PULONG TextWidth,
1924 _Out_ PULONG TextHeight
1925 );
1926
1927 NTSTATUS
1928 BlDisplaySetScreenResolution (
1929 VOID
1930 );
1931
1932 NTSTATUS
1933 BlDisplayGetScreenResolution (
1934 _Out_ PULONG HRes,
1935 _Out_ PULONG Vres
1936 );
1937
1938 VOID
1939 BlDisplayInvalidateOemBitmap (
1940 VOID
1941 );
1942
1943 PBITMAP
1944 BlDisplayGetOemBitmap (
1945 _Out_ PCOORD Offset,
1946 _Out_opt_ PULONG Flags
1947 );
1948
1949 BOOLEAN
1950 BlDisplayValidOemBitmap (
1951 VOID
1952 );
1953
1954 NTSTATUS
1955 BlDisplayClearScreen (
1956 VOID
1957 );
1958
1959 NTSTATUS
1960 BlDisplaySetCursorType (
1961 _In_ ULONG Type
1962 );
1963
1964 /* I/O ROUTINES **************************************************************/
1965
1966 NTSTATUS
1967 BlpIoRegisterDestroyRoutine (
1968 _In_ PBL_IO_DESTROY_ROUTINE DestroyRoutine
1969 );
1970
1971 NTSTATUS
1972 BlDeviceClose (
1973 _In_ ULONG DeviceId
1974 );
1975
1976 NTSTATUS
1977 BlpDeviceOpen (
1978 _In_ PBL_DEVICE_DESCRIPTOR Device,
1979 _In_ ULONG Flags,
1980 _In_ ULONG Unknown,
1981 _Out_ PULONG DeviceId
1982 );
1983
1984 NTSTATUS
1985 BlDeviceGetInformation (
1986 _In_ ULONG DeviceId,
1987 _Out_ PBL_DEVICE_INFORMATION DeviceInformation
1988 );
1989
1990 NTSTATUS
1991 BlDeviceSetInformation (
1992 _In_ ULONG DeviceId,
1993 _In_ PBL_DEVICE_INFORMATION DeviceInformation
1994 );
1995
1996 NTSTATUS
1997 BlDeviceReadAtOffset (
1998 _In_ ULONG DeviceId,
1999 _In_ ULONG Size,
2000 _In_ ULONGLONG Offset,
2001 _In_ PVOID Buffer,
2002 _Out_ PULONG BytesRead
2003 );
2004
2005 /* IMAGE ROUTINES ************************************************************/
2006
2007 NTSTATUS
2008 BlImgLoadImageWithProgress2 (
2009 _In_ ULONG DeviceId,
2010 _In_ BL_MEMORY_TYPE MemoryType,
2011 _In_ PWCHAR FileName,
2012 _Inout_ PVOID* MappedBase,
2013 _Inout_ PULONG MappedSize,
2014 _In_ ULONG ImageFlags,
2015 _In_ BOOLEAN ShowProgress,
2016 _Out_opt_ PUCHAR* HashBuffer,
2017 _Out_opt_ PULONG HashSize
2018 );
2019
2020 PIMAGE_SECTION_HEADER
2021 BlImgFindSection (
2022 _In_ PVOID ImageBase,
2023 _In_ ULONG ImageSize
2024 );
2025
2026 /* FILE I/O ROUTINES *********************************************************/
2027
2028 NTSTATUS
2029 BlFileClose (
2030 _In_ ULONG FileId
2031 );
2032
2033 NTSTATUS
2034 BlFileReadAtOffsetEx (
2035 _In_ ULONG FileId,
2036 _In_ ULONG Size,
2037 _In_ ULONGLONG ByteOffset,
2038 _In_ PVOID Buffer,
2039 _Out_ PULONG BytesReturned,
2040 _In_ ULONG Flags
2041 );
2042
2043 NTSTATUS
2044 BlFileGetInformation (
2045 _In_ ULONG FileId,
2046 _In_ PBL_FILE_INFORMATION FileInfo
2047 );
2048
2049 NTSTATUS
2050 BlFileOpen (
2051 _In_ ULONG DeviceId,
2052 _In_ PWCHAR FileName,
2053 _In_ ULONG Flags,
2054 _Out_ PULONG FileId
2055 );
2056
2057 /* INPUT CONSOLE ROUTINES ****************************************************/
2058
2059 VOID
2060 ConsoleInputLocalDestruct (
2061 _In_ struct _BL_INPUT_CONSOLE* Console
2062 );
2063
2064 NTSTATUS
2065 ConsoleInputBaseReinitialize (
2066 _In_ struct _BL_INPUT_CONSOLE* Console
2067 );
2068
2069 NTSTATUS
2070 ConsoleCreateLocalInputCnsole (
2071 VOID
2072 );
2073
2074 /* TEXT CONSOLE ROUTINES *****************************************************/
2075
2076 VOID
2077 ConsoleGraphicalDestruct (
2078 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2079 );
2080
2081 NTSTATUS
2082 ConsoleGraphicalClearText (
2083 _In_ PBL_GRAPHICS_CONSOLE Console,
2084 _In_ BOOLEAN LineOnly
2085 );
2086
2087 NTSTATUS
2088 ConsoleGraphicalClearPixels (
2089 _In_ PBL_GRAPHICS_CONSOLE Console,
2090 _In_ ULONG Color
2091 );
2092
2093 NTSTATUS
2094 ConsoleGraphicalReinitialize (
2095 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2096 );
2097
2098 NTSTATUS
2099 ConsoleGraphicalSetTextState (
2100 _In_ PBL_GRAPHICS_CONSOLE Console,
2101 _In_ ULONG Mask,
2102 _In_ PBL_DISPLAY_STATE TextState
2103 );
2104
2105 BOOLEAN
2106 ConsoleGraphicalIsEnabled (
2107 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2108 );
2109
2110 NTSTATUS
2111 ConsoleGraphicalGetGraphicalResolution (
2112 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2113 _In_ PBL_DISPLAY_MODE DisplayMode
2114 );
2115
2116 NTSTATUS
2117 ConsoleGraphicalGetOriginalResolution (
2118 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2119 _In_ PBL_DISPLAY_MODE DisplayMode
2120 );
2121
2122 NTSTATUS
2123 ConsoleGraphicalEnable (
2124 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2125 _In_ BOOLEAN Enable
2126 );
2127
2128 VOID
2129 ConsoleTextLocalDestruct (
2130 _In_ struct _BL_TEXT_CONSOLE* Console
2131 );
2132
2133 NTSTATUS
2134 ConsoleTextLocalReinitialize (
2135 _In_ struct _BL_TEXT_CONSOLE* Console
2136 );
2137
2138 NTSTATUS
2139 ConsoleTextBaseGetTextState (
2140 _In_ struct _BL_TEXT_CONSOLE* Console,
2141 _Out_ PBL_DISPLAY_STATE TextState
2142 );
2143
2144 NTSTATUS
2145 ConsoleTextLocalSetTextState (
2146 _In_ struct _BL_TEXT_CONSOLE* Console,
2147 _In_ ULONG Flags,
2148 _In_ PBL_DISPLAY_STATE TextState
2149 );
2150
2151 NTSTATUS
2152 ConsoleTextBaseGetTextResolution (
2153 _In_ struct _BL_TEXT_CONSOLE* Console,
2154 _Out_ PULONG TextResolution
2155 );
2156
2157 NTSTATUS
2158 ConsoleTextLocalSetTextResolution (
2159 _In_ struct _BL_TEXT_CONSOLE* Console,
2160 _In_ ULONG NewTextResolution,
2161 _Out_ PULONG OldTextResolution
2162 );
2163
2164 NTSTATUS
2165 ConsoleTextLocalClearText (
2166 _In_ struct _BL_TEXT_CONSOLE* Console,
2167 _In_ BOOLEAN LineOnly
2168 );
2169
2170 NTSTATUS
2171 ConsoleTextLocalWriteText (
2172 _In_ struct _BL_TEXT_CONSOLE* Console,
2173 _In_ PCHAR Text,
2174 _In_ ULONG Attribute
2175 );
2176
2177 NTSTATUS
2178 ConsoleTextLocalConstruct (
2179 _In_ PBL_TEXT_CONSOLE TextConsole,
2180 _In_ BOOLEAN Activate
2181 );
2182
2183 BOOLEAN
2184 ConsolepFindResolution (
2185 _In_ PBL_DISPLAY_MODE Mode,
2186 _In_ PBL_DISPLAY_MODE List,
2187 _In_ ULONG MaxIndex
2188 );
2189
2190 NTSTATUS
2191 ConsoleFirmwareTextClear (
2192 _In_ PBL_TEXT_CONSOLE Console,
2193 _In_ BOOLEAN LineOnly
2194 );
2195
2196 VOID
2197 ConsoleFirmwareTextClose (
2198 _In_ PBL_TEXT_CONSOLE TextConsole
2199 );
2200
2201 NTSTATUS
2202 ConsoleFirmwareTextOpen (
2203 _In_ PBL_TEXT_CONSOLE TextConsole
2204 );
2205
2206 NTSTATUS
2207 ConsoleFirmwareTextSetState (
2208 _In_ PBL_TEXT_CONSOLE TextConsole,
2209 _In_ UCHAR Mask,
2210 _In_ PBL_DISPLAY_STATE State
2211 );
2212
2213 NTSTATUS
2214 ConsoleGraphicalConstruct (
2215 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2216 );
2217
2218 NTSTATUS
2219 ConsoleCreateRemoteConsole (
2220 _In_ PBL_TEXT_CONSOLE* TextConsole
2221 );
2222
2223 NTSTATUS
2224 ConsoleEfiGraphicalOpenProtocol (
2225 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2226 _In_ BL_GRAPHICS_CONSOLE_TYPE Type
2227 );
2228
2229 VOID
2230 ConsoleFirmwareGraphicalClose (
2231 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2232 );
2233
2234 VOID
2235 ConsoleFirmwareGraphicalDisable (
2236 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2237 );
2238
2239 NTSTATUS
2240 ConsoleFirmwareGraphicalClear (
2241 _In_ PBL_GRAPHICS_CONSOLE Console,
2242 _In_ ULONG Color
2243 );
2244
2245 NTSTATUS
2246 ConsoleFirmwareGraphicalEnable (
2247 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2248 );
2249
2250 NTSTATUS
2251 ConsoleEfiUgaOpen (
2252 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2253 );
2254
2255 VOID
2256 ConsoleEfiUgaClose (
2257 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2258 );
2259
2260 VOID
2261 ConsoleEfiGopClose (
2262 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2263 );
2264
2265 NTSTATUS
2266 ConsoleEfiGopOpen (
2267 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2268 );
2269
2270 NTSTATUS
2271 ConsoleEfiGopEnable (
2272 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2273 );
2274
2275 NTSTATUS
2276 ConsoleEfiUgaSetResolution (
2277 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2278 _In_ PBL_DISPLAY_MODE DisplayMode,
2279 _In_ ULONG DisplayModeCount
2280 );
2281
2282 NTSTATUS
2283 ConsoleCreateLocalInputConsole (
2284 VOID
2285 );
2286
2287 NTSTATUS
2288 ConsoleInputLocalEraseBuffer (
2289 _In_ PBL_INPUT_CONSOLE Console,
2290 _In_opt_ PULONG ValueToFill
2291 );
2292
2293 VOID
2294 ConsolepClearBuffer (
2295 _In_ PUCHAR FrameBuffer,
2296 _In_ ULONG Width,
2297 _In_ PUCHAR FillColor,
2298 _In_ ULONG Height,
2299 _In_ ULONG ScanlineWidth,
2300 _In_ ULONG PixelDepth
2301 );
2302
2303 NTSTATUS
2304 ConsolepConvertColorToPixel (
2305 _In_ BL_COLOR Color,
2306 _Out_ PUCHAR Pixel
2307 );
2308
2309 extern ULONG MmDescriptorCallTreeCount;
2310 extern ULONG BlpApplicationFlags;
2311 extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
2312 extern BL_TRANSLATION_TYPE MmTranslationType;
2313 extern PBL_ARCH_CONTEXT CurrentExecutionContext;
2314 extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
2315 extern BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
2316 extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
2317 extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
2318 extern EFI_GUID EfiGraphicsOutputProtocol;
2319 extern EFI_GUID EfiUgaDrawProtocol;
2320 extern EFI_GUID EfiLoadedImageProtocol;
2321 extern EFI_GUID EfiDevicePathProtocol;
2322 extern EFI_GUID EfiBlockIoProtocol;
2323 extern EFI_GUID EfiSimpleTextInputExProtocol;
2324 extern EFI_GUID EfiRootAcpiTableGuid;
2325 extern EFI_GUID EfiRootAcpiTable10Guid;
2326 extern EFI_GUID EfiGlobalVariable;
2327 extern ULONG ConsoleGraphicalResolutionListFlags;
2328 extern BL_DISPLAY_MODE ConsoleGraphicalResolutionList[];
2329 extern BL_DISPLAY_MODE ConsoleTextResolutionList[];
2330 extern ULONG ConsoleGraphicalResolutionListSize;
2331 extern PVOID DspRemoteInputConsole;
2332 extern PVOID DspLocalInputConsole;
2333 extern WCHAR BlScratchBuffer[8192];
2334 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
2335 #endif