Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2024 00:05:21 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4505c8924202 - main - simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource
Message-ID:  <202402160005.41G05LHJ022997@gitrepo.freebsd.org>

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

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

commit 4505c89242025f840023cdf092fdab845586f42d
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-02-16 00:04:50 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-02-16 00:04:50 +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
---
 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 bf6fceb48a9c..71ba8a0a1f7a 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -447,9 +447,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.
@@ -470,6 +467,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?202402160005.41G05LHJ022997>