From nobody Thu Feb 27 14:16:45 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3YLP704Hz5qG25; Thu, 27 Feb 2025 14:16:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3YLP6Gflz3xJ4; Thu, 27 Feb 2025 14:16:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740665805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3gUgE+7Y6seLd2p/X3RhT+WdF08qwLGyPuvz8wlBwc4=; b=dRK/EHEw88MScUK8p2vEw6TbdwtLpvH9ERbLmJ1zC3PhTIH74s23VBIx7S026ONzx0BOUL xgZDbIHeVFxZObyZlS6nvYrm4zfdNlnZdZI5noLpUwPfqqxXUOxbZQsfuDEpkUlJeZcqB6 RlFeERrLki/E9g2paMqP6WWOthYp25S/mOrSky1sCU51IaGCsnYA81OhB7B69kxd427URU ALg17yyadvpIZKHD4o2ZwTLd6iGMKnj9z57tndEVUnL8+Al8l97Nb1ZA3RW46mZRX04rNr e0gpLh3kZjcrivcQ0ozqVvdCjmqHmGNc0bV4zhKOxW69EBXpb1nuTq2Rg4dYRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740665805; a=rsa-sha256; cv=none; b=yfg/Yv0z2Hi4NuXHZWsVCxIvGJlRFRSrxmlUDLRHefRDCq1VI3zo/N7M7W/VdpDsHwNFdU yejKpS4CVGzyG+zdUyo/WpoXQTBf/QhZvlyPUqUFaVYE6IxzRFViE75iCdK4yTcjY6HvFe atJzdKvfJjQZ/HaEX6GlVo4MMIub6zt4EpzNMu+AU2UI0voL3mWPtYdShj3x3UdbvbvzS2 7SG/VX3InX31sOeZKW9yBm0laOL2EktWoah2FeoZzke789lU3w00HxbhTgm5/Liuqyq7/p iax6aFxNtRx42LFnFzx4GKmULNiD0L2UIAltCwVbXMJ5xX06AGlIWGT5ZRxVeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740665805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3gUgE+7Y6seLd2p/X3RhT+WdF08qwLGyPuvz8wlBwc4=; b=D18CvxGhnLwlPflQw120Jr+bk6rMxKlpgP5SoiPDqYT69K2akh2w6Ez7R/os9lc/Tc6vh8 egx2BJPcdl5X9EHrA+WDj5YEhRAsORXzAxX7D18bRGHJqgmG4dNn5nm/rrDGwdFYvK0Ax0 Md3v6lrSm4iX859dP7P3fjiy2ibqA0c+dE/6ITIHUCc15WtdVt4rd07UhxoNY3Sv8sPduu S/E1QZfsfRpy2jV9Qg1fKB/QUTmajiyNhvx4JhO7UUxJcIVDkEmWBaB2aStbYviurFvvSU UJ7a7bF4sx+e9NY/YtRyGUWbwCx94QNCMshqfPNyyms8UP4mSH6W4hFyqQfbQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3YLP5s3mzmbW; Thu, 27 Feb 2025 14:16:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51REGj8R016094; Thu, 27 Feb 2025 14:16:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51REGjtd016091; Thu, 27 Feb 2025 14:16:45 GMT (envelope-from git) Date: Thu, 27 Feb 2025 14:16:45 GMT Message-Id: <202502271416.51REGjtd016091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 672a0a76ed4a - stable/14 - simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 672a0a76ed4ab2fbcad7bc668b1f2dd1a8f09766 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=672a0a76ed4ab2fbcad7bc668b1f2dd1a8f09766 commit 672a0a76ed4ab2fbcad7bc668b1f2dd1a8f09766 Author: John Baldwin AuthorDate: 2024-01-23 17:38:25 +0000 Commit: John Baldwin CommitDate: 2025-02-27 13:09:20 +0000 simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43442 (cherry picked from commit 3cf553288b968106e40882bb73b30da652614ba0) --- sys/dev/fdt/simplebus.c | 90 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index db357b190d9e..273e77abd642 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -47,6 +47,19 @@ static int simplebus_probe(device_t dev); static struct resource *simplebus_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); +static int simplebus_adjust_resource(device_t bus, device_t child, + int type, struct resource *r, rman_res_t start, rman_res_t end); +static int simplebus_release_resource(device_t bus, device_t child, + int type, int rid, struct resource *r); +static int simplebus_activate_resource(device_t bus, + device_t child, int type, int rid, struct resource *r); +static int simplebus_deactivate_resource(device_t bus, + device_t child, int type, int rid, struct resource *r); +static int simplebus_map_resource(device_t bus, device_t child, + int type, struct resource *r, struct resource_map_request *args, + struct resource_map *map); +static int simplebus_unmap_resource(device_t bus, device_t child, + int type, struct resource *r, struct resource_map *map); static void simplebus_probe_nomatch(device_t bus, device_t child); static int simplebus_print_child(device_t bus, device_t child); static device_t simplebus_add_child(device_t dev, u_int order, @@ -84,10 +97,12 @@ static device_method_t simplebus_methods[] = { DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, simplebus_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_release_resource, simplebus_release_resource), + DEVMETHOD(bus_activate_resource, simplebus_activate_resource), + DEVMETHOD(bus_deactivate_resource, simplebus_deactivate_resource), + DEVMETHOD(bus_adjust_resource, simplebus_adjust_resource), + DEVMETHOD(bus_map_resource, simplebus_map_resource), + DEVMETHOD(bus_unmap_resource, simplebus_unmap_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), @@ -433,6 +448,9 @@ 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. @@ -441,9 +459,6 @@ simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, if ((di = device_get_ivars(child)) == NULL) return (NULL); - if (type == SYS_RES_IOPORT) - type = SYS_RES_MEMORY; - rle = resource_list_find(&di->rl, type, *rid); if (rle == NULL) { if (bootverbose) @@ -481,6 +496,67 @@ simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, count, flags)); } +static int +simplebus_adjust_resource(device_t bus, device_t child, int type, + struct resource *r, rman_res_t start, rman_res_t end) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_adjust_resource(bus, child, type, r, start, end)); +} + +static int +simplebus_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_release_resource(bus, child, type, rid, r)); +} + +static int +simplebus_activate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_activate_resource(bus, child, type, rid, r)); +} + +static int +simplebus_deactivate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_deactivate_resource(bus, child, type, rid, r)); +} + +static int +simplebus_map_resource(device_t bus, device_t child, int type, + struct resource *r, struct resource_map_request *args, + struct resource_map *map) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_map_resource(bus, child, type, r, args, map)); +} + +static int +simplebus_unmap_resource(device_t bus, device_t child, int type, + struct resource *r, struct resource_map *map) +{ + + if (type == SYS_RES_IOPORT) + type = SYS_RES_MEMORY; + return (bus_generic_unmap_resource(bus, child, type, r, map)); +} + static int simplebus_print_res(struct simplebus_devinfo *di) {