summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-04-15 16:31:31 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-04-15 16:31:31 +0000
commit0190273c5fcf50acd5dd57162f031143f387039f (patch)
tree94980c126c652474318c58f1f7b9a4d722261da5
parent1219c35e365ab66a18d84dc6866637c26a6bce3b (diff)
Give this code a chance to work on platforms where the page size isn't 8k.
-rw-r--r--sys/dev/pci/if_cas.c16
-rw-r--r--sys/dev/pci/if_casvar.h9
2 files changed, 16 insertions, 9 deletions
diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c
index 13fa4c7669f..2dc43009a11 100644
--- a/sys/dev/pci/if_cas.c
+++ b/sys/dev/pci/if_cas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cas.c,v 1.5 2007/04/11 21:39:14 kettenis Exp $ */
+/* $OpenBSD: if_cas.c,v 1.6 2007/04/15 16:31:30 kettenis Exp $ */
/*
*
@@ -332,7 +332,7 @@ cas_config(struct cas_softc *sc)
* DMA map for it.
*/
if ((error = bus_dmamem_alloc(sc->sc_dmatag,
- sizeof(struct cas_control_data), PAGE_SIZE, 0, &sc->sc_cdseg,
+ sizeof(struct cas_control_data), CAS_PAGE_SIZE, 0, &sc->sc_cdseg,
1, &sc->sc_cdnseg, 0)) != 0) {
printf("\n%s: unable to allocate control data, error = %d\n",
sc->sc_dev.dv_xname, error);
@@ -372,8 +372,8 @@ cas_config(struct cas_softc *sc)
caddr_t kva;
int rseg;
- if ((error = bus_dmamem_alloc(sc->sc_dmatag, PAGE_SIZE,
- PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) {
+ if ((error = bus_dmamem_alloc(sc->sc_dmatag, CAS_PAGE_SIZE,
+ CAS_PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) {
printf("\n%s: unable to alloc rx DMA mem %d, "
"error = %d\n", sc->sc_dev.dv_xname, i, error);
goto fail_5;
@@ -381,22 +381,22 @@ cas_config(struct cas_softc *sc)
sc->sc_rxsoft[i].rxs_dmaseg = seg;
if ((error = bus_dmamem_map(sc->sc_dmatag, &seg, rseg,
- PAGE_SIZE, &kva, BUS_DMA_NOWAIT)) != 0) {
+ CAS_PAGE_SIZE, &kva, BUS_DMA_NOWAIT)) != 0) {
printf("\n%s: unable to alloc rx DMA mem %d, "
"error = %d\n", sc->sc_dev.dv_xname, i, error);
goto fail_5;
}
sc->sc_rxsoft[i].rxs_kva = kva;
- if ((error = bus_dmamap_create(sc->sc_dmatag, PAGE_SIZE, 1,
- PAGE_SIZE, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
+ if ((error = bus_dmamap_create(sc->sc_dmatag, CAS_PAGE_SIZE, 1,
+ CAS_PAGE_SIZE, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
printf("\n%s: unable to create rx DMA map %d, "
"error = %d\n", sc->sc_dev.dv_xname, i, error);
goto fail_5;
}
if ((error = bus_dmamap_load(sc->sc_dmatag,
- sc->sc_rxsoft[i].rxs_dmamap, kva, PAGE_SIZE, NULL,
+ sc->sc_rxsoft[i].rxs_dmamap, kva, CAS_PAGE_SIZE, NULL,
BUS_DMA_NOWAIT)) != 0) {
printf("\n%s: unable to load rx DMA map %d, "
"error = %d\n", sc->sc_dev.dv_xname, i, error);
diff --git a/sys/dev/pci/if_casvar.h b/sys/dev/pci/if_casvar.h
index fbc1e07ce71..f41fe3df7c5 100644
--- a/sys/dev/pci/if_casvar.h
+++ b/sys/dev/pci/if_casvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_casvar.h,v 1.3 2007/02/27 21:19:40 kettenis Exp $ */
+/* $OpenBSD: if_casvar.h,v 1.4 2007/04/15 16:31:30 kettenis Exp $ */
/*
*
@@ -41,6 +41,13 @@
*/
/*
+ * Preferred page size. Cassini has a configurable page size, but
+ * needs at least 8k to handle jumbo frames. This happens to be the
+ * default anyway.
+ */
+#define CAS_PAGE_SIZE 8192
+
+/*
* Transmit descriptor ring size. This is arbitrary, but allocate
* enough descriptors for 64 pending transmissions and 16 segments
* per packet.