Implement BlEnterFirmwareSetup() routine
This commit is contained in:
parent
7b2a2565c5
commit
94e6ca7aec
@ -312,6 +312,9 @@
|
||||
#define EFI_TEXT_BOX_FULL_BLOCK 0x2588
|
||||
#define EFI_TEXT_BOX_LIGHT_BLOCK 0x2591
|
||||
|
||||
/* EFI OS indication bits */
|
||||
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001ULL
|
||||
|
||||
/* EFI protocols GUIDs */
|
||||
#define EFI_BLOCK_IO_PROTOCOL_GUID {0x964E5B21, 0x6459, 0x11D2, {0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
|
||||
#define EFI_BLOCK_IO2_PROTOCOL_GUID {0xA77B2472, 0xE282, 0x4E9F, {0xA2, 0x45, 0xC2, 0xC0, 0xE2, 0x7B, 0xBC, 0xC1}}
|
||||
|
@ -9,6 +9,51 @@
|
||||
#include <xtldr.h>
|
||||
|
||||
|
||||
/**
|
||||
* Reboots into UEFI firmware setup interface.
|
||||
*
|
||||
* @return This routine returns a status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlEnterFirmwareSetup()
|
||||
{
|
||||
EFI_GUID Guid = EFI_GLOBAL_VARIABLE_GUID;
|
||||
PULONGLONG SetupSupport;
|
||||
ULONGLONG Indications;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Check if booting into firmware interface is supported */
|
||||
Status = BlGetEfiVariable(&Guid, L"OsIndicationsSupported", (PVOID*)&SetupSupport);
|
||||
if(Status != STATUS_EFI_SUCCESS || !(*SetupSupport & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
|
||||
{
|
||||
/* Reboot into firmware setup is not supported */
|
||||
BlDebugPrint(L"WARNING: Reboot into firmware setup interface not supported\n");
|
||||
return STATUS_EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/* Get the value of OsIndications variable */
|
||||
Indications = 0;
|
||||
Status = BlGetEfiVariable(&Guid, L"OsIndications", (PVOID)&Indications);
|
||||
|
||||
/* Enable FW setup on next boot */
|
||||
Indications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
|
||||
Status = BlSetEfiVariable(&Guid, L"OsIndications", (PVOID)&Indications, sizeof(Indications));
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to update OsIndications variable */
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Reboot into firmware setup */
|
||||
BlRebootSystem();
|
||||
|
||||
/* Must not reach this point, just make the compiler happy */
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exits EFI boot services.
|
||||
*
|
||||
|
@ -95,6 +95,10 @@ XTCDECL
|
||||
VOID
|
||||
BlEnableConsoleCursor();
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlEnterFirmwareSetup();
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlEnumerateBlockDevices();
|
||||
|
Loading…
Reference in New Issue
Block a user