From f1481cb2a9e37f502408db2aa64ea7960d8a2f5f Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 14 Mar 2022 13:08:32 +0000 Subject: [PATCH] Make sure the apldart(4) implementation of bus_dmamap_destroy(9) does the equivalent of bus_dmamap_unload(9) if active mappings exist. This fixes the kerenal panics seen with bringing bwfm(4) down and up again. ok jsg@, patrick@ --- sys/arch/arm64/dev/apldart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/arch/arm64/dev/apldart.c b/sys/arch/arm64/dev/apldart.c index 5b4f65e7459..3f3b3bd26c8 100644 --- a/sys/arch/arm64/dev/apldart.c +++ b/sys/arch/arm64/dev/apldart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apldart.c,v 1.12 2022/03/01 20:45:27 kettenis Exp $ */ +/* $OpenBSD: apldart.c,v 1.13 2022/03/14 13:08:32 kettenis Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -517,6 +517,9 @@ apldart_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) struct apldart_softc *sc = t->_cookie; struct apldart_map_state *ams = map->_dm_cookie; + if (map->dm_nsegs) + apldart_dmamap_unload(t, map); + free(ams, M_DEVBUF, map->_dm_segcnt * sizeof(*ams)); sc->sc_dmat->_dmamap_destroy(sc->sc_dmat, map); } -- 2.20.1