Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F158271501
D53651.id166103.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D53651.id166103.diff
View Options
diff --git a/lib/libefivar/ProcessorBind.h b/lib/libefivar/ProcessorBind.h
--- a/lib/libefivar/ProcessorBind.h
+++ b/lib/libefivar/ProcessorBind.h
@@ -1,3 +1,3 @@
/* File in public domain */
/* Brings in the glue for UEFI/EDK2 Tianocore code to run on this OS */
-#include "efi-osdep.h"
+#include <sys/efi-edk2.h>
diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c
--- a/lib/libefivar/efivar-dp-format.c
+++ b/lib/libefivar/efivar-dp-format.c
@@ -33,10 +33,7 @@
#include <string.h>
#include "efichar.h"
-
-#include "efi-osdep.h"
#include "efivar-dp.h"
-
#include "uefi-dplib.h"
/*
diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c
--- a/lib/libefivar/efivar-dp-parse.c
+++ b/lib/libefivar/efivar-dp-parse.c
@@ -35,10 +35,7 @@
#include <wchar.h>
#include "efichar.h"
-
-#include "efi-osdep.h"
#include "efivar-dp.h"
-
#include "uefi-dplib.h"
/* XXX STUBS -- this stuff doesn't work yet */
diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c
--- a/lib/libefivar/efivar-dp-xlate.c
+++ b/lib/libefivar/efivar-dp-xlate.c
@@ -39,10 +39,7 @@
#include <string.h>
#include "efichar.h"
-
-#include "efi-osdep.h"
#include "efivar-dp.h"
-
#include "uefi-dplib.h"
#define MAX_DP_SANITY 4096 /* Biggest device path in bytes */
diff --git a/lib/libefivar/uefi-dplib.h b/lib/libefivar/uefi-dplib.h
--- a/lib/libefivar/uefi-dplib.h
+++ b/lib/libefivar/uefi-dplib.h
@@ -37,6 +37,7 @@
#ifndef _UEFI_DEVICE_PATH_LIB_H_
#define _UEFI_DEVICE_PATH_LIB_H_
+
#include <Uefi.h>
#include <Protocol/DevicePathUtilities.h>
#include <Protocol/DebugPort.h>
diff --git a/lib/libefivar/uefi-dputil.c b/lib/libefivar/uefi-dputil.c
--- a/lib/libefivar/uefi-dputil.c
+++ b/lib/libefivar/uefi-dputil.c
@@ -33,9 +33,6 @@
#include <stdio.h>
#include <string.h>
#include <sys/endian.h>
-
-#include "efi-osdep.h"
-
#include "uefi-dplib.h"
/* XXX maybe I should include the entire DevicePathUtiltiies.c and ifdef out what we don't use */
diff --git a/lib/libefivar/efi-osdep.h b/sys/sys/efi-edk2.h
rename from lib/libefivar/efi-osdep.h
rename to sys/sys/efi-edk2.h
--- a/lib/libefivar/efi-osdep.h
+++ b/sys/sys/efi-edk2.h
@@ -1,30 +1,11 @@
-/*-
- * Copyright (c) 2017 Netflix, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+/*
+ * Copyright (c) 2017-2025 Netflix, Inc.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * SPDX-License-Identifier: BSD-2-Clause
*/
-#ifndef _EFI_OSDEP_H_
-#define _EFI_OSDEP_H_
+#ifndef _SYS_EFI_EDK2_H_
+#define _SYS_EFI_EDK2_H_
/*
* Defines to adjust the types that EDK2 uses for FreeBSD so we can
@@ -34,10 +15,8 @@
* annoying dependencies that are difficult to satisfy.
*/
-#include <sys/cdefs.h>
#include <stdlib.h>
#include <stdint.h>
-#include <uuid.h>
typedef int8_t INT8;
typedef int16_t INT16;
@@ -61,7 +40,7 @@
//typedef uuid_t EFI_GUID;
/* We can't actually call this stuff, so snip out API syntactic sugar */
-#define INTERFACE_DECL(x)
+#define INTERFACE_DECL(x) struct x
#define EFIAPI
#define IN
#define OUT
@@ -107,4 +86,18 @@
#endif
/* FreeBSD doesn't have/use MDE_CPU_EBC or MDE_CPU_IPF (ia64) */
-#endif /* _EFI_OSDEP_H_ */
+#if __SIZEOF_LONG__ == 4
+#define MAX_BIT 0x80000000
+#else
+#define MAX_BIT 0x8000000000000000
+#endif
+
+/*
+ * Sometimes EFI is included after sys/param.h, and that causes a collision. We
+ * get a collision the other way too, so when including both, you have to
+ * include sys/param.h first.
+ */
+#undef MAX
+#undef MIN
+
+#endif /* _SYS_EFI_EDK2_H_ */
diff --git a/sys/sys/efi-freebsd.h b/sys/sys/efi-freebsd.h
new file mode 100644
--- /dev/null
+++ b/sys/sys/efi-freebsd.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2025 Netflix, Inc.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+#ifndef _SYS_EFI_FREEBSD_H_
+#define _SYS_EFI_FREEBSD_H_
+
+/*
+ * Minimal defines to allow FreeBSD to use the same type names as EDK2,
+ * but without depending on all of EDK2's types.
+ */
+#include <sys/_null.h>
+
+#endif /* _SYS_EFI_FREEBSD_H_ */
diff --git a/sys/sys/efi.h b/sys/sys/efi.h
--- a/sys/sys/efi.h
+++ b/sys/sys/efi.h
@@ -27,8 +27,8 @@
#ifndef _SYS_EFI_H_
#define _SYS_EFI_H_
-#include <sys/uuid.h>
#include <machine/efi.h>
+#include <sys/efi-freebsd.h>
#define EFI_PAGE_SHIFT 12
#define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT)
diff --git a/tools/build/test-includes/badfiles.inc b/tools/build/test-includes/badfiles.inc
--- a/tools/build/test-includes/badfiles.inc
+++ b/tools/build/test-includes/badfiles.inc
@@ -31,6 +31,7 @@
sys/domainset.h \
sys/dtrace_bsd.h \
sys/dvdio.h \
+ sys/efitcg.h \
sys/elf32.h \
sys/elf64.h \
sys/elf_common.h \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 31, 3:31 PM (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33650607
Default Alt Text
D53651.id166103.diff (5 KB)
Attached To
Mode
D53651: efi: Move edk2 compat defines to sys/efi-edk2.h
Attached
Detach File
Event Timeline
Log In to Comment