[efi] Allow for optional protocols
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
f4e069bf2e
commit
95cff6a4d8
@ -59,6 +59,8 @@ struct efi_protocol {
|
|||||||
EFI_GUID guid;
|
EFI_GUID guid;
|
||||||
/** Variable containing pointer to protocol structure */
|
/** Variable containing pointer to protocol structure */
|
||||||
void **protocol;
|
void **protocol;
|
||||||
|
/** Protocol is required */
|
||||||
|
int required;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** EFI protocol table */
|
/** EFI protocol table */
|
||||||
@ -78,6 +80,21 @@ struct efi_protocol {
|
|||||||
.protocol = ( ( void ** ) ( void * ) \
|
.protocol = ( ( void ** ) ( void * ) \
|
||||||
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
|
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
|
||||||
(_ptr) : (_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 */
|
/** An EFI configuration table used by iPXE */
|
||||||
|
@ -187,8 +187,9 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
|
|||||||
} else {
|
} else {
|
||||||
DBGC ( systab, "EFI does not provide protocol %s\n",
|
DBGC ( systab, "EFI does not provide protocol %s\n",
|
||||||
efi_guid_ntoa ( &prot->guid ) );
|
efi_guid_ntoa ( &prot->guid ) );
|
||||||
/* All protocols are required */
|
/* Fail if protocol is required */
|
||||||
return efirc;
|
if ( prot->required )
|
||||||
|
return efirc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user