git: 19f8884afeb8 - stable/12 - Create ptov() function.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 06:10:34 UTC
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=19f8884afeb822d3cde7915dd1f4e231ffc443b3
commit 19f8884afeb822d3cde7915dd1f4e231ffc443b3
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2020-02-20 00:46:16 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
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 <stand.h>
-#include <bootstrap.h>
#include <sys/endian.h>
-#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 */