diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cardbus/if_xl_cardbus.c | 3 | ||||
-rw-r--r-- | sys/dev/ic/xl.c | 280 | ||||
-rw-r--r-- | sys/dev/ic/xlreg.h | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_xl_pci.c | 3 |
4 files changed, 214 insertions, 89 deletions
diff --git a/sys/dev/cardbus/if_xl_cardbus.c b/sys/dev/cardbus/if_xl_cardbus.c index 69958cc744f..32da1f2c93b 100644 --- a/sys/dev/cardbus/if_xl_cardbus.c +++ b/sys/dev/cardbus/if_xl_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_cardbus.c,v 1.10 2002/03/14 01:26:53 millert Exp $ */ +/* $OpenBSD: if_xl_cardbus.c,v 1.11 2002/06/15 05:14:41 aaron Exp $ */ /* $NetBSD: if_xl_cardbus.c,v 1.13 2000/03/07 00:32:52 mycroft Exp $ */ /* @@ -236,6 +236,7 @@ xl_cardbus_attach(parent, self, aux) printf(": 3Com %s", ecp->ecp_name); sc->xl_flags = ecp->ecp_flags; + sc->sc_dmat = ca->ca_dmat; iob = adr; sc->xl_bhandle = ioh; diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index eb8cf012b6d..596d3b6128d 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.37 2002/06/09 03:14:18 todd Exp $ */ +/* $OpenBSD: xl.c,v 1.38 2002/06/15 05:14:41 aaron Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -142,8 +142,6 @@ #include <net/bpf.h> #endif -#include <uvm/uvm_extern.h> /* for vtophys */ - #include <dev/ic/xlreg.h> int xl_newbuf(struct xl_softc *, struct xl_chain_onefrag *); @@ -1091,7 +1089,9 @@ xl_list_tx_init_90xB(sc) ld = sc->xl_ldata; for (i = 0; i < XL_TX_LIST_CNT; i++) { cd->xl_tx_chain[i].xl_ptr = &ld->xl_tx_list[i]; - cd->xl_tx_chain[i].xl_phys = vtophys(&ld->xl_tx_list[i]); + cd->xl_tx_chain[i].xl_phys = + sc->sc_listmap->dm_segs[0].ds_addr + + offsetof(struct xl_list_data, xl_tx_list[i]); if (i == (XL_TX_LIST_CNT - 1)) cd->xl_tx_chain[i].xl_next = &cd->xl_tx_chain[0]; else @@ -1125,6 +1125,7 @@ int xl_list_rx_init(sc) struct xl_chain_data *cd; struct xl_list_data *ld; int i; + bus_addr_t next; cd = &sc->xl_cdata; ld = sc->xl_ldata; @@ -1134,15 +1135,17 @@ int xl_list_rx_init(sc) (struct xl_list_onefrag *)&ld->xl_rx_list[i]; if (xl_newbuf(sc, &cd->xl_rx_chain[i]) == ENOBUFS) return(ENOBUFS); + next = sc->sc_listmap->dm_segs[0].ds_addr; if (i == (XL_RX_LIST_CNT - 1)) { cd->xl_rx_chain[i].xl_next = &cd->xl_rx_chain[0]; - ld->xl_rx_list[i].xl_next = - vtophys(&ld->xl_rx_list[0]); + next += + offsetof(struct xl_list_data, xl_rx_list[0]); } else { cd->xl_rx_chain[i].xl_next = &cd->xl_rx_chain[i + 1]; - ld->xl_rx_list[i].xl_next = - vtophys(&ld->xl_rx_list[i + 1]); + next += + offsetof(struct xl_list_data, xl_rx_list[i + 1]); } + ld->xl_rx_list[i].xl_next = next; } cd->xl_rx_head = &cd->xl_rx_chain[0]; @@ -1158,6 +1161,7 @@ int xl_newbuf(sc, c) struct xl_chain_onefrag *c; { struct mbuf *m_new = NULL; + bus_dmamap_t map; MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) @@ -1170,15 +1174,31 @@ int xl_newbuf(sc, c) } m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + if (bus_dmamap_load(sc->sc_dmat, sc->sc_rx_sparemap, + mtod(m_new, caddr_t), MCLBYTES, NULL, BUS_DMA_NOWAIT) != 0) { + printf("%s: rx load failed\n", sc->sc_dev.dv_xname); + m_freem(m_new); + return (ENOBUFS); + } + map = c->map; + c->map = sc->sc_rx_sparemap; + sc->sc_rx_sparemap = map; /* Force longword alignment for packet payload. */ m_adj(m_new, ETHER_ALIGN); + bus_dmamap_sync(sc->sc_dmat, c->map, 0, c->map->dm_mapsize, + BUS_DMASYNC_PREREAD); + c->xl_mbuf = m_new; - c->xl_ptr->xl_frag.xl_addr = vtophys(mtod(m_new, caddr_t)); - c->xl_ptr->xl_frag.xl_len = MCLBYTES | XL_LAST_FRAG; + c->xl_ptr->xl_frag.xl_addr = c->map->dm_segs[0].ds_addr + ETHER_ALIGN; + c->xl_ptr->xl_frag.xl_len = c->map->dm_segs[0].ds_len | XL_LAST_FRAG; c->xl_ptr->xl_status = 0; + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + ((caddr_t)c->xl_ptr - sc->sc_listkva), sizeof(struct xl_list), + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + return(0); } @@ -1191,6 +1211,11 @@ int xl_rx_resync(sc) pos = sc->xl_cdata.xl_rx_head; for (i = 0; i < XL_RX_LIST_CNT; i++) { + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + ((caddr_t)pos->xl_ptr - sc->sc_listkva), + sizeof(struct xl_list), + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + if (pos->xl_ptr->xl_status) break; pos = pos->xl_next; @@ -1225,6 +1250,11 @@ again: cur_rx = sc->xl_cdata.xl_rx_head; sc->xl_cdata.xl_rx_head = cur_rx->xl_next; + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + ((caddr_t)cur_rx->xl_ptr - sc->sc_listkva), + sizeof(struct xl_list), + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + /* * If an error occurs, update stats, clear the * status word and leave the mbuf cluster in place: @@ -1254,6 +1284,9 @@ again: m = cur_rx->xl_mbuf; total_len = cur_rx->xl_ptr->xl_status & XL_RXSTAT_LENMASK; + bus_dmamap_sync(sc->sc_dmat, cur_rx->map, 0, + cur_rx->map->dm_mapsize, BUS_DMASYNC_POSTREAD); + /* * Try to conjure up a new mbuf cluster. If that * fails, it means we have an out of memory condition and @@ -1317,7 +1350,8 @@ again: CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_UP_STALL); xl_wait(sc); CSR_WRITE_4(sc, XL_UPLIST_PTR, - vtophys(&sc->xl_ldata->xl_rx_list[0])); + sc->sc_listmap->dm_segs[0].ds_addr + + offsetof(struct xl_list_data, xl_rx_list[0])); sc->xl_cdata.xl_rx_head = &sc->xl_cdata.xl_rx_chain[0]; CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_UP_UNSTALL); goto again; @@ -1353,14 +1387,27 @@ void xl_txeof(sc) while(sc->xl_cdata.xl_tx_head != NULL) { cur_tx = sc->xl_cdata.xl_tx_head; + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + ((caddr_t)cur_tx->xl_ptr - sc->sc_listkva), + sizeof(struct xl_list), + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + if (CSR_READ_4(sc, XL_DOWNLIST_PTR)) break; sc->xl_cdata.xl_tx_head = cur_tx->xl_next; - m_freem(cur_tx->xl_mbuf); - cur_tx->xl_mbuf = NULL; ifp->if_opackets++; + if (cur_tx->map->dm_nsegs != 0) { + bus_dmamap_t map = cur_tx->map; + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, map); + } + if (cur_tx->xl_mbuf != NULL) { + m_freem(cur_tx->xl_mbuf); + cur_tx->xl_mbuf = NULL; + } cur_tx->xl_next = sc->xl_cdata.xl_tx_free; sc->xl_cdata.xl_tx_free = cur_tx; } @@ -1372,7 +1419,9 @@ void xl_txeof(sc) if (CSR_READ_4(sc, XL_DMACTL) & XL_DMACTL_DOWN_STALLED || !CSR_READ_4(sc, XL_DOWNLIST_PTR)) { CSR_WRITE_4(sc, XL_DOWNLIST_PTR, - vtophys(sc->xl_cdata.xl_tx_head->xl_ptr)); + sc->sc_listmap->dm_segs[0].ds_addr + + ((caddr_t)sc->xl_cdata.xl_tx_head->xl_ptr - + sc->sc_listkva)); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_DOWN_UNSTALL); } } @@ -1446,7 +1495,9 @@ void xl_txeoc(sc) } else { if (sc->xl_cdata.xl_tx_head != NULL) CSR_WRITE_4(sc, XL_DOWNLIST_PTR, - vtophys(sc->xl_cdata.xl_tx_head->xl_ptr)); + sc->sc_listmap->dm_segs[0].ds_addr + + ((caddr_t)sc->xl_cdata.xl_tx_head->xl_ptr - + sc->sc_listkva)); } /* * Remember to set this for the @@ -1606,29 +1657,29 @@ int xl_encap(sc, c, m_head) struct xl_chain *c; struct mbuf *m_head; { - int frag = 0; - struct xl_frag *f = NULL; - int total_len; - struct mbuf *m; + int frag, total_len; + bus_dmamap_t map; + + map = sc->sc_tx_sparemap; + +reload: + if (bus_dmamap_load_mbuf(sc->sc_dmat, map, + m_head, BUS_DMA_NOWAIT) != 0) + return (ENOBUFS); /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out * of fragments or hit the end of the mbuf chain. */ - m = m_head; - total_len = 0; - - for (m = m_head, frag = 0; m != NULL; m = m->m_next) { - if (m->m_len != 0) { - if (frag == XL_MAXFRAGS) - break; - total_len+= m->m_len; - c->xl_ptr->xl_frag[frag].xl_addr = - vtophys(mtod(m, vm_offset_t)); - c->xl_ptr->xl_frag[frag].xl_len = m->m_len; - frag++; - } + for (frag = 0, total_len = 0; frag < map->dm_nsegs; frag++) { + if ((XL_TX_LIST_CNT - (sc->xl_cdata.xl_tx_cnt + frag)) < 3) + return (ENOBUFS); + if (frag == XL_MAXFRAGS) + break; + total_len += map->dm_segs[frag].ds_len; + c->xl_ptr->xl_frag[frag].xl_addr = map->dm_segs[frag].ds_addr; + c->xl_ptr->xl_frag[frag].xl_len = map->dm_segs[frag].ds_len; } /* @@ -1639,7 +1690,7 @@ int xl_encap(sc, c, m_head) * pointers/counters; it wouldn't gain us anything, * and would waste cycles. */ - if (m != NULL) { + if (frag != map->dm_nsegs) { struct mbuf *m_new = NULL; MGETHDR(m_new, M_DONTWAIT, MT_DATA); @@ -1657,17 +1708,24 @@ int xl_encap(sc, c, m_head) m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len; m_freem(m_head); m_head = m_new; - f = &c->xl_ptr->xl_frag[0]; - f->xl_addr = vtophys(mtod(m_new, caddr_t)); - f->xl_len = total_len = m_new->m_len; - frag = 1; + goto reload; } + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, + BUS_DMASYNC_PREWRITE); + c->xl_mbuf = m_head; - c->xl_ptr->xl_frag[frag - 1].xl_len |= XL_LAST_FRAG; + sc->sc_tx_sparemap = c->map; + c->map = map; + c->xl_ptr->xl_frag[frag - 1].xl_len |= XL_LAST_FRAG; c->xl_ptr->xl_status = total_len; c->xl_ptr->xl_next = 0; + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + offsetof(struct xl_list_data, xl_tx_list[0]), + sizeof(struct xl_list) * XL_TX_LIST_CNT, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + return(0); } @@ -1718,7 +1776,10 @@ void xl_start(ifp) /* Chain it together. */ if (prev != NULL) { prev->xl_next = cur_tx; - prev->xl_ptr->xl_next = vtophys(cur_tx->xl_ptr); + prev->xl_ptr->xl_next = + sc->sc_listmap->dm_segs[0].ds_addr + + ((caddr_t)cur_tx->xl_ptr - sc->sc_listkva); + } prev = cur_tx; @@ -1757,7 +1818,8 @@ void xl_start(ifp) if (sc->xl_cdata.xl_tx_head != NULL) { sc->xl_cdata.xl_tx_tail->xl_next = start_tx; sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next = - vtophys(start_tx->xl_ptr); + sc->sc_listmap->dm_segs[0].ds_addr + + ((caddr_t)start_tx->xl_ptr - sc->sc_listkva); sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &= ~XL_TXSTAT_DL_INTR; sc->xl_cdata.xl_tx_tail = cur_tx; @@ -1766,7 +1828,9 @@ void xl_start(ifp) sc->xl_cdata.xl_tx_tail = cur_tx; } if (!CSR_READ_4(sc, XL_DOWNLIST_PTR)) - CSR_WRITE_4(sc, XL_DOWNLIST_PTR, vtophys(start_tx->xl_ptr)); + CSR_WRITE_4(sc, XL_DOWNLIST_PTR, + sc->sc_listmap->dm_segs[0].ds_addr + + ((caddr_t)start_tx->xl_ptr - sc->sc_listkva)); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_DOWN_UNSTALL); @@ -1802,32 +1866,39 @@ int xl_encap_90xB(sc, c, m_head) struct xl_chain *c; struct mbuf *m_head; { - int frag = 0; struct xl_frag *f = NULL; - struct mbuf *m; struct xl_list *d; + int frag; + bus_dmamap_t map; /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out * of fragments or hit the end of the mbuf chain. */ + map = sc->sc_tx_sparemap; d = c->xl_ptr; d->xl_status = 0; d->xl_next = 0; - for (m = m_head, frag = 0; m != NULL; m = m->m_next) { - if (m->m_len != 0) { - if (frag == XL_MAXFRAGS) - break; - f = &d->xl_frag[frag]; - f->xl_addr = vtophys(mtod(m, vm_offset_t)); - f->xl_len = m->m_len; - frag++; - } + if (bus_dmamap_load_mbuf(sc->sc_dmat, map, + m_head, BUS_DMA_NOWAIT) != 0) + return (ENOBUFS); + + for (frag = 0; frag < map->dm_nsegs; frag++) { + if (frag == XL_MAXFRAGS) + break; + f = &d->xl_frag[frag]; + f->xl_addr = map->dm_segs[frag].ds_addr; + f->xl_len = map->dm_segs[frag].ds_len; } + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, + BUS_DMASYNC_PREWRITE); + c->xl_mbuf = m_head; + sc->sc_tx_sparemap = c->map; + c->map = map; c->xl_ptr->xl_frag[frag - 1].xl_len |= XL_LAST_FRAG; c->xl_ptr->xl_status = XL_TXSTAT_RND_DEFEAT; @@ -1838,6 +1909,11 @@ int xl_encap_90xB(sc, c, m_head) if (m_head->m_pkthdr.csum & M_UDPV4_CSUM_OUT) c->xl_ptr->xl_status |= XL_TXSTAT_UDPCKSUM; + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, + offsetof(struct xl_list_data, xl_tx_list[0]), + sizeof(struct xl_list) * XL_TX_LIST_CNT, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + return(0); } @@ -2054,7 +2130,8 @@ void xl_init(xsc) */ CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_UP_STALL); xl_wait(sc); - CSR_WRITE_4(sc, XL_UPLIST_PTR, vtophys(&sc->xl_ldata->xl_rx_list[0])); + CSR_WRITE_4(sc, XL_UPLIST_PTR, sc->sc_listmap->dm_segs[0].ds_addr + + offsetof(struct xl_list_data, xl_rx_list[0])); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_UP_UNSTALL); xl_wait(sc); @@ -2065,7 +2142,8 @@ void xl_init(xsc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_DOWN_STALL); xl_wait(sc); CSR_WRITE_4(sc, XL_DOWNLIST_PTR, - vtophys(&sc->xl_ldata->xl_tx_list[0])); + sc->sc_listmap->dm_segs[0].ds_addr + + offsetof(struct xl_list_data, xl_tx_list[0])); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_DOWN_UNSTALL); xl_wait(sc); } @@ -2392,6 +2470,13 @@ xl_freetxrx(sc) * Free data in the RX lists. */ for (i = 0; i < XL_RX_LIST_CNT; i++) { + if (sc->xl_cdata.xl_rx_chain[i].map->dm_segs != 0) { + bus_dmamap_t map = sc->xl_cdata.xl_rx_chain[i].map; + + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_dmat, map); + } if (sc->xl_cdata.xl_rx_chain[i].xl_mbuf != NULL) { m_freem(sc->xl_cdata.xl_rx_chain[i].xl_mbuf); sc->xl_cdata.xl_rx_chain[i].xl_mbuf = NULL; @@ -2403,6 +2488,13 @@ xl_freetxrx(sc) * Free the TX list buffers. */ for (i = 0; i < XL_TX_LIST_CNT; i++) { + if (sc->xl_cdata.xl_tx_chain[i].map->dm_segs != 0) { + bus_dmamap_t map = sc->xl_cdata.xl_tx_chain[i].map; + + bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, map); + } if (sc->xl_cdata.xl_tx_chain[i].xl_mbuf != NULL) { m_freem(sc->xl_cdata.xl_tx_chain[i].xl_mbuf); sc->xl_cdata.xl_tx_chain[i].xl_mbuf = NULL; @@ -2463,8 +2555,6 @@ xl_attach(sc) { u_int8_t enaddr[ETHER_ADDR_LEN]; struct ifnet *ifp = &sc->sc_arpcom.ac_if; - caddr_t roundptr; - u_int round; int i, media = IFM_ETHER|IFM_100_TX|IFM_FDX; struct ifmedia *ifm; @@ -2481,6 +2571,60 @@ xl_attach(sc) } bcopy(enaddr, (char *)&sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); + if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct xl_list_data), + PAGE_SIZE, 0, sc->sc_listseg, 1, &sc->sc_listnseg, + BUS_DMA_NOWAIT) != 0) { + printf(": can't alloc list mem\n"); + return; + } + if (bus_dmamem_map(sc->sc_dmat, sc->sc_listseg, sc->sc_listnseg, + sizeof(struct xl_list_data), &sc->sc_listkva, + BUS_DMA_NOWAIT) != 0) { + printf(": can't map list mem\n"); + return; + } + if (bus_dmamap_create(sc->sc_dmat, sizeof(struct xl_list_data), 1, + sizeof(struct xl_list_data), 0, BUS_DMA_NOWAIT, + &sc->sc_listmap) != 0) { + printf(": can't alloc list map\n"); + return; + } + if (bus_dmamap_load(sc->sc_dmat, sc->sc_listmap, sc->sc_listkva, + sizeof(struct xl_list_data), NULL, BUS_DMA_NOWAIT) != 0) { + printf(": can't load list map\n"); + return; + } + sc->xl_ldata = (struct xl_list_data *)sc->sc_listkva; + bzero(sc->xl_ldata, sizeof(struct xl_list_data)); + + for (i = 0; i < XL_RX_LIST_CNT; i++) { + if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, + 0, BUS_DMA_NOWAIT, + &sc->xl_cdata.xl_rx_chain[i].map) != 0) { + printf(": can't create rx map\n"); + return; + } + } + if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, + BUS_DMA_NOWAIT, &sc->sc_rx_sparemap) != 0) { + printf(": can't create rx spare map\n"); + return; + } + + for (i = 0; i < XL_TX_LIST_CNT; i++) { + if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, + XL_TX_LIST_CNT - 3, MCLBYTES, 0, BUS_DMA_NOWAIT, + &sc->xl_cdata.xl_tx_chain[i].map) != 0) { + printf(": can't create tx map\n"); + return; + } + } + if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, XL_TX_LIST_CNT - 3, + MCLBYTES, 0, BUS_DMA_NOWAIT, &sc->sc_tx_sparemap) != 0) { + printf(": can't create tx spare map\n"); + return; + } + printf(" address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr)); if (sc->xl_flags & (XL_FLAG_INVERT_LED_PWR|XL_FLAG_INVERT_MII_PWR)) { @@ -2498,30 +2642,6 @@ xl_attach(sc) CSR_WRITE_2(sc, 12, n); } - sc->xl_ldata_ptr = malloc(sizeof(struct xl_list_data) + 8, - M_DEVBUF, M_NOWAIT); - if (sc->xl_ldata_ptr == NULL) { - printf("%s: no memory for list buffers\n",sc->sc_dev.dv_xname); - return; - } - - sc->xl_ldata = (struct xl_list_data *)sc->xl_ldata_ptr; -#ifdef __alpha__ - round = (u_int64_t)sc->xl_ldata_ptr & 0xf; -#else - round = (u_int32_t)sc->xl_ldata_ptr & 0xf; -#endif - roundptr = sc->xl_ldata_ptr; - for (i = 0; i < 8; i++) { - if (round % 8) { - round++; - roundptr++; - } else - break; - } - sc->xl_ldata = (struct xl_list_data *)roundptr; - bzero(sc->xl_ldata, sizeof(struct xl_list_data)); - /* * Figure out the card type. 3c905B adapters have the * 'supportsNoTxLength' bit set in the capabilities diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h index 2990bc1a3ab..32c5a95d398 100644 --- a/sys/dev/ic/xlreg.h +++ b/sys/dev/ic/xlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xlreg.h,v 1.12 2002/06/09 03:14:18 todd Exp $ */ +/* $OpenBSD: xlreg.h,v 1.13 2002/06/15 05:14:41 aaron Exp $ */ /* * Copyright (c) 1997, 1998 @@ -460,12 +460,14 @@ struct xl_chain { struct xl_chain *xl_next; struct xl_chain *xl_prev; u_int32_t xl_phys; + bus_dmamap_t map; }; struct xl_chain_onefrag { struct xl_list_onefrag *xl_ptr; struct mbuf *xl_mbuf; struct xl_chain_onefrag *xl_next; + bus_dmamap_t map; }; struct xl_chain_data { @@ -580,12 +582,18 @@ struct xl_softc { u_int8_t xl_stats_no_timeout; u_int16_t xl_tx_thresh; int xl_if_flags; - caddr_t xl_ldata_ptr; struct xl_list_data *xl_ldata; struct xl_chain_data xl_cdata; int xl_flags; void (*intr_ack)(struct xl_softc *); void * sc_sdhook, *sc_pwrhook; + bus_dma_tag_t sc_dmat; + bus_dmamap_t sc_listmap; + bus_dma_segment_t sc_listseg[1]; + int sc_listnseg; + caddr_t sc_listkva; + bus_dmamap_t sc_rx_sparemap; + bus_dmamap_t sc_tx_sparemap; }; #define xl_rx_goodframes(x) \ @@ -716,11 +724,6 @@ struct xl_stats { #define XL_PME_EN 0x0010 #define XL_PME_STATUS 0x8000 -#ifdef __alpha__ -#undef vtophys -#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va) -#endif - #ifndef ETHER_ALIGN #define ETHER_ALIGN 2 #endif diff --git a/sys/dev/pci/if_xl_pci.c b/sys/dev/pci/if_xl_pci.c index 8c9cec8817f..037be8c2ece 100644 --- a/sys/dev/pci/if_xl_pci.c +++ b/sys/dev/pci/if_xl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_pci.c,v 1.11 2002/03/14 01:26:59 millert Exp $ */ +/* $OpenBSD: if_xl_pci.c,v 1.12 2002/06/15 05:14:41 aaron Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -151,6 +151,7 @@ xl_pci_attach(parent, self, aux) bus_size_t iosize; u_int32_t command; + sc->sc_dmat = pa->pa_dmat; sc->xl_unit = sc->sc_dev.dv_unit; sc->xl_flags = 0; |