From c78ad207baed95dc3148632ab882d445acc39034 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Wed, 14 Apr 2021 08:22:06 +0000 Subject: [PATCH] Switch the EFI virtual address to a uint64_t It is defined as a uint64_t in the UEFI spec. As it's not used as a pointer by the kernel follow this and define it as the same in the kernel. Reviewed by: kib, manu, imp Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29759 --- sys/amd64/amd64/efirt_machdep.c | 2 +- sys/amd64/amd64/machdep.c | 2 +- sys/arm/arm/machdep_boot.c | 2 +- sys/arm64/arm64/efirt_machdep.c | 2 +- sys/arm64/arm64/machdep.c | 2 +- sys/dev/efidev/efirt.c | 4 ++-- sys/sys/efi.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c index 1c53caaef601..3c8392bee86f 100644 --- a/sys/amd64/amd64/efirt_machdep.c +++ b/sys/amd64/amd64/efirt_machdep.c @@ -204,7 +204,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz) descsz)) { if ((p->md_attr & EFI_MD_ATTR_RT) == 0) continue; - if (p->md_virt != NULL && (uint64_t)p->md_virt != p->md_phys) { + if (p->md_virt != 0 && p->md_virt != p->md_phys) { if (bootverbose) printf("EFI Runtime entry %d is mapped\n", i); goto fail; diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0951f3f71a0a..497975f0ee30 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1107,7 +1107,7 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, type = types[p->md_type]; else type = ""; - printf("%23s %012lx %12p %08lx ", type, p->md_phys, + printf("%23s %012lx %012lx %08lx ", type, p->md_phys, p->md_virt, p->md_pages); if (p->md_attr & EFI_MD_ATTR_UC) printf("UC "); diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c index b13cf2ef23ea..332e9beb091e 100644 --- a/sys/arm/arm/machdep_boot.c +++ b/sys/arm/arm/machdep_boot.c @@ -442,7 +442,7 @@ arm_add_efi_map_entries(struct efi_map_header *efihdr, struct mem_region *mr, type = types[p->md_type]; else type = ""; - printf("%23s %012llx %12p %08llx ", type, p->md_phys, + printf("%23s %012llx %012llx %08llx ", type, p->md_phys, p->md_virt, p->md_pages); if (p->md_attr & EFI_MD_ATTR_UC) printf("UC "); diff --git a/sys/arm64/arm64/efirt_machdep.c b/sys/arm64/arm64/efirt_machdep.c index cd4e5d7bae00..a48fda6d02b8 100644 --- a/sys/arm64/arm64/efirt_machdep.c +++ b/sys/arm64/arm64/efirt_machdep.c @@ -184,7 +184,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz) descsz)) { if ((p->md_attr & EFI_MD_ATTR_RT) == 0) continue; - if (p->md_virt != NULL && (uint64_t)p->md_virt != p->md_phys) { + if (p->md_virt != 0 && p->md_virt != p->md_phys) { if (bootverbose) printf("EFI Runtime entry %d is mapped\n", i); goto fail; diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index c2e0eae188f2..71aa45b47d59 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -1046,7 +1046,7 @@ print_efi_map_entry(struct efi_md *p) type = types[p->md_type]; else type = ""; - printf("%23s %012lx %12p %08lx ", type, p->md_phys, + printf("%23s %012lx %012lx %08lx ", type, p->md_phys, p->md_virt, p->md_pages); if (p->md_attr & EFI_MD_ATTR_UC) printf("UC "); diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index f28b9981919c..aa7e9afdb69d 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -126,8 +126,8 @@ efi_is_in_map(struct efi_md *map, int ndesc, int descsz, vm_offset_t addr) if ((p->md_attr & EFI_MD_ATTR_RT) == 0) continue; - if (addr >= (uintptr_t)p->md_virt && - addr < (uintptr_t)p->md_virt + p->md_pages * PAGE_SIZE) + if (addr >= p->md_virt && + addr < p->md_virt + p->md_pages * PAGE_SIZE) return (true); } diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 0c0b52afc81d..7f9408d19b39 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -74,7 +74,7 @@ struct efi_md { #define EFI_MD_TYPE_PERSISTENT 14 /* Persistent memory. */ uint32_t __pad; uint64_t md_phys; - void *md_virt; + uint64_t md_virt; uint64_t md_pages; uint64_t md_attr; #define EFI_MD_ATTR_UC 0x0000000000000001UL