From nobody Tue Jan 23 17:46:05 2024 X-Original-To: dev-commits-src-main@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 4TKDz15p9yz57mp8; Tue, 23 Jan 2024 17:46:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TKDz13DV9z47QF; Tue, 23 Jan 2024 17:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031965; 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=9JvW26eNviNEr+zHlxKa3/aIjLHIh6o5RjwI0QhcWX0=; b=PrW/jptxBRcbQBElce7SwepHOaoL/izTmLZiw2i8VQrOQpD2R6yAl9vB9miwjef4eVil42 lM4bmbPcYvovONZlVNkhl5o5RADFZHIt3MQZsupwBXEDmsQrQ2mOYhVIKgZBs/1hOtqz+d HkPCRdny0A4WxA4aIl1/WmRNNw8nNfu7gk5wFmjEgTvQ/Tp57HQ1kfIcHdIi3NaedtFJ9l upsty7vu3bBn7eBhjGAqHnDZiZduAhu16SsfKWJ1eGBoIJ09yf3dJPMthTvnvFBMNrpkDG 8+clpsq3veukf7WVAzHke3dtcR3WKC5Zq7HexGlqAZ4vrbOKemfLcZtpiGkC5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031965; 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=9JvW26eNviNEr+zHlxKa3/aIjLHIh6o5RjwI0QhcWX0=; b=smSp9jcwcFOY7VKPHbmtxoVgEWwPw4JktOB1tXPucPrvWpRODKuYFo1wDHL/TqXEiER0iL 7lGYUOAXLVziflfMIToSzdoF2rftZFHTKn4HgbEkvIPWFpB8S2w7b/jhm5VVQuy65WELhR 7V98LFAmLaZhUU5L52kwU1XXwoMRtf6sGkjuDIfGa8KGUvnCYLJ9NpopTY6P49iVhRVef3 lTrLVAMSqPwuqiabq+c68FErBGGEn28ycUbsEb8VXpR0jx3NPQ85H4wFjkrrJrMVeWADkG nJ6YvGPFUpUm+7JgvNMe+r9zOYOgu+M1LvdxI5WnHvYuGsmHZQy1K2EzgTWcmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706031965; a=rsa-sha256; cv=none; b=iRlFHaDGlYxOO1GVUKko+i/dhelWd4mCP1R+sUYoFwtMlZBFSjeJtMWPmahI0WTC55Vf7o KNeFCWjqrpFerdVlkb+nwb/UxywIAoj278CuX86C6gh9ZtCbwTLiC/Tm50m8Tao30UptBH qC9HtyNBbzkRd6cVLxPM2KH6Bit+947ZJ21Toai20M03FrqIUYVpNzbtHAMK9O/98vO0mw jNeySa97F3+6WXWTJMTerkN7EXUoPFCLtrA28UAHl34sRX0Bvj5QFpwcV/XPXOiBBRvMbR RKIqiHqs97DqjqVR2S6MqbI0HGY1a78AfTwYR941vmCMWheimGftgesprfVRRw== 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 4TKDz12FJtzfpS; Tue, 23 Jan 2024 17:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40NHk5v6076178; Tue, 23 Jan 2024 17:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40NHk5Vn076175; Tue, 23 Jan 2024 17:46:05 GMT (envelope-from git) Date: Tue, 23 Jan 2024 17:46:05 GMT Message-Id: <202401231746.40NHk5Vn076175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3cf553288b96 - main - simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3cf553288b968106e40882bb73b30da652614ba0 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3cf553288b968106e40882bb73b30da652614ba0 commit 3cf553288b968106e40882bb73b30da652614ba0 Author: John Baldwin AuthorDate: 2024-01-23 17:38:25 +0000 Commit: John Baldwin CommitDate: 2024-01-23 17:38:25 +0000 simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43442 --- 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 25d6fa51fc51..bf6fceb48a9c 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -46,6 +46,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, @@ -83,10 +96,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), @@ -432,6 +447,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. @@ -440,9 +458,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) @@ -480,6 +495,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) {