From 8bc8506e91f34c113663c7427545e4fb05b4462d Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Wed, 2 Mar 2016 00:18:05 +0000 Subject: [PATCH] Fix 2 bugs in the mpc85xx local bus controller driver. 1) Include opt_platform.h to get QORIQ_DPAA. Otherwise the definition of OCP85XX_TGTIF_LBC is incorrect. 2) The child resources are already allocated, just activate them, instead of incorrectly remapping the memory regions (resource lists for lbc consist of the virtual address of the child's resources, not the physical address). Sponsored by: Alex Perez/Inertial Computing --- sys/powerpc/mpc85xx/lbc.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c index fe582dde5659..189b3976d57f 100644 --- a/sys/powerpc/mpc85xx/lbc.c +++ b/sys/powerpc/mpc85xx/lbc.c @@ -31,6 +31,8 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -68,6 +70,11 @@ static MALLOC_DEFINE(M_LBC, "localbus", "localbus devices information"); static int lbc_probe(device_t); static int lbc_attach(device_t); static int lbc_shutdown(device_t); +static int lbc_activate_resource(device_t bus __unused, device_t child __unused, + int type, int rid __unused, struct resource *r); +static int lbc_deactivate_resource(device_t bus __unused, + device_t child __unused, int type __unused, int rid __unused, + struct resource *r); static struct resource *lbc_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int lbc_print_child(device_t, device_t); @@ -91,8 +98,8 @@ static device_method_t lbc_methods[] = { DEVMETHOD(bus_alloc_resource, lbc_alloc_resource), DEVMETHOD(bus_release_resource, lbc_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_activate_resource, lbc_activate_resource), + DEVMETHOD(bus_deactivate_resource, lbc_deactivate_resource), /* OFW bus interface */ DEVMETHOD(ofw_bus_get_devinfo, lbc_get_devinfo), @@ -766,6 +773,23 @@ lbc_release_resource(device_t dev, device_t child, int type, int rid, return (rman_release_resource(res)); } +static int +lbc_activate_resource(device_t bus __unused, device_t child __unused, + int type __unused, int rid __unused, struct resource *r) +{ + + /* Child resources were already mapped, just activate. */ + return (rman_activate_resource(r)); +} + +static int +lbc_deactivate_resource(device_t bus __unused, device_t child __unused, + int type __unused, int rid __unused, struct resource *r) +{ + + return (rman_deactivate_resource(r)); +} + static const struct ofw_bus_devinfo * lbc_get_devinfo(device_t bus, device_t child) {