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
This commit is contained in:
Mitchell Horne 2023-02-10 10:37:08 -04:00
parent abe3309e71
commit c514686aa0

View File

@ -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 <machine/bus.h>
#include <machine/endian.h>
#include <machine/intr_machdep.h>
#include <machine/resource.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/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().
*/
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 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 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_map_resource_t nexus_map_resource;
static bus_release_resource_t nexus_release_resource;
static bus_unmap_resource_t nexus_unmap_resource;
static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
#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 */
@ -222,7 +222,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,