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