Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fixes from PR 9838:



details:   https://anonhg.NetBSD.org/src/rev/15394f7459f1
branches:  trunk
changeset: 486040:15394f7459f1
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Thu May 11 20:55:03 2000 +0000

description:
Fixes from PR 9838:
Only access board memory using the front-end functions.
Add hook for clearing latched interrupts.
Corrent debugging printf of ethertype on LE systems.
Make it possible to us I82586_DEBUG as a kernel option.

Tested on arm26 and mvme68k.

diffstat:

 sys/dev/ic/i82586.c    |  39 +++++++++++++++++++++------------------
 sys/dev/ic/i82586var.h |   5 ++++-
 2 files changed, 25 insertions(+), 19 deletions(-)

diffs (114 lines):

diff -r 1da880b47f9c -r 15394f7459f1 sys/dev/ic/i82586.c
--- a/sys/dev/ic/i82586.c       Thu May 11 19:54:35 2000 +0000
+++ b/sys/dev/ic/i82586.c       Thu May 11 20:55:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82586.c,v 1.26 2000/03/30 12:45:31 augustss Exp $     */
+/*     $NetBSD: i82586.c,v 1.27 2000/05/11 20:55:03 bjh21 Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -561,6 +561,8 @@
        bus_space_barrier(sc->bt, sc->bh, 0, 0, BUS_SPACE_BARRIER_READ);
        status = (sc->ie_bus_read16)(sc, IE_SCB_STATUS(sc->scb));
        i82586_start_cmd(sc, status & mask, 0, 0, 0);
+       if (sc->intrhook)
+               sc->intrhook(sc, INTR_ACK);
 }
 
 /*
@@ -1235,7 +1237,7 @@
                printf("%s: frame from ether %s type 0x%x len %d\n",
                        sc->sc_dev.dv_xname,
                        ether_sprintf(eh->ether_shost),
-                       (u_int)eh->ether_type,
+                       (u_int)ntohs(eh->ether_type),
                        pktlen);
        }
 #endif
@@ -1446,12 +1448,12 @@
 
        /* Put in 16-bit mode */
        off = IE_SCP_BUS_USE(sc->scp);
-       bus_space_write_1(sc->bt, sc->bh, off, 0);
+       (sc->ie_bus_write16)(sc, off, 0);
        bus_space_barrier(sc->bt, sc->bh, off, 1, BUS_SPACE_BARRIER_WRITE);
 
        /* Set the ISCP `busy' bit */
        off = IE_ISCP_BUSY(sc->iscp);
-       bus_space_write_1(sc->bt, sc->bh, off, 1);
+       (sc->ie_bus_write16)(sc, off, 1);
        bus_space_barrier(sc->bt, sc->bh, off, 1, BUS_SPACE_BARRIER_WRITE);
 
        if (sc->hwreset)
@@ -1464,7 +1466,7 @@
        /* Read back the ISCP `busy' bit; it should be clear by now */
        off = IE_ISCP_BUSY(sc->iscp);
        bus_space_barrier(sc->bt, sc->bh, off, 1, BUS_SPACE_BARRIER_READ);
-       result = bus_space_read_1(sc->bt, sc->bh, off) == 0;
+       result = (sc->ie_bus_read16)(sc, off) == 0;
 
        /* Acknowledge any interrupts we may have caused. */
        ie_ack(sc, IE_ST_WHENCE);
@@ -1742,21 +1744,22 @@
        int promiscuous, manchester;
 {
        int cmdresult, status;
+       u_int8_t buf[IE_CMD_CFG_SZ]; /* XXX malloc? */
 
+       *IE_CMD_CFG_CNT(buf)       = 0x0c;
+       *IE_CMD_CFG_FIFO(buf)      = 8;
+        *IE_CMD_CFG_SAVEBAD(buf)   = 0x40;
+       *IE_CMD_CFG_ADDRLEN(buf)   = 0x2e;
+       *IE_CMD_CFG_PRIORITY(buf)  = 0;
+       *IE_CMD_CFG_IFS(buf)       = 0x60;
+       *IE_CMD_CFG_SLOT_LOW(buf)  = 0;
+       *IE_CMD_CFG_SLOT_HIGH(buf) = 0xf2;
+       *IE_CMD_CFG_PROMISC(buf)   = !!promiscuous | manchester << 2;
+       *IE_CMD_CFG_CRSCDT(buf)    = 0;
+       *IE_CMD_CFG_MINLEN(buf)    = 64;
+       *IE_CMD_CFG_JUNK(buf)      = 0xff;
+       sc->memcopyout(sc, buf, cmd, IE_CMD_CFG_SZ);
        setup_simple_command(sc, IE_CMD_CONFIG, cmd);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_CNT(cmd), 0x0c);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_FIFO(cmd), 8);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_SAVEBAD(cmd), 0x40);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_ADDRLEN(cmd), 0x2e);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_PRIORITY(cmd), 0);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_IFS(cmd), 0x60);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_SLOT_LOW(cmd), 0);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_SLOT_HIGH(cmd), 0xf2);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_PROMISC(cmd),
-                                         !!promiscuous | manchester << 2);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_CRSCDT(cmd), 0);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_MINLEN(cmd), 64);
-       bus_space_write_1(sc->bt, sc->bh, IE_CMD_CFG_JUNK(cmd), 0xff);
        bus_space_barrier(sc->bt, sc->bh, cmd, IE_CMD_CFG_SZ,
                          BUS_SPACE_BARRIER_WRITE);
 
diff -r 1da880b47f9c -r 15394f7459f1 sys/dev/ic/i82586var.h
--- a/sys/dev/ic/i82586var.h    Thu May 11 19:54:35 2000 +0000
+++ b/sys/dev/ic/i82586var.h    Thu May 11 20:55:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82586var.h,v 1.13 2000/05/09 22:51:34 pk Exp $        */
+/*     $NetBSD: i82586var.h,v 1.14 2000/05/11 20:55:04 bjh21 Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -97,7 +97,9 @@
  * This sun version based on i386 version 1.30.
  */
 
+#ifndef I82586_DEBUG
 #define I82586_DEBUG 0
+#endif
 
 /* Debug elements */
 #define        IED_RINT        0x01
@@ -121,6 +123,7 @@
 #define INTR_ENTER     0               /* intr hook called on ISR entry */
 #define INTR_EXIT      1               /* intr hook called on ISR exit */
 #define INTR_LOOP      2               /* intr hook called on ISR loop */
+#define INTR_ACK       3               /* intr hook called on ie_ack */
 
 #define CHIP_PROBE     0               /* reset called from chip probe */
 #define CARD_RESET     1               /* reset called from card reset */



Home | Main Index | Thread Index | Old Index