/*-1* Copyright (c) 2017 Netflix, Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11*12* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND13* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE14* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE15* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE16* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL17* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS18* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)19* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT20* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY21* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF22* SUCH DAMAGE.23*/2425#ifndef _EFI_OSDEP_H_26#define _EFI_OSDEP_H_2728/*29* Defines to adjust the types that EDK2 uses for FreeBSD so we can30* use the code and headers mostly unchanged. The headers are imported31* all into one directory to avoid case issues with filenames and32* included. The actual code is heavily modified since it has too many33* annoying dependencies that are difficult to satisfy.34*/3536#include <sys/cdefs.h>37#include <stdlib.h>38#include <stdint.h>39#include <uuid.h>4041typedef int8_t INT8;42typedef int16_t INT16;43typedef int32_t INT32;44typedef int64_t INT64;45typedef intptr_t INTN;46typedef uint8_t UINT8;47typedef uint16_t UINT16;48typedef uint32_t UINT32;49typedef uint64_t UINT64;50typedef uintptr_t UINTN;51//typedef uintptr_t EFI_PHYSICAL_ADDRESS;52//typedef uint32_t EFI_IPv4_ADDRESS;53//typedef uint8_t EFI_MAC_ADDRESS[6];54//typedef uint8_t EFI_IPv6_ADDRESS[16];55typedef uint8_t CHAR8;56typedef uint16_t CHAR16;57typedef UINT8 BOOLEAN;58typedef void VOID;59//typedef uuid_t GUID;60//typedef uuid_t EFI_GUID;6162/* We can't actually call this stuff, so snip out API syntactic sugar */63#define INTERFACE_DECL(x)64#define EFIAPI65#define IN66#define OUT67#define CONST const68#define OPTIONAL69//#define TRUE 170//#define FALSE 07172/*73* EDK2 has fine definitions for these, so let it define them.74*/75#undef NULL76#undef EFI_PAGE_SIZE77#undef EFI_PAGE_MASK7879/*80* Note: the EDK2 code assumed #pragma packed works and PACKED is a81* workaround for some old toolchain issues for EDK2 that aren't82* relevent to FreeBSD.83*/84#define PACKED8586/*87* Since we're not compiling for the UEFI boot time (which use ms abi88* conventions), tell EDK2 to define VA_START correctly. For the boot89* loader, this likely needs to be different.90*/91#define NO_MSABI_VA_FUNCS 19293/*94* Finally, we need to define the processor we are in EDK2 terms.95*/96#if defined(__i386__)97#define MDE_CPU_IA3298#elif defined(__amd64__)99#define MDE_CPU_X64100#elif defined(__arm__)101#define MDE_CPU_ARM102#elif defined(__aarch64__)103#define MDE_CPU_AARCH64104#elif defined(__riscv)105#define MDE_CPU_RISCV64106#endif107/* FreeBSD doesn't have/use MDE_CPU_EBC or MDE_CPU_IPF (ia64) */108109#endif /* _EFI_OSDEP_H_ */110111112