git: 71cfd330fc00 - main - arm64/riscv nexus: Implement bus_unmap_resource
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Nov 2023 17:07:07 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=71cfd330fc008187ff41db795ae5e6372bf802ab commit 71cfd330fc008187ff41db795ae5e6372bf802ab Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-11-23 17:06:51 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-11-23 17:06:51 +0000 arm64/riscv nexus: Implement bus_unmap_resource Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D42725 --- sys/arm64/arm64/nexus.c | 17 +++++++++++++++++ sys/riscv/riscv/nexus.c | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 7c4cb073c2ef..a20f8d0289ad 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -112,6 +112,7 @@ static bus_deactivate_resource_t nexus_deactivate_resource; static bus_get_resource_list_t nexus_get_reslist; static bus_map_resource_t nexus_map_resource; static bus_release_resource_t nexus_release_resource; +static bus_unmap_resource_t nexus_unmap_resource; #ifdef SMP static bus_bind_intr_t nexus_bind_intr; @@ -141,6 +142,7 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif @@ -494,6 +496,21 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, return (0); } +static int +nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map *map) +{ + + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + pmap_unmapdev(map->r_vaddr, map->r_size); + return (0); + default: + return (EINVAL); + } +} + #ifdef FDT static device_method_t nexus_fdt_methods[] = { /* Device interface */ diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index 936db3e548e9..d92ad7861ae9 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -87,6 +87,7 @@ static bus_deactivate_resource_t nexus_deactivate_resource; static bus_get_resource_list_t nexus_get_reslist; static bus_map_resource_t nexus_map_resource; static bus_release_resource_t nexus_release_resource; +static bus_unmap_resource_t nexus_unmap_resource; static bus_config_intr_t nexus_config_intr; static bus_describe_intr_t nexus_describe_intr; @@ -118,6 +119,7 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), + DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_setup_intr, nexus_setup_intr), @@ -456,6 +458,20 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, return (0); } +static int +nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map *map) +{ + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + pmap_unmapdev(map->r_vaddr, map->r_size); + return (0); + default: + return (EINVAL); + } +} + static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, pcell_t *intr)