[BOOT:LIB] More initialization and cleanup
Started BlpMmDestroy(), MmMdDestroy(), MmPaDestroy(), EfiSetWatchdogTimer(), EfiOpenProtocol(), EfiConInExSetState(), and BlDestroyLibrary(). Completed BlpFwInitialize(). Improved InitializeLibrary().
This commit is contained in:
@@ -16,14 +16,17 @@ Abstract:
|
||||
#include <ntrtl.h>
|
||||
#include "bootlib.h"
|
||||
#include "efi.h"
|
||||
#include "efilib.h"
|
||||
|
||||
BOOT_FIRMWARE_DATA EfiFirmwareData;
|
||||
PBOOT_FIRMWARE_DATA EfiFirmwareParameters;
|
||||
EFI_HANDLE EfiImageHandle;
|
||||
EFI_SYSTEM_TABLE *EfiST;
|
||||
EFI_BOOT_SERVICES *EfiBS;
|
||||
EFI_RUNTIME_SERVICES *EfiRT;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut;
|
||||
SIMPLE_INPUT_INTERFACE *EfiConIn;
|
||||
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
|
||||
|
||||
NTSTATUS
|
||||
BlpFwInitialize (
|
||||
@@ -54,6 +57,9 @@ Return Value:
|
||||
--*/
|
||||
|
||||
{
|
||||
NTSTATUS Status;
|
||||
EFI_KEY_TOGGLE_STATE KeyToggleState;
|
||||
|
||||
if (FirmwareData == NULL || FirmwareData->Version == 0) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -62,16 +68,33 @@ Return Value:
|
||||
RtlCopyMemory(&EfiFirmwareData, FirmwareData, sizeof(BOOT_FIRMWARE_DATA));
|
||||
EfiFirmwareParameters = &EfiFirmwareData;
|
||||
|
||||
EfiImageHandle = FirmwareData->ImageHandle;
|
||||
EfiST = FirmwareData->SystemTable;
|
||||
EfiBS = EfiST->BootServices;
|
||||
EfiRT = EfiST->RuntimeServices;
|
||||
EfiConOut = EfiST->ConOut;
|
||||
EfiConIn = EfiST->ConIn;
|
||||
}
|
||||
EfiConInEx = NULL;
|
||||
} else if (Stage == 1) {
|
||||
//
|
||||
// Open the extended console input protocol.
|
||||
// If successful, tell it to capture partial key events.
|
||||
//
|
||||
Status = EfiOpenProtocol(
|
||||
EfiST->ConsoleInHandle,
|
||||
&EfiSimpleTextInputExProtocol,
|
||||
(VOID**)&EfiConInEx
|
||||
);
|
||||
if (NT_SUCCESS(Status)) {
|
||||
KeyToggleState = EFI_KEY_STATE_EXPOSED | EFI_TOGGLE_STATE_VALID;
|
||||
EfiConInExSetState(EfiConInEx, &KeyToggleState);
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Implement stage 1 initialization.
|
||||
//
|
||||
//
|
||||
// Disable the watchdog timer.
|
||||
//
|
||||
EfiSetWatchdogTimer(0, 0, 0, NULL);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user