diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-08-08 20:57:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-08-08 20:57:54 +0000 |
commit | 9113cd3c494a20ab640e894f528b8fd3d0f48fbe (patch) | |
tree | c3dc188bc9cb21cc3545ef3b7606416faf09a284 | |
parent | f470cc366344d05b99d29fd9c83b1a9091329f7a (diff) |
Support DMA coherent devices that attach to mainbus(4) as well.
ok patrick@
-rw-r--r-- | sys/arch/arm64/dev/mainbus.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/arm64/dev/mainbus.c b/sys/arch/arm64/dev/mainbus.c index 4205acff7a1..049ecc3fff6 100644 --- a/sys/arch/arm64/dev/mainbus.c +++ b/sys/arch/arm64/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.9 2018/02/24 09:45:10 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.10 2018/08/08 20:57:53 kettenis Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org> @@ -202,6 +202,13 @@ mainbus_attach_node(struct device *self, int node, cfmatch_t submatch) OF_getpropintarray(node, "interrupts", fa.fa_intr, len); } + if (OF_getproplen(node, "dma-coherent") >= 0) { + fa.fa_dmat = malloc(sizeof(*sc->sc_dmat), + M_DEVBUF, M_WAITOK | M_ZERO); + memcpy(fa.fa_dmat, sc->sc_dmat, sizeof(*sc->sc_dmat)); + fa.fa_dmat->_flags |= BUS_DMA_COHERENT; + } + if (submatch == NULL) submatch = mainbus_match_status; config_found_sm(self, &fa, NULL, submatch); |