From 41f3aaf426830630eac9e77d8f4f8d023bf78b40 Mon Sep 17 00:00:00 2001 From: jmcneill Date: Mon, 28 Dec 2020 16:49:58 +0000 Subject: [PATCH] Initialize DMA memory when allocating it. Should fix PR# 51734 (hdaudio "RIRB timeout" on boot). --- sys/dev/hdaudio/hdaudio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/hdaudio/hdaudio.c b/sys/dev/hdaudio/hdaudio.c index 3533c800aa83..c1e6b716aa93 100644 --- a/sys/dev/hdaudio/hdaudio.c +++ b/sys/dev/hdaudio/hdaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.11 2020/06/11 02:39:30 thorpej Exp $ */ +/* $NetBSD: hdaudio.c,v 1.12 2020/12/28 16:49:58 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.11 2020/06/11 02:39:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.12 2020/12/28 16:49:58 jmcneill Exp $"); #include #include @@ -179,6 +179,10 @@ hdaudio_dma_alloc(struct hdaudio_softc *sc, struct hdaudio_dma *dma, if (err) goto destroy; + memset(dma->dma_addr, 0, dma->dma_size); + bus_dmamap_sync(sc->sc_dmat, dma->dma_map, 0, dma->dma_size, + BUS_DMASYNC_PREWRITE); + dma->dma_valid = true; return 0;