git: a3d6e0de1c89 - main - powerpc: Fix bus_space_unmap

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 23 Jan 2024 17:46:02 UTC
The branch main has been updated by jhb:

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

commit a3d6e0de1c89c145b40ed80fe54c6bad1abbf416
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-23 17:37:53 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-23 17:37:53 +0000

    powerpc: Fix bus_space_unmap
    
    Previously it failed to compile since the macro passed too many
    arguments to the function.  Fix by adding the bus handle to the
    function and adding an implementation that calls pmap_unmapdev.
    
    Reviewed by:    jhibbits
    Differential Revision:  https://reviews.freebsd.org/D43440
---
 sys/powerpc/include/bus.h         | 2 +-
 sys/powerpc/powerpc/bus_machdep.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/powerpc/include/bus.h b/sys/powerpc/include/bus.h
index 6e91900c236d..ddb4737d9b76 100644
--- a/sys/powerpc/include/bus.h
+++ b/sys/powerpc/include/bus.h
@@ -103,7 +103,7 @@ struct bus_space {
 	/* mapping/unmapping */
 	int	(*bs_map)(bus_addr_t, bus_size_t, int,
 	    bus_space_handle_t *);
-	void	(*bs_unmap)(bus_size_t);
+	void	(*bs_unmap)(bus_space_handle_t, bus_size_t);
 	int	(*bs_subregion)(bus_space_handle_t, bus_size_t,
 	    bus_size_t, bus_space_handle_t *);
 
diff --git a/sys/powerpc/powerpc/bus_machdep.c b/sys/powerpc/powerpc/bus_machdep.c
index 39096edfc1f7..e908750961d0 100644
--- a/sys/powerpc/powerpc/bus_machdep.c
+++ b/sys/powerpc/powerpc/bus_machdep.c
@@ -140,8 +140,13 @@ bs_remap_earlyboot(void)
 }
 
 static void
-bs_gen_unmap(bus_size_t size __unused)
+bs_gen_unmap(bus_space_handle_t bsh, bus_size_t size)
 {
+
+	if (!pmap_bootstrapped)
+		return;
+
+	pmap_unmapdev((void *)bsh, size);
 }
 
 static int