Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 2025 15:45:02 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3dae01840d99 - main - arm/freescale: Stop using devmap_ptov
Message-ID:  <202505021545.542Fj2Pc097585@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

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

commit 3dae01840d99bab646d39b9487adca44ab96ba22
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-05-02 15:33:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-05-02 15:39:04 +0000

    arm/freescale: Stop using devmap_ptov
    
    Call pmap_mapdev directly. If it can allocate this memory using the
    static device map via devmap_ptov it will so there is no need to call
    it directly.
    
    Reviewed by:    mhorne
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D50014
---
 sys/arm/freescale/imx/imx6_machdep.c | 4 +++-
 sys/arm/freescale/imx/imx_machdep.c  | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c
index 9cfae5b9c802..cc23b33f4f92 100644
--- a/sys/arm/freescale/imx/imx6_machdep.c
+++ b/sys/arm/freescale/imx/imx6_machdep.c
@@ -35,6 +35,7 @@
 #include <sys/devmap.h>
 
 #include <vm/vm.h>
+#include <vm/pmap.h>
 
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -310,12 +311,13 @@ imx_soc_type(void)
 		    IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT;
 		/*printf("digprog = 0x%08x\n", digprog);*/
 		if (hwsoc == HWSOC_MX6DL) {
-			pcr = devmap_ptov(SCU_CONFIG_PHYSADDR, 4);
+			pcr = pmap_mapdev(SCU_CONFIG_PHYSADDR, 4);
 			if (pcr != NULL) {
 				/*printf("scu config = 0x%08x\n", *pcr);*/
 				if ((*pcr & 0x03) == 0) {
 					hwsoc = HWSOC_MX6SOLO;
 				}
+				pmap_unmapdev(pcr, 4);
 			}
 		}
 	}
diff --git a/sys/arm/freescale/imx/imx_machdep.c b/sys/arm/freescale/imx/imx_machdep.c
index e5d3dc4811b9..b3f347cebc78 100644
--- a/sys/arm/freescale/imx/imx_machdep.c
+++ b/sys/arm/freescale/imx/imx_machdep.c
@@ -31,7 +31,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/reboot.h>
-#include <sys/devmap.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -66,7 +65,7 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr)
 {
 	volatile uint16_t cr, *pcr;
 
-	if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) {
+	if ((pcr = pmap_mapdev(wdcr_physaddr, sizeof(*pcr))) == NULL) {
 		printf("imx_wdog_cpu_reset(): "
 		    "cannot find control register... locking up now.");
 		for (;;)
@@ -116,7 +115,7 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys)
 {
 	volatile uint16_t * psr;
 
-	if ((psr = devmap_ptov(wdsr_phys, sizeof(*psr))) == NULL)
+	if ((psr = pmap_mapdev(wdsr_phys, sizeof(*psr))) == NULL)
 		return;
 	last_reset_status = *psr;
 	if (last_reset_status & WDOG_RSR_SFTW) {
@@ -126,4 +125,5 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys)
 	} else if (last_reset_status & WDOG_RSR_POR) {
 		sysctl___hw_imx_last_reset_reason.oid_arg1 = "PowerOnReset";
 	}
+	pmap_unmapdev((void *)(uintptr_t)psr, sizeof(*psr));
 }



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