summaryrefslogtreecommitdiff
path: root/sys/arch/arm64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2021-03-29 17:04:01 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2021-03-29 17:04:01 +0000
commit70c220d82163ac0cbb4b2a3c76b6592dc3561b49 (patch)
treed8731eb6a6cb28ba16855d70a68c99021f6e37a4 /sys/arch/arm64
parent6beeccb80e0306f739c4d88b98800b772f209743 (diff)
Turns out the PCIe DARTs support a full 32-bit device virtual address space.
Adjust the region managed by the extend accordingly but avoid the first and last page. The last page collides with the MSI address used by the PCIe controller and not using the first page helps finding bugs. ok patrick@
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r--sys/arch/arm64/dev/apldart.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/arm64/dev/apldart.c b/sys/arch/arm64/dev/apldart.c
index 2397fbbb13b..4e52e47c9d5 100644
--- a/sys/arch/arm64/dev/apldart.c
+++ b/sys/arch/arm64/dev/apldart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apldart.c,v 1.1 2021/02/27 16:19:14 kettenis Exp $ */
+/* $OpenBSD: apldart.c,v 1.2 2021/03/29 17:04:00 kettenis Exp $ */
/*
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
*
@@ -190,9 +190,14 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sid_mask = OF_getpropint(faa->fa_node, "sid-mask", 0xffff);
sc->sc_nsid = fls(sc->sc_sid_mask);
- /* Default aperture for PCIe DART. */
- sc->sc_dvabase = 0x00100000UL;
- sc->sc_dvaend = 0x3fefffffUL;
+ /*
+ * Skip the first page to help catching bugs where a device is
+ * doing DMA to/from address zero because we didn't properly
+ * set up the DMA transfer. Skip the last page to avoid using
+ * the address reserved for MSIs.
+ */
+ sc->sc_dvabase = DART_PAGE_SIZE;
+ sc->sc_dvaend = 0xffffffff - DART_PAGE_SIZE;
/* Disable translations. */
for (sid = 0; sid < sc->sc_nsid; sid++)