summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/reboot.h
blob: 361988ff1e5942b63a334e8a538c3ee0906d9d5c (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef _IPXE_REBOOT_H
#define _IPXE_REBOOT_H

/** @file
 *
 * iPXE reboot API
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
FILE_SECBOOT ( PERMITTED );

#include <ipxe/api.h>
#include <config/reboot.h>

/**
 * Calculate static inline reboot API function name
 *
 * @v _prefix		Subsystem prefix
 * @v _api_func		API function
 * @ret _subsys_func	Subsystem API function
 */
#define REBOOT_INLINE( _subsys, _api_func ) \
	SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func )

/**
 * Provide an reboot API implementation
 *
 * @v _prefix		Subsystem prefix
 * @v _api_func		API function
 * @v _func		Implementing function
 */
#define PROVIDE_REBOOT( _subsys, _api_func, _func ) \
	PROVIDE_SINGLE_API ( REBOOT_PREFIX_ ## _subsys, _api_func, _func )

/**
 * Provide a static inline reboot API implementation
 *
 * @v _prefix		Subsystem prefix
 * @v _api_func		API function
 */
#define PROVIDE_REBOOT_INLINE( _subsys, _api_func ) \
	PROVIDE_SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func )

/* Include all architecture-independent reboot API headers */
#include <ipxe/null_reboot.h>
#include <ipxe/efi/efi_reboot.h>

/* Include all architecture-dependent reboot API headers */
#include <bits/reboot.h>

/**
 * Reboot system
 *
 * @v flags		Reboot flags
 */
void reboot ( int flags );

#define REBOOT_WARM	0x00000001 /**< Perform a warm reboot */
#define REBOOT_SETUP	0x00000002 /**< Reboot to firmware setup */

/**
 * Power off system
 *
 * @ret rc		Return status code
 *
 * This function may fail, since not all systems support being powered
 * off by software.
 */
int poweroff ( void );

#endif /* _IPXE_REBOOT_H */