summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>2000-07-07 13:32:47 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>2000-07-07 13:32:47 +0000
commit6af51839652bec4f7ffdfd024898f468aca0d413 (patch)
tree45d607be8da36a99a1e5e0be9bbd98bf40dd4d89 /sys/arch
parent1ce081cf8a770c9444e16eea79a50c07a845d6d7 (diff)
Updates from a newer version of the NetBSD driver.
Use the interrupt line as configured by pci, now that the bridge will walk the openfirmware device tree and properly initialize that field.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/mac/if_gm.c38
-rw-r--r--sys/arch/powerpc/mac/if_gmreg.h5
2 files changed, 27 insertions, 16 deletions
diff --git a/sys/arch/powerpc/mac/if_gm.c b/sys/arch/powerpc/mac/if_gm.c
index 5324dcd3d7e..1bea01f8e98 100644
--- a/sys/arch/powerpc/mac/if_gm.c
+++ b/sys/arch/powerpc/mac/if_gm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gm.c,v 1.3 2000/04/01 15:38:21 rahnds Exp $ */
+/* $OpenBSD: if_gm.c,v 1.4 2000/07/07 13:32:46 rahnds Exp $ */
/* $NetBSD: if_gm.c,v 1.2 2000/03/04 11:17:00 tsubai Exp $ */
/*-
@@ -259,7 +259,7 @@ gmac_attach(parent, self, aux)
* pci info? pa_intrline returns 60, not 1 like the hardware expects
* on uni-north G4 system.
*/
- if (pci_intr_establish(pa->pa_pc, 0x1, IPL_NET,
+ if (pci_intr_establish(pa->pa_pc, pa->pa_intrline, IPL_NET,
gmac_intr, sc, "gmac") == NULL)
{
printf(": unable to establish interrupt");
@@ -455,7 +455,7 @@ gmac_intr(v)
if (status & GMAC_INT_RXDONE)
gmac_rint(sc);
- if (status & GMAC_INT_TXDONE)
+ if (status & GMAC_INT_TXEMPTY)
gmac_tint(sc);
return 1;
@@ -466,17 +466,9 @@ gmac_tint(sc)
struct gmac_softc *sc;
{
struct ifnet *ifp = &sc->sc_if;
- volatile struct gmac_dma *dp;
- int i;
-
- i = gmac_read_reg(sc, GMAC_TXDMACOMPLETE);
- dp = &sc->sc_txlist[i];
- dp->cmd = 0; /* to be safe */
- __asm __volatile ("sync");
ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_timer = 0;
- ifp->if_opackets++;
gmac_start(ifp);
}
@@ -613,8 +605,6 @@ gmac_start(ifp)
if (m == 0)
break;
- ifp->if_flags |= IFF_OACTIVE;
-
/* 5 seconds to watch for failing to transmit */
ifp->if_timer = 5;
ifp->if_opackets++; /* # of pkts */
@@ -644,6 +634,14 @@ gmac_start(ifp)
if (ifp->if_bpf)
bpf_tap(ifp->if_bpf, buff, tlen);
#endif
+ i++;
+ if (i == NTXBUF) {
+ i = 0;
+ }
+ if (i == gmac_read_reg(sc, GMAC_TXDMACOMPLETE)) {
+ ifp->if_flags |= IFF_OACTIVE;
+ break;
+ }
}
}
@@ -788,6 +786,18 @@ gmac_init_mac(sc)
gmac_write_reg(sc, GMAC_TXMACCONFIG, 0);
gmac_write_reg(sc, GMAC_XIFCONFIG, 5);
gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 0);
+ if (IFM_OPTIONS(sc->sc_mii.mii_media_active) & IFM_FDX) {
+ gmac_write_reg(sc, GMAC_TXMACCONFIG, 6);
+ gmac_write_reg(sc, GMAC_XIFCONFIG, 1);
+ } else {
+ gmac_write_reg(sc, GMAC_TXMACCONFIG, 0);
+ gmac_write_reg(sc, GMAC_XIFCONFIG, 5);
+ }
+ if (0) { /* g-bit? */
+ gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 3);
+ } else {
+ gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 0);
+ }
}
void
@@ -813,7 +823,7 @@ gmac_init(sc)
gmac_start_txdma(sc);
gmac_start_rxdma(sc);
- gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXDONE | GMAC_INT_RXDONE));
+ gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXEMPTY | GMAC_INT_RXDONE));
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
diff --git a/sys/arch/powerpc/mac/if_gmreg.h b/sys/arch/powerpc/mac/if_gmreg.h
index bc5e9f63f08..44c14ec0bf0 100644
--- a/sys/arch/powerpc/mac/if_gmreg.h
+++ b/sys/arch/powerpc/mac/if_gmreg.h
@@ -37,8 +37,9 @@ struct gmac_dma {
#define GMAC_SOP 0x40000000 /* start of packet? */
#define GMAC_LEN_MASK 0x00003fff
-#define GMAC_INT_TXDONE 0x04
-#define GMAC_INT_RXDONE 0x10
+#define GMAC_INT_TXEMPTY 0x02 /* TX ring empty */
+#define GMAC_INT_TXDONE 0x04
+#define GMAC_INT_RXDONE 0x10
#define GMAC_RXMAC_PR 0x08