/* SPDX-License-Identifier: GPL-2.0+ */
/*
 *  Internal structures for the EFI driver binding protocol
 *
 *  Copyright (c) 2017 Heinrich Schuchardt
 */

#ifndef _EFI_DRIVER_H
#define _EFI_DRIVER_H 1

#include <efi_loader.h>

/**
 * struct efi_driver_binding_extended_protocol - extended driver binding protocol
 *
 * This structure adds internal fields to the driver binding protocol.
 *
 * @bp:		driver binding protocol
 * @ops:	operations supported by the driver
 */
struct efi_driver_binding_extended_protocol {
	struct efi_driver_binding_protocol bp;
	const struct efi_driver_ops *ops;
};

/**
 * struct efi_driver_ops - operations support by an EFI driver
 *
 * @protocol:		The GUID of the protocol which is consumed by the
 *			driver. This GUID is used by the EFI uclass in the
 *			supports() and start() methods of the
 *			EFI_DRIVER_BINDING_PROTOCOL.
 * @child_protocol:	Protocol supported by the child handles generated by
 *			the EFI driver.
 * @init:		Function called by the EFI uclass after installing the
 *			driver binding protocol.
 * @bind:		Function called by the EFI uclass to attach the
 *			driver to EFI driver to a handle.
 */
struct efi_driver_ops {
	const efi_guid_t *protocol;
	const efi_guid_t *child_protocol;
	efi_status_t (*init)(struct efi_driver_binding_extended_protocol *this);
	efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
			     efi_handle_t handle, void *interface);
};

#endif /* _EFI_DRIVER_H */