summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2015-01-24 15:15:50 +0000
committerkettenis <kettenis@openbsd.org>2015-01-24 15:15:50 +0000
commit5ed3837b51452a086b330785e4cf1b51d4ce1641 (patch)
tree92c44ce8509a1ed427bba5bead519985dfbd5f84 /sys
parentAdd bus_dmamem_alloc_range(9) to allow drivers to allocate DMA'able memory (diff)
downloadwireguard-openbsd-5ed3837b51452a086b330785e4cf1b51d4ce1641.tar.xz
wireguard-openbsd-5ed3837b51452a086b330785e4cf1b51d4ce1641.zip
Use bus_dmamem_alloc_range(9) to make sure the ring descriprtors can be
accessed by the device. ok deraadt@, stsp@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bce.c7
1 files 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,