Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Make tlp_read_srom() work on big-endian systems.



details:   https://anonhg.NetBSD.org/src/rev/a4e8bd5c4eba
branches:  trunk
changeset: 476720:a4e8bd5c4eba
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 26 03:39:01 1999 +0000

description:
Make tlp_read_srom() work on big-endian systems.

>From a patch supplied by Luoqi Chen <luoqi%chekov.watermarkgroup.com@localhost>.

diffstat:

 sys/dev/ic/tulip.c       |  11 +++++++----
 sys/dev/ic/tulipvar.h    |   4 ++--
 sys/dev/pci/if_tlp_pci.c |   7 +++----
 3 files changed, 12 insertions(+), 10 deletions(-)

diffs (81 lines):

diff -r 6d8e71372e52 -r a4e8bd5c4eba sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Sun Sep 26 02:42:50 1999 +0000
+++ b/sys/dev/ic/tulip.c        Sun Sep 26 03:39:01 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.17 1999/09/25 00:27:00 thorpej Exp $       */
+/*     $NetBSD: tulip.c,v 1.18 1999/09/26 03:39:01 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -1674,9 +1674,10 @@
 tlp_read_srom(sc, word, wordcnt, data)
        struct tulip_softc *sc;
        int word, wordcnt;
-       u_int16_t *data;
+       u_int8_t *data;
 {
        u_int32_t miirom;
+       u_int16_t datain;
        int i, x;
 
        tlp_srom_idle(sc);
@@ -1717,13 +1718,15 @@
 
                /* Shift out data. */
                miirom &= ~MIIROM_SROMDI;
-               data[i] = 0;
+               datain = 0;
                for (x = 16; x > 0; x--) {
                        SROM_EMIT(sc, miirom|MIIROM_SROMSK);
                        if (TULIP_ISSET(sc, CSR_MIIROM, MIIROM_SROMDO))
-                               data[i] |= (1 << (x - 1));
+                               datain |= (1 << (x - 1));
                        SROM_EMIT(sc, miirom);
                }
+               data[2 * i] = datain & 0xff;
+               data[(2 * i) + 1] = datain >> 8;
 
                /* Clear CHIP SELECT. */
                miirom &= ~MIIROM_SROMCS;
diff -r 6d8e71372e52 -r a4e8bd5c4eba sys/dev/ic/tulipvar.h
--- a/sys/dev/ic/tulipvar.h     Sun Sep 26 02:42:50 1999 +0000
+++ b/sys/dev/ic/tulipvar.h     Sun Sep 26 03:39:01 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulipvar.h,v 1.12 1999/09/25 00:27:00 thorpej Exp $    */
+/*     $NetBSD: tulipvar.h,v 1.13 1999/09/26 03:39:01 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -420,7 +420,7 @@
 
 void   tlp_attach __P((struct tulip_softc *, const u_int8_t *));
 int    tlp_intr __P((void *));
-void   tlp_read_srom __P((struct tulip_softc *, int, int, u_int16_t *));
+void   tlp_read_srom __P((struct tulip_softc *, int, int, u_int8_t *));
 int    tlp_srom_crcok __P((const u_int8_t *));
 int    tlp_isv_srom __P((const u_int8_t *));
 int    tlp_isv_srom_enaddr __P((struct tulip_softc *, u_int8_t *));
diff -r 6d8e71372e52 -r a4e8bd5c4eba sys/dev/pci/if_tlp_pci.c
--- a/sys/dev/pci/if_tlp_pci.c  Sun Sep 26 02:42:50 1999 +0000
+++ b/sys/dev/pci/if_tlp_pci.c  Sun Sep 26 03:39:01 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tlp_pci.c,v 1.13 1999/09/25 00:27:00 thorpej Exp $  */
+/*     $NetBSD: if_tlp_pci.c,v 1.14 1999/09/26 03:39:02 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -490,12 +490,11 @@
            }
 
        default:
-               tlp_read_srom(sc, 0, sizeof(sc->sc_srom) >> 1,
-                   (u_int16_t *)sc->sc_srom);
+               tlp_read_srom(sc, 0, sizeof(sc->sc_srom) >> 1, sc->sc_srom);
 #if 0
                printf("SROM CONTENTS:");
                for (i = 0; i < sizeof(sc->sc_srom); i++) {
-                       if ((i % 10) == 0)
+                       if ((i % 8) == 0)
                                printf("\n\t");
                        printf("0x%02x ", sc->sc_srom[i]);
                }



Home | Main Index | Thread Index | Old Index