[BOOT:LIB] Implement BlpFwInitialize()
This commit is contained in:
64
BOOT/ENVIRON/LIB/EFI/efifw.c
Normal file
64
BOOT/ENVIRON/LIB/EFI/efifw.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2024, Quinn Stephens.
|
||||
Provided under the BSD 3-Clause license.
|
||||
|
||||
Module Name:
|
||||
|
||||
efifw.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Provides EFI firmware utilities.
|
||||
|
||||
--*/
|
||||
|
||||
#include "bootlib.h"
|
||||
#include "bootmgr.h"
|
||||
|
||||
EFI_SYSTEM_TABLE *EfiST;
|
||||
EFI_BOOT_SERVICES *EfiBS;
|
||||
EFI_RUNTIME_SERVICES *EfiRT;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut;
|
||||
SIMPLE_INPUT_INTERFACE *EfiConIn;
|
||||
|
||||
NTSTATUS
|
||||
BlpFwInitialize (
|
||||
IN ULONG Stage,
|
||||
IN PBOOT_FIRMWARE_DATA FirmwareData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Internal routine to initialize the boot library.
|
||||
|
||||
Arguments:
|
||||
|
||||
Stage - 0 or 1.
|
||||
|
||||
FirmwareData - firmware data structure to use for initialization.
|
||||
|
||||
Return Value:
|
||||
|
||||
STATUS_SUCCESS if successful,
|
||||
STATUS_INVALID_PARAMETER if FirmwareData is invalid.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
if (FirmwareData == NULL || FirmwareData->Version == 0) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Stage == 0) {
|
||||
EfiST = FirmwareData->SystemTable;
|
||||
EfiBS = EfiST->BootServices;
|
||||
EfiRT = EfiST->RuntimeServices;
|
||||
EfiConOut = EfiST->ConOut;
|
||||
EfiConIn = EfiST->ConIn;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user