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
This commit is contained in:
John Baldwin 2022-09-22 15:08:52 -07:00
parent 02fac928ab
commit 7ae99f80b6
59 changed files with 138 additions and 133 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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);
}

View File

@ -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);
}
/*

View File

@ -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 "

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;
va = (vm_offset_t)p;
offset = va & PAGE_MASK;
va = trunc_page(va);
size = round_page(size + offset);

View File

@ -315,7 +315,7 @@ void moea_cpu_bootstrap(int);
void moea_bootstrap(vm_offset_t, vm_offset_t);
void *moea_mapdev(vm_paddr_t, vm_size_t);
void *moea_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
void moea_unmapdev(vm_offset_t, vm_size_t);
void moea_unmapdev(void *, vm_size_t);
vm_paddr_t moea_kextract(vm_offset_t);
void moea_kenter_attr(vm_offset_t, vm_paddr_t, vm_memattr_t);
void moea_kenter(vm_offset_t, vm_paddr_t);
@ -2724,14 +2724,15 @@ moea_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
}
void
moea_unmapdev(vm_offset_t va, vm_size_t size)
moea_unmapdev(void *p, vm_size_t size)
{
vm_offset_t base, offset;
vm_offset_t base, offset, va;
/*
* If this is outside kernel virtual space, then it's a
* battable entry and doesn't require unmapping
*/
va = (vm_offset_t)p;
if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= virtual_end)) {
base = trunc_page(va);
offset = va & PAGE_MASK;

View File

@ -425,7 +425,7 @@ void moea64_activate(struct thread *);
void moea64_deactivate(struct thread *);
void *moea64_mapdev(vm_paddr_t, vm_size_t);
void *moea64_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
void moea64_unmapdev(vm_offset_t, vm_size_t);
void moea64_unmapdev(void *, vm_size_t);
vm_paddr_t moea64_kextract(vm_offset_t);
void moea64_page_set_memattr(vm_page_t m, vm_memattr_t ma);
void moea64_kenter_attr(vm_offset_t, vm_paddr_t, vm_memattr_t ma);
@ -3206,10 +3206,11 @@ moea64_mapdev(vm_paddr_t pa, vm_size_t size)
}
void
moea64_unmapdev(vm_offset_t va, vm_size_t size)
moea64_unmapdev(void *p, vm_size_t size)
{
vm_offset_t base, offset;
vm_offset_t base, offset, va;
va = (vm_offset_t)p;
base = trunc_page(va);
offset = va & PAGE_MASK;
size = roundup2(offset + size, PAGE_SIZE);

View File

@ -489,7 +489,7 @@ static void mmu_radix_pinit0(pmap_t);
static void *mmu_radix_mapdev(vm_paddr_t, vm_size_t);
static void *mmu_radix_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
static void mmu_radix_unmapdev(vm_offset_t, vm_size_t);
static void mmu_radix_unmapdev(void *, vm_size_t);
static void mmu_radix_kenter_attr(vm_offset_t, vm_paddr_t, vm_memattr_t ma);
static boolean_t mmu_radix_dev_direct_mapped(vm_paddr_t, vm_size_t);
static void mmu_radix_dumpsys_map(vm_paddr_t pa, size_t sz, void **va);
@ -5900,12 +5900,14 @@ mmu_radix_page_set_memattr(vm_page_t m, vm_memattr_t ma)
}
static void
mmu_radix_unmapdev(vm_offset_t va, vm_size_t size)
mmu_radix_unmapdev(void *p, vm_size_t size)
{
vm_offset_t offset;
vm_offset_t offset, va;
CTR3(KTR_PMAP, "%s(%p, %#x)", __func__, p, size);
CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, va, size);
/* If we gave a direct map region in pmap_mapdev, do nothing */
va = (vm_offset_t)p;
if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS)
return;

View File

