Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Mar 2016 00:18:05 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296287 - head/sys/powerpc/mpc85xx
Message-ID:  <201603020018.u220I5If079456@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Mar  2 00:18:05 2016
New Revision: 296287
URL: https://svnweb.freebsd.org/changeset/base/296287

Log:
  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

Modified:
  head/sys/powerpc/mpc85xx/lbc.c

Modified: head/sys/powerpc/mpc85xx/lbc.c
==============================================================================
--- head/sys/powerpc/mpc85xx/lbc.c	Wed Mar  2 00:13:13 2016	(r296286)
+++ head/sys/powerpc/mpc85xx/lbc.c	Wed Mar  2 00:18:05 2016	(r296287)
@@ -31,6 +31,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -68,6 +70,11 @@ static MALLOC_DEFINE(M_LBC, "localbus", 
 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, devic
 	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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603020018.u220I5If079456>