Date: Wed, 3 Jan 2024 20:45:33 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 30ead05708ae - stable/14 - arm64/amd64/riscv nexus: Use bus_generic_rl_* Message-ID: <202401032045.403KjXXa037349@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=30ead05708ae4fc488cb2afa3924a329fab7c7ba commit 30ead05708ae4fc488cb2afa3924a329fab7c7ba Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-11-22 17:06:33 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-01-03 20:33:59 +0000 arm64/amd64/riscv nexus: Use bus_generic_rl_* Reviewed by: mhorne, imp Differential Revision: https://reviews.freebsd.org/D42716 (cherry picked from commit ecf2106c0701e522b8c643f8ea37550b3e58ba57) --- sys/arm64/arm64/nexus.c | 16 +--------------- sys/riscv/riscv/nexus.c | 18 +++--------------- sys/x86/x86/nexus.c | 48 +++--------------------------------------------- 3 files changed, 7 insertions(+), 75 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index b9871f0e9b3a..2394ad912391 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -112,7 +112,6 @@ 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 bus_bind_intr_t nexus_bind_intr; @@ -139,7 +138,7 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), - DEVMETHOD(bus_set_resource, nexus_set_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif @@ -433,19 +432,6 @@ nexus_get_reslist(device_t dev, device_t child) return (&ndev->nx_resources); } -static int -nexus_set_resource(device_t dev, device_t child, int type, int rid, - rman_res_t start, rman_res_t count) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count); - - return (0); -} - static int nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index 48878807bb7e..2e693e6cf655 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -86,7 +86,6 @@ 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_set_resource_t nexus_set_resource; static bus_release_resource_t nexus_release_resource; static bus_config_intr_t nexus_config_intr; @@ -113,9 +112,11 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), DEVMETHOD(bus_deactivate_resource, nexus_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), DEVMETHOD(bus_map_resource, nexus_map_resource), - DEVMETHOD(bus_set_resource, nexus_set_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_describe_intr, nexus_describe_intr), @@ -395,19 +396,6 @@ nexus_get_reslist(device_t dev, device_t child) return (&ndev->nx_resources); } -static int -nexus_set_resource(device_t dev, device_t child, int type, int rid, - rman_res_t start, rman_res_t count) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count); - - return (0); -} - static int nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c index c90a8d252845..4896271b92bd 100644 --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -101,12 +101,9 @@ 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_delete_resource_t nexus_delete_resource; -static bus_get_resource_t nexus_get_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; static bus_unmap_resource_t nexus_unmap_resource; #ifdef SMP @@ -145,12 +142,12 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), - DEVMETHOD(bus_get_resource, nexus_get_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), - DEVMETHOD(bus_delete_resource, nexus_delete_resource), + DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), - DEVMETHOD(bus_set_resource, nexus_set_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), @@ -645,45 +642,6 @@ nexus_get_reslist(device_t dev, device_t child) return (&ndev->nx_resources); } -static int -nexus_set_resource(device_t dev, device_t child, int type, int rid, - rman_res_t start, rman_res_t count) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count); - return (0); -} - -static int -nexus_get_resource(device_t dev, device_t child, int type, int rid, - rman_res_t *startp, rman_res_t *countp) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - struct resource_list_entry *rle; - - rle = resource_list_find(rl, type, rid); - if (!rle) - return (ENOENT); - if (startp) - *startp = rle->start; - if (countp) - *countp = rle->count; - return (0); -} - -static void -nexus_delete_resource(device_t dev, device_t child, int type, int rid) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - resource_list_delete(rl, type, rid); -} - static int nexus_get_cpus(device_t dev, device_t child, enum cpu_sets op, size_t setsize, cpuset_t *cpuset)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401032045.403KjXXa037349>