git: d3d739ffa7a5 - stable/13 - powerpc: nexus code tidy-up

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 17 Apr 2023 17:04:05 UTC
The branch stable/13 has been updated by mhorne:

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

commit d3d739ffa7a53530ad81b4c242b9e12743bc8d99
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2023-02-10 14:37:08 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-04-17 16:57:55 +0000

    powerpc: nexus code tidy-up
    
    Make a pass at the various nexus implementations, fixing some very minor
    style issues, obsolete comments, etc.
    
    Update the top-level comment to be closer to other nexus
    implementations.
    
    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 c514686aa06a08a97df051a75da9ea7964a74fb0)
---
 sys/powerpc/powerpc/nexus.c | 76 ++++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c
index 78bcf6363d60..baca759b2071 100644
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -32,62 +32,62 @@
  * 	from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09
  */
 
+/*
+ * This code implements a `root nexus' for Power ISA Architecture
+ * machines.  The function of the root nexus is to serve as an
+ * attachment point for both processors and buses, and to manage
+ * resources which are common to all of them.  In particular,
+ * this code implements the core resource managers for interrupt
+ * requests and I/O memory address space.
+ */
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/endian.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
-#include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
-#include <sys/pcpu.h>
 #include <sys/rman.h>
-#include <sys/smp.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
 
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/ofw_bus_subr.h>
-#include <dev/ofw/openfirm.h>
-
 #include <machine/bus.h>
+#include <machine/endian.h>
 #include <machine/intr_machdep.h>
 #include <machine/resource.h>
 
-/*
- * The nexus handles root-level resource allocation requests and interrupt
- * mapping. All direct subdevices of nexus are attached by DEVICE_IDENTIFY().
- */
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
 
 static struct rman intr_rman;
 static struct rman mem_rman;
 
-static device_probe_t nexus_probe;
-static device_attach_t nexus_attach;
-static bus_setup_intr_t nexus_setup_intr;
-static bus_teardown_intr_t nexus_teardown_intr;
-static bus_alloc_resource_t nexus_alloc_resource;
-static bus_activate_resource_t nexus_activate_resource;
+static device_probe_t		nexus_probe;
+static device_attach_t		nexus_attach;
+
+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_adjust_resource_t nexus_adjust_resource;
-static bus_release_resource_t nexus_release_resource;
-static  int nexus_map_resource(device_t bus, device_t child, int type,
-			       struct resource *r,
-			       struct resource_map_request *argsp,
-			       struct resource_map *map);
-static  int nexus_unmap_resource(device_t bus, device_t child, int type,
-			       struct resource *r, struct resource_map *map);
-
-static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
+static bus_map_resource_t	nexus_map_resource;
+static bus_release_resource_t	nexus_release_resource;
+static bus_unmap_resource_t	nexus_unmap_resource;
+
 #ifdef SMP
-static bus_bind_intr_t nexus_bind_intr;
+static bus_bind_intr_t		nexus_bind_intr;
 #endif
-static bus_config_intr_t nexus_config_intr;
-static ofw_bus_map_intr_t nexus_ofw_map_intr;
+static bus_config_intr_t	nexus_config_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;
+
+static ofw_bus_map_intr_t	nexus_ofw_map_intr;
 
 static device_method_t nexus_methods[] = {
 	/* Device interface */
@@ -96,19 +96,19 @@ static device_method_t nexus_methods[] = {
 
 	/* Bus interface */
 	DEVMETHOD(bus_add_child,	bus_generic_add_child),
-	DEVMETHOD(bus_alloc_resource,	nexus_alloc_resource),
-	DEVMETHOD(bus_activate_resource,	nexus_activate_resource),
-	DEVMETHOD(bus_deactivate_resource,	nexus_deactivate_resource),
 	DEVMETHOD(bus_adjust_resource,	nexus_adjust_resource),
-	DEVMETHOD(bus_release_resource,	nexus_release_resource),
+	DEVMETHOD(bus_activate_resource, nexus_activate_resource),
+	DEVMETHOD(bus_alloc_resource,	nexus_alloc_resource),
+	DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
 	DEVMETHOD(bus_map_resource,	nexus_map_resource),
+	DEVMETHOD(bus_release_resource,	nexus_release_resource),
 	DEVMETHOD(bus_unmap_resource,   nexus_unmap_resource),
-	DEVMETHOD(bus_setup_intr,	nexus_setup_intr),
-	DEVMETHOD(bus_teardown_intr,	nexus_teardown_intr),
 #ifdef SMP
 	DEVMETHOD(bus_bind_intr,	nexus_bind_intr),
 #endif
 	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),
 
 	/* ofw_bus interface */
@@ -225,7 +225,7 @@ nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
 {
 
 	return (powerpc_config_intr(irq, trig, pol));
-} 
+}
 
 static int
 nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells,