Initial support for xtldr modules and bootloader protocol

This commit is contained in:
2022-09-17 00:14:09 +02:00
parent 33ff15e1db
commit 109c24f389
11 changed files with 262 additions and 15 deletions

View File

@@ -18,6 +18,43 @@ PEFI_SYSTEM_TABLE EfiSystemTable;
/* Serial port configuration */
CPPORT EfiSerialPort;
/**
* This routine loads XTLDR EFI modules.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
EFI_STATUS
BlLoadEfiModules()
{
EFI_STATUS Status;
return STATUS_EFI_SUCCESS;
}
/**
* This routine registers XTLDR protocol for further usage by modules.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
EFI_STATUS
BlRegisterXtLoaderProtocol()
{
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
XT_BOOT_LOADER_PROTOCOL LoaderProtocol;
EFI_HANDLE Handle;
/* Set all routines available via loader protocol */
LoaderProtocol.DbgPrint = BlDbgPrint;
LoaderProtocol.EfiPrint = BlEfiPrint;
/* Register loader protocol */
return EfiSystemTable->BootServices->InstallProtocolInterface(&Handle, &Guid, EFI_NATIVE_INTERFACE, &LoaderProtocol);
}
/**
* This routine is the entry point of the XT EFI boot loader.
*
@@ -60,6 +97,20 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
BlDbgPrint(L"WARNING: Failed to disable watchdog timer\n");
}
/* Register loader protocol */
Status = BlRegisterXtLoaderProtocol();
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to register loader protocol */
BlDbgPrint(L"ERROR: Failed to register XTLDR loader protocol\n");
}
Status = BlLoadEfiModules();
if(Status != STATUS_EFI_SUCCESS)
{
BlDbgPrint(L"ERROR: Failed to load XTLDR modules\n");
}
/* Discover and enumerate EFI block devices */
BlEnumerateEfiBlockDevices();