david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[efi] Allow for optional protocols

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2014-05-19 20:23:31 +01:00
parent f4e069bf2e
commit 95cff6a4d8
2 changed files with 20 additions and 2 deletions

View File

@ -59,6 +59,8 @@ struct efi_protocol {
EFI_GUID guid;
/** Variable containing pointer to protocol structure */
void **protocol;
/** Protocol is required */
int required;
};
/** EFI protocol table */
@ -78,6 +80,21 @@ struct efi_protocol {
.protocol = ( ( void ** ) ( void * ) \
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
(_ptr) : (_ptr) ) ), \
.required = 1, \
}
/** Declare an EFI protocol to be requested by iPXE
*
* @v _protocol EFI protocol name
* @v _ptr Pointer to protocol instance
*/
#define EFI_REQUEST_PROTOCOL( _protocol, _ptr ) \
struct efi_protocol __ ## _protocol __efi_protocol = { \
.guid = _protocol ## _GUID, \
.protocol = ( ( void ** ) ( void * ) \
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
(_ptr) : (_ptr) ) ), \
.required = 0, \
}
/** An EFI configuration table used by iPXE */

View File

@ -187,8 +187,9 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
} else {
DBGC ( systab, "EFI does not provide protocol %s\n",
efi_guid_ntoa ( &prot->guid ) );
/* All protocols are required */
return efirc;
/* Fail if protocol is required */
if ( prot->required )
return efirc;
}
}