2 * Copyright (c) 2017 Netflix, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * Defines to adjust the types that EDK2 uses for FreeBSD so we can
34 * use the code and headers mostly unchanged. The headers are imported
35 * all into one directory to avoid case issues with filenames and
36 * included. The actual code is heavily modified since it has too many
37 * annoying dependencies that are difficult to satisfy.
40 #include <sys/cdefs.h>
46 typedef int16_t INT16;
47 typedef int32_t INT32;
48 typedef int64_t INT64;
49 typedef intptr_t INTN;
50 typedef uint8_t UINT8;
51 typedef uint16_t UINT16;
52 typedef uint32_t UINT32;
53 typedef uint64_t UINT64;
54 typedef uintptr_t UINTN;
55 //typedef uintptr_t EFI_PHYSICAL_ADDRESS;
56 //typedef uint32_t EFI_IPv4_ADDRESS;
57 //typedef uint8_t EFI_MAC_ADDRESS[6];
58 //typedef uint8_t EFI_IPv6_ADDRESS[16];
59 typedef uint8_t CHAR8;
60 typedef uint16_t CHAR16;
61 typedef UINT8 BOOLEAN;
63 //typedef uuid_t GUID;
64 //typedef uuid_t EFI_GUID;
66 /* We can't actually call this stuff, so snip out API syntactic sugar */
67 #define INTERFACE_DECL(x)
77 * EDK2 has fine definitions for these, so let it define them.
84 * Note: the EDK2 code assumed #pragma packed works and PACKED is a
85 * workaround for some old toolchain issues for EDK2 that aren't
86 * relevent to FreeBSD.
91 * Since we're not compiling for the UEFI boot time (which use ms abi
92 * conventions), tell EDK2 to define VA_START correctly. For the boot
93 * loader, this likely needs to be different.
95 #define NO_MSABI_VA_FUNCS 1
98 * Finally, we need to define the processor we are in EDK2 terms.
100 #if defined(__i386__)
102 #elif defined(__amd64__)
104 #elif defined(__arm__)
106 #elif defined(__aarch64__)
107 #define MDE_CPU_AARCH64
109 /* FreeBSD doesn't have/use MDE_CPU_EBC or MDE_CPU_IPF (ia64) */
111 #endif /* _EFI_OSDEP_H_ */