1 | /*! |
2 | * @header |
3 | * Shims for the SPI. |
4 | */ |
5 | #ifndef __IMG4_SHIM_H |
6 | #define __IMG4_SHIM_H |
7 | |
8 | #ifndef __IMG4_INDIRECT |
9 | #error "Please #include <img4/firmware.h> instead of this file directly" |
10 | #endif // __IMG4_INDIRECT |
11 | |
12 | #include <stdint.h> |
13 | #include <stddef.h> |
14 | #include <stdbool.h> |
15 | |
16 | #if KERNEL |
17 | #define IMG4_TARGET_SHIM_FOUND 1 |
18 | #define IMG4_TARGET_XNU 1 |
19 | |
20 | #if __has_include(<img4/shim_xnu.h>) |
21 | #include <img4/shim_xnu.h> |
22 | #endif |
23 | |
24 | #if XNU_KERNEL_PRIVATE |
25 | #define IMG4_TARGET_XNU_PROPER 1 |
26 | #else |
27 | #define IMG4_TARGET_XNU_PROPER 0 |
28 | #endif |
29 | #endif // KERNEL |
30 | |
31 | |
32 | #if !IMG4_TARGET_SHIM_FOUND |
33 | #if EFI |
34 | #define IMG4_TARGET_EFI 1 |
35 | #if __has_include(<img4/shim_efi.h>) |
36 | #pragma clang diagnostic push |
37 | #pragma clang diagnostic ignored "-Wpragma-pack" |
38 | #include <img4/shim_efi.h> |
39 | #pragma clang diagnostic pop |
40 | #endif // __has_include(<img4/shim_efi.h>) |
41 | #elif SEP // EFI |
42 | #define IMG4_TARGET_SEP 1 |
43 | #include <img4/shim_sep.h> |
44 | #else // EFI |
45 | #define IMG4_TARGET_DARWIN 1 |
46 | #if __has_include(<img4/shim_darwin.h>) |
47 | #include <img4/shim_darwin.h> |
48 | #endif |
49 | #endif // EFI |
50 | #endif // !IMG4_TARGET_SHIM_FOUND |
51 | |
52 | #if IMG4_TARGET_XNU || IMG4_TARGET_DARWIN |
53 | #define IMG4_TARGET_DARWIN_GENERIC 1 |
54 | #endif |
55 | |
56 | #endif // __IMG4_SHIM_H |
57 | |