mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[BOOTMGFW]
- Checkpoint commit of about 1000+ lines of text console support code. Right now, it's very disorganized and not tested. - Write out the rest of the initialization path. Almost everything else is only for Boot Debugging, BitLocker, TPM, PXE... svn path=/trunk/; revision=69076
This commit is contained in:
parent
ec566e8082
commit
0cb7238f1d
5 changed files with 1419 additions and 12 deletions
|
@ -22,7 +22,8 @@ list(APPEND BOOTLIB_SOURCE
|
|||
lib/io/io.c
|
||||
lib/io/device.c
|
||||
lib/io/file.c
|
||||
lib/io/fat.c)
|
||||
lib/io/fat.c
|
||||
lib/platform/display.c)
|
||||
|
||||
if(ARCH STREQUAL "i386")
|
||||
list(APPEND BOOTLIB_ASM_SOURCE
|
||||
|
|
|
@ -73,10 +73,12 @@ EarlyPrint(_In_ PWCHAR Format, ...);
|
|||
|
||||
#define BL_MM_REMOVE_VIRTUAL_REGION_FLAG 0x80000000
|
||||
|
||||
#define BL_LIBRARY_FLAG_NO_DISPLAY 0x01
|
||||
#define BL_LIBRARY_FLAG_REINITIALIZE 0x02
|
||||
#define BL_LIBRARY_FLAG_REINITIALIZE_ALL 0x04
|
||||
#define BL_LIBRARY_FLAG_ZERO_HEAP_ALLOCATIONS_ON_FREE 0x10
|
||||
#define BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED 0x20
|
||||
#define BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE 0x800
|
||||
|
||||
#define BL_FS_REGISTER_AT_HEAD_FLAG 1
|
||||
|
||||
|
@ -595,6 +597,11 @@ FatInitialize (
|
|||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayInitialize (
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
/* FIRMWARE ROUTINES *********************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
@ -609,6 +616,45 @@ EfiStall (
|
|||
_In_ ULONG StallTime
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutQueryMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Mode,
|
||||
_In_ PULONG Columns,
|
||||
_In_ PULONG Rows
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Mode
|
||||
);
|
||||
|
||||
VOID
|
||||
EfiConOutReadCurrentMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_Out_ EFI_SIMPLE_TEXT_OUTPUT_MODE* Mode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetAttribute (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Attribute
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetCursorPosition (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Column,
|
||||
_In_ ULONG Row
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutEnableCursor (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ BOOLEAN Visible
|
||||
);
|
||||
|
||||
/* PLATFORM TIMER ROUTINES ***************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
@ -739,11 +785,21 @@ BlMmFreeHeap (
|
|||
_In_ PVOID Buffer
|
||||
);
|
||||
|
||||
/* DISPLAY ROUTINES **********************************************************/
|
||||
|
||||
VOID
|
||||
BlDisplayGetTextCellResolution (
|
||||
_Out_ PULONG TextWidth,
|
||||
_Out_ PULONG TextHeight
|
||||
);
|
||||
|
||||
extern ULONG MmDescriptorCallTreeCount;
|
||||
extern ULONG BlpApplicationFlags;
|
||||
extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
|
||||
extern BL_TRANSLATION_TYPE MmTranslationType;
|
||||
extern PBL_ARCH_CONTEXT CurrentExecutionContext;
|
||||
extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
|
||||
extern BL_APPLICATION_ENTRY BlpApplicationEntry;
|
||||
extern SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,8 +18,9 @@ PWCHAR BlpApplicationBaseDirectory;
|
|||
PBOOT_APPLICATION_PARAMETER_BLOCK BlpApplicationParameters;
|
||||
BL_APPLICATION_ENTRY BlpApplicationEntry;
|
||||
BOOLEAN BlpLibraryParametersInitialized;
|
||||
BOOLEAN EnSubsystemInitialized;
|
||||
LIST_ENTRY EnEventNotificationList;
|
||||
|
||||
ULONG PdPersistAllocations;
|
||||
LIST_ENTRY BlBadpListHead;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -178,34 +179,46 @@ InitializeLibrary (
|
|||
return Status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
/* Initialize support for Trusted Platform Module v1.2 */
|
||||
BlpTpmInitialize();
|
||||
#endif
|
||||
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
/* Initialize the event manager */
|
||||
EnSubsystemInitialized = 1;
|
||||
InitializeListHead(&EnEventNotificationList);
|
||||
#endif
|
||||
|
||||
/* Initialize the I/O Manager */
|
||||
/* Initialize the I/O Manager */i
|
||||
Status = BlpIoInitialize();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Destroy memory manager in phase 1 and the event manager */
|
||||
EarlyPrint(L"IO init failed\n");
|
||||
//if (EnSubsystemInitialized) BlpEnDestroy();
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
if (EnSubsystemInitialized)
|
||||
{
|
||||
BlpEnDestroy();
|
||||
}
|
||||
#endif
|
||||
//BlpMmDestroy(1);
|
||||
return Status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef BL_NET_SUPPORT
|
||||
/* Initialize the network stack */
|
||||
Status = BlNetInitialize();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Destroy the I/O, event, and memory managers in phase 1 */
|
||||
BlpIoDestroy();
|
||||
if (EnSubsystemInitialized) BlpEnDestroy();
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
if (EnSubsystemInitialized)
|
||||
{
|
||||
BlpEnDestroy();
|
||||
}
|
||||
#endif
|
||||
BlpMmDestroy(1);
|
||||
return Status;
|
||||
}
|
||||
|
@ -216,16 +229,122 @@ InitializeLibrary (
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Destroy the network, I/O, event, and memory managers in phase 1 */
|
||||
//BlNetDestroy();
|
||||
#ifdef BL_NET_SUPPORT
|
||||
BlNetDestroy();
|
||||
#endif
|
||||
//BlpIoDestroy();
|
||||
//if (EnSubsystemInitialized) BlpEnDestroy();
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
if (EnSubsystemInitialized)
|
||||
{
|
||||
BlpEnDestroy();
|
||||
}
|
||||
#endif
|
||||
//BlpMmDestroy(1);
|
||||
EarlyPrint(L"Util init failed\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
EarlyPrint(L"TODO!\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
#ifdef BL_KD_SUPPORT
|
||||
/* Initialize PCI Platform Support */
|
||||
PltInitializePciConfiguration();
|
||||
#endif
|
||||
|
||||
#ifdef BL_SECURE_BOOT_SUPPORT
|
||||
/* Read the current SecureBoot Policy*/
|
||||
Status = BlSecureBootSetActivePolicyFromPersistedData();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Destroy everything that we've currently set up */
|
||||
#ifdef BL_KD_SUPPORT
|
||||
PltDestroyPciConfiguration();
|
||||
#endif
|
||||
#ifdef BL_NET_SUPPORT
|
||||
BlNetDestroy();
|
||||
#endif
|
||||
BlpIoDestroy();
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
if (EnSubsystemInitialized)
|
||||
{
|
||||
BlpEnDestroy();
|
||||
}
|
||||
#endif
|
||||
BlpMmDestroy(1);
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
/* Initialize phase 0 of the security subsystem */
|
||||
SipInitializePhase0();
|
||||
#endif
|
||||
|
||||
#ifdef BL_KD_SUPPORT
|
||||
/* Bring up the boot debugger, now that SecureBoot has been processed */
|
||||
BlBdInitialize();
|
||||
#endif
|
||||
|
||||
#ifdef BL_ETW_SUPPORT
|
||||
/* Initialize internal logging */
|
||||
BlpLogInitialize();
|
||||
#endif
|
||||
|
||||
/* Are graphics enabled? */
|
||||
if (!(LibraryParameters->LibraryFlags & BL_LIBRARY_FLAG_NO_DISPLAY))
|
||||
{
|
||||
/* Initialize the graphics library */
|
||||
BlpDisplayInitialize(LibraryParameters->LibraryFlags);
|
||||
}
|
||||
|
||||
/* Initialize the boot application persistent data */
|
||||
PdPersistAllocations = 0;
|
||||
InitializeListHead(&BlBadpListHead);
|
||||
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
/* Now setup the security subsystem in phase 1 */
|
||||
BlpSiInitialize(1);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Setup the text, UI and font resources */
|
||||
Status = BlpResourceInitialize();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Tear down everything if this failed */
|
||||
if (!(LibraryParameters->LibraryFlags & BL_LIBRARY_FLAG_TEXT_MODE))
|
||||
{
|
||||
// BlpDisplayDestroy();
|
||||
}
|
||||
//BlpBdDestroy();
|
||||
#ifdef BL_KD_SUPPORT
|
||||
PltDestroyPciConfiguration();
|
||||
#endif
|
||||
#ifdef BL_NET_SUPPORT
|
||||
BlNetDestroy();
|
||||
#endif
|
||||
//BlpIoDestroy();
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
if (EnSubsystemInitialized)
|
||||
{
|
||||
BlpEnDestroy();
|
||||
}
|
||||
#endif
|
||||
//BlpMmDestroy(1);
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BL_BITLOCKER_SUPPORT
|
||||
/* Setup the boot cryptography library */
|
||||
g_pEnvironmentData = &SymCryptEnvironmentWindowsBootLibrary;
|
||||
if (SymCryptEnvWindowsBootLibInit)
|
||||
{
|
||||
SymCryptEnvWindowsBootLibInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We are fully initialized, remember this and exit with success */
|
||||
BlpLibraryParameters.LibraryFlags |= BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
Quickie:
|
||||
EarlyPrint(L"Exiting init: %lx\n", Status);
|
||||
|
|
|
@ -247,6 +247,186 @@ EfiStall (
|
|||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutQueryMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Mode,
|
||||
_In_ PULONG Columns,
|
||||
_In_ PULONG Rows
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->QueryMode(TextInterface, Mode, Columns, Rows);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Mode
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->SetMode(TextInterface, Mode);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetAttribute (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Attribute
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->SetAttribute(TextInterface, Attribute);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutSetCursorPosition (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ ULONG Column,
|
||||
_In_ ULONG Row
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->SetCursorPosition(TextInterface, Column, Row);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutEnableCursor (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ BOOLEAN Visible
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->EnableCursor(TextInterface, Visible);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
VOID
|
||||
EfiConOutReadCurrentMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_Out_ EFI_SIMPLE_TEXT_OUTPUT_MODE* Mode
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
RtlCopyMemory(Mode, TextInterface->Mode, sizeof(*Mode));
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiAllocatePages (
|
||||
_In_ ULONG Type,
|
||||
|
|
1051
reactos/boot/environ/lib/platform/display.c
Normal file
1051
reactos/boot/environ/lib/platform/display.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue