Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2025 14:16:58 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: 8765268c119f - stable/14 - simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource
Message-ID:  <202502271416.51REGwsO016489@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=8765268c119f3fe4d0a4a9e65ce3be0efd283133

commit 8765268c119f3fe4d0a4a9e65ce3be0efd283133
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-02-16 00:04:50 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-02-27 13:09:21 +0000

    simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource
    
    Specifically, the set/get_resource methods do not currently remap
    resource types, so remap the type in alloc_resource only after
    looking for a matching resource list entry.
    
    Fixes:          3cf553288b96 simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY
    (cherry picked from commit 4505c89242025f840023cdf092fdab845586f42d)
---
 sys/dev/fdt/simplebus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index 273e77abd642..854494eb4899 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -448,9 +448,6 @@ simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid,
 
 	sc = device_get_softc(bus);
 
-	if (type == SYS_RES_IOPORT)
-		type = SYS_RES_MEMORY;
-
 	/*
 	 * Request for the default allocation with a given rid: use resource
 	 * list stored in the local device info.
@@ -471,6 +468,9 @@ simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid,
 		count = rle->count;
         }
 
+	if (type == SYS_RES_IOPORT)
+		type = SYS_RES_MEMORY;
+
 	if (type == SYS_RES_MEMORY) {
 		/* Remap through ranges property */
 		for (j = 0; j < sc->nranges; j++) {



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