Allow BlGetXtLoaderProtocol() routine to store loader protocol in a specified variable
ci/woodpecker/push/build Pipeline was successful Details

This commit is contained in:
Rafal Kupiec 2022-10-18 15:44:21 +02:00
parent 96a848b498
commit f8a120a24c
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 13 additions and 7 deletions

View File

@ -18,7 +18,7 @@
* @since XT 1.0
*/
EFI_STATUS
BlGetXtLoaderProtocol()
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
{
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
PEFI_HANDLE Handles = NULL;
@ -41,7 +41,7 @@ BlGetXtLoaderProtocol()
for(Index = 0; Index < Count; Index++)
{
/* Try to open protocol */
Status = EfiSystemTable->BootServices->OpenProtocol(Handles[Index], &Guid, (PVOID*)&EfiXtLdrProtocol,
Status = EfiSystemTable->BootServices->OpenProtocol(Handles[Index], &Guid, (PVOID*)LdrProtocol,
EfiImageHandle, NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
/* Check if successfully opened the loader protocol */
@ -57,7 +57,7 @@ BlGetXtLoaderProtocol()
EfiSystemTable->BootServices->FreePool(Handles);
/* Make sure the loaded protocol has been found */
if(EfiXtLdrProtocol == NULL)
if(*LdrProtocol == NULL)
{
/* Protocol not found */
return STATUS_EFI_NOT_FOUND;

View File

@ -17,6 +17,6 @@
EXTERN PXT_BOOT_LOADER_PROTOCOL EfiXtLdrProtocol;
EFI_STATUS
BlGetXtLoaderProtocol();
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol);
#endif /* __XTLDR_BLMOD_H */

View File

@ -36,14 +36,20 @@ EFI_STATUS
BlXtLoaderModuleMain(EFI_HANDLE ImageHandle,
PEFI_SYSTEM_TABLE SystemTable)
{
EFI_STATUS Status;
/* Set the system table and image handle */
EfiImageHandle = ImageHandle;
EfiSystemTable = SystemTable;
/* Open the XTLDR protocol */
BlGetXtLoaderProtocol();
Status = BlGetXtLoaderProtocol(&EfiXtLdrProtocol);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to open loader protocol */
return STATUS_EFI_PROTOCOL_ERROR;
}
/* Print message and return success */
EfiXtLdrProtocol->EfiPrint(L"XTLDR dummy module initialized\n");
/* Return success */
return STATUS_EFI_SUCCESS;
}