Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Work around missing __BUS_SPACE_HAS_STREAM_METHOD...



details:   https://anonhg.NetBSD.org/src/rev/4a16c6aac31a
branches:  trunk
changeset: 782236:4a16c6aac31a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Oct 22 16:43:05 2012 +0000

description:
Work around missing __BUS_SPACE_HAS_STREAM_METHODS on some ports.

diffstat:

 sys/dev/ic/siisata.c |  26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r b952a3705e23 -r 4a16c6aac31a sys/dev/ic/siisata.c
--- a/sys/dev/ic/siisata.c      Mon Oct 22 15:43:32 2012 +0000
+++ b/sys/dev/ic/siisata.c      Mon Oct 22 16:43:05 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.22 2012/07/31 15:50:34 bouyer Exp $ */
+/* $NetBSD: siisata.c,v 1.23 2012/10/22 16:43:05 jakllsch Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.22 2012/07/31 15:50:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.23 2012/10/22 16:43:05 jakllsch Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -110,6 +110,28 @@
 
 #define ATA_DELAY 10000                /* 10s for a drive I/O */
 
+#ifndef __BUS_SPACE_HAS_STREAM_METHODS
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define bus_space_read_stream_4 bus_space_read_4
+#define bus_space_read_region_stream_4 bus_space_read_region_4
+#else
+static inline uint32_t
+bus_space_read_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
+{
+       return htole32(bus_space_read_4(t, h, o);
+}
+
+static inline void
+bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint32_t *p, bus_size_t c)
+{
+       bus_space_read_region_4(t, h, o, p, c);
+       for (bus_size_t i = 0; i < c; i++) {
+               p[i] = htole32(p[i]);
+       }
+}
+#endif
+#endif
+
 static void siisata_attach_port(struct siisata_softc *, int);
 static void siisata_intr_port(struct siisata_channel *);
 



Home | Main Index | Thread Index | Old Index