Date: Thu, 20 Feb 2020 00:46:16 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358135 - in head/stand: efi/loader i386/libi386 i386/loader libsa Message-ID: <202002200046.01K0kGNO061926@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Feb 20 00:46:16 2020 New Revision: 358135 URL: https://svnweb.freebsd.org/changeset/base/358135 Log: 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. Differential Revision: https://reviews.freebsd.org/D23660 Modified: head/stand/efi/loader/main.c head/stand/i386/libi386/smbios.c head/stand/i386/loader/main.c head/stand/libsa/stand.h Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Feb 20 00:34:46 2020 (r358134) +++ head/stand/efi/loader/main.c Thu Feb 20 00:46:16 2020 (r358135) @@ -852,7 +852,11 @@ read_loader_env(const char *name, char *def_fn, bool o } } - +caddr_t +ptov(uintptr_t x) +{ + return ((caddr_t)x); +} EFI_STATUS main(int argc, CHAR16 *argv[]) Modified: head/stand/i386/libi386/smbios.c ============================================================================== --- head/stand/i386/libi386/smbios.c Thu Feb 20 00:34:46 2020 (r358134) +++ head/stand/i386/libi386/smbios.c Thu Feb 20 00:46:16 2020 (r358135) @@ -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 Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Thu Feb 20 00:34:46 2020 (r358134) +++ head/stand/i386/loader/main.c Thu Feb 20 00:46:16 2020 (r358135) @@ -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) { Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Thu Feb 20 00:34:46 2020 (r358134) +++ head/stand/libsa/stand.h Thu Feb 20 00:46:16 2020 (r358135) @@ -452,4 +452,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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002200046.01K0kGNO061926>