-/* $OpenBSD: mainbus.c,v 1.8 2021/06/20 16:51:37 deraadt Exp $ */
+/* $OpenBSD: mainbus.c,v 1.9 2024/04/07 21:08:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
struct machine_bus_dma_tag mainbus_dma_tag = {
NULL,
- 0,
+ BUS_DMA_COHERENT,
_dmamap_create,
_dmamap_destroy,
_dmamap_load,
OF_getpropintarray(node, "interrupts", fa.fa_intr, len);
}
+ if (OF_getproplen(node, "dma-noncoherent") >= 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;
+ } else 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 && sc->sc_early == 0)
print = mainbus_print;
if (submatch == NULL)
-/* $OpenBSD: simplebus.c,v 1.6 2023/09/22 01:10:44 jsg Exp $ */
+/* $OpenBSD: simplebus.c,v 1.7 2024/04/07 21:08:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
OF_getpropintarray(node, "interrupts", fa.fa_intr, len);
}
- if (OF_getproplen(node, "dma-coherent") >= 0) {
+ if (OF_getproplen(node, "dma-noncoherent") >= 0) {
+ fa.fa_dmat = malloc(sizeof(sc->sc_dma),
+ M_DEVBUF, M_WAITOK | M_ZERO);
+ memcpy(fa.fa_dmat, &sc->sc_dma, sizeof(sc->sc_dma));
+ fa.fa_dmat->_flags &= ~BUS_DMA_COHERENT;
+ } else if (OF_getproplen(node, "dma-coherent") >= 0) {
fa.fa_dmat = malloc(sizeof(sc->sc_dma),
M_DEVBUF, M_WAITOK | M_ZERO);
memcpy(fa.fa_dmat, &sc->sc_dma, sizeof(sc->sc_dma));