pmap_mapdev: Consistently use vm_paddr_t for the first argument.

The devmap variants used vm_offset_t for some reason, and a few places
explicitly cast bus addresses to vm_offset_t.  (Probably those casts
along with similar casts for vm_size_t should just be removed and
instead permit the compiler to DTRT.)

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35961
This commit is contained in:
John Baldwin 2022-07-28 15:55:10 -07:00
parent 9579540144
commit ea8f128c7c
7 changed files with 10 additions and 10 deletions

View File

@ -363,7 +363,7 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
}
rman_set_bustag(r, fdtbus_bs_tag);
#else
vaddr = (bus_space_handle_t)pmap_mapdev((vm_offset_t)paddr,
vaddr = (bus_space_handle_t)pmap_mapdev((vm_paddr_t)paddr,
(vm_size_t)psize);
if (vaddr == 0) {
rman_deactivate_resource(r);

View File

@ -81,7 +81,7 @@ fsl_ocotp_devmap(void)
ocotp_size = (vm_size_t)size;
if ((ocotp_regs = pmap_mapdev((vm_offset_t)base, ocotp_size)) == NULL)
if ((ocotp_regs = pmap_mapdev((vm_paddr_t)base, ocotp_size)) == NULL)
goto fatal;
return;

View File

@ -184,13 +184,13 @@ bool pmap_klookup(vm_offset_t va, vm_paddr_t *pa);
vm_paddr_t pmap_kextract(vm_offset_t va);
void pmap_kremove(vm_offset_t);
void pmap_kremove_device(vm_offset_t, vm_size_t);
void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma);
void *pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma);
bool pmap_page_is_mapped(vm_page_t m);
int pmap_pinit_stage(pmap_t, enum pmap_stage, int);
bool pmap_ps_enabled(pmap_t pmap);
uint64_t pmap_to_ttbr0(pmap_t pmap);
void *pmap_mapdev(vm_offset_t, vm_size_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);

View File

@ -260,7 +260,7 @@ devmap_vtop(void * vpva, vm_size_t size)
* pmap_kenter_device().
*/
void *
pmap_mapdev(vm_offset_t pa, vm_size_t size)
pmap_mapdev(vm_paddr_t pa, vm_size_t size)
{
vm_offset_t va, offset;
void * rva;
@ -292,7 +292,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size)
#if defined(__aarch64__) || defined(__riscv)
void *
pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma)
pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
{
vm_offset_t va, offset;
void * rva;

View File

@ -627,7 +627,7 @@ macio_activate_resource(device_t bus, device_t child, int type, int rid,
return (bus_activate_resource(bus, type, rid, res));
if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) {
p = pmap_mapdev((vm_offset_t)rman_get_start(res) + sc->sc_base,
p = pmap_mapdev((vm_paddr_t)rman_get_start(res) + sc->sc_base,
(vm_size_t)rman_get_size(res));
if (p == NULL)
return (ENOMEM);

View File

@ -372,7 +372,7 @@ iobus_activate_resource(device_t bus, device_t child, int type, int rid,
return (bus_activate_resource(bus, type, rid, res));
if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) {
p = pmap_mapdev((vm_offset_t)rman_get_start(res) + sc->sc_addr,
p = pmap_mapdev((vm_paddr_t)rman_get_start(res) + sc->sc_addr,
(vm_size_t)rman_get_size(res));
if (p == NULL)
return (ENOMEM);

View File

@ -162,11 +162,11 @@ void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
vm_paddr_t pmap_kextract(vm_offset_t va);
void pmap_kremove(vm_offset_t);
void pmap_kremove_device(vm_offset_t, vm_size_t);
void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma);
void *pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma);
bool pmap_page_is_mapped(vm_page_t m);
bool pmap_ps_enabled(pmap_t);
void *pmap_mapdev(vm_offset_t, vm_size_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);