Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jan 2024 20:45:36 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 19cfade3f392 - stable/14 - arm64/riscv nexus: Implement bus_unmap_resource
Message-ID:  <202401032045.403Kja0c037474@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=19cfade3f3924a7b5bc23d919e280db7f303ffd0

commit 19cfade3f3924a7b5bc23d919e280db7f303ffd0
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-11-23 17:06:51 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-03 20:34:28 +0000

    arm64/riscv nexus: Implement bus_unmap_resource
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D42725
    
    (cherry picked from commit 71cfd330fc008187ff41db795ae5e6372bf802ab)
---
 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 25d23f74d92b..5bd9b15dde2c 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;
@@ -139,6 +140,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
@@ -492,6 +494,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401032045.403Kja0c037474>