This commit is contained in:
parent
1296b44ae0
commit
37a37c225f
@ -11,6 +11,7 @@ include_directories(
|
|||||||
|
|
||||||
# Specify list of source code files
|
# Specify list of source code files
|
||||||
list(APPEND XTLDR_SOURCE
|
list(APPEND XTLDR_SOURCE
|
||||||
|
${XTLDR_SOURCE_DIR}/blproto.c
|
||||||
${XTLDR_SOURCE_DIR}/console.c
|
${XTLDR_SOURCE_DIR}/console.c
|
||||||
${XTLDR_SOURCE_DIR}/efiutil.c
|
${XTLDR_SOURCE_DIR}/efiutil.c
|
||||||
${XTLDR_SOURCE_DIR}/string.c
|
${XTLDR_SOURCE_DIR}/string.c
|
||||||
|
@ -7,12 +7,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtbl.h>
|
#include <xtbl.h>
|
||||||
#include <blmod.h>
|
#include <blproto.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine locates and opens the XT boot loader protocol.
|
* This routine locates and opens the XT boot loader protocol.
|
||||||
*
|
*
|
||||||
|
* @param LdrProtocol
|
||||||
|
* Supplies the address where a pointer to the loader protocol is returned.
|
||||||
|
*
|
||||||
* @return This routine returns status code.
|
* @return This routine returns status code.
|
||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
@ -21,13 +24,35 @@ EFI_STATUS
|
|||||||
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
|
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
|
||||||
{
|
{
|
||||||
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
EFI_GUID Guid = XT_BOOT_LOADER_PROTOCOL_GUID;
|
||||||
|
|
||||||
|
/* Load XTLDR protocol */
|
||||||
|
return BlLoadXtProtocol((PVOID *)LdrProtocol, &Guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine locates and opens the requested XT protocol.
|
||||||
|
*
|
||||||
|
* @param ProtocolHandler
|
||||||
|
* Supplies the address where a pointer to the opened protocol is returned.
|
||||||
|
*
|
||||||
|
* @param ProtocolGuid
|
||||||
|
* Supplies a pointer to the unique protocol GUID.
|
||||||
|
*
|
||||||
|
* @return This routine returns status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
EFI_STATUS
|
||||||
|
BlLoadXtProtocol(PVOID *ProtocolHandler,
|
||||||
|
PEFI_GUID ProtocolGuid)
|
||||||
|
{
|
||||||
PEFI_HANDLE Handles = NULL;
|
PEFI_HANDLE Handles = NULL;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT_PTR Count;
|
UINT_PTR Count;
|
||||||
UINT Index;
|
UINT Index;
|
||||||
|
|
||||||
/* Try to locate the handles */
|
/* Try to locate the handles */
|
||||||
Status = EfiSystemTable->BootServices->LocateHandleBuffer(ByProtocol, &Guid, NULL, &Count, &Handles);
|
Status = EfiSystemTable->BootServices->LocateHandleBuffer(ByProtocol, ProtocolGuid, NULL, &Count, &Handles);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Unable to get handles */
|
/* Unable to get handles */
|
||||||
@ -41,7 +66,7 @@ BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
|
|||||||
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*)LdrProtocol,
|
Status = EfiSystemTable->BootServices->OpenProtocol(Handles[Index], ProtocolGuid, ProtocolHandler,
|
||||||
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 +82,7 @@ BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol)
|
|||||||
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(*LdrProtocol == NULL)
|
if(*ProtocolHandler == NULL)
|
||||||
{
|
{
|
||||||
/* Protocol not found */
|
/* Protocol not found */
|
||||||
return STATUS_EFI_NOT_FOUND;
|
return STATUS_EFI_NOT_FOUND;
|
||||||
|
@ -16,4 +16,8 @@
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol);
|
BlGetXtLoaderProtocol(PXT_BOOT_LOADER_PROTOCOL *LdrProtocol);
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
BlLoadXtProtocol(PVOID *ProtocolHandler,
|
||||||
|
PEFI_GUID ProtocolGuid);
|
||||||
|
|
||||||
#endif /* __XTLDR_BLMOD_H */
|
#endif /* __XTLDR_BLMOD_H */
|
@ -16,6 +16,9 @@
|
|||||||
/* EFI Image Handle */
|
/* EFI Image Handle */
|
||||||
EXTERN EFI_HANDLE EfiImageHandle;
|
EXTERN EFI_HANDLE EfiImageHandle;
|
||||||
|
|
||||||
|
/* XT Boot Loader protocol */
|
||||||
|
EXTERN XT_BOOT_LOADER_PROTOCOL EfiLdrProtocol;
|
||||||
|
|
||||||
/* EFI System Table */
|
/* EFI System Table */
|
||||||
EXTERN PEFI_SYSTEM_TABLE EfiSystemTable;
|
EXTERN PEFI_SYSTEM_TABLE EfiSystemTable;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xtbl.h>
|
#include <xtbl.h>
|
||||||
#include <blmod.h>
|
#include <blproto.h>
|
||||||
|
|
||||||
|
|
||||||
/* EFI Image Handle */
|
/* EFI Image Handle */
|
||||||
|
Loading…
Reference in New Issue
Block a user