Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2009 13:49:10 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
Subject:   svn commit: r197354 - in stable/6/sys: . conf contrib/pf dev/cxgb sparc64/sbus
Message-ID:  <200909201349.n8KDnAVo058437@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Sep 20 13:49:10 2009
New Revision: 197354
URL: http://svn.freebsd.org/changeset/base/197354

Log:
  MFC: r190112 (partial)
  
  - As suggested by OpenSolaris use up-burst-sizes for determining the
    supported burst sizes.
  - Add support for 64-bit burst sizes (required for SBus GEM).
  - Take advantage of KOBJMETHOD_END.
  - Add missing const.

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)
  stable/6/sys/sparc64/sbus/sbus.c
  stable/6/sys/sparc64/sbus/sbusvar.h

Modified: stable/6/sys/sparc64/sbus/sbus.c
==============================================================================
--- stable/6/sys/sparc64/sbus/sbus.c	Sun Sep 20 13:47:55 2009	(r197353)
+++ stable/6/sys/sparc64/sbus/sbus.c	Sun Sep 20 13:49:10 2009	(r197354)
@@ -212,7 +212,7 @@ static ofw_bus_get_name_t sbus_get_name;
 static ofw_bus_get_node_t sbus_get_node;
 static ofw_bus_get_type_t sbus_get_type;
 
-static int sbus_inlist(const char *, const char **);
+static int sbus_inlist(const char *, const char *const *);
 static struct sbus_devinfo * sbus_setup_dinfo(struct sbus_softc *sc,
     phandle_t node, char *name);
 static void sbus_destroy_dinfo(struct sbus_devinfo *dinfo);
@@ -233,14 +233,14 @@ static device_method_t sbus_methods[] = 
 	DEVMETHOD(bus_print_child,	sbus_print_child),
 	DEVMETHOD(bus_probe_nomatch,	sbus_probe_nomatch),
 	DEVMETHOD(bus_read_ivar,	sbus_read_ivar),
-	DEVMETHOD(bus_setup_intr, 	sbus_setup_intr),
-	DEVMETHOD(bus_teardown_intr,	sbus_teardown_intr),
 	DEVMETHOD(bus_alloc_resource,	sbus_alloc_resource),
 	DEVMETHOD(bus_activate_resource,	sbus_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,	sbus_deactivate_resource),
 	DEVMETHOD(bus_release_resource,	sbus_release_resource),
-	DEVMETHOD(bus_get_resource_list, sbus_get_resource_list),
+	DEVMETHOD(bus_setup_intr, 	sbus_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	sbus_teardown_intr),
 	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
+	DEVMETHOD(bus_get_resource_list, sbus_get_resource_list),
 
 	/* ofw_bus interface */
 	DEVMETHOD(ofw_bus_get_compat,	sbus_get_compat),
@@ -249,7 +249,7 @@ static device_method_t sbus_methods[] = 
 	DEVMETHOD(ofw_bus_get_node,	sbus_get_node),
 	DEVMETHOD(ofw_bus_get_type,	sbus_get_type),
 
-	{ 0, 0 }
+	KOBJMETHOD_END
 };
 
 static driver_t sbus_driver = {
@@ -266,14 +266,14 @@ MODULE_VERSION(sbus, 1);
 #define	OFW_SBUS_TYPE	"sbus"
 #define	OFW_SBUS_NAME	"sbus"
 
-static const char *sbus_order_first[] = {
+static const char *const sbus_order_first[] = {
 	"auxio",
 	"dma",
 	NULL
 };
 
 static int
-sbus_inlist(const char *name, const char **list)
+sbus_inlist(const char *name, const char *const *list)
 {
 	int i;
 
@@ -388,11 +388,12 @@ sbus_attach(device_t dev)
 
 	/*
 	 * Get the SBus burst transfer size if burst transfers are supported.
-	 * XXX: is the default correct?
 	 */
-	if (OF_getprop(node, "burst-sizes", &sc->sc_burst,
+	if (OF_getprop(node, "up-burst-sizes", &sc->sc_burst,
 	    sizeof(sc->sc_burst)) == -1 || sc->sc_burst == 0)
-		sc->sc_burst = SBUS_BURST_DEF;
+		sc->sc_burst =
+		    (SBUS_BURST64_DEF << SBUS_BURST64_SHIFT) | SBUS_BURST_DEF;
+
 
 	/* initalise the IOMMU */
 
@@ -849,8 +850,8 @@ sbus_activate_resource(device_t bus, dev
 	}
 	if (type == SYS_RES_MEMORY) {
 		/*
-		 * Need to memory-map the device space, as some drivers depend
-		 * on the virtual address being set and useable.
+		 * Need to memory-map the device space, as some drivers
+		 * depend on the virtual address being set and usable.
 		 */
 		error = sparc64_bus_mem_map(rman_get_bustag(r),
 		    rman_get_bushandle(r), rman_get_size(r), 0, 0, &p);

Modified: stable/6/sys/sparc64/sbus/sbusvar.h
==============================================================================
--- stable/6/sys/sparc64/sbus/sbusvar.h	Sun Sep 20 13:47:55 2009	(r197353)
+++ stable/6/sys/sparc64/sbus/sbusvar.h	Sun Sep 20 13:49:10 2009	(r197354)
@@ -77,7 +77,7 @@
  */
 
 #ifndef _SPARC64_SBUS_SBUSVAR_H_
-#define _SPARC64_SBUS_SBUSVAR_H_
+#define	_SPARC64_SBUS_SBUSVAR_H_
 
 /*
  * Macros for probe order
@@ -88,18 +88,24 @@
 /*
  * PROM-reported DMA burst sizes for the SBus
  */
-#define SBUS_BURST_1	0x1
-#define SBUS_BURST_2	0x2
-#define SBUS_BURST_4	0x4
-#define SBUS_BURST_8	0x8
-#define SBUS_BURST_16	0x10
-#define SBUS_BURST_32	0x20
-#define SBUS_BURST_64	0x40
+#define	SBUS_BURST_1		(1 << 0)
+#define	SBUS_BURST_2		(1 << 1)
+#define	SBUS_BURST_4		(1 << 2)
+#define	SBUS_BURST_8		(1 << 3)
+#define	SBUS_BURST_16		(1 << 4)
+#define	SBUS_BURST_32		(1 << 5)
+#define	SBUS_BURST_64		(1 << 6)
+#define	SBUS_BURST_MASK		((1 << SBUS_BURST_SIZE) - 1)
+#define	SBUS_BURST_SIZE		16
+#define	SBUS_BURST64_MASK	(SBUS_BURST_MASK << SBUS_BURST64_SHIFT)
+#define	SBUS_BURST64_SHIFT	16
 
 /* Used if no burst sizes are specified for the bus. */
 #define	SBUS_BURST_DEF \
 	(SBUS_BURST_1 | SBUS_BURST_2 | SBUS_BURST_4 | SBUS_BURST_8 | 	\
-	SBUS_BURST_16)
+	SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
+#define	SBUS_BURST64_DEF \
+	(SBUS_BURST_8 | SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64)
 
 enum sbus_device_ivars {
 	SBUS_IVAR_BURSTSZ,
@@ -111,7 +117,7 @@ enum sbus_device_ivars {
 /*
  * Simplified accessors for sbus devices
  */
-#define SBUS_ACCESSOR(var, ivar, type) \
+#define	SBUS_ACCESSOR(var, ivar, type) \
 	__BUS_ACCESSOR(sbus, var, SBUS, ivar, type)
 
 SBUS_ACCESSOR(burstsz,		BURSTSZ,	int)



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