@ -333,7 +333,7 @@ static void mmu_booke_deactivate(struct thread *);
static void mmu_booke_bootstrap(vm_offset_t, vm_offset_t);
static void *mmu_booke_mapdev(vm_paddr_t, vm_size_t);
static void *mmu_booke_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
static void mmu_booke_unmapdev(vm_offset_t, vm_size_t);
static void mmu_booke_unmapdev(void *, vm_size_t);
static vm_paddr_t mmu_booke_kextract(vm_offset_t);
static void mmu_booke_kenter(vm_offset_t, vm_paddr_t);
static void mmu_booke_kenter_attr(vm_offset_t, vm_paddr_t, vm_memattr_t);
@ -2313,14 +2313,15 @@ mmu_booke_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
* 'Unmap' a range mapped by mmu_booke_mapdev().
*/
static void
mmu_booke_unmapdev(vm_offset_t va, vm_size_t size)
mmu_booke_unmapdev(void *p, vm_size_t size)
{
#ifdef SUPPORTS_SHRINKING_TLB1
vm_offset_t base, offset;
vm_offset_t base, offset, va;
/*
* Unmap only if this is inside kernel virtual space.
*/
va = (vm_offset_t)p;
if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)) {
base = trunc_page(va);
offset = va & PAGE_MASK;

View File

@ -38,7 +38,7 @@ typedef void (*pmap_kenter_attr_t)(vm_offset_t, vm_paddr_t, vm_memattr_t);
typedef void (*pmap_kremove_t)(vm_offset_t);
typedef void *(*pmap_mapdev_t)(vm_paddr_t, vm_size_t);
typedef void *(*pmap_mapdev_attr_t)(vm_paddr_t, vm_size_t, vm_memattr_t);
typedef void (*pmap_unmapdev_t)(vm_offset_t, vm_size_t);
typedef void (*pmap_unmapdev_t)(void *, vm_size_t);
typedef void (*pmap_page_set_memattr_t)(vm_page_t, vm_memattr_t);
typedef int (*pmap_change_attr_t)(vm_offset_t, vm_size_t, vm_memattr_t);
typedef int (*pmap_map_user_ptr_t)(pmap_t, volatile const void *,

View File

@ -310,7 +310,7 @@ void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t);
void pmap_kremove(vm_offset_t);
void *pmap_mapdev(vm_paddr_t, vm_size_t);
void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
void pmap_unmapdev(vm_offset_t, vm_size_t);
void pmap_unmapdev(void *, vm_size_t);
void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t);
int pmap_map_user_ptr(pmap_t pm, volatile const void *uaddr,

View File

@ -157,7 +157,8 @@ lbc_banks_unmap(struct lbc_softc *sc)
if (sc->sc_range[r].size == 0)
return;
pmap_unmapdev(sc->sc_range[r].kva, sc->sc_range[r].size);
pmap_unmapdev((void *)sc->sc_range[r].kva,
sc->sc_range[r].size);
law_disable(OCP85XX_TGTIF_LBC, sc->sc_range[r].addr,
sc->sc_range[r].size);
r++;

View File

@ -650,7 +650,7 @@ macio_deactivate_resource(device_t bus, device_t child, int type, int rid,
u_int32_t psize;
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));

View File

@ -613,7 +613,7 @@ unin_chip_deactivate_resource(device_t bus, device_t child, int type, int rid,
u_int32_t psize;
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));

View File

@ -269,7 +269,7 @@ nexus_deactivate_resource(device_t bus __unused, device_t child __unused,
bus_size_t psize;
psize = rman_get_size(r);
pmap_unmapdev((vm_offset_t)rman_get_virtual(r), psize);
pmap_unmapdev(rman_get_virtual(r), psize);
}
return (rman_deactivate_resource(r));
@ -349,7 +349,7 @@ nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
*/
switch (type) {
case SYS_RES_MEMORY:
pmap_unmapdev((vm_offset_t)map->r_vaddr, map->r_size);
pmap_unmapdev(map->r_vaddr, map->r_size);
/* FALLTHROUGH */
case SYS_RES_IOPORT:
break;

View File

@ -175,7 +175,7 @@ DEFINE_PMAP_IFUNC(void, cpu_bootstrap, (int));
DEFINE_PMAP_IFUNC(void *, mapdev, (vm_paddr_t, vm_size_t));
DEFINE_PMAP_IFUNC(void *, mapdev_attr, (vm_paddr_t, vm_size_t, vm_memattr_t));
DEFINE_PMAP_IFUNC(void, page_set_memattr, (vm_page_t, vm_memattr_t));
DEFINE_PMAP_IFUNC(void, unmapdev, (vm_offset_t, vm_size_t));
DEFINE_PMAP_IFUNC(void, unmapdev, (void *, vm_size_t));
DEFINE_PMAP_IFUNC(int, map_user_ptr,
(pmap_t, volatile const void *, void **, size_t, size_t *));
DEFINE_PMAP_IFUNC(int, decode_kernel_ptr, (vm_offset_t, int *, vm_offset_t *));

View File

@ -395,7 +395,7 @@ iobus_deactivate_resource(device_t bus, device_t child, int type, int rid,
u_int32_t psize;
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));

View File

@ -169,8 +169,8 @@ bool pmap_ps_enabled(pmap_t);
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);

View File

@ -106,7 +106,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

View File

@ -4455,7 +4455,7 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
}
void
pmap_unmapbios(vm_paddr_t pa, vm_size_t size)
pmap_unmapbios(void *p, vm_size_t size)
{
}

View File

@ -59,5 +59,5 @@ bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
{
if (tag == X86_BUS_SPACE_MEM)
pmap_unmapdev(bsh, size);
pmap_unmapdev((void *)bsh, size);
}

View File

@ -613,7 +613,7 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase)
{
struct ioapic *io;
struct ioapic_intsrc *intpin;
volatile ioapic_t *apic;
ioapic_t *apic;
u_int numintr, i;
uint32_t value;
@ -625,7 +625,7 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase)
/* If it's version register doesn't seem to work, punt. */
if (value == 0xffffffff) {
pmap_unmapdev((vm_offset_t)apic, IOAPIC_MEM_REGION);
pmap_unmapdev(apic, IOAPIC_MEM_REGION);
return (NULL);
}

View File

@ -542,7 +542,7 @@ nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
*/
switch (type) {
case SYS_RES_MEMORY:
pmap_unmapdev((vm_offset_t)map->r_vaddr, map->r_size);
pmap_unmapdev(map->r_vaddr, map->r_size);
/* FALLTHROUGH */
case SYS_RES_IOPORT:
break;