svn commit: r299239 - in head/sys/dev/bhnd: . bhndb tools

Adrian Chadd adrian at FreeBSD.org
Sun May 8 18:20:02 UTC 2016


Author: adrian
Date: Sun May  8 18:20:01 2016
New Revision: 299239
URL: https://svnweb.freebsd.org/changeset/base/299239

Log:
  [bhnd] Add bhnd_resource support for the bus_(read|write)(_multi_)stream_* functions.
  
  This adds additional bhnd_resource shims used by the upcoming SPROM deltas.
  
  Submitted by:	Landon Fuller <landonf at landonf.org>
  Differential Revision:	https://reviews.freebsd.org/D6194

Modified:
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/tools/bus_macro.sh

Modified: head/sys/dev/bhnd/bhnd.c
==============================================================================
--- head/sys/dev/bhnd/bhnd.c	Sun May  8 18:18:35 2016	(r299238)
+++ head/sys/dev/bhnd/bhnd.c	Sun May  8 18:20:01 2016	(r299239)
@@ -587,48 +587,53 @@ bhnd_generic_resume_child(device_t dev, 
  * non-bridged bus implementations, resources will never be marked as
  * indirect, and these methods should never be called.
  */
-
-static uint8_t
-bhnd_read_1(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset)
-{
-	return (BHND_BUS_READ_1(device_get_parent(dev), child, r, offset));
-}
-
-static uint16_t 
-bhnd_read_2(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset)
-{
-	return (BHND_BUS_READ_2(device_get_parent(dev), child, r, offset));
-}
-
-static uint32_t 
-bhnd_read_4(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset)
-{
-	return (BHND_BUS_READ_4(device_get_parent(dev), child, r, offset));
-}
-
-static void
-bhnd_write_1(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset, uint8_t value)
-{
-	BHND_BUS_WRITE_1(device_get_parent(dev), child, r, offset, value);
-}
-
-static void
-bhnd_write_2(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset, uint16_t value)
-{
-	BHND_BUS_WRITE_2(device_get_parent(dev), child, r, offset, value);
-}
-
-static void 
-bhnd_write_4(device_t dev, device_t child, struct bhnd_resource *r,
-    bus_size_t offset, uint32_t value)
-{
-	BHND_BUS_WRITE_4(device_get_parent(dev), child, r, offset, value);
-}
+#define	BHND_IO_READ(_type, _name, _method)			\
+static _type							\
+bhnd_read_ ## _name (device_t dev, device_t child,		\
+    struct bhnd_resource *r, bus_size_t offset)			\
+{								\
+	return (BHND_BUS_READ_ ## _method(			\
+		    device_get_parent(dev), child, r, offset));	\
+}
+
+#define	BHND_IO_WRITE(_type, _name, _method)			\
+static void							\
+bhnd_write_ ## _name (device_t dev, device_t child,		\
+    struct bhnd_resource *r, bus_size_t offset, _type value)	\
+{								\
+	return (BHND_BUS_WRITE_ ## _method(			\
+		    device_get_parent(dev), child, r, offset,	\
+		    value));	\
+}
+
+#define	BHND_IO_MULTI(_type, _rw, _name, _method)			\
+static void								\
+bhnd_ ## _rw ## _multi_ ## _name (device_t dev, device_t child,	\
+    struct bhnd_resource *r, bus_size_t offset, _type *datap,		\
+    bus_size_t count)							\
+{									\
+	BHND_BUS_ ## _method(device_get_parent(dev), child, r,		\
+	    offset, datap, count);					\
+}
+
+#define	BHND_IO_METHODS(_type, _size)					\
+	BHND_IO_READ(_type, _size, _size)				\
+	BHND_IO_WRITE(_type, _size, _size)				\
+									\
+	BHND_IO_READ(_type, stream_ ## _size, STREAM_ ## _size)		\
+	BHND_IO_WRITE(_type, stream_ ## _size, STREAM_ ## _size)	\
+									\
+	BHND_IO_MULTI(_type, read, _size, READ_MULTI_ ## _size)		\
+	BHND_IO_MULTI(_type, write, _size, WRITE_MULTI_ ## _size)	\
+									\
+	BHND_IO_MULTI(_type, read, stream_ ## _size,			\
+	   READ_MULTI_STREAM_ ## _size)					\
+	BHND_IO_MULTI(_type, write, stream_ ## _size,			\
+	   WRITE_MULTI_STREAM_ ## _size)				\
+
+BHND_IO_METHODS(uint8_t, 1);
+BHND_IO_METHODS(uint16_t, 2);
+BHND_IO_METHODS(uint32_t, 4);
 
 static void 
 bhnd_barrier(device_t dev, device_t child, struct bhnd_resource *r,
@@ -684,6 +689,27 @@ static device_method_t bhnd_methods[] = 
 	DEVMETHOD(bhnd_bus_write_1,		bhnd_write_1),
 	DEVMETHOD(bhnd_bus_write_2,		bhnd_write_2),
 	DEVMETHOD(bhnd_bus_write_4,		bhnd_write_4),
+	DEVMETHOD(bhnd_bus_read_stream_1,	bhnd_read_stream_1),
+	DEVMETHOD(bhnd_bus_read_stream_2,	bhnd_read_stream_2),
+	DEVMETHOD(bhnd_bus_read_stream_4,	bhnd_read_stream_4),
+	DEVMETHOD(bhnd_bus_write_stream_1,	bhnd_write_stream_1),
+	DEVMETHOD(bhnd_bus_write_stream_2,	bhnd_write_stream_2),
+	DEVMETHOD(bhnd_bus_write_stream_4,	bhnd_write_stream_4),
+
+	DEVMETHOD(bhnd_bus_read_multi_1,	bhnd_read_multi_1),
+	DEVMETHOD(bhnd_bus_read_multi_2,	bhnd_read_multi_2),
+	DEVMETHOD(bhnd_bus_read_multi_4,	bhnd_read_multi_4),
+	DEVMETHOD(bhnd_bus_write_multi_1,	bhnd_write_multi_1),
+	DEVMETHOD(bhnd_bus_write_multi_2,	bhnd_write_multi_2),
+	DEVMETHOD(bhnd_bus_write_multi_4,	bhnd_write_multi_4),
+	
+	DEVMETHOD(bhnd_bus_read_multi_stream_1,	bhnd_read_multi_stream_1),
+	DEVMETHOD(bhnd_bus_read_multi_stream_2,	bhnd_read_multi_stream_2),
+	DEVMETHOD(bhnd_bus_read_multi_stream_4,	bhnd_read_multi_stream_4),
+	DEVMETHOD(bhnd_bus_write_multi_stream_1,bhnd_write_multi_stream_1),
+	DEVMETHOD(bhnd_bus_write_multi_stream_2,bhnd_write_multi_stream_2),
+	DEVMETHOD(bhnd_bus_write_multi_stream_4,bhnd_write_multi_stream_4),
+
 	DEVMETHOD(bhnd_bus_barrier,		bhnd_barrier),
 
 	DEVMETHOD_END

Modified: head/sys/dev/bhnd/bhnd.h
==============================================================================
--- head/sys/dev/bhnd/bhnd.h	Sun May  8 18:18:35 2016	(r299238)
+++ head/sys/dev/bhnd/bhnd.h	Sun May  8 18:20:01 2016	(r299239)
@@ -608,37 +608,152 @@ bhnd_get_region_addr(device_t dev, bhnd_
 #define bhnd_bus_barrier(r, o, l, f) \
     ((r)->direct) ? \
 	bus_barrier((r)->res, (o), (l), (f)) : \
-	BHND_BUS_BARRIER(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_BARRIER( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o), (l), (f))
 #define bhnd_bus_read_1(r, o) \
     ((r)->direct) ? \
 	bus_read_1((r)->res, (o)) : \
-	BHND_BUS_READ_1(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_READ_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_1(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_1((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 #define bhnd_bus_write_1(r, o, v) \
     ((r)->direct) ? \
 	bus_write_1((r)->res, (o), (v)) : \
-	BHND_BUS_WRITE_1(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_WRITE_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_1(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_1((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_read_stream_1(r, o) \
+    ((r)->direct) ? \
+	bus_read_stream_1((r)->res, (o)) : \
+	BHND_BUS_READ_STREAM_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_stream_1(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_stream_1((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_STREAM_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_write_stream_1(r, o, v) \
+    ((r)->direct) ? \
+	bus_write_stream_1((r)->res, (o), (v)) : \
+	BHND_BUS_WRITE_STREAM_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_stream_1(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_stream_1((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_STREAM_1( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 #define bhnd_bus_read_2(r, o) \
     ((r)->direct) ? \
 	bus_read_2((r)->res, (o)) : \
-	BHND_BUS_READ_2(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_READ_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_2(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_2((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 #define bhnd_bus_write_2(r, o, v) \
     ((r)->direct) ? \
 	bus_write_2((r)->res, (o), (v)) : \
-	BHND_BUS_WRITE_2(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_WRITE_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_2(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_2((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_read_stream_2(r, o) \
+    ((r)->direct) ? \
+	bus_read_stream_2((r)->res, (o)) : \
+	BHND_BUS_READ_STREAM_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_stream_2(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_stream_2((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_STREAM_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_write_stream_2(r, o, v) \
+    ((r)->direct) ? \
+	bus_write_stream_2((r)->res, (o), (v)) : \
+	BHND_BUS_WRITE_STREAM_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_stream_2(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_stream_2((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_STREAM_2( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 #define bhnd_bus_read_4(r, o) \
     ((r)->direct) ? \
 	bus_read_4((r)->res, (o)) : \
-	BHND_BUS_READ_4(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_READ_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_4(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_4((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 #define bhnd_bus_write_4(r, o, v) \
     ((r)->direct) ? \
 	bus_write_4((r)->res, (o), (v)) : \
-	BHND_BUS_WRITE_4(device_get_parent(rman_get_device((r)->res)),	\
+	BHND_BUS_WRITE_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
 	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_4(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_4((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_read_stream_4(r, o) \
+    ((r)->direct) ? \
+	bus_read_stream_4((r)->res, (o)) : \
+	BHND_BUS_READ_STREAM_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o))
+#define bhnd_bus_read_multi_stream_4(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_read_multi_stream_4((r)->res, (o), (d), (c)) : \
+	BHND_BUS_READ_MULTI_STREAM_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
+#define bhnd_bus_write_stream_4(r, o, v) \
+    ((r)->direct) ? \
+	bus_write_stream_4((r)->res, (o), (v)) : \
+	BHND_BUS_WRITE_STREAM_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (v))
+#define bhnd_bus_write_multi_stream_4(r, o, d, c) \
+    ((r)->direct) ? \
+	bus_write_multi_stream_4((r)->res, (o), (d), (c)) : \
+	BHND_BUS_WRITE_MULTI_STREAM_4( \
+	    device_get_parent(rman_get_device((r)->res)),	\
+	    rman_get_device((r)->res), (r), (o), (d), (c))
 
 #endif /* _BHND_BHND_H_ */

Modified: head/sys/dev/bhnd/bhnd_bus_if.m
==============================================================================
--- head/sys/dev/bhnd/bhnd_bus_if.m	Sun May  8 18:18:35 2016	(r299238)
+++ head/sys/dev/bhnd/bhnd_bus_if.m	Sun May  8 18:20:01 2016	(r299239)
@@ -463,6 +463,183 @@ METHOD void write_4 {
 	uint32_t value;
 }
 
+/** An implementation of bus_read_stream_1() compatible with bhnd_resource */
+METHOD uint8_t read_stream_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+}
+
+/** An implementation of bus_read_stream_2() compatible with bhnd_resource */
+METHOD uint16_t read_stream_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+}
+
+/** An implementation of bus_read_stream_4() compatible with bhnd_resource */
+METHOD uint32_t read_stream_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+}
+
+/** An implementation of bus_write_stream_1() compatible with bhnd_resource */
+METHOD void write_stream_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint8_t value;
+}
+
+/** An implementation of bus_write_stream_2() compatible with bhnd_resource */
+METHOD void write_stream_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint16_t value;
+}
+
+/** An implementation of bus_write_stream_4() compatible with bhnd_resource */
+METHOD void write_stream_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint32_t value;
+}
+
+/** An implementation of bus_read_multi_1() compatible with bhnd_resource */
+METHOD void read_multi_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint8_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_read_multi_2() compatible with bhnd_resource */
+METHOD void read_multi_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint16_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_read_multi_4() compatible with bhnd_resource */
+METHOD void read_multi_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint32_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_1() compatible with bhnd_resource */
+METHOD void write_multi_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint8_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_2() compatible with bhnd_resource */
+METHOD void write_multi_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint16_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_4() compatible with bhnd_resource */
+METHOD void write_multi_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint32_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_read_multi_stream_1() compatible
+ *  bhnd_resource */
+METHOD void read_multi_stream_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint8_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_read_multi_stream_2() compatible
+ *  bhnd_resource */
+METHOD void read_multi_stream_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint16_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_read_multi_stream_4() compatible
+ *  bhnd_resource */
+METHOD void read_multi_stream_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint32_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_stream_1() compatible
+ *  bhnd_resource */
+METHOD void write_multi_stream_1 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint8_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_stream_2() compatible with
+ *  bhnd_resource */
+METHOD void write_multi_stream_2 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint16_t *datap;
+	bus_size_t count;
+}
+
+/** An implementation of bus_write_multi_stream_4() compatible with
+ *  bhnd_resource */
+METHOD void write_multi_stream_4 {
+	device_t dev;
+	device_t child;
+	struct bhnd_resource *r;
+	bus_size_t offset;
+	uint32_t *datap;
+	bus_size_t count;
+}
+
 /** An implementation of bus_barrier() compatible with bhnd_resource */
 METHOD void barrier {
 	device_t dev;

Modified: head/sys/dev/bhnd/bhndb/bhndb.c
==============================================================================
--- head/sys/dev/bhnd/bhndb/bhndb.c	Sun May  8 18:18:35 2016	(r299238)
+++ head/sys/dev/bhnd/bhndb/bhndb.c	Sun May  8 18:20:01 2016	(r299239)
@@ -1737,37 +1737,60 @@ bhndb_io_resource(struct bhndb_softc *sc
 	BHNDB_UNLOCK(sc);
 
 /* Defines a bhndb_bus_read_* method implementation */
-#define	BHNDB_IO_READ(_type, _size)				\
+#define	BHNDB_IO_READ(_type, _name)				\
 static _type							\
-bhndb_bus_read_ ## _size (device_t dev, device_t child,		\
+bhndb_bus_read_ ## _name (device_t dev, device_t child,		\
     struct bhnd_resource *r, bus_size_t offset)			\
 {								\
 	_type v;						\
 	BHNDB_IO_COMMON_SETUP(sizeof(_type));			\
-	v = bus_read_ ## _size (io_res, io_offset);		\
+	v = bus_read_ ## _name (io_res, io_offset);		\
 	BHNDB_IO_COMMON_TEARDOWN();				\
 								\
 	return (v);						\
 }
 
 /* Defines a bhndb_bus_write_* method implementation */
-#define	BHNDB_IO_WRITE(_type, _size)				\
+#define	BHNDB_IO_WRITE(_type, _name)				\
 static void							\
-bhndb_bus_write_ ## _size (device_t dev, device_t child,	\
+bhndb_bus_write_ ## _name (device_t dev, device_t child,	\
     struct bhnd_resource *r, bus_size_t offset, _type value)	\
 {								\
 	BHNDB_IO_COMMON_SETUP(sizeof(_type));			\
-	bus_write_ ## _size (io_res, io_offset, value);		\
+	bus_write_ ## _name (io_res, io_offset, value);		\
 	BHNDB_IO_COMMON_TEARDOWN();				\
 }
 
-BHNDB_IO_READ(uint8_t, 1);
-BHNDB_IO_READ(uint16_t, 2);
-BHNDB_IO_READ(uint32_t, 4);
-
-BHNDB_IO_WRITE(uint8_t, 1);
-BHNDB_IO_WRITE(uint16_t, 2);
-BHNDB_IO_WRITE(uint32_t, 4);
+/* Defines a bhndb_bus_(read|write)_multi_* method implementation */
+#define	BHNDB_IO_MULTI(_type, _rw, _name)			\
+static void							\
+bhndb_bus_ ## _rw ## _multi_ ## _name (device_t dev,		\
+    device_t child, struct bhnd_resource *r, bus_size_t offset,	\
+    _type *datap, bus_size_t count)				\
+{								\
+	BHNDB_IO_COMMON_SETUP(sizeof(_type) * count);		\
+	bus_ ## _rw ## _multi_ ## _name (io_res, io_offset,	\
+	    datap, count);					\
+	BHNDB_IO_COMMON_TEARDOWN();				\
+}
+
+/* Defines a complete set of read/write methods */
+#define	BHNDB_IO_METHODS(_type, _size)				\
+	BHNDB_IO_READ(_type, _size)				\
+	BHNDB_IO_WRITE(_type, _size)				\
+								\
+	BHNDB_IO_READ(_type, stream_ ## _size)			\
+	BHNDB_IO_WRITE(_type, stream_ ## _size)			\
+								\
+	BHNDB_IO_MULTI(_type, read, _size)			\
+	BHNDB_IO_MULTI(_type, write, _size)			\
+								\
+	BHNDB_IO_MULTI(_type, read, stream_ ## _size)		\
+	BHNDB_IO_MULTI(_type, write, stream_ ## _size)
+
+BHNDB_IO_METHODS(uint8_t, 1);
+BHNDB_IO_METHODS(uint16_t, 2);
+BHNDB_IO_METHODS(uint32_t, 4);
 
 /**
  * Default bhndb(4) implementation of BHND_BUS_BARRIER().
@@ -1919,6 +1942,28 @@ static device_method_t bhndb_methods[] =
 	DEVMETHOD(bhnd_bus_write_1,		bhndb_bus_write_1),
 	DEVMETHOD(bhnd_bus_write_2,		bhndb_bus_write_2),
 	DEVMETHOD(bhnd_bus_write_4,		bhndb_bus_write_4),
+
+	DEVMETHOD(bhnd_bus_read_stream_1,	bhndb_bus_read_stream_1),
+	DEVMETHOD(bhnd_bus_read_stream_2,	bhndb_bus_read_stream_2),
+	DEVMETHOD(bhnd_bus_read_stream_4,	bhndb_bus_read_stream_4),
+	DEVMETHOD(bhnd_bus_write_stream_1,	bhndb_bus_write_stream_1),
+	DEVMETHOD(bhnd_bus_write_stream_2,	bhndb_bus_write_stream_2),
+	DEVMETHOD(bhnd_bus_write_stream_4,	bhndb_bus_write_stream_4),
+
+	DEVMETHOD(bhnd_bus_read_multi_1,	bhndb_bus_read_multi_1),
+	DEVMETHOD(bhnd_bus_read_multi_2,	bhndb_bus_read_multi_2),
+	DEVMETHOD(bhnd_bus_read_multi_4,	bhndb_bus_read_multi_4),
+	DEVMETHOD(bhnd_bus_write_multi_1,	bhndb_bus_write_multi_1),
+	DEVMETHOD(bhnd_bus_write_multi_2,	bhndb_bus_write_multi_2),
+	DEVMETHOD(bhnd_bus_write_multi_4,	bhndb_bus_write_multi_4),
+	
+	DEVMETHOD(bhnd_bus_read_multi_stream_1,	bhndb_bus_read_multi_stream_1),
+	DEVMETHOD(bhnd_bus_read_multi_stream_2,	bhndb_bus_read_multi_stream_2),
+	DEVMETHOD(bhnd_bus_read_multi_stream_4,	bhndb_bus_read_multi_stream_4),
+	DEVMETHOD(bhnd_bus_write_multi_stream_1,bhndb_bus_write_multi_stream_1),
+	DEVMETHOD(bhnd_bus_write_multi_stream_2,bhndb_bus_write_multi_stream_2),
+	DEVMETHOD(bhnd_bus_write_multi_stream_4,bhndb_bus_write_multi_stream_4),
+
 	DEVMETHOD(bhnd_bus_barrier,		bhndb_bus_barrier),
 
 	DEVMETHOD_END

Modified: head/sys/dev/bhnd/tools/bus_macro.sh
==============================================================================
--- head/sys/dev/bhnd/tools/bus_macro.sh	Sun May  8 18:18:35 2016	(r299238)
+++ head/sys/dev/bhnd/tools/bus_macro.sh	Sun May  8 18:20:01 2016	(r299239)
@@ -50,8 +50,8 @@ macro () {
 		echo -n ", (${i})"
 	done
 	echo ") : \\"
-	echo -n "	BHND_BUS_${bus_n}("
-	echo "device_get_parent(rman_get_device((r)->res)),	\\"
+	echo "	BHND_BUS_${bus_n}( \\"
+	echo "	    device_get_parent(rman_get_device((r)->res)),	\\"
 	echo -n "	    rman_get_device((r)->res), (r)"
 	for i
 	do
@@ -70,15 +70,15 @@ do
 	# macro copy_region_$w so dh do c
 	# macro copy_region_stream_$w ?
 	# macro peek_$w
-	for s in "" #stream_
+	for s in "" stream_
 	do
 		macro read_$s$w o
-#		macro read_multi_$s$w o d c
+		macro read_multi_$s$w o d c
 #		macro read_region_$s$w o d c
 #		macro set_multi_$s$w o v c
 #		macro set_region_$s$w o v c
 		macro write_$s$w o v
-#		macro write_multi_$s$w o d c
+		macro write_multi_$s$w o d c
 #		macro write_region_$s$w o d c
 	done
 done


More information about the svn-src-all mailing list