MFC revs 1.33, 1.34, 1.35, and 1.36.
These changes allow bfe to work on machines with > 1GB of ram. Approved by: re
This commit is contained in:
parent
6a2081b51d
commit
7597bbc0f2
@ -197,22 +197,25 @@ bfe_dma_alloc(device_t dev)
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
/* parent tag */
|
||||
/*
|
||||
* parent tag. Apparently the chip cannot handle any DMA address
|
||||
* greater than 1GB.
|
||||
*/
|
||||
error = bus_dma_tag_create(NULL, /* parent */
|
||||
PAGE_SIZE, 0, /* alignment, boundary */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR_32BIT, /* highaddr */
|
||||
0x3FFFFFFF, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
MAXBSIZE, /* maxsize */
|
||||
BUS_SPACE_UNRESTRICTED, /* num of segments */
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* max segment size */
|
||||
BUS_DMA_ALLOCNOW, /* flags */
|
||||
0, /* flags */
|
||||
NULL, NULL, /* lockfunc, lockarg */
|
||||
&sc->bfe_parent_tag);
|
||||
|
||||
/* tag for TX ring */
|
||||
error = bus_dma_tag_create(sc->bfe_parent_tag,
|
||||
BFE_TX_LIST_SIZE, BFE_TX_LIST_SIZE,
|
||||
1, 0,
|
||||
BUS_SPACE_MAXADDR,
|
||||
BUS_SPACE_MAXADDR,
|
||||
NULL, NULL,
|
||||
@ -230,7 +233,7 @@ bfe_dma_alloc(device_t dev)
|
||||
|
||||
/* tag for RX ring */
|
||||
error = bus_dma_tag_create(sc->bfe_parent_tag,
|
||||
BFE_RX_LIST_SIZE, BFE_RX_LIST_SIZE,
|
||||
1, 0,
|
||||
BUS_SPACE_MAXADDR,
|
||||
BUS_SPACE_MAXADDR,
|
||||
NULL, NULL,
|
||||
@ -255,7 +258,7 @@ bfe_dma_alloc(device_t dev)
|
||||
MCLBYTES,
|
||||
1,
|
||||
BUS_SPACE_MAXSIZE_32BIT,
|
||||
0,
|
||||
BUS_DMA_ALLOCNOW,
|
||||
NULL, NULL,
|
||||
&sc->bfe_tag);
|
||||
|
||||
@ -299,7 +302,7 @@ bfe_dma_alloc(device_t dev)
|
||||
if(error)
|
||||
return (ENOMEM);
|
||||
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREWRITE);
|
||||
|
||||
error = bus_dmamem_alloc(sc->bfe_tx_tag, (void *)&sc->bfe_tx_list,
|
||||
BUS_DMA_NOWAIT, &sc->bfe_tx_map);
|
||||
@ -314,7 +317,7 @@ bfe_dma_alloc(device_t dev)
|
||||
return (ENOMEM);
|
||||
|
||||
bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE);
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREWRITE);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -526,7 +529,7 @@ bfe_tx_ring_free(struct bfe_softc *sc)
|
||||
}
|
||||
}
|
||||
bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE);
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREWRITE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -543,7 +546,7 @@ bfe_rx_ring_free(struct bfe_softc *sc)
|
||||
}
|
||||
}
|
||||
bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE);
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREWRITE);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -556,7 +559,7 @@ bfe_list_rx_init(struct bfe_softc *sc)
|
||||
return (ENOBUFS);
|
||||
}
|
||||
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREWRITE);
|
||||
CSR_WRITE_4(sc, BFE_DMARX_PTR, (i * sizeof(struct bfe_desc)));
|
||||
|
||||
sc->bfe_rx_cons = 0;
|
||||
@ -594,7 +597,7 @@ bfe_list_newbuf(struct bfe_softc *sc, int c, struct mbuf *m)
|
||||
r = &sc->bfe_rx_ring[c];
|
||||
bus_dmamap_load(sc->bfe_tag, r->bfe_map, mtod(m, void *),
|
||||
MCLBYTES, bfe_dma_map_desc, d, 0);
|
||||
bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_PREWRITE);
|
||||
|
||||
ctrl = ETHER_MAX_LEN + 32;
|
||||
|
||||
@ -603,7 +606,7 @@ bfe_list_newbuf(struct bfe_softc *sc, int c, struct mbuf *m)
|
||||
|
||||
d->bfe_ctrl = ctrl;
|
||||
r->bfe_mbuf = m;
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREWRITE);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1138,7 +1141,7 @@ bfe_rxeof(struct bfe_softc *sc)
|
||||
r = &sc->bfe_rx_ring[cons];
|
||||
m = r->bfe_mbuf;
|
||||
rxheader = mtod(m, struct bfe_rxheader*);
|
||||
bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_POSTREAD);
|
||||
len = rxheader->len;
|
||||
r->bfe_mbuf = NULL;
|
||||
|
||||
@ -1300,7 +1303,7 @@ bfe_encap(struct bfe_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
|
||||
r->bfe_map, mtod(m, void*), m->m_len,
|
||||
bfe_dma_map_desc, d, 0);
|
||||
bus_dmamap_sync(sc->bfe_tag, r->bfe_map,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
|
||||
frag = cur;
|
||||
BFE_INC(cur, BFE_TX_LIST_CNT);
|
||||
@ -1313,7 +1316,7 @@ bfe_encap(struct bfe_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
|
||||
|
||||
sc->bfe_tx_list[frag].bfe_ctrl |= BFE_DESC_EOF;
|
||||
sc->bfe_tx_ring[frag].bfe_mbuf = m_head;
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREREAD);
|
||||
bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, BUS_DMASYNC_PREWRITE);
|
||||
|
||||
*txidx = cur;
|
||||
sc->bfe_tx_cnt += cnt;
|
||||
|
Loading…
Reference in New Issue
Block a user