/src/barebox/include/efi/mode.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | |
3 | | #ifndef __EFI_MODE_H |
4 | | #define __EFI_MODE_H |
5 | | |
6 | | #include <linux/stddef.h> |
7 | | #include <linux/types.h> |
8 | | #include <efi/types.h> |
9 | | |
10 | | struct efi_boot_services; |
11 | | struct efi_runtime_services; |
12 | | extern struct efi_boot_services *BS, *loaderBS; |
13 | | extern struct efi_runtime_services *RT, *loaderRT; |
14 | | |
15 | | enum efi_loader_state { |
16 | | EFI_LOADER_INACTIVE = 0, |
17 | | EFI_LOADER_BOOT, |
18 | | EFI_LOADER_RUNTIME, |
19 | | }; |
20 | | |
21 | | #if IN_PBL && defined(CONFIG_EFI_STUB) |
22 | | bool efi_is_payload(void); |
23 | | #else |
24 | | static inline bool efi_is_payload(void) |
25 | 0 | { |
26 | 0 | return IS_ENABLED(CONFIG_EFI_PAYLOAD) && IN_PROPER && BS; |
27 | 0 | } Unexecuted instantiation: memory.c:efi_is_payload Unexecuted instantiation: startup.c:efi_is_payload Unexecuted instantiation: bootm.c:efi_is_payload Unexecuted instantiation: bfetch.c:efi_is_payload |
28 | | #endif |
29 | | |
30 | | #ifdef CONFIG_EFI_LOADER |
31 | | enum efi_loader_state efi_is_loader(void); |
32 | | #else |
33 | | static inline enum efi_loader_state efi_is_loader(void) |
34 | 0 | { |
35 | 0 | return EFI_LOADER_INACTIVE; |
36 | 0 | } Unexecuted instantiation: memory.c:efi_is_loader Unexecuted instantiation: startup.c:efi_is_loader Unexecuted instantiation: bootm.c:efi_is_loader Unexecuted instantiation: bfetch.c:efi_is_loader |
37 | | #endif |
38 | | |
39 | | |
40 | | static inline struct efi_boot_services *efi_get_boot_services(void) |
41 | 0 | { |
42 | 0 | if (efi_is_payload()) |
43 | 0 | return BS; |
44 | 0 | if (efi_is_loader()) |
45 | 0 | return loaderBS; |
46 | 0 |
|
47 | 0 | return NULL; |
48 | 0 | } Unexecuted instantiation: memory.c:efi_get_boot_services Unexecuted instantiation: startup.c:efi_get_boot_services Unexecuted instantiation: bootm.c:efi_get_boot_services Unexecuted instantiation: bfetch.c:efi_get_boot_services |
49 | | |
50 | | static inline struct efi_runtime_services *efi_get_runtime_services(void) |
51 | 0 | { |
52 | 0 | if (efi_is_payload()) |
53 | 0 | return RT; |
54 | 0 | if (efi_is_loader()) |
55 | 0 | return loaderRT; |
56 | 0 |
|
57 | 0 | return NULL; |
58 | 0 | } Unexecuted instantiation: memory.c:efi_get_runtime_services Unexecuted instantiation: startup.c:efi_get_runtime_services Unexecuted instantiation: bootm.c:efi_get_runtime_services Unexecuted instantiation: bfetch.c:efi_get_runtime_services |
59 | | |
60 | | #endif |