forked from xt-sys/exectos
Allow BlGetXtLoaderProtocol() routine to store loader protocol in a specified variable
This commit is contained in:
parent
96a848b498
commit
f8a120a24c
@ -18,7 +18,7 @@
|
|||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetXtLoaderProtocol()
|
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
|
||||||
{
|
{
|
||||||
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
||||||
PEFI_HANDLE Handles = NULL;
|
PEFI_HANDLE Handles = NULL;
|
||||||
@ -41,7 +41,7 @@ BlGetXtLoaderProtocol()
|
|||||||
for(Index = 0; Index < Count; Index++)
|
for(Index = 0; Index < Count; Index++)
|
||||||
{
|
{
|
||||||
/* Try to open protocol */
|
/* 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);
|
EfiImageHandle, NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
|
||||||
|
|
||||||
/* Check if successfully opened the loader protocol */
|
/* Check if successfully opened the loader protocol */
|
||||||
@ -57,7 +57,7 @@ BlGetXtLoaderProtocol()
|
|||||||
EfiSystemTable->BootServices->FreePool(Handles);
|
EfiSystemTable->BootServices->FreePool(Handles);
|
||||||
|
|
||||||
/* Make sure the loaded protocol has been found */
|
/* Make sure the loaded protocol has been found */
|
||||||
if(EfiXtLdrProtocol == NULL)
|
if(*LdrProtocol == NULL)
|
||||||
{
|
{
|
||||||
/* Protocol not found */
|
/* Protocol not found */
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
EXTERN PXT_BOOT_LOADER_PROTOCOL EfiXtLdrProtocol;
|
EXTERN PXT_BOOT_LOADER_PROTOCOL EfiXtLdrProtocol;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetXtLoaderProtocol();
|
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol);
|
||||||
|
|
||||||
#endif /* __XTLDR_BLMOD_H */
|
#endif /* __XTLDR_BLMOD_H */
|
||||||
|
@ -36,14 +36,20 @@ EFI_STATUS
|
|||||||
BlXtLoaderModuleMain(EFI_HANDLE ImageHandle,
|
BlXtLoaderModuleMain(EFI_HANDLE ImageHandle,
|
||||||
PEFI_SYSTEM_TABLE SystemTable)
|
PEFI_SYSTEM_TABLE SystemTable)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Set the system table and image handle */
|
/* Set the system table and image handle */
|
||||||
EfiImageHandle = ImageHandle;
|
EfiImageHandle = ImageHandle;
|
||||||
EfiSystemTable = SystemTable;
|
EfiSystemTable = SystemTable;
|
||||||
|
|
||||||
/* Open the XTLDR protocol */
|
/* 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 */
|
/* Return success */
|
||||||
EfiXtLdrProtocol->EfiPrint(L"XTLDR dummy module initialized\n");
|
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user