Re: git: 7ae99f80b666 - main - pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.

From: FreeBSD User <freebsd_at_walstatt-de.de>
Date: Fri, 23 Sep 2022 06:40:15 UTC
Am Thu, 22 Sep 2022 22:10:49 GMT
John Baldwin <jhb@FreeBSD.org> schrieb:

> The branch main has been updated by jhb:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae99f80b6661760c5de3edd330b279f04b092a2
> 
> commit 7ae99f80b6661760c5de3edd330b279f04b092a2
> Author:     John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2022-09-22 22:08:52 +0000
> Commit:     John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2022-09-22 22:08:52 +0000
> 
>     pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.
>     
>     This matches the return type of pmap_mapdev/bios.
>     
>     Reviewed by:    kib, markj
>     Sponsored by:   DARPA
>     Differential Revision:  https://reviews.freebsd.org/D36548
> ---
>  sys/amd64/acpica/acpi_machdep.c               | 21 +++++++++------------
>  sys/amd64/amd64/mem.c                         |  2 +-
>  sys/amd64/amd64/pmap.c                        |  6 ++++--
>  sys/amd64/include/pmap.h                      |  2 +-
>  sys/arm/arm/bus_space_generic.c               |  2 +-
>  sys/arm/arm/nexus.c                           |  2 +-
>  sys/arm/broadcom/bcm2835/bcm2835_fbd.c        |  4 ++--
>  sys/arm/freescale/fsl_ocotp.c                 |  2 +-
>  sys/arm/include/pmap.h                        |  2 +-
>  sys/arm/mv/armadaxp/armadaxp_mp.c             |  2 +-
>  sys/arm64/acpica/acpi_machdep.c               | 18 ++++++++----------
>  sys/arm64/arm64/bus_machdep.c                 |  2 +-
>  sys/arm64/arm64/pmap.c                        |  5 +++--
>  sys/arm64/include/pmap.h                      |  4 ++--
>  sys/compat/linuxkpi/common/src/linux_compat.c |  2 +-
>  sys/compat/x86bios/x86bios.c                  |  4 ++--
>  sys/dev/acpica/Osd/OsdMemory.c                |  6 +++---
>  sys/dev/acpica/acpi_apei.c                    |  3 +--
>  sys/dev/acpica/acpi_pxm.c                     |  2 +-
>  sys/dev/cesa/cesa.c                           |  4 ++--
>  sys/dev/cesa/cesa.h                           |  2 +-
>  sys/dev/drm2/drm_memory.c                     |  2 +-
>  sys/dev/drm2/ttm/ttm_bo_util.c                |  8 ++++----
>  sys/dev/fb/vesa.c                             |  5 +++--
>  sys/dev/ioat/ioat_test.c                      |  3 +--
>  sys/dev/ipmi/ipmi_smbios.c                    |  8 ++++----
>  sys/dev/mxge/if_mxge.c                        |  6 +++---
>  sys/dev/ofw/ofw_pcib.c                        |  2 +-
>  sys/dev/pci/vga_pci.c                         |  2 +-
>  sys/dev/powermac_nvram/powermac_nvram.c       | 22 +++++++++++-----------
>  sys/dev/powermac_nvram/powermac_nvramvar.h    |  6 +++---
>  sys/dev/smbios/smbios.c                       |  2 +-
>  sys/dev/vt/hw/efifb/efifb.c                   |  2 +-
>  sys/dev/vt/hw/vbefb/vbefb.c                   |  2 +-
>  sys/dev/xen/bus/xenpv.c                       |  4 ++--
>  sys/i386/acpica/acpi_machdep.c                | 14 +++++++-------
>  sys/i386/i386/pmap.c                          |  5 +++--
>  sys/i386/i386/pmap_base.c                     |  4 ++--
>  sys/i386/include/pmap.h                       |  2 +-
>  sys/i386/include/pmap_base.h                  |  2 +-
>  sys/kern/subr_devmap.c                        |  7 ++++---
>  sys/powerpc/aim/mmu_oea.c                     |  7 ++++---
>  sys/powerpc/aim/mmu_oea64.c                   |  7 ++++---
>  sys/powerpc/aim/mmu_radix.c                   | 10 ++++++----
>  sys/powerpc/booke/pmap.c                      |  7 ++++---
>  sys/powerpc/include/mmuvar.h                  |  2 +-
>  sys/powerpc/include/pmap.h                    |  2 +-
>  sys/powerpc/mpc85xx/lbc.c                     |  3 ++-
>  sys/powerpc/powermac/macio.c                  |  2 +-
>  sys/powerpc/powermac/uninorth.c               |  2 +-
>  sys/powerpc/powerpc/nexus.c                   |  4 ++--
>  sys/powerpc/powerpc/pmap_dispatch.c           |  2 +-
>  sys/powerpc/psim/iobus.c                      |  2 +-
>  sys/riscv/include/pmap.h                      |  4 ++--
>  sys/riscv/riscv/bus_machdep.c                 |  2 +-
>  sys/riscv/riscv/pmap.c                        |  2 +-
>  sys/x86/x86/bus_machdep.c                     |  2 +-
>  sys/x86/x86/io_apic.c                         |  4 ++--
>  sys/x86/x86/nexus.c                           |  2 +-
>  59 files changed, 138 insertions(+), 133 deletions(-)
> 
> diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c
> index 41ec1554147f..41d70a1c9751 100644
> --- a/sys/amd64/acpica/acpi_machdep.c
> +++ b/sys/amd64/acpica/acpi_machdep.c
> @@ -103,17 +103,17 @@ map_table(vm_paddr_t pa, const char *sig)
>  
>  	header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
>  	if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
> -		pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +		pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  		return (NULL);
>  	}
>  	length = header->Length;
> -	pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  	table = pmap_mapbios(pa, length);
>  	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
>  		if (bootverbose)
>  			printf("ACPI: Failed checksum for table %s\n", sig);
>  #if (ACPI_CHECKSUM_ABORT)
> -		pmap_unmapbios((vm_offset_t)table, length);
> +		pmap_unmapbios(table, length);
>  		return (NULL);
>  #endif
>  	}
> @@ -132,7 +132,7 @@ probe_table(vm_paddr_t address, const char *sig)
>  
>  	table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER));
>  	ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0;
> -	pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
>  	return (ret);
>  }
>  
> @@ -154,7 +154,7 @@ acpi_unmap_table(void *table)
>  	ACPI_TABLE_HEADER *header;
>  
>  	header = (ACPI_TABLE_HEADER *)table;
> -	pmap_unmapbios((vm_offset_t)table, header->Length);
> +	pmap_unmapbios(table, header->Length);
>  }
>  
>  /*
> @@ -201,15 +201,13 @@ acpi_find_table(const char *sig)
>  		 */
>  		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
>  			printf("ACPI: RSDP failed extended checksum\n");
> -			pmap_unmapbios((vm_offset_t)rsdp,
> -			    sizeof(ACPI_TABLE_RSDP));
> +			pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  			return (0);
>  		}
>  		xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
>  		if (xsdt == NULL) {
>  			printf("ACPI: Failed to map XSDT\n");
> -			pmap_unmapbios((vm_offset_t)rsdp,
> -			    sizeof(ACPI_TABLE_RSDP));
> +			pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  			return (0);
>  		}
>  		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
> @@ -224,8 +222,7 @@ acpi_find_table(const char *sig)
>  		rsdt = map_table(rsdp->RsdtPhysicalAddress, ACPI_SIG_RSDT);
>  		if (rsdt == NULL) {
>  			printf("ACPI: Failed to map RSDT\n");
> -			pmap_unmapbios((vm_offset_t)rsdp,
> -			    sizeof(ACPI_TABLE_RSDP));
> +			pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  			return (0);
>  		}
>  		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
> @@ -237,7 +234,7 @@ acpi_find_table(const char *sig)
>  			}
>  		acpi_unmap_table(rsdt);
>  	}
> -	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
> +	pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  	if (addr == 0)
>  		return (0);
>  
> diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
> index 65ca81039956..761ccf6cb307 100644
> --- a/sys/amd64/amd64/mem.c
> +++ b/sys/amd64/amd64/mem.c
> @@ -148,7 +148,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
>  			}
>  			p = pmap_mapdev(v, PAGE_SIZE);
>  			error = uiomove(p, c, uio);
> -			pmap_unmapdev((vm_offset_t)p, PAGE_SIZE);
> +			pmap_unmapdev(p, PAGE_SIZE);
>  			break;
>  		}
>  	}
> diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
> index e3f281784893..c7fd0135880e 100644
> --- a/sys/amd64/amd64/pmap.c
> +++ b/sys/amd64/amd64/pmap.c
> @@ -9295,12 +9295,14 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
>  }
>  
>  void
> -pmap_unmapdev(vm_offset_t va, vm_size_t size)
> +pmap_unmapdev(void *p, vm_size_t size)
>  {
>  	struct pmap_preinit_mapping *ppim;
> -	vm_offset_t offset;
> +	vm_offset_t offset, va;
>  	int i;
>  
> +	va = (vm_offset_t)p;
> +
>  	/* If we gave a direct map region in pmap_mapdev, do nothing */
>  	if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS)
>  		return;
> diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
> index c37ae82c0301..c92c09db22a9 100644
> --- a/sys/amd64/include/pmap.h
> +++ b/sys/amd64/include/pmap.h
> @@ -508,7 +508,7 @@ void	pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma);
>  void	pmap_pinit_pml4(vm_page_t);
>  void	pmap_pinit_pml5(vm_page_t);
>  bool	pmap_ps_enabled(pmap_t pmap);
> -void	pmap_unmapdev(vm_offset_t, vm_size_t);
> +void	pmap_unmapdev(void *, vm_size_t);
>  void	pmap_invalidate_page(pmap_t, vm_offset_t);
>  void	pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t);
>  void	pmap_invalidate_all(pmap_t);
> diff --git a/sys/arm/arm/bus_space_generic.c b/sys/arm/arm/bus_space_generic.c
> index f4bf434d6f5f..220cf773e38a 100644
> --- a/sys/arm/arm/bus_space_generic.c
> +++ b/sys/arm/arm/bus_space_generic.c
> @@ -95,7 +95,7 @@ void
>  generic_bs_unmap(bus_space_tag_t t, bus_space_handle_t h, bus_size_t size)
>  {
>  
> -	pmap_unmapdev((vm_offset_t)h, size);
> +	pmap_unmapdev((void *)h, size);
>  }
>  
>  void
> diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c
> index 2e825b5f66a9..bc91becce6e0 100644
> --- a/sys/arm/arm/nexus.c
> +++ b/sys/arm/arm/nexus.c
> @@ -399,7 +399,7 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int
> rid, #ifdef FDT
>  			bus_space_unmap(fdtbus_bs_tag, vaddr, psize);
>  #else
> -			pmap_unmapdev((vm_offset_t)vaddr, (vm_size_t)psize);
> +			pmap_unmapdev((void *)vaddr, (vm_size_t)psize);
>  #endif
>  			rman_set_virtual(r, NULL);
>  			rman_set_bushandle(r, 0);
> diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
> index 2b0b89d36342..cff854dc6248 100644
> --- a/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
> +++ b/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
> @@ -152,12 +152,12 @@ bcm_fb_setup_fbd(struct bcmsc_softc *sc)
>  	fbd = device_add_child(sc->dev, "fbd", device_get_unit(sc->dev));
>  	if (fbd == NULL) {
>  		device_printf(sc->dev, "Failed to add fbd child\n");
> -		pmap_unmapdev(sc->info.fb_vbase, sc->info.fb_size);
> +		pmap_unmapdev((void *)sc->info.fb_vbase, sc->info.fb_size);
>  		return (ENXIO);
>  	} else if (device_probe_and_attach(fbd) != 0) {
>  		device_printf(sc->dev, "Failed to attach fbd device\n");
>  		device_delete_child(sc->dev, fbd);
> -		pmap_unmapdev(sc->info.fb_vbase, sc->info.fb_size);
> +		pmap_unmapdev((void *)sc->info.fb_vbase, sc->info.fb_size);
>  		return (ENXIO);
>  	}
>  
> diff --git a/sys/arm/freescale/fsl_ocotp.c b/sys/arm/freescale/fsl_ocotp.c
> index e757c262e61c..332239cfdbc0 100644
> --- a/sys/arm/freescale/fsl_ocotp.c
> +++ b/sys/arm/freescale/fsl_ocotp.c
> @@ -135,7 +135,7 @@ ocotp_attach(device_t dev)
>  
>  	/* We're done with the temporary mapping now. */
>  	if (ocotp_regs != NULL)
> -		pmap_unmapdev((vm_offset_t)ocotp_regs, ocotp_size);
> +		pmap_unmapdev(ocotp_regs, ocotp_size);
>  
>  	err = 0;
>  
> diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h
> index d06d44d648d5..90b1cdb827af 100644
> --- a/sys/arm/include/pmap.h
> +++ b/sys/arm/include/pmap.h
> @@ -47,7 +47,7 @@ void *pmap_kenter_temporary(vm_paddr_t, int);
>  void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
>  
>  void *pmap_mapdev(vm_paddr_t, vm_size_t);
> -void pmap_unmapdev(vm_offset_t, vm_size_t);
> +void pmap_unmapdev(void *, vm_size_t);
>  
>  static inline void *
>  pmap_mapdev_attr(vm_paddr_t addr, vm_size_t size, int attr)
> diff --git a/sys/arm/mv/armadaxp/armadaxp_mp.c b/sys/arm/mv/armadaxp/armadaxp_mp.c
> index d6adf8b9ef97..235019872b9d 100644
> --- a/sys/arm/mv/armadaxp/armadaxp_mp.c
> +++ b/sys/arm/mv/armadaxp/armadaxp_mp.c
> @@ -121,7 +121,7 @@ mv_axp_platform_mp_start_ap(platform_t plat)
>  	    src++, dst++) {
>  		*dst = *src;
>  	}
> -	pmap_unmapdev((vm_offset_t)dst, PAGE_SIZE);
> +	pmap_unmapdev(dst, PAGE_SIZE);
>  	if (cputype == CPU_ID_MV88SV584X_V7) {
>  		/* Core rev A0 */
>  		div_val = read_cpu_clkdiv(CPU_DIVCLK_CTRL2_RATIO_FULL1);
> diff --git a/sys/arm64/acpica/acpi_machdep.c b/sys/arm64/acpica/acpi_machdep.c
> index 113c8c4b8848..1b89b8ff04e2 100644
> --- a/sys/arm64/acpica/acpi_machdep.c
> +++ b/sys/arm64/acpica/acpi_machdep.c
> @@ -71,11 +71,11 @@ map_table(vm_paddr_t pa, const char *sig)
>  
>  	header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
>  	if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
> -		pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +		pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  		return (NULL);
>  	}
>  	length = header->Length;
> -	pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  
>  	table = pmap_mapbios(pa, length);
>  	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
> @@ -107,10 +107,10 @@ probe_table(vm_paddr_t address, const char *sig)
>  	}
>  
>  	if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
> -		pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
> +		pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
>  		return (0);
>  	}
> -	pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
>  	return (1);
>  }
>  
> @@ -121,7 +121,7 @@ acpi_unmap_table(void *table)
>  	ACPI_TABLE_HEADER *header;
>  
>  	header = (ACPI_TABLE_HEADER *)table;
> -	pmap_unmapbios((vm_offset_t)table, header->Length);
> +	pmap_unmapbios(table, header->Length);
>  }
>  
>  /*
> @@ -174,15 +174,13 @@ acpi_find_table(const char *sig)
>  		 */
>  		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
>  			printf("ACPI: RSDP failed extended checksum\n");
> -			pmap_unmapbios((vm_offset_t)rsdp,
> -			    sizeof(ACPI_TABLE_RSDP));
> +			pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  			return (0);
>  		}
>  		xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
>  		if (xsdt == NULL) {
>  			printf("ACPI: Failed to map XSDT\n");
> -			pmap_unmapbios((vm_offset_t)rsdp,
> -			    sizeof(ACPI_TABLE_RSDP));
> +			pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  			return (0);
>  		}
>  		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
> @@ -197,7 +195,7 @@ acpi_find_table(const char *sig)
>  		printf("ACPI: Unsupported RSDP version %d and XSDT %#lx\n",
>  		    rsdp->Revision, rsdp->XsdtPhysicalAddress);
>  	}
> -	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
> +	pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  
>  	if (addr == 0)
>  		return (0);
> diff --git a/sys/arm64/arm64/bus_machdep.c b/sys/arm64/arm64/bus_machdep.c
> index b2136af38cad..bce20f8eb6d4 100644
> --- a/sys/arm64/arm64/bus_machdep.c
> +++ b/sys/arm64/arm64/bus_machdep.c
> @@ -116,7 +116,7 @@ static void
>  generic_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
>  {
>  
> -	pmap_unmapdev(bsh, size);
> +	pmap_unmapdev((void *)bsh, size);
>  }
>  
>  static void
> diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
> index c86e9f562729..2dc453e1aa33 100644
> --- a/sys/arm64/arm64/pmap.c
> +++ b/sys/arm64/arm64/pmap.c
> @@ -6095,15 +6095,16 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
>  }
>  
>  void
> -pmap_unmapbios(vm_offset_t va, vm_size_t size)
> +pmap_unmapbios(void *p, vm_size_t size)
>  {
>  	struct pmap_preinit_mapping *ppim;
> -	vm_offset_t offset, tmpsize, va_trunc;
> +	vm_offset_t offset, tmpsize, va, va_trunc;
>  	pd_entry_t *pde;
>  	pt_entry_t *l2;
>  	int i, lvl, l2_blocks, block;
>  	bool preinit_map;
>  
> +	va = (vm_offset_t)p;
>  	l2_blocks =
>  	   (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT;
>  	KASSERT(l2_blocks > 0, ("pmap_unmapbios: invalid size %lx", size));
> diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h
> index 9605c813285b..55388b845aed 100644
> --- a/sys/arm64/include/pmap.h
> +++ b/sys/arm64/include/pmap.h
> @@ -192,8 +192,8 @@ void	pmap_disable_promotion(vm_offset_t sva, vm_size_t size);
>  
>  void	*pmap_mapdev(vm_paddr_t, vm_size_t);
>  void	*pmap_mapbios(vm_paddr_t, vm_size_t);
> -void	pmap_unmapdev(vm_offset_t, vm_size_t);
> -void	pmap_unmapbios(vm_offset_t, vm_size_t);
> +void	pmap_unmapdev(void *, vm_size_t);
> +void	pmap_unmapbios(void *, vm_size_t);
>  
>  boolean_t pmap_map_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
>  void	pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
> diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c
> b/sys/compat/linuxkpi/common/src/linux_compat.c index 89d2728ce28e..6f1def64fa0f 100644
> --- a/sys/compat/linuxkpi/common/src/linux_compat.c
> +++ b/sys/compat/linuxkpi/common/src/linux_compat.c
> @@ -1976,7 +1976,7 @@ iounmap(void *addr)
>  	if (vmmap == NULL)
>  		return;
>  #if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
> || defined(__riscv)
> -	pmap_unmapdev((vm_offset_t)addr, vmmap->vm_size);
> +	pmap_unmapdev(addr, vmmap->vm_size);
>  #endif
>  	kfree(vmmap);
>  }
> diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c
> index f6350b8f6388..7bb7e5b35bd1 100644
> --- a/sys/compat/x86bios/x86bios.c
> +++ b/sys/compat/x86bios/x86bios.c
> @@ -662,14 +662,14 @@ x86bios_unmap_mem(void)
>  	}
>  	if (x86bios_ivt != NULL) {
>  #ifdef X86BIOS_NATIVE_ARCH
> -		pmap_unmapbios((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
> +		pmap_unmapbios(x86bios_ivt, X86BIOS_IVT_SIZE);
>  #else
>  		free(x86bios_ivt, M_DEVBUF);
>  		x86bios_ivt = NULL;
>  #endif
>  	}
>  	if (x86bios_rom != NULL)
> -		pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
> +		pmap_unmapdev(x86bios_rom, X86BIOS_ROM_SIZE);
>  	if (x86bios_seg != NULL) {
>  		contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
>  		x86bios_seg = NULL;
> diff --git a/sys/dev/acpica/Osd/OsdMemory.c b/sys/dev/acpica/Osd/OsdMemory.c
> index b806642a61fc..599065e5c653 100644
> --- a/sys/dev/acpica/Osd/OsdMemory.c
> +++ b/sys/dev/acpica/Osd/OsdMemory.c
> @@ -63,7 +63,7 @@ AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length)
>  void
>  AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Length)
>  {
> -    pmap_unmapbios((vm_offset_t)LogicalAddress, Length);
> +    pmap_unmapbios(LogicalAddress, Length);
>  }
>  
>  ACPI_STATUS
> @@ -110,7 +110,7 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value, UINT32
> Width) break;
>      }
>  
> -    pmap_unmapdev((vm_offset_t)LogicalAddress, Width / 8);
> +    pmap_unmapdev(LogicalAddress, Width / 8);
>  
>      return (AE_OK);
>  }
> @@ -139,7 +139,7 @@ AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT64 Value, UINT32
> Width) break;
>      }
>  
> -    pmap_unmapdev((vm_offset_t)LogicalAddress, Width / 8);
> +    pmap_unmapdev(LogicalAddress, Width / 8);
>  
>      return (AE_OK);
>  }
> diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c
> index 5c442d59972d..9923b2ff9247 100644
> --- a/sys/dev/acpica/acpi_apei.c
> +++ b/sys/dev/acpica/acpi_apei.c
> @@ -787,8 +787,7 @@ apei_detach(device_t dev)
>  			free(ge->copybuf, M_DEVBUF);
>  		}
>  		if (ge->buf) {
> -			pmap_unmapdev((vm_offset_t)ge->buf,
> -			    ge->v1.ErrorBlockLength);
> +			pmap_unmapdev(ge->buf, ge->v1.ErrorBlockLength);
>  		}
>  		free(ge, M_DEVBUF);
>  	}
> diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c
> index 808886d744f0..03624f00e2f6 100644
> --- a/sys/dev/acpica/acpi_pxm.c
> +++ b/sys/dev/acpica/acpi_pxm.c
> @@ -666,7 +666,7 @@ acpi_pxm_set_cpu_locality(void)
>  			    pc->pc_domain);
>  	}
>  	/* XXXMJ the page is leaked. */
> -	pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus);
> +	pmap_unmapbios(cpus, sizeof(*cpus) * max_cpus);
>  	srat_physaddr = 0;
>  	cpus = NULL;
>  }
> diff --git a/sys/dev/cesa/cesa.c b/sys/dev/cesa/cesa.c
> index 64d022a994a3..4ceb6fddf478 100644
> --- a/sys/dev/cesa/cesa.c
> +++ b/sys/dev/cesa/cesa.c
> @@ -962,7 +962,7 @@ cesa_setup_sram(struct cesa_softc *sc)
>  	sram_va = pmap_mapdev(sc->sc_sram_base_pa, sc->sc_sram_size);
>  	if (sram_va == NULL)
>  		return (ENOMEM);
> -	sc->sc_sram_base_va = (vm_offset_t)sram_va;
> +	sc->sc_sram_base_va = sram_va;
>  
>  	return (0);
>  }
> @@ -1072,7 +1072,7 @@ cesa_setup_sram_armada(struct cesa_softc *sc)
>  	sram_va = pmap_mapdev(sc->sc_sram_base_pa, sc->sc_sram_size);
>  	if (sram_va == NULL)
>  		return (ENOMEM);
> -	sc->sc_sram_base_va = (vm_offset_t)sram_va;
> +	sc->sc_sram_base_va = sram_va;
>  
>  	return (0);
>  }
> diff --git a/sys/dev/cesa/cesa.h b/sys/dev/cesa/cesa.h
> index 9387c87e9615..c7529ec6d0ef 100644
> --- a/sys/dev/cesa/cesa.h
> +++ b/sys/dev/cesa/cesa.h
> @@ -259,7 +259,7 @@ struct cesa_softc {
>  
>  	/* CESA SRAM Address */
>  	bus_addr_t			sc_sram_base_pa;
> -	vm_offset_t			sc_sram_base_va;
> +	void				*sc_sram_base_va;
>  	bus_size_t			sc_sram_size;
>  };
>  
> diff --git a/sys/dev/drm2/drm_memory.c b/sys/dev/drm2/drm_memory.c
> index 226c2c15734b..e32925445f9c 100644
> --- a/sys/dev/drm2/drm_memory.c
> +++ b/sys/dev/drm2/drm_memory.c
> @@ -129,6 +129,6 @@ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device
> *dev) dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
>  		vunmap(map->handle);
>  	else
> -		pmap_unmapdev((vm_offset_t)map->handle, map->size);
> +		pmap_unmapdev(map->handle, map->size);
>  }
>  EXPORT_SYMBOL(drm_core_ioremapfree);
> diff --git a/sys/dev/drm2/ttm/ttm_bo_util.c b/sys/dev/drm2/ttm/ttm_bo_util.c
> index c53bb21450d8..9caab983787c 100644
> --- a/sys/dev/drm2/ttm/ttm_bo_util.c
> +++ b/sys/dev/drm2/ttm/ttm_bo_util.c
> @@ -224,7 +224,7 @@ void ttm_mem_reg_iounmap(struct ttm_bo_device *bdev, struct ttm_mem_reg
> *mem, man = &bdev->man[mem->mem_type];
>  
>  	if (virtual && mem->bus.addr == NULL)
> -		pmap_unmapdev((vm_offset_t)virtual, mem->bus.size);
> +		pmap_unmapdev(virtual, mem->bus.size);
>  	(void) ttm_mem_io_lock(man, false);
>  	ttm_mem_io_free(bdev, mem);
>  	ttm_mem_io_unlock(man);
> @@ -263,7 +263,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src,
>  
>  	memcpy(dst, src, PAGE_SIZE);
>  
> -	pmap_unmapdev((vm_offset_t)dst, PAGE_SIZE);
> +	pmap_unmapdev(dst, PAGE_SIZE);
>  
>  	return 0;
>  }
> @@ -285,7 +285,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
>  
>  	memcpy(dst, src, PAGE_SIZE);
>  
> -	pmap_unmapdev((vm_offset_t)src, PAGE_SIZE);
> +	pmap_unmapdev(src, PAGE_SIZE);
>  
>  	return 0;
>  }
> @@ -570,7 +570,7 @@ void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map)
>  		return;
>  	switch (map->bo_kmap_type) {
>  	case ttm_bo_map_iomap:
> -		pmap_unmapdev((vm_offset_t)map->virtual, map->size);
> +		pmap_unmapdev(map->virtual, map->size);
>  		break;
>  	case ttm_bo_map_vmap:
>  		pmap_qremove((vm_offset_t)(map->virtual), map->num_pages);
> diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c
> index f1d75873f983..0e19884e86b5 100644
> --- a/sys/dev/fb/vesa.c
> +++ b/sys/dev/fb/vesa.c
> @@ -1305,7 +1305,8 @@ vesa_set_mode(video_adapter_t *adp, int mode)
>  			}
>  			int10_set_mode(adp->va_initial_bios_mode);
>  			if (adp->va_info.vi_flags & V_INFO_LINEAR)
> -				pmap_unmapdev(adp->va_buffer, vesa_vmem_max);
> +				pmap_unmapdev((void *)adp->va_buffer,
> +				    vesa_vmem_max);
>  			/* 
>  			 * Once (*prevvidsw->get_info)() succeeded, 
>  			 * (*prevvidsw->set_mode)() below won't fail...
> @@ -1350,7 +1351,7 @@ vesa_set_mode(video_adapter_t *adp, int mode)
>  		adp->va_flags |= V_ADP_DAC8;
>  
>  	if (adp->va_info.vi_flags & V_INFO_LINEAR)
> -		pmap_unmapdev(adp->va_buffer, vesa_vmem_max);
> +		pmap_unmapdev((void *)adp->va_buffer, vesa_vmem_max);
>  
>  #if VESA_DEBUG > 0
>  	printf("VESA: mode set!\n");
> diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c
> index 3a42ba5fb54c..46aa6e9ca55e 100644
> --- a/sys/dev/ioat/ioat_test.c
> +++ b/sys/dev/ioat/ioat_test.c
> @@ -504,8 +504,7 @@ ioat_dma_test(void *arg)
>  	ioat_test_release_memory(test);
>  out:
>  	if (test->testkind == IOAT_TEST_RAW_DMA && !test->raw_is_virtual)
> -		pmap_unmapdev((vm_offset_t)test->raw_vtarget,
> -		    test->buffer_size);
> +		pmap_unmapdev(test->raw_vtarget, test->buffer_size);
>  	ioat_put_dmaengine(dmaengine);
>  }
>  
> diff --git a/sys/dev/ipmi/ipmi_smbios.c b/sys/dev/ipmi/ipmi_smbios.c
> index e26b6f2956ad..c7e07642ce8d 100644
> --- a/sys/dev/ipmi/ipmi_smbios.c
> +++ b/sys/dev/ipmi/ipmi_smbios.c
> @@ -182,10 +182,10 @@ ipmi_smbios_probe(struct ipmi_get_info *info)
>  	 */
>  	header = pmap_mapbios(addr, sizeof(struct smbios_eps));
>  	table = pmap_mapbios(addr, header->length);
> -	pmap_unmapbios((vm_offset_t)header, sizeof(struct smbios_eps));
> +	pmap_unmapbios(header, sizeof(struct smbios_eps));
>  	header = table;
>  	if (smbios_cksum(header) != 0) {
> -		pmap_unmapbios((vm_offset_t)header, header->length);
> +		pmap_unmapbios(header, header->length);
>  		return;
>  	}
>  
> @@ -196,8 +196,8 @@ ipmi_smbios_probe(struct ipmi_get_info *info)
>  	    info);
>  
>  	/* Unmap everything. */
> -	pmap_unmapbios((vm_offset_t)table, header->structure_table_length);
> -	pmap_unmapbios((vm_offset_t)header, header->length);
> +	pmap_unmapbios(table, header->structure_table_length);
> +	pmap_unmapbios(header, header->length);
>  }
>  
>  /*
> diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c
> index bfeedadf4521..8b2118eeb9de 100644
> --- a/sys/dev/mxge/if_mxge.c
> +++ b/sys/dev/mxge/if_mxge.c
> @@ -435,7 +435,7 @@ mxge_enable_nvidia_ecrc(mxge_softc_t *sc)
>  	if (! (vendor_id == ivend && device_id == idev)) {
>  		device_printf(sc->dev, "mapping failed: 0x%x:0x%x\n",
>  			      vendor_id, device_id);
> -		pmap_unmapdev((vm_offset_t)va, PAGE_SIZE);
> +		pmap_unmapdev(va, PAGE_SIZE);
>  		return;
>  	}
>  
> @@ -444,11 +444,11 @@ mxge_enable_nvidia_ecrc(mxge_softc_t *sc)
>  
>  	if (val == 0xffffffff) {
>  		device_printf(sc->dev, "extended mapping failed\n");
> -		pmap_unmapdev((vm_offset_t)va, PAGE_SIZE);
> +		pmap_unmapdev(va, PAGE_SIZE);
>  		return;
>  	}
>  	*ptr32 = val | 0x40;
> -	pmap_unmapdev((vm_offset_t)va, PAGE_SIZE);
> +	pmap_unmapdev(va, PAGE_SIZE);
>  	if (mxge_verbose)
>  		device_printf(sc->dev,
>  			      "Enabled ECRC on upstream Nvidia bridge "
> diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c
> index e2aa0c9203b7..f40e860a8309 100644
> --- a/sys/dev/ofw/ofw_pcib.c
> +++ b/sys/dev/ofw/ofw_pcib.c
> @@ -622,7 +622,7 @@ ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int
> rid, }
>  
>  	psize = rman_get_size(res);
> -	pmap_unmapdev((vm_offset_t)rman_get_virtual(res), psize);
> +	pmap_unmapdev(rman_get_virtual(res), psize);
>  
>  	return (rman_deactivate_resource(res));
>  }
> diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c
> index a38f52d1bd12..ac8615d88e57 100644
> --- a/sys/dev/pci/vga_pci.c
> +++ b/sys/dev/pci/vga_pci.c
> @@ -285,7 +285,7 @@ vga_pci_unmap_bios(device_t dev, void *bios)
>  #if defined(__amd64__) || defined(__i386__)
>  	if (vga_pci_is_boot_display(dev)) {
>  		/* We mapped the BIOS shadow copy located at 0xC0000. */
> -		pmap_unmapdev((vm_offset_t)bios, VGA_PCI_BIOS_SHADOW_SIZE);
> +		pmap_unmapdev(bios, VGA_PCI_BIOS_SHADOW_SIZE);
>  
>  		return;
>  	}
> diff --git a/sys/dev/powermac_nvram/powermac_nvram.c
> b/sys/dev/powermac_nvram/powermac_nvram.c index 7913437bd1fc..247d35264441 100644
> --- a/sys/dev/powermac_nvram/powermac_nvram.c
> +++ b/sys/dev/powermac_nvram/powermac_nvram.c
> @@ -156,14 +156,14 @@ powermac_nvram_attach(device_t dev)
>  	 */
>  	i = (i/4) - 2;
>  
> -	sc->sc_bank0 = (vm_offset_t)pmap_mapdev(reg[i], NVRAM_SIZE * 2);
> -	sc->sc_bank1 = sc->sc_bank0 + NVRAM_SIZE;
> +	sc->sc_bank0 = pmap_mapdev(reg[i], NVRAM_SIZE * 2);
> +	sc->sc_bank1 = (char *)sc->sc_bank0 + NVRAM_SIZE;
>  
> -	gen0 = powermac_nvram_check((void *)sc->sc_bank0);
> -	gen1 = powermac_nvram_check((void *)sc->sc_bank1);
> +	gen0 = powermac_nvram_check(sc->sc_bank0);
> +	gen1 = powermac_nvram_check(sc->sc_bank1);
>  
>  	if (gen0 == -1 && gen1 == -1) {
> -		if ((void *)sc->sc_bank0 != NULL)
> +		if (sc->sc_bank0 != NULL)
>  			pmap_unmapdev(sc->sc_bank0, NVRAM_SIZE * 2);
>  		device_printf(dev, "both banks appear to be corrupt\n");
>  		return ENXIO;
> @@ -172,7 +172,7 @@ powermac_nvram_attach(device_t dev)
>  	    gen0, gen1);
>  
>  	sc->sc_bank = (gen0 > gen1) ? sc->sc_bank0 : sc->sc_bank1;
> -	bcopy((void *)sc->sc_bank, (void *)sc->sc_data, NVRAM_SIZE);
> +	bcopy(sc->sc_bank, sc->sc_data, NVRAM_SIZE);
>  
>  	sc->sc_cdev = make_dev(&powermac_nvram_cdevsw, 0, 0, 0, 0600,
>  	    "powermac_nvram");
> @@ -190,7 +190,7 @@ powermac_nvram_detach(device_t dev)
>  
>  	sc = device_get_softc(dev);
>  
> -	if ((void *)sc->sc_bank0 != NULL)
> +	if (sc->sc_bank0 != NULL)
>  		pmap_unmapdev(sc->sc_bank0, NVRAM_SIZE * 2);
>  
>  	if (sc->sc_cdev != NULL)
> @@ -224,12 +224,12 @@ powermac_nvram_close(struct cdev *dev, int fflag, int devtype, struct
> thread *td {
>  	struct powermac_nvram_softc *sc = dev->si_drv1;
>  	struct core99_header *header;
> -	vm_offset_t bank;
> +	void *bank;
>  
>  	sx_xlock(&sc->sc_lock);
>  	if (sc->sc_wpos != sizeof(sc->sc_data)) {
>  		/* Short write, restore in-memory copy */
> -		bcopy((void *)sc->sc_bank, (void *)sc->sc_data, NVRAM_SIZE);
> +		bcopy(sc->sc_bank, sc->sc_data, NVRAM_SIZE);
>  		sc->sc_isopen = 0;
>  		sx_xunlock(&sc->sc_lock);
>  		return 0;
> @@ -249,8 +249,8 @@ powermac_nvram_close(struct cdev *dev, int fflag, int devtype, struct
> thread *td (uint8_t *)&(header->adler_checksum));
>  
>  	bank = (sc->sc_bank == sc->sc_bank0) ? sc->sc_bank1 : sc->sc_bank0;
> -	if (erase_bank(sc->sc_dev, (uint8_t *)bank) != 0 ||
> -	    write_bank(sc->sc_dev, (uint8_t *)bank, sc->sc_data) != 0) {
> +	if (erase_bank(sc->sc_dev, bank) != 0 ||
> +	    write_bank(sc->sc_dev, bank, sc->sc_data) != 0) {
>  		sc->sc_isopen = 0;
>  		sx_xunlock(&sc->sc_lock);
>  		return ENOSPC;
> diff --git a/sys/dev/powermac_nvram/powermac_nvramvar.h
> b/sys/dev/powermac_nvram/powermac_nvramvar.h index abc514357531..ba637b62b83a 100644
> --- a/sys/dev/powermac_nvram/powermac_nvramvar.h
> +++ b/sys/dev/powermac_nvram/powermac_nvramvar.h
> @@ -51,9 +51,9 @@ struct powermac_nvram_softc {
>  	device_t		sc_dev;
>  	struct sx		sc_lock;
>  	phandle_t		sc_node;
> -	vm_offset_t		sc_bank;
> -	vm_offset_t		sc_bank0;
> -	vm_offset_t		sc_bank1;
> +	void *			sc_bank;
> +	void *			sc_bank0;
> +	void *			sc_bank1;
>  	uint8_t			sc_data[NVRAM_SIZE];
>  
>  	struct cdev *		sc_cdev;
> diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c
> index 57f20d7b75c1..b76d0f343671 100644
> --- a/sys/dev/smbios/smbios.c
> +++ b/sys/dev/smbios/smbios.c
> @@ -124,7 +124,7 @@ smbios_identify (driver_t *driver, device_t parent)
>  		device_set_driver(child, driver);
>  		bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
>  		device_set_desc(child, "System Management BIOS");
> -		pmap_unmapbios((vm_offset_t)eps, 0x1f);
> +		pmap_unmapbios(eps, 0x1f);
>  	}
>  
>  	return;
> diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c
> index fd78e53bbaf7..b30b1d29e205 100644
> --- a/sys/dev/vt/hw/efifb/efifb.c
> +++ b/sys/dev/vt/hw/efifb/efifb.c
> @@ -154,5 +154,5 @@ vt_efifb_fini(struct vt_device *vd, void *softc)
>  	struct fb_info	*info = softc;
>  
>  	vt_fb_fini(vd, softc);
> -	pmap_unmapdev(info->fb_vbase, info->fb_size);
> +	pmap_unmapdev((void *)info->fb_vbase, info->fb_size);
>  }
> diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c
> index 569a40eb7d95..5223fb58d850 100644
> --- a/sys/dev/vt/hw/vbefb/vbefb.c
> +++ b/sys/dev/vt/hw/vbefb/vbefb.c
> @@ -159,5 +159,5 @@ vt_vbefb_fini(struct vt_device *vd, void *softc)
>  	struct fb_info	*info = softc;
>  
>  	vt_fb_fini(vd, softc);
> -	pmap_unmapdev(info->fb_vbase, info->fb_size);
> +	pmap_unmapdev((void *)info->fb_vbase, info->fb_size);
>  }
> diff --git a/sys/dev/xen/bus/xenpv.c b/sys/dev/xen/bus/xenpv.c
> index 3d1d1025b736..584b114119e9 100644
> --- a/sys/dev/xen/bus/xenpv.c
> +++ b/sys/dev/xen/bus/xenpv.c
> @@ -144,12 +144,12 @@ static int
>  xenpv_free_physmem(device_t dev, device_t child, int res_id, struct resource *res)
>  {
>  	vm_paddr_t phys_addr;
> -	vm_offset_t virt_addr;
> +	void *virt_addr;
>  	size_t size;
>  
>  	phys_addr = rman_get_start(res);
>  	size = rman_get_size(res);
> -	virt_addr = (vm_offset_t)rman_get_virtual(res);
> +	virt_addr = rman_get_virtual(res);
>  
>  	pmap_unmapdev(virt_addr, size);
>  	vm_phys_fictitious_unreg_range(phys_addr, phys_addr + size);
> diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c
> index 82138e61f14c..9df23565de4a 100644
> --- a/sys/i386/acpica/acpi_machdep.c
> +++ b/sys/i386/acpica/acpi_machdep.c
> @@ -96,7 +96,7 @@ acpi_machdep_quirks(int *quirks)
>  	/* BIOS address 0xffff5 contains the date in the format mm/dd/yy. */
>  	va = pmap_mapbios(0xffff0, 16);
>  	sscanf(va + 11, "%2d", &year);
> -	pmap_unmapbios((vm_offset_t)va, 16);
> +	pmap_unmapbios(va, 16);
>  
>  	/* 
>  	 * Date must be >= 1/1/1999 or we don't trust ACPI.  Note that this
> @@ -121,17 +121,17 @@ map_table(vm_paddr_t pa, const char *sig)
>  
>  	header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
>  	if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
> -		pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +		pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  		return (NULL);
>  	}
>  	length = header->Length;
> -	pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
>  	table = pmap_mapbios(pa, length);
>  	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
>  		if (bootverbose)
>  			printf("ACPI: Failed checksum for table %s\n", sig);
>  #if (ACPI_CHECKSUM_ABORT)
> -		pmap_unmapbios((vm_offset_t)table, length);
> +		pmap_unmapbios(table, length);
>  		return (NULL);
>  #endif
>  	}
> @@ -150,7 +150,7 @@ probe_table(vm_paddr_t address, const char *sig)
>  
>  	table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER));
>  	ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0;
> -	pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
> +	pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
>  	return (ret);
>  }
>  
> @@ -172,7 +172,7 @@ acpi_unmap_table(void *table)
>  	ACPI_TABLE_HEADER *header;
>  
>  	header = (ACPI_TABLE_HEADER *)table;
> -	pmap_unmapbios((vm_offset_t)table, header->Length);
> +	pmap_unmapbios(table, header->Length);
>  }
>  
>  /*
> @@ -253,7 +253,7 @@ acpi_find_table(const char *sig)
>  			}
>  		acpi_unmap_table(rsdt);
>  	}
> -	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
> +	pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
>  	if (addr == 0)
>  		return (0);
>  
> diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
> index 70139b2f4e66..21aa5abee53b 100644
> --- a/sys/i386/i386/pmap.c
> +++ b/sys/i386/i386/pmap.c
> @@ -5503,12 +5503,13 @@ __CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t size, int
> mode, }
>  
>  static void
> -__CONCAT(PMTYPE, unmapdev)(vm_offset_t va, vm_size_t size)
> +__CONCAT(PMTYPE, unmapdev)(void *p, vm_size_t size)
>  {
>  	struct pmap_preinit_mapping *ppim;
> -	vm_offset_t offset;
> +	vm_offset_t offset, va;
>  	int i;
>  
> +	va = (vm_offset_t)p;
>  	if (va >= PMAP_MAP_LOW && va <= KERNBASE && va + size <= KERNBASE)
>  		return;
>  	offset = va & PAGE_MASK;
> diff --git a/sys/i386/i386/pmap_base.c b/sys/i386/i386/pmap_base.c
> index 6f0d105f0f56..6a3391e36d26 100644
> --- a/sys/i386/i386/pmap_base.c
> +++ b/sys/i386/i386/pmap_base.c
> @@ -807,10 +807,10 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
>  }
>  
>  void
> -pmap_unmapdev(vm_offset_t va, vm_size_t size)
> +pmap_unmapdev(void *p, vm_size_t size)
>  {
>  
> -	pmap_methods_ptr->pm_unmapdev(va, size);
> +	pmap_methods_ptr->pm_unmapdev(p, size);
>  }
>  
>  void
> diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h
> index 7174c3d5b2bd..8ee309a5ab85 100644
> --- a/sys/i386/include/pmap.h
> +++ b/sys/i386/include/pmap.h
> @@ -277,7 +277,7 @@ void	pmap_remap_lower(bool);
>  void	pmap_remap_lowptdi(bool);
>  void	pmap_set_nx(void);
>  void	pmap_sf_buf_map(struct sf_buf *sf);
> -void	pmap_unmapdev(vm_offset_t, vm_size_t);
> +void	pmap_unmapdev(void *, vm_size_t);
>  void	pmap_invalidate_page(pmap_t, vm_offset_t);
>  void	pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t);
>  void	pmap_invalidate_all(pmap_t);
> diff --git a/sys/i386/include/pmap_base.h b/sys/i386/include/pmap_base.h
> index 322d749c4591..ca9a5049d696 100644
> --- a/sys/i386/include/pmap_base.h
> +++ b/sys/i386/include/pmap_base.h
> @@ -96,7 +96,7 @@ struct pmap_methods {
>  	void (*pm_remove_write)(vm_page_t);
>  	int (*pm_ts_referenced)(vm_page_t);
>  	void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int, int);
> -	void (*pm_unmapdev)(vm_offset_t, vm_size_t);
> +	void (*pm_unmapdev)(void *, vm_size_t);
>  	void (*pm_page_set_memattr)(vm_page_t, vm_memattr_t);
>  	vm_paddr_t (*pm_extract)(pmap_t, vm_offset_t);
>  	vm_page_t (*pm_extract_and_hold)(pmap_t, vm_offset_t, vm_prot_t);
> diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
> index fed9adcb9adb..df72e49f4de5 100644
> --- a/sys/kern/subr_devmap.c
> +++ b/sys/kern/subr_devmap.c
> @@ -325,14 +325,15 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
>   * Unmap device memory and free the kva space.
>   */
>  void
> -pmap_unmapdev(vm_offset_t va, vm_size_t size)
> +pmap_unmapdev(void *p, vm_size_t size)
>  {
> -	vm_offset_t offset;
> +	vm_offset_t offset, va;
>  
>  	/* Nothing to do if we find the mapping in the static table. */
> -	if (devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND)
> +	if (devmap_vtop(p, size) != DEVMAP_PADDR_NOTFOUND)
>  		return;
>  
> *** 325 LINES SKIPPED ***
> 

This commit breaks compiling x11/nvidia-driver on CURRENT:

[...]
--- nvidia_os.o ---
nvidia_os.c:283:19: error: incompatible integer to pointer conversion passing 'vm_offset_t'
(aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
pmap_unmapdev((vm_offset_t)address, size); ^~~~~~~~~~~~~~~~~~~~
./machine/pmap.h:511:26: note: passing argument to parameter here
void    pmap_unmapdev(void *, vm_size_t);
[...]

I took the liberty to file a bug for the port x11/nvidia-driver here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266561

Kind regards,

O. Hartmann
                            ^


-- 
O. Hartmann