diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-10-10 00:09:08 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-10-10 00:09:08 +0000 |
commit | dc8d0c42a03c25fdf64c58d17fc94f81dd2782d7 (patch) | |
tree | 7035711de4c06df38dee1f8dbe133b6798372b20 /sys/dev/ic/dp8390.c | |
parent | 883652ccedcb7255aa5d5ad9048216f16d568ac3 (diff) |
Add bus_space_barrier.
Add DELAY in some busy loops to allow the DMA engine to actually do something
(neccessary on fast processors).
From ws@ & mycroft@ NetBSD
Testing by deraadt@ nick@, ok deraadt@
Diffstat (limited to 'sys/dev/ic/dp8390.c')
-rw-r--r-- | sys/dev/ic/dp8390.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index 109bc698208..23397fe9680 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.35 2006/10/07 22:08:19 brad Exp $ */ +/* $OpenBSD: dp8390.c,v 1.36 2006/10/10 00:09:07 brad Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -205,8 +205,10 @@ dp8390_stop(sc) int n = 5000; /* Stop everything on the interface, and select page 0 registers. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP); + NIC_BARRIER(regt, regh); /* * Wait for interface to enter stopped state, but limit # of checks to @@ -215,7 +217,7 @@ dp8390_stop(sc) */ while (((NIC_GET(regt, regh, ED_P0_ISR) & ED_ISR_RST) == 0) && --n) - ; + DELAY(1); if (sc->stop_card != NULL) (*sc->stop_card)(sc); @@ -265,8 +267,10 @@ dp8390_init(sc) sc->txb_next_tx = 0; /* Set interface for page 0, remote DMA complete, stopped. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP); + NIC_BARRIER(regt, regh); if (sc->dcr_reg & ED_DCR_LS) { NIC_PUT(regt, regh, ED_P0_DCR, sc->dcr_reg); @@ -314,8 +318,10 @@ dp8390_init(sc) NIC_PUT(regt, regh, ED_P0_ISR, 0xff); /* Program command register for page 1. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP); + NIC_BARRIER(regt, regh); /* Copy out our station address. */ for (i = 0; i < ETHER_ADDR_LEN; ++i) @@ -335,8 +341,10 @@ dp8390_init(sc) NIC_PUT(regt, regh, ED_P1_CURR, sc->next_packet); /* Program command register for page 0. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP); + NIC_BARRIER(regt, regh); /* Accept broadcast and multicast packets by default. */ i = ED_RCR_AB | ED_RCR_AM | sc->rcr_proto; @@ -357,6 +365,7 @@ dp8390_init(sc) (*sc->init_card)(sc); /* Fire up the interface. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA); @@ -392,8 +401,10 @@ dp8390_xmit(sc) len = sc->txb_len[sc->txb_next_tx]; /* Set NIC for page 0 register access. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA); + NIC_BARRIER(regt, regh); /* Set TX buffer start page. */ NIC_PUT(regt, regh, ED_P0_TPSR, sc->tx_page_start + @@ -404,6 +415,7 @@ dp8390_xmit(sc) NIC_PUT(regt, regh, ED_P0_TBCR1, len >> 8); /* Set page 0, remote DMA complete, transmit packet, and *start*. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_TXP | ED_CR_STA); @@ -498,8 +510,10 @@ dp8390_rint(sc) loop: /* Set NIC to page 1 registers to get 'current' pointer. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA); + NIC_BARRIER(regt, regh); /* * 'sc->next_packet' is the logical beginning of the ring-buffer - i.e. @@ -514,8 +528,10 @@ loop: return; /* Set NIC to page 0 registers to update boundary register. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA); + NIC_BARRIER(regt, regh); do { /* Get pointer to this buffer's header structure. */ @@ -613,8 +629,10 @@ dp8390_intr(arg) return (0); /* Set NIC to page 0 registers. */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA); + NIC_BARRIER(regt, regh); isr = NIC_GET(regt, regh, ED_P0_ISR); if (!isr) @@ -771,8 +789,10 @@ dp8390_intr(arg) * set in the transmit routine, is *okay* - it is 'edge' * triggered from low to high). */ + NIC_BARRIER(regt, regh); NIC_PUT(regt, regh, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA); + NIC_BARRIER(regt, regh); /* * If the Network Talley Counters overflow, read them to reset |