From nobody Mon Apr 17 17:04:08 2023 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 4Q0YLJ3Gdzz44vt4; Mon, 17 Apr 2023 17:04:08 +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 4Q0YLJ2V3hz49YH; Mon, 17 Apr 2023 17:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681751048; 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=/fFbDkvtnYvTGoRxS5C2u1QqpvK14Ol7btScAQ4La/o=; b=eOarPNs3uzn5XbEz+DfOViJxbUt1H5M+IQ611+Kz4j9w0hF1WN5BdyTp7y9HEn/hMqVCg/ OACwctS0DWZo5YiDkf6YouXVzDiM2IvyAKelCYaGsM9bPu+r64g5o4EQqGmmJMUBL10d/W Vu0DGlHz5UGab3WTZ+cgBeGTKqZkrbiX/4uaU6Km0PJP84af/dWQc9r7S64V+GFRjuerdw 7Fh6VWJcPNcFVK5z4vAjrg5QTLK52OCmha6Eca+CzTHCY/JlHNZE3pC/5TWItu1AfstJ8F MmWmaR3cT1GIWiMgUYPZgkTY1n0o5BT930sf+MmAPVWCeOqZPgfV2ViE36ezDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681751048; 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=/fFbDkvtnYvTGoRxS5C2u1QqpvK14Ol7btScAQ4La/o=; b=XUWsR50pwkOEG2zmhXj+ZYNywRY14DqIikk2R2cNmSLntE6eCDzxfJSTO8V0TXTwPk2l5x 3Cf/34AczP9wUwwpg9DNi6Wvo0zJiDB5a0rsmMlj4EECVMANNGuz3N2imz33WeEIsgP0Fr sffMNCjxiR7k/3xDu0WeGZHxmqUVNNVA1UEcps+BymrISCbDM0ekhYWUqgQIKBDhqmKvlz 2P9N4HayljOBtbCdp1rgIyv8zchhz2wcapQpxIC/BkCd64NANl61dS9Cnpk5ABrBxqeVtJ PQanssopW9roUYqkJLP5s4s672Sn7m4qZKsha/nR8ruvBY68u/VELILGhUdTng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681751048; a=rsa-sha256; cv=none; b=r6F64Frs/yvnlaZuajsYYn6FwN+pPSaOLZ/9/YdidO4k/vK1N2W5YknDRF/4Suc51Ix4qq 6IB3oumhecbOkO0BEWCUNEJDHrIUfNFDbyZ1iOcMltYtQ/3QHsvrf07N3Z0tBdd8W7PA9Y AORG45Hzi4qvfgDo2YLAWGks729y7ijSeBCE2E2S6p88b6TtGsQOtO6YbU8BTrpk1AI8cf qluoR4jxAxQl7skVImSbX49p4yizjpQBS8Pg4cclBkX2QAozrvOYMvz3BJxmD+qhIyvvMo bZ+2tGR5QEzB3pg8i7DqqW8LTe5cvmQ1w/jzsgyyo+htr/+AfBoJ/J2gxjf/cg== 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 4Q0YLJ1Y6hzd7Y; Mon, 17 Apr 2023 17:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33HH48xP002679; Mon, 17 Apr 2023 17:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33HH48rh002678; Mon, 17 Apr 2023 17:04:08 GMT (envelope-from git) Date: Mon, 17 Apr 2023 17:04:08 GMT Message-Id: <202304171704.33HH48rh002678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 08e65a6bf425 - stable/13 - arm64: nexus code tidy-up 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 08e65a6bf4255f7f399dfa34de02ec04e77af554 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=08e65a6bf4255f7f399dfa34de02ec04e77af554 commit 08e65a6bf4255f7f399dfa34de02ec04e77af554 Author: Mitchell Horne AuthorDate: 2023-02-10 14:26:53 +0000 Commit: Mitchell Horne CommitDate: 2023-04-17 16:59:15 +0000 arm64: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 (cherry picked from commit e582d4a2b09e679baae457b50c7270b4a9f501bf) --- sys/arm64/arm64/nexus.c | 96 +++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 350ad9d1be76..bc7e8e881dab 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -46,21 +46,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include -#include -#include -#include -#include #include #include -#include +#include #include +#include +#include +#include +#include #ifdef FDT #include @@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "acpi_bus_if.h" -#include "pcib_if.h" #endif extern struct bus_space memmap_bus; @@ -94,63 +93,57 @@ static device_probe_t nexus_fdt_probe; static device_attach_t nexus_fdt_attach; #endif #ifdef DEV_ACPI -static device_probe_t nexus_acpi_probe; -static device_attach_t nexus_acpi_attach; +static device_probe_t nexus_acpi_probe; +static device_attach_t nexus_acpi_attach; #endif -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, u_int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); -static int nexus_map_resource(device_t, device_t, int, struct resource *, - struct resource_map_request *, struct resource_map *); -static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol); -static struct resource_list *nexus_get_reslist(device_t, device_t); -static int nexus_set_resource(device_t, device_t, int, int, - rman_res_t, rman_res_t); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); - -static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_get_resource_list_t nexus_get_reslist; +static bus_map_resource_t nexus_map_resource; +static bus_release_resource_t nexus_release_resource; +static bus_set_resource_t nexus_set_resource; + #ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); +static bus_bind_intr_t nexus_bind_intr; #endif +static bus_config_intr_t nexus_config_intr; +static bus_describe_intr_t nexus_describe_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; #ifdef FDT -static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, - int icells, pcell_t *intr); +static ofw_bus_map_intr_t nexus_ofw_map_intr; #endif static device_method_t nexus_methods[] = { /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_map_resource, nexus_map_resource), - DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), - DEVMETHOD(bus_set_resource, nexus_set_resource), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), - DEVMETHOD(bus_setup_intr, nexus_setup_intr), - DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), - DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), + DEVMETHOD(bus_set_resource, nexus_set_resource), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif - { 0, 0 } + DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_setup_intr, nexus_setup_intr), + DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), + + DEVMETHOD_END }; static driver_t nexus_driver = { @@ -216,7 +209,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include footbridge.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -236,10 +228,10 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, */ if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) - return(NULL); + return (NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); if (rle == NULL) - return(NULL); + return (NULL); start = rle->start; end = rle->end; count = rle->count; @@ -362,7 +354,7 @@ static bus_space_tag_t nexus_get_bus_tag(device_t bus __unused, device_t child __unused) { - return(&memmap_bus); + return (&memmap_bus); } static int @@ -420,7 +412,7 @@ nexus_set_resource(device_t dev, device_t child, int type, int rid, /* XXX this should return a success/failure indicator */ resource_list_add(rl, type, rid, start, start + count - 1, count); - return(0); + return (0); } static int