From nobody Fri Oct 08 06:10:34 2021 X-Original-To: dev-commits-src-branches@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 5A1BA12D2C44; Fri, 8 Oct 2021 06:10:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQd8q5DF2z3Kx9; Fri, 8 Oct 2021 06:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A83FB21B7D; Fri, 8 Oct 2021 06:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1986AYiv006899; Fri, 8 Oct 2021 06:10:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1986AYLU006898; Fri, 8 Oct 2021 06:10:34 GMT (envelope-from git) Date: Fri, 8 Oct 2021 06:10:34 GMT Message-Id: <202110080610.1986AYLU006898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 19f8884afeb8 - stable/12 - Create ptov() function. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 19f8884afeb822d3cde7915dd1f4e231ffc443b3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=19f8884afeb822d3cde7915dd1f4e231ffc443b3 commit 19f8884afeb822d3cde7915dd1f4e231ffc443b3 Author: Warner Losh AuthorDate: 2020-02-20 00:46:16 +0000 Commit: Kyle Evans CommitDate: 2021-10-08 02:42:05 +0000 Create ptov() function. Create a ptov() function. It's basically the same as the btx PTOV macro, but works everywhere. smbios needs this to translate addresses, but the translation differs between BIOS booting and EFI booting. Make it a function so one smbios.o can be used everywhere. Provide definitions for it in the two loaders affected. (cherry picked from commit ed2a65769a5d04fcfc2acff3fa11d6b69394fd88) --- stand/efi/loader/main.c | 6 +++++- stand/i386/libi386/smbios.c | 9 +-------- stand/i386/loader/main.c | 6 ++++++ stand/libsa/stand.h | 5 +++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index b7225965a383..b391f091b1e4 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -882,7 +882,11 @@ read_loader_env(const char *name, char *def_fn, bool once) } } - +caddr_t +ptov(uintptr_t x) +{ + return ((caddr_t)x); +} EFI_STATUS main(int argc, CHAR16 *argv[]) diff --git a/stand/i386/libi386/smbios.c b/stand/i386/libi386/smbios.c index 2aa62fa85df7..c621114d9107 100644 --- a/stand/i386/libi386/smbios.c +++ b/stand/i386/libi386/smbios.c @@ -28,16 +28,9 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#ifdef EFI -/* In EFI, we don't need PTOV(). */ -#define PTOV(x) (caddr_t)(x) -#else -#include "btxv86.h" -#endif -#include "smbios.h" +#define PTOV(x) ptov(x) /* * Detect SMBIOS and export information about the SMBIOS into the diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index 5265769cd0d9..67d1fe1b2b20 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -86,6 +86,12 @@ extern char end[]; static void *heap_top; static void *heap_bottom; +caddr_t +ptov(uintptr_t x) +{ + return (PTOV(x)); +} + int main(void) { diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 81b1882d71f0..14e1703326a4 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -453,4 +453,9 @@ const char *x86_hypervisor(void); #define reallocf(x, y) Reallocf(x, y, NULL, 0) #endif +/* + * va <-> pa routines. MD code must supply. + */ +caddr_t ptov(uintptr_t); + #endif /* STAND_H */