diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-02-27 22:01:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-02-27 22:01:05 +0000 |
commit | 4906100bfb6110904e11a05a62592ed3518acce9 (patch) | |
tree | 6315a7216ec5350d6ea394cc37e9765f9447644c /sys | |
parent | cad998c248a34bfed045f3a27347bad3bf8c8c1a (diff) |
Use the DMA defines from dev/ic/lsi64854reg.h whenever possible; no functional
change.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc/dev/dma.c | 34 | ||||
-rw-r--r-- | sys/arch/sparc/dev/dmareg.h | 47 | ||||
-rw-r--r-- | sys/arch/sparc/dev/if_le.c | 17 |
3 files changed, 27 insertions, 71 deletions
diff --git a/sys/arch/sparc/dev/dma.c b/sys/arch/sparc/dev/dma.c index 50a5bdacac4..0ecfa849131 100644 --- a/sys/arch/sparc/dev/dma.c +++ b/sys/arch/sparc/dev/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.19 2004/02/01 15:39:37 miod Exp $ */ +/* $OpenBSD: dma.c,v 1.20 2005/02/27 22:01:03 miod Exp $ */ /* $NetBSD: dma.c,v 1.46 1997/08/27 11:24:16 bouyer Exp $ */ /* @@ -154,12 +154,12 @@ dmaattach(parent, self, aux) char *cabletype = getpropstring(ca->ca_ra.ra_node, "cable-selection"); if (strcmp(cabletype, "tpe") == 0) { - sc->sc_regs->csr |= DE_AUI_TP; + sc->sc_regs->csr |= E_TP_AUI; } else if (strcmp(cabletype, "aui") == 0) { - sc->sc_regs->csr &= ~DE_AUI_TP; + sc->sc_regs->csr &= ~E_TP_AUI; } else { /* assume TP if nothing there */ - sc->sc_regs->csr |= DE_AUI_TP; + sc->sc_regs->csr |= E_TP_AUI; } delay(20000); /* manual says we need 20ms delay */ } @@ -290,15 +290,15 @@ espsearch: * DMA rev0 & rev1: we are not allowed to touch the DMA "flush" \ * and "drain" bits while it is still thinking about a \ * request. \ - * other revs: D_R_PEND bit reads as 0 \ + * other revs: D_ESC_R_PEND bit reads as 0 \ */ \ - DMAWAIT(sc, sc->sc_regs->csr & D_R_PEND, "R_PEND", dontpanic); \ + DMAWAIT(sc, sc->sc_regs->csr & D_ESC_R_PEND, "R_PEND", dontpanic);\ /* \ * Select drain bit based on revision \ * also clears errors and D_TC flag \ */ \ if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ - DMACSR(sc) |= D_DRAIN; \ + DMACSR(sc) |= D_ESC_DRAIN; \ else \ DMACSR(sc) |= D_INVALIDATE; \ /* \ @@ -314,9 +314,9 @@ espsearch: * DMA rev0 & rev1: we are not allowed to touch the DMA "flush" \ * and "drain" bits while it is still thinking about a \ * request. \ - * other revs: D_R_PEND bit reads as 0 \ + * other revs: D_ESC_R_PEND bit reads as 0 \ */ \ - DMAWAIT(sc, sc->sc_regs->csr & D_R_PEND, "R_PEND", dontpanic); \ + DMAWAIT(sc, sc->sc_regs->csr & D_ESC_R_PEND, "R_PEND", dontpanic);\ csr = DMACSR(sc); \ csr &= ~(D_WRITE|D_EN_DMA); \ csr |= D_INVALIDATE; \ @@ -339,17 +339,17 @@ dma_reset(sc, isledma) switch (sc->sc_rev) { case DMAREV_2: - sc->sc_regs->csr &= ~D_BURST_SIZE; /* must clear first */ + sc->sc_regs->csr &= ~L64854_BURST_SIZE; /* must clear first */ if (sc->sc_burst & SBUS_BURST_32) { - DMACSR(sc) |= D_BURST_32; + DMACSR(sc) |= L64854_BURST_32; } else if (sc->sc_burst & SBUS_BURST_16) { - DMACSR(sc) |= D_BURST_16; + DMACSR(sc) |= L64854_BURST_16; } else { - DMACSR(sc) |= D_BURST_0; + DMACSR(sc) |= L64854_BURST_0; } break; case DMAREV_ESC: - DMACSR(sc) |= D_AUTODRAIN; /* Auto-drain */ + DMACSR(sc) |= D_ESC_AUTODRAIN; /* Auto-drain */ if (sc->sc_burst & SBUS_BURST_32) { DMACSR(sc) &= ~0x800; } else @@ -506,13 +506,13 @@ espdmaintr(sc) csr = DMACSR(sc); NCR_DMA(("%s: intr: addr %p, csr %b\n", sc->sc_dev.dv_xname, - DMADDR(sc), csr, DMACSRBITS)); + DMADDR(sc), csr, DDMACSR_BITS)); if (csr & D_ERR_PEND) { DMACSR(sc) &= ~D_EN_DMA; /* Stop DMA */ DMACSR(sc) |= D_INVALIDATE; printf("%s: error: csr=%b\n", sc->sc_dev.dv_xname, - csr, DMACSRBITS); + csr, DDMACSR_BITS); return -1; } @@ -626,7 +626,7 @@ ledmaintr(sc) DMACSR(sc) &= ~D_EN_DMA; /* Stop DMA */ DMACSR(sc) |= D_INVALIDATE; printf("%s: error: csr=%b\n", sc->sc_dev.dv_xname, - csr, DMACSRBITS); + csr, DDMACSR_BITS); DMA_RESET(sc); } return 1; diff --git a/sys/arch/sparc/dev/dmareg.h b/sys/arch/sparc/dev/dmareg.h index 54a29e0e483..a34639c2304 100644 --- a/sys/arch/sparc/dev/dmareg.h +++ b/sys/arch/sparc/dev/dmareg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dmareg.h,v 1.6 2003/06/05 12:27:02 deraadt Exp $ */ +/* $OpenBSD: dmareg.h,v 1.7 2005/02/27 22:01:04 miod Exp $ */ /* $NetBSD: dmareg.h,v 1.10 1996/11/28 09:37:34 pk Exp $ */ /* @@ -24,59 +24,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define DMACSRBITS "\020\01INT\02ERR\03DR1\04DR2\05IEN\011WRITE\016ENCNT\017TC\032DMAON" +#include <dev/ic/lsi64854reg.h> struct dma_regs { volatile u_long csr; /* DMA CSR */ -#define D_INT_PEND 0x00000001 /* interrupt pending */ -#define D_ERR_PEND 0x00000002 /* error pending */ -#define D_DRAINING 0x0000000c /* fifo draining */ -#define D_INT_EN 0x00000010 /* interrupt enable */ -#define D_INVALIDATE 0x00000020 /* invalidate fifo */ -#define D_SLAVE_ERR 0x00000040 /* slave access size error */ -#define D_DRAIN 0x00000040 /* rev0,1,esc: drain fifo */ -#define D_RESET 0x00000080 /* reset scsi */ -#define D_WRITE 0x00000100 /* 1 = dev -> mem */ -#define D_EN_DMA 0x00000200 /* enable DMA requests */ -#define D_R_PEND 0x00000400 /* rev0,1: request pending */ -#define D_ESC_BURST 0x00000800 /* DMA ESC: 16 byte bursts */ -#define D_EN_CNT 0x00002000 /* enable byte counter */ -#define D_TC 0x00004000 /* terminal count */ -#define D_DSBL_CSR_DRN 0x00010000 /* disable fifo drain on csr */ -#define D_DSBL_SCSI_DRN 0x00020000 /* disable fifo drain on reg */ -#define D_BURST_SIZE 0x000c0000 /* sbus read/write burst size */ -#define D_BURST_0 0x00080000 /* no bursts (SCSI-only) */ -#define D_BURST_16 0x00000000 /* 16-byte bursts */ -#define D_BURST_32 0x00040000 /* 32-byte bursts */ -#define D_AUTODRAIN 0x00040000 /* DMA ESC: Auto-drain */ -#define D_DIAG 0x00100000 /* disable fifo drain on addr */ -#define D_TWO_CYCLE 0x00200000 /* 2 clocks per transfer */ -#define D_FASTER 0x00400000 /* 3 clocks per transfer */ -#define DE_AUI_TP 0x00400000 /* 1 for TP, 0 for AUI */ -#define D_TCI_DIS 0x00800000 /* disable intr on D_TC */ -#define D_EN_NEXT 0x01000000 /* enable auto next address */ -#define D_DMA_ON 0x02000000 /* enable dma from scsi */ -#define D_A_LOADED 0x04000000 /* address loaded */ -#define D_NA_LOADED 0x08000000 /* next address loaded */ -#define D_DEV_ID 0xf0000000 /* device ID */ -#define DMAREV_0 0x00000000 /* Sunray DMA */ -#define DMAREV_ESC 0x40000000 /* DMA ESC array */ -#define DMAREV_1 0x80000000 /* 'DMA' */ -#define DMAREV_PLUS 0x90000000 /* 'DMA+' */ -#define DMAREV_2 0xa0000000 /* 'DMA2' */ -#define DMAREV_HME 0xb0000000 /* 'HME' gate array */ - volatile caddr_t addr; -#define DMA_D_ADDR 0x01 /* DMA ADDR (in u_longs) */ - volatile u_long bcnt; /* DMA COUNT (in u_longs) */ -#define D_BCNT_MASK 0x00ffffff /* only 24 bits */ - volatile u_long test; /* DMA TEST (in u_longs) */ #define en_testcsr addr /* enet registers overlap */ #define en_cachev bcnt #define en_bar test - }; /* diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c index 69bc8f30622..a933b5abc38 100644 --- a/sys/arch/sparc/dev/if_le.c +++ b/sys/arch/sparc/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.24 2004/09/29 07:35:11 miod Exp $ */ +/* $OpenBSD: if_le.c,v 1.25 2005/02/27 22:01:04 miod Exp $ */ /* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */ /*- @@ -111,7 +111,6 @@ myleintr(arg) } if (dodrain) { /* XXX - is this necessary with D_DSBL_WRINVAL on? */ -#define E_DRAIN 0x400 /* XXX: fix dmareg.h */ int i = 10; while (i-- > 0 && (lesc->sc_dma->sc_regs->csr & D_DRAINING)) delay(1); @@ -180,10 +179,10 @@ lesetutp(sc) while (--tries) { csr = lesc->sc_dma->sc_regs->csr; - csr |= DE_AUI_TP; + csr |= E_TP_AUI; lesc->sc_dma->sc_regs->csr = csr; delay(20000); /* must not touch le for 20ms */ - if (lesc->sc_dma->sc_regs->csr & DE_AUI_TP) + if (lesc->sc_dma->sc_regs->csr & E_TP_AUI) return; } } @@ -198,10 +197,10 @@ lesetaui(sc) while (--tries) { csr = lesc->sc_dma->sc_regs->csr; - csr &= ~DE_AUI_TP; + csr &= ~E_TP_AUI; lesc->sc_dma->sc_regs->csr = csr; delay(20000); /* must not touch le for 20ms */ - if ((lesc->sc_dma->sc_regs->csr & DE_AUI_TP) == 0) + if ((lesc->sc_dma->sc_regs->csr & E_TP_AUI) == 0) return; } } @@ -281,7 +280,7 @@ lemediastatus(ifp, ifmr) /* * Notify the world which media we're currently using. */ - if (lesc->sc_dma->sc_regs->csr & DE_AUI_TP) + if (lesc->sc_dma->sc_regs->csr & E_TP_AUI) ifmr->ifm_active = IFM_ETHER | IFM_10_T; else ifmr->ifm_active = IFM_ETHER | IFM_10_5; @@ -306,7 +305,7 @@ lehwreset(sc) if (CPU_ISSUN4M && lesc->sc_dma) { u_int32_t aui; - aui = lesc->sc_dma->sc_regs->csr & DE_AUI_TP; + aui = lesc->sc_dma->sc_regs->csr & E_TP_AUI; DMA_RESET(lesc->sc_dma); lesc->sc_dma->sc_regs->en_bar = lesc->sc_laddr & 0xff000000; DMA_ENINTR(lesc->sc_dma); @@ -359,7 +358,7 @@ lenocarrier(sc) * Check if the user has requested a certain cable type, and * if so, honor that request. */ - if (lesc->sc_dma->sc_regs->csr & DE_AUI_TP) { + if (lesc->sc_dma->sc_regs->csr & E_TP_AUI) { switch (IFM_SUBTYPE(sc->sc_ifmedia.ifm_media)) { case IFM_10_5: case IFM_AUTO: |