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