From 48bd625b7704d14c9ebaf3592e2fc53f591ffd27 Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 8 Aug 2018 20:57:53 +0000 Subject: [PATCH] Support DMA coherent devices that attach to mainbus(4) as well. ok patrick@ --- sys/arch/arm64/dev/mainbus.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 * Copyright (c) 2017 Mark Kettenis @@ -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); -- 2.20.1