Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Endian-ness bugfix for elink3 on big-endian hosts.



details:   https://anonhg.NetBSD.org/src/rev/a05d9d81f022
branches:  trunk
changeset: 471867:a05d9d81f022
user:      jonathan <jonathan%NetBSD.org@localhost>
date:      Tue Apr 13 20:23:52 1999 +0000

description:
Endian-ness bugfix for elink3 on big-endian hosts.
  Big-endian CPUs should use bus_space_{read,write}_multi_stream methods
  to PIO packet data to NIC in 16-bit or 32-bit chunks.
  Make it so.
  Since we don't have stream methods on all ports yet (esp. i386), use
  the bus_space_{read,write}_multi methods if the compile-time
  stream-method feature-test   macro is not set.
Originally from tsubai%netbsd.org@localhost, via HAYAKAWA koichi's cardbus patches.

diffstat:

 sys/dev/ic/elink3.c |  23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diffs (65 lines):

diff -r c0a155802277 -r a05d9d81f022 sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c       Tue Apr 13 20:17:47 1999 +0000
+++ b/sys/dev/ic/elink3.c       Tue Apr 13 20:23:52 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.54 1999/03/25 23:18:32 thorpej Exp $      */
+/*     $NetBSD: elink3.c,v 1.55 1999/04/13 20:23:52 jonathan Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -125,6 +125,19 @@
 #endif
 
 /*
+ * XXX endian workaround for big-endian CPUs  with pcmcia:
+ * if stream methods for bus_space_multi are not provided, define them
+ * using non-stream bus_space_{read,write}_multi_.
+ * Assumes host CPU is same endian-ness as bus.
+ */
+#ifndef __BUS_SPACE_HAS_STREAM_METHODS
+#define bus_space_read_multi_stream_2  bus_space_read_multi_2
+#define bus_space_read_multi_stream_4  bus_space_read_multi_4
+#define bus_space_write_multi_stream_2 bus_space_write_multi_2
+#define bus_space_write_multi_stream_4 bus_space_write_multi_4
+#endif /* __BUS_SPACE_HAS_STREAM_METHODS */
+
+/*
  * Structure to map media-present bits in boards to ifmedia codes and
  * printable media names. Used for table-driven ifmedia initialization.
  */
@@ -1115,7 +1128,7 @@
                                            (void *)(mtod(m, u_long) + count);
                                        m->m_len -= count;
                                }
-                               bus_space_write_multi_4(iot, ioh,
+                               bus_space_write_multi_stream_4(iot, ioh,
                                    txreg, mtod(m, u_int32_t *), m->m_len >> 2);
                                m->m_data = (void *)(mtod(m, u_long) +
                                        (u_long)(m->m_len & ~3));
@@ -1138,7 +1151,7 @@
                                            (void *)(mtod(m, u_long) + 1);
                                        m->m_len -= 1;
                                }
-                               bus_space_write_multi_2(iot, ioh,
+                               bus_space_write_multi_stream_2(iot, ioh,
                                    txreg, mtod(m, u_int16_t *),
                                    m->m_len >> 1);
                        }
@@ -1599,7 +1612,7 @@
                                remaining -= count;
                        }
                        if (remaining > 3) {
-                               bus_space_read_multi_4(iot, ioh,
+                               bus_space_read_multi_stream_4(iot, ioh,
                                    rxreg, (u_int32_t *) offset,
                                    remaining >> 2);
                                offset += remaining & ~3;
@@ -1618,7 +1631,7 @@
                                offset += 1;
                        }
                        if (remaining > 1) {
-                               bus_space_read_multi_2(iot, ioh,
+                               bus_space_read_multi_stream_2(iot, ioh,
                                    rxreg, (u_int16_t *) offset,
                                    remaining >> 1);
                                offset += remaining & ~1;



Home | Main Index | Thread Index | Old Index