From 5ed3837b51452a086b330785e4cf1b51d4ce1641 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 24 Jan 2015 15:15:50 +0000 Subject: [PATCH] Use bus_dmamem_alloc_range(9) to make sure the ring descriprtors can be accessed by the device. ok deraadt@, stsp@ --- sys/dev/pci/if_bce.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index 537353a8b93..98df2a42356 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.40 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: if_bce.c,v 1.41 2015/01/24 15:15:50 kettenis Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -315,8 +315,9 @@ bce_attach(struct device *parent, struct device *self, void *aux) * XXX PAGE_SIZE is wasteful; we only need 1KB + 1KB, but * due to the limition above. ?? */ - if ((error = bus_dmamem_alloc(sc->bce_dmatag, 2 * PAGE_SIZE, - PAGE_SIZE, 2 * PAGE_SIZE, &seg, 1, &rseg, BUS_DMA_NOWAIT))) { + if ((error = bus_dmamem_alloc_range(sc->bce_dmatag, 2 * PAGE_SIZE, + PAGE_SIZE, 2 * PAGE_SIZE, &seg, 1, &rseg, BUS_DMA_NOWAIT, + (bus_addr_t)0, (bus_addr_t)0x3fffffff))) { printf(": unable to alloc space for ring descriptors, " "error = %d\n", error); uvm_km_free(kernel_map, (vaddr_t)sc->bce_data, -- 2.20.1