summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2016-05-08 18:20:01 +0000
committeradrian <adrian@FreeBSD.org>2016-05-08 18:20:01 +0000
commit0fdbf5a8e1f07588912ef519c7f9b64cf33aae7a (patch)
treeff49278b9430ff14576e5d607c1c1f55885864d3
parentf8ecd440a5b94f6b236c6884e07f4f1a0ec58293 (diff)
downloadFreeBSD-src-0fdbf5a8e1f07588912ef519c7f9b64cf33aae7a.zip
FreeBSD-src-0fdbf5a8e1f07588912ef519c7f9b64cf33aae7a.tar.gz
[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@landonf.org> Differential Revision: https://reviews.freebsd.org/D6194
-rw-r--r--sys/dev/bhnd/bhnd.c98
-rw-r--r--sys/dev/bhnd/bhnd.h129
-rw-r--r--sys/dev/bhnd/bhnd_bus_if.m177
-rw-r--r--sys/dev/bhnd/bhndb/bhndb.c69
-rwxr-xr-xsys/dev/bhnd/tools/bus_macro.sh10
5 files changed, 423 insertions, 60 deletions
diff --git a/sys/dev/bhnd/bhnd.c b/sys/dev/bhnd/bhnd.c
index 44c36ed..8b3c378 100644
--- a/sys/dev/bhnd/bhnd.c
+++ b/sys/dev/bhnd/bhnd.c
@@ -587,48 +587,53 @@ bhnd_generic_resume_child(device_t dev, device_t child)
* 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));
+#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)); \
}
-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));
+#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)); \
}
-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));
+#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); \
}
-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_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
diff --git a/sys/dev/bhnd/bhnd.h b/sys/dev/bhnd/bhnd.h
index 1b0cecf..fdfe510 100644
--- a/sys/dev/bhnd/bhnd.h
+++ b/sys/dev/bhnd/bhnd.h
@@ -608,37 +608,152 @@ bhnd_get_region_addr(device_t dev, bhnd_port_type port_type, u_int port,
#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_ */
diff --git a/sys/dev/bhnd/bhnd_bus_if.m b/sys/dev/bhnd/bhnd_bus_if.m
index fc0cd25..2622524 100644
--- a/sys/dev/bhnd/bhnd_bus_if.m
+++ b/sys/dev/bhnd/bhnd_bus_if.m
@@ -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;
diff --git a/sys/dev/bhnd/bhndb/bhndb.c b/sys/dev/bhnd/bhndb/bhndb.c
index 6680938..6ca1efc 100644
--- a/sys/dev/bhnd/bhndb/bhndb.c
+++ b/sys/dev/bhnd/bhndb/bhndb.c
@@ -1737,37 +1737,60 @@ bhndb_io_resource(struct bhndb_softc *sc, bus_addr_t addr, bus_size_t size,
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);
+/* 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(); \
+}
-BHNDB_IO_WRITE(uint8_t, 1);
-BHNDB_IO_WRITE(uint16_t, 2);
-BHNDB_IO_WRITE(uint32_t, 4);
+/* 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
diff --git a/sys/dev/bhnd/tools/bus_macro.sh b/sys/dev/bhnd/tools/bus_macro.sh
index de9e798..a11ed0c 100755
--- a/sys/dev/bhnd/tools/bus_macro.sh
+++ b/sys/dev/bhnd/tools/bus_macro.sh
@@ -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
OpenPOWER on IntegriCloud