The branch main has been updated by andrew:

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

commit 60344d7e09d51bb7d64a7997e0d9e03de2ca1e86
Author:     Andrew Turner <[email protected]>
AuthorDate: 2024-10-29 10:19:56 +0000
Commit:     Andrew Turner <[email protected]>
CommitDate: 2024-10-29 10:31:37 +0000

    arm64: Use the common activate function in nexus
    
    For non-memory and non-ioport spaces use the common
    bus_generic_rman_activate_resource function in the arm64 nexus. We
    can't currently use it for memory types as it doesn't support
    non-posted memory.
    
    Reviewed by:    jhb
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D47283
---
 sys/arm64/arm64/nexus.c | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c
index 3e9399384855..d780c9950e63 100644
--- a/sys/arm64/arm64/nexus.c
+++ b/sys/arm64/arm64/nexus.c
@@ -106,7 +106,6 @@ static bus_print_child_t    nexus_print_child;
 
 static bus_activate_resource_t nexus_activate_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_get_rman_t          nexus_get_rman;
 static bus_map_resource_t      nexus_map_resource;
@@ -133,7 +132,7 @@ static device_method_t nexus_methods[] = {
        DEVMETHOD(bus_activate_resource, nexus_activate_resource),
        DEVMETHOD(bus_adjust_resource,  bus_generic_rman_adjust_resource),
        DEVMETHOD(bus_alloc_resource,   nexus_alloc_resource),
-       DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
+       DEVMETHOD(bus_deactivate_resource, 
bus_generic_rman_deactivate_resource),
        DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
        DEVMETHOD(bus_get_resource,     bus_generic_rl_get_resource),
        DEVMETHOD(bus_get_resource_list, nexus_get_reslist),
@@ -331,15 +330,15 @@ nexus_activate_resource_flags(device_t bus, device_t 
child, struct resource *r,
        struct resource_map map;
        int err, use_np;
 
-       if ((err = rman_activate_resource(r)) != 0)
-               return (err);
-
        /*
         * If this is a memory resource, map it into the kernel.
         */
        switch (rman_get_type(r)) {
        case SYS_RES_IOPORT:
        case SYS_RES_MEMORY:
+               if ((err = rman_activate_resource(r)) != 0)
+                       return (err);
+
                if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
                        resource_init_map_request(&args);
                        use_np = (flags & BUS_SPACE_MAP_NONPOSTED) != 0 ||
@@ -359,12 +358,8 @@ nexus_activate_resource_flags(device_t bus, device_t 
child, struct resource *r,
                        rman_set_mapping(r, &map);
                }
                break;
-       case SYS_RES_IRQ:
-               err = intr_activate_irq(child, r);
-               if (err != 0) {
-                       rman_deactivate_resource(r);
-                       return (err);
-               }
+       default:
+               return (bus_generic_rman_activate_resource(bus, child, r));
        }
        return (0);
 }
@@ -383,26 +378,6 @@ nexus_get_reslist(device_t dev, device_t child)
        return (&ndev->nx_resources);
 }
 
-static int
-nexus_deactivate_resource(device_t bus, device_t child, struct resource *r)
-{
-       int error;
-
-       switch (rman_get_type(r)) {
-       case SYS_RES_MEMORY:
-       case SYS_RES_IOPORT:
-               return (bus_generic_rman_deactivate_resource(bus, child, r));
-       case SYS_RES_IRQ:
-               error = rman_deactivate_resource(r);
-               if (error)
-                       return (error);
-               intr_deactivate_irq(child, r);
-               return (0);
-       default:
-               return (EINVAL);
-       }
-}
-
 static int
 nexus_map_resource(device_t bus, device_t child, struct resource *r,
     struct resource_map_request *argsp, struct resource_map *map)

Reply via email to