summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/efi/efi_driver.h
blob: e5872ced3da0c77825d8441ffe372744b410044c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _IPXE_EFI_DRIVER_H
#define _IPXE_EFI_DRIVER_H

/** @file
 *
 * EFI driver interface
 */

FILE_LICENCE ( GPL2_OR_LATER );

#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/DriverBinding.h>
#include <ipxe/efi/Protocol/ComponentName2.h>
#include <ipxe/efi/Protocol/DevicePath.h>

/** An EFI driver */
struct efi_driver {
	/** Name */
	const char *name;
	/** EFI name */
	CHAR16 wname[32];
	/** EFI driver binding protocol */
	EFI_DRIVER_BINDING_PROTOCOL driver;
	/** EFI component name protocol */
	EFI_COMPONENT_NAME2_PROTOCOL wtf;
};

/** Initialise an EFI driver
 *
 * @v name		Driver name
 * @v supported		Device supported method
 * @v start		Device start method
 * @v stop		Device stop method
 */
#define EFI_DRIVER_INIT( _name, _supported, _start, _stop ) {	\
	.name = _name,						\
	.driver = {						\
		.Supported = _supported,			\
		.Start = _start,				\
		.Stop = _stop,					\
		.Version = 0x10,				\
	} }

extern EFI_DEVICE_PATH_PROTOCOL *
efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL *path );

extern EFI_STATUS efi_driver_install ( struct efi_driver *efidrv );

#endif /* _IPXE_EFI_DRIVER_H */