From nobody Sun Nov 16 18:29:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d8fXZ3Lynz6GsB2; Sun, 16 Nov 2025 18:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d8fXZ0vXqz43Js; Sun, 16 Nov 2025 18:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v2Jpgd19mGWMWgp0TCLXgCbAENIbltcD0VWfKwcAe2E=; b=hqZXzfAw4flOBRQlUcX/KlS7dmcpe13C+SIpp9Y8D0/js7l48A0orqG/CG3UgbchYNWG3b 4sHmIUpQdnrWygab0DrH/t2sHzVgJfStdUbuULHe7ebrNWD3kzMN+qBPwNtTF5dObnJvEY 3BafCikZ/rxt+4ifhknJZh/C3Nw785XLLjt+FGSQFaXPKDE9LPk3RWN8QmTll5F68hJz7p ydI1pA0Yzfa0bYPJxXa/3o+Ju4iziJrDfvenBna0L/Sm37mVY3oba9v/c09WCEyhSGJE6i KrqGz9KlqTnBDKhzXof2PtGfNy9Te2RILeM/LuqFtaiagF0yG1l8zeyjmN/QUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v2Jpgd19mGWMWgp0TCLXgCbAENIbltcD0VWfKwcAe2E=; b=iB3Yl+Y4Kzz0UHIdD1Hak72nPbyVfrstosM3F1XgiySePgFiRcprAKTtmuIFdyCq/+V1Oy UV9NC9+qZuvQ9ByUcRh8JbC6NmXtNix5PN2XsGTiF5zWp26Z6nmPkPvTLVSXwo/ATgCYVa ce/5n0KTrjyzhc8/XgTY9mODGNQri2NOyec8UVXujDW4uJsUrS2dsVPPM4pSLCHjcw8cgk EHchsXXlgZaskoqqt2O31p5XdEev63VJGLMt+OCD9SpYXY07QkwfcjifMXQwUXND7wCsxr x/zI4UqRpvhDnaZQW+wbKJfVSXJgPloHbKizm9QHuE0QAJzAgunsexLXcwKG+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763317742; a=rsa-sha256; cv=none; b=Go6TDRWP95IaOnkh0S5FMgZRAO/XVgPanOIITCGL5rMalNsJqdmg7GLzYBOYQbRWqDHIYs qLy5uicxWPf6j9JdPcqOvBzR7gJ5V8QECOlcz0X93TORNBNRa8GkFxyxOBfqheWq1xXVHk rxRudU7oYjjNHLGleGTSlJ79cXZWn9QVTzK+OxJZwvUDCzYnkGXZEcCs9pKvwwYMtyL8Cd 2uGt0AiupE2cMo5Jq/2OL6dgpSvXD1xvFPS2/sAplL3+84SsUk1xrxbOI/S5dp8xZIVpha IDti4/2j25sPrOXlioxWbzX2yXLti+uFMxpXjtKD0laB3xhcyJVpqtEAwUCLoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d8fXZ0V7Qzqf2; Sun, 16 Nov 2025 18:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5AGIT2V9007924; Sun, 16 Nov 2025 18:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AGIT2Za007920; Sun, 16 Nov 2025 18:29:02 GMT (envelope-from git) Date: Sun, 16 Nov 2025 18:29:02 GMT Message-Id: <202511161829.5AGIT2Za007920@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ce1342883e03 - main - efi: Move edk2 compat defines to sys/efi-edk2.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce1342883e03e6a021f03a49d13539a145d320e2 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ce1342883e03e6a021f03a49d13539a145d320e2 commit ce1342883e03e6a021f03a49d13539a145d320e2 Author: Warner Losh AuthorDate: 2025-11-16 17:32:26 +0000 Commit: Warner Losh CommitDate: 2025-11-16 18:29:02 +0000 efi: Move edk2 compat defines to sys/efi-edk2.h Create efi-freebsd.h, which is safe to include from the FreeBSD context (all of userland, except the small bits we share with edk2 and the kernel). This defines anything that we need. At the moment, it just includes NULL definitions. Create efi-edk2.h, which is approximately ProcessorBind.h from edk2 that we can include in FreeBSD compontents that are re-using edk2 components (bits of the boot laoder, and libefi*). Update the efi_gid definitions to match edk2 better. Add this file to badfiles.inc, since we can't write it in a way that's compatible. This is copied from the old efi-osdep.h. This has to be done in one commit that's bigger than I like since we can't easily move things piecemeal around they are so inter-related. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D53651 --- lib/libefivar/ProcessorBind.h | 2 +- lib/libefivar/efivar-dp-format.c | 3 -- lib/libefivar/efivar-dp-parse.c | 3 -- lib/libefivar/efivar-dp-xlate.c | 3 -- lib/libefivar/uefi-dplib.h | 1 + lib/libefivar/uefi-dputil.c | 3 -- lib/libefivar/efi-osdep.h => sys/sys/efi-edk2.h | 49 +++++++++++-------------- sys/sys/efi-freebsd.h | 15 ++++++++ sys/sys/efi.h | 2 +- tools/build/test-includes/badfiles.inc | 1 + 10 files changed, 40 insertions(+), 42 deletions(-) diff --git a/lib/libefivar/ProcessorBind.h b/lib/libefivar/ProcessorBind.h index 46abe715d38f..6985a193cff9 100644 --- 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 diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index f2dcf1b91c01..2050b09951cb 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -33,10 +33,7 @@ #include #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 index 51c134692f1e..c594e94580da 100644 --- a/lib/libefivar/efivar-dp-parse.c +++ b/lib/libefivar/efivar-dp-parse.c @@ -35,10 +35,7 @@ #include #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 index 1e816cecbb81..78d82ba4bce0 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -39,10 +39,7 @@ #include #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 index 6f76a9763a34..4787088dac19 100644 --- a/lib/libefivar/uefi-dplib.h +++ b/lib/libefivar/uefi-dplib.h @@ -37,6 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _UEFI_DEVICE_PATH_LIB_H_ #define _UEFI_DEVICE_PATH_LIB_H_ + #include #include #include diff --git a/lib/libefivar/uefi-dputil.c b/lib/libefivar/uefi-dputil.c index 6e8f3aeca2ce..c31da14eed2d 100644 --- a/lib/libefivar/uefi-dputil.c +++ b/lib/libefivar/uefi-dputil.c @@ -33,9 +33,6 @@ #include #include #include - -#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 similarity index 57% rename from lib/libefivar/efi-osdep.h rename to sys/sys/efi-edk2.h index e91d7405da97..513c56549803 100644 --- 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 #include #include -#include typedef int8_t INT8; typedef int16_t INT16; @@ -61,7 +40,7 @@ typedef void VOID; //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 @@ typedef void VOID; #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 index 000000000000..f3fd04a2196c --- /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 + +#endif /* _SYS_EFI_FREEBSD_H_ */ diff --git a/sys/sys/efi.h b/sys/sys/efi.h index f82c733898b4..830cca9c1832 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -27,8 +27,8 @@ #ifndef _SYS_EFI_H_ #define _SYS_EFI_H_ -#include #include +#include #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 index 9feb73edc5d0..3c7390b22a89 100644 --- a/tools/build/test-includes/badfiles.inc +++ b/tools/build/test-includes/badfiles.inc @@ -31,6 +31,7 @@ BADHDRS= \ sys/domainset.h \ sys/dtrace_bsd.h \ sys/dvdio.h \ + sys/efitcg.h \ sys/elf32.h \ sys/elf64.h \ sys/elf_common.h \