From nobody Thu Oct 30 18:41:01 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761037945; cv=none; d=zohomail.com; s=zohoarc; b=kK5Y7HZocXqw+E8gkURHPUNyiKDcnBieE6iGNT6750OmiLGTpmWle+BCzWe8+Il+XajSpcbm1tRzX4PGTfft077A5SiwYrRjGtzTdQdHrZ/ONu1gj1k81r2n2PV06qbUxf18CXeUkWAXxwD3O2KaCwmDE6P7iixH67A9YQR+4PY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761037945; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nmXqy4w9Xp3d871swaw2TtPMrWUPX5OISXyRJWRiPhU=; b=NOscf/wmnalnJjmmhFli4KLXyk60gANOqyttP62QWg93uzTaoJHubBKAbA6IPjuP/psmsexEtbUJN1jKiFRKMwmUdH8PnSkbqpIdWP7K/TRM/Q3IY9i4jjHe5bHy5IWQFBDWagSPE6k8FabGI3yJ3Md6e18yT9pOjwtpBWIAAEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761037945304794.0579465911508; Tue, 21 Oct 2025 02:12:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vB8KN-0006bO-8c; Tue, 21 Oct 2025 05:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vB8KI-0006Tx-7l for qemu-devel@nongnu.org; Tue, 21 Oct 2025 05:06:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vB8K8-0004Kx-LK for qemu-devel@nongnu.org; Tue, 21 Oct 2025 05:06:41 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-LXr6cZvVPt6z4InVfl5tIA-1; Tue, 21 Oct 2025 05:06:13 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 072491956096; Tue, 21 Oct 2025 09:06:12 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E0431800451; Tue, 21 Oct 2025 09:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761037591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nmXqy4w9Xp3d871swaw2TtPMrWUPX5OISXyRJWRiPhU=; b=iYyxT/KvonWqrPAHFZ7zWTnCl9UI7e3vmORhzizcgXoJDi8Nb5/IYtMxMOxQzlQNByoFdI 37NdDPLSrlxMTpfrKHLrA8irBdlVPKag64Qp0F5/kcsD9zL9/SqvkoJqmu3N+KFg2atdhW CJeFJTh8Om5KChpwwrArfJWNBcpePFo= X-MC-Unique: LXr6cZvVPt6z4InVfl5tIA-1 X-Mimecast-MFC-AGG-ID: LXr6cZvVPt6z4InVfl5tIA_1761037572 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Volker=20R=C3=BCmelin?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH 31/43] hw/audio: replace AUD_log() usage Date: Tue, 21 Oct 2025 13:03:02 +0400 Message-ID: <20251021090317.425409-32-marcandre.lureau@redhat.com> In-Reply-To: <20251021090317.425409-1-marcandre.lureau@redhat.com> References: <20251021090317.425409-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URI_DOTEDU=1 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761037961660158500 From: Marc-Andr=C3=A9 Lureau AUD_log() is just printf(stderr, "prefix: "..), we can use error_report() or warn_report() appropriately instead. Ideally it should be converted to traces, but there are many places to convert, this is left for another day. Avoid bit-rot by using conditionals. The patch could be splitted if necessary. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/ac97.c | 120 ++++++++++++++++++++++----------------------- hw/audio/adlib.c | 20 +++----- hw/audio/cs4231a.c | 40 +++++++-------- hw/audio/es1370.c | 24 ++++----- hw/audio/gus.c | 21 ++++---- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 93 +++++++++++++++++------------------ 7 files changed, 151 insertions(+), 169 deletions(-) diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 9157588dbc..1b2ce601a6 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -26,6 +26,7 @@ #include "qemu/module.h" #include "system/dma.h" #include "qom/object.h" +#include "qemu/error-report.h" #include "ac97.h" =20 #define SOFT_VOLUME @@ -141,11 +142,8 @@ enum { BUP_LAST =3D 2 }; =20 -#ifdef DEBUG_AC97 -#define dolog(...) AUD_log("ac97", __VA_ARGS__) -#else -#define dolog(...) -#endif +#define DEBUG_AC97 0 +#define dolog(fmt, ...) do { if (DEBUG_AC97) error_report("ac97: " fmt, ##= __VA_ARGS__); } while (0) =20 #define MKREGS(prefix, start) \ enum { \ @@ -190,7 +188,7 @@ static void fetch_bd(AC97LinkState *s, AC97BusMasterReg= s *r) r->bd.addr =3D le32_to_cpu(*(uint32_t *) &b[0]) & ~3; r->bd.ctl_len =3D le32_to_cpu(*(uint32_t *) &b[4]); r->picb =3D r->bd.ctl_len & 0xffff; - dolog("bd %2d addr=3D0x%x ctl=3D0x%06x len=3D0x%x(%d bytes)\n", + dolog("bd %2d addr=3D0x%x ctl=3D0x%06x len=3D0x%x(%d bytes)", r->civ, r->bd.addr, r->bd.ctl_len >> 16, r->bd.ctl_len & 0xffff, (r->bd.ctl_len & 0xffff) << 1); } @@ -222,7 +220,7 @@ static void update_sr(AC97LinkState *s, AC97BusMasterRe= gs *r, uint32_t new_sr) =20 r->sr =3D new_sr; =20 - dolog("IOC%d LVB%d sr=3D0x%x event=3D%d level=3D%d\n", + dolog("IOC%d LVB%d sr=3D0x%x event=3D%d level=3D%d", r->sr & SR_BCIS, r->sr & SR_LVBCI, r->sr, event, level); =20 if (!event) { @@ -231,11 +229,11 @@ static void update_sr(AC97LinkState *s, AC97BusMaster= Regs *r, uint32_t new_sr) =20 if (level) { s->glob_sta |=3D masks[r - s->bm_regs]; - dolog("set irq level=3D1\n"); + dolog("set irq level=3D1"); pci_irq_assert(&s->dev); } else { s->glob_sta &=3D ~masks[r - s->bm_regs]; - dolog("set irq level=3D0\n"); + dolog("set irq level=3D0"); pci_irq_deassert(&s->dev); } } @@ -256,14 +254,14 @@ static void voice_set_active(AC97LinkState *s, int bm= _index, int on) break; =20 default: - AUD_log("ac97", "invalid bm_index(%d) in voice_set_active", bm_ind= ex); + error_report("ac97: invalid bm_index(%d) in voice_set_active", bm_= index); break; } } =20 static void reset_bm_regs(AC97LinkState *s, AC97BusMasterRegs *r) { - dolog("reset_bm_regs\n"); + dolog("reset_bm_regs"); r->bdbar =3D 0; r->civ =3D 0; r->lvi =3D 0; @@ -281,7 +279,7 @@ static void reset_bm_regs(AC97LinkState *s, AC97BusMast= erRegs *r) static void mixer_store(AC97LinkState *s, uint32_t i, uint16_t v) { if (i + 2 > sizeof(s->mixer_data)) { - dolog("mixer_store: index %d out of bounds %zd\n", + dolog("mixer_store: index %d out of bounds %zd", i, sizeof(s->mixer_data)); return; } @@ -295,7 +293,7 @@ static uint16_t mixer_load(AC97LinkState *s, uint32_t i) uint16_t val =3D 0xffff; =20 if (i + 2 > sizeof(s->mixer_data)) { - dolog("mixer_load: index %d out of bounds %zd\n", + dolog("mixer_load: index %d out of bounds %zd", i, sizeof(s->mixer_data)); } else { val =3D s->mixer_data[i + 0] | (s->mixer_data[i + 1] << 8); @@ -460,7 +458,7 @@ static void mixer_reset(AC97LinkState *s) { uint8_t active[LAST_INDEX]; =20 - dolog("mixer_reset\n"); + dolog("mixer_reset"); memset(s->mixer_data, 0, sizeof(s->mixer_data)); memset(active, 0, sizeof(active)); mixer_store(s, AC97_Reset, 0x0000); /* 6940 */ @@ -508,7 +506,7 @@ static void mixer_reset(AC97LinkState *s) static uint32_t nam_readb(void *opaque, uint32_t addr) { AC97LinkState *s =3D opaque; - dolog("U nam readb 0x%x\n", addr); + dolog("U nam readb 0x%x", addr); s->cas =3D 0; return ~0U; } @@ -523,7 +521,7 @@ static uint32_t nam_readw(void *opaque, uint32_t addr) static uint32_t nam_readl(void *opaque, uint32_t addr) { AC97LinkState *s =3D opaque; - dolog("U nam readl 0x%x\n", addr); + dolog("U nam readl 0x%x", addr); s->cas =3D 0; return ~0U; } @@ -535,7 +533,7 @@ static uint32_t nam_readl(void *opaque, uint32_t addr) static void nam_writeb(void *opaque, uint32_t addr, uint32_t val) { AC97LinkState *s =3D opaque; - dolog("U nam writeb 0x%x <- 0x%x\n", addr, val); + dolog("U nam writeb 0x%x <- 0x%x", addr, val); s->cas =3D 0; } =20 @@ -563,10 +561,10 @@ static void nam_writew(void *opaque, uint32_t addr, u= int32_t val) break; case AC97_Vendor_ID1: case AC97_Vendor_ID2: - dolog("Attempt to write vendor ID to 0x%x\n", val); + dolog("Attempt to write vendor ID to 0x%x", val); break; case AC97_Extended_Audio_ID: - dolog("Attempt to write extended audio ID to 0x%x\n", val); + dolog("Attempt to write extended audio ID to 0x%x", val); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(val & EACS_VRA)) { @@ -579,36 +577,36 @@ static void nam_writew(void *opaque, uint32_t addr, u= int32_t val) mixer_store(s, AC97_MIC_ADC_Rate, 0xbb80); open_voice(s, MC_INDEX, 48000); } - dolog("Setting extended audio control to 0x%x\n", val); + dolog("Setting extended audio control to 0x%x", val); mixer_store(s, AC97_Extended_Audio_Ctrl_Stat, val); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store(s, addr, val); - dolog("Set front DAC rate to %d\n", val); + dolog("Set front DAC rate to %d", val); open_voice(s, PO_INDEX, val); } else { - dolog("Attempt to set front DAC rate to %d, but VRA is not set= \n", + dolog("Attempt to set front DAC rate to %d, but VRA is not set= ", val); } break; case AC97_MIC_ADC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store(s, addr, val); - dolog("Set MIC ADC rate to %d\n", val); + dolog("Set MIC ADC rate to %d", val); open_voice(s, MC_INDEX, val); } else { - dolog("Attempt to set MIC ADC rate to %d, but VRM is not set\n= ", + dolog("Attempt to set MIC ADC rate to %d, but VRM is not set", val); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store(s, addr, val); - dolog("Set front LR ADC rate to %d\n", val); + dolog("Set front LR ADC rate to %d", val); open_voice(s, PI_INDEX, val); } else { - dolog("Attempt to set LR ADC rate to %d, but VRA is not set\n", + dolog("Attempt to set LR ADC rate to %d, but VRA is not set", val); } break; @@ -630,7 +628,7 @@ static void nam_writew(void *opaque, uint32_t addr, uin= t32_t val) /* None of the features in these regs are emulated, so they are RO= */ break; default: - dolog("U nam writew 0x%x <- 0x%x\n", addr, val); + dolog("U nam writew 0x%x <- 0x%x", addr, val); mixer_store(s, addr, val); break; } @@ -639,7 +637,7 @@ static void nam_writew(void *opaque, uint32_t addr, uin= t32_t val) static void nam_writel(void *opaque, uint32_t addr, uint32_t val) { AC97LinkState *s =3D opaque; - dolog("U nam writel 0x%x <- 0x%x\n", addr, val); + dolog("U nam writel 0x%x <- 0x%x", addr, val); s->cas =3D 0; } =20 @@ -655,7 +653,7 @@ static uint32_t nabm_readb(void *opaque, uint32_t addr) =20 switch (addr) { case CAS: - dolog("CAS %d\n", s->cas); + dolog("CAS %d", s->cas); val =3D s->cas; s->cas =3D 1; break; @@ -664,38 +662,38 @@ static uint32_t nabm_readb(void *opaque, uint32_t add= r) case MC_CIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->civ; - dolog("CIV[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("CIV[%d] -> 0x%x", GET_BM(addr), val); break; case PI_LVI: case PO_LVI: case MC_LVI: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->lvi; - dolog("LVI[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("LVI[%d] -> 0x%x", GET_BM(addr), val); break; case PI_PIV: case PO_PIV: case MC_PIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->piv; - dolog("PIV[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("PIV[%d] -> 0x%x", GET_BM(addr), val); break; case PI_CR: case PO_CR: case MC_CR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->cr; - dolog("CR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("CR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_SR: case PO_SR: case MC_SR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->sr & 0xff; - dolog("SRb[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("SRb[%d] -> 0x%x", GET_BM(addr), val); break; default: - dolog("U nabm readb 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readb 0x%x -> 0x%x", addr, val); break; } return val; @@ -713,17 +711,17 @@ static uint32_t nabm_readw(void *opaque, uint32_t add= r) case MC_SR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->sr; - dolog("SR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("SR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_PICB: case PO_PICB: case MC_PICB: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->picb; - dolog("PICB[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("PICB[%d] -> 0x%x", GET_BM(addr), val); break; default: - dolog("U nabm readw 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readw 0x%x -> 0x%x", addr, val); break; } return val; @@ -741,14 +739,14 @@ static uint32_t nabm_readl(void *opaque, uint32_t add= r) case MC_BDBAR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->bdbar; - dolog("BMADDR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("BMADDR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_CIV: case PO_CIV: case MC_CIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->civ | (r->lvi << 8) | (r->sr << 16); - dolog("CIV LVI SR[%d] -> 0x%x, 0x%x, 0x%x\n", GET_BM(addr), + dolog("CIV LVI SR[%d] -> 0x%x, 0x%x, 0x%x", GET_BM(addr), r->civ, r->lvi, r->sr); break; case PI_PICB: @@ -756,19 +754,19 @@ static uint32_t nabm_readl(void *opaque, uint32_t add= r) case MC_PICB: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->picb | (r->piv << 16) | (r->cr << 24); - dolog("PICB PIV CR[%d] -> 0x%x 0x%x 0x%x 0x%x\n", GET_BM(addr), + dolog("PICB PIV CR[%d] -> 0x%x 0x%x 0x%x 0x%x", GET_BM(addr), val, r->picb, r->piv, r->cr); break; case GLOB_CNT: val =3D s->glob_cnt; - dolog("glob_cnt -> 0x%x\n", val); + dolog("glob_cnt -> 0x%x", val); break; case GLOB_STA: val =3D s->glob_sta | GS_S0CR; - dolog("glob_sta -> 0x%x\n", val); + dolog("glob_sta -> 0x%x", val); break; default: - dolog("U nabm readl 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readl 0x%x -> 0x%x", addr, val); break; } return val; @@ -795,7 +793,7 @@ static void nabm_writeb(void *opaque, uint32_t addr, ui= nt32_t val) fetch_bd(s, r); } r->lvi =3D val % 32; - dolog("LVI[%d] <- 0x%x\n", GET_BM(addr), val); + dolog("LVI[%d] <- 0x%x", GET_BM(addr), val); break; case PI_CR: case PO_CR: @@ -816,7 +814,7 @@ static void nabm_writeb(void *opaque, uint32_t addr, ui= nt32_t val) voice_set_active(s, r - s->bm_regs, 1); } } - dolog("CR[%d] <- 0x%x (cr 0x%x)\n", GET_BM(addr), val, r->cr); + dolog("CR[%d] <- 0x%x (cr 0x%x)", GET_BM(addr), val, r->cr); break; case PI_SR: case PO_SR: @@ -824,10 +822,10 @@ static void nabm_writeb(void *opaque, uint32_t addr, = uint32_t val) r =3D &s->bm_regs[GET_BM(addr)]; r->sr |=3D val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr(s, r, r->sr & ~(val & SR_WCLEAR_MASK)); - dolog("SR[%d] <- 0x%x (sr 0x%x)\n", GET_BM(addr), val, r->sr); + dolog("SR[%d] <- 0x%x (sr 0x%x)", GET_BM(addr), val, r->sr); break; default: - dolog("U nabm writeb 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writeb 0x%x <- 0x%x", addr, val); break; } } @@ -844,10 +842,10 @@ static void nabm_writew(void *opaque, uint32_t addr, = uint32_t val) r =3D &s->bm_regs[GET_BM(addr)]; r->sr |=3D val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr(s, r, r->sr & ~(val & SR_WCLEAR_MASK)); - dolog("SR[%d] <- 0x%x (sr 0x%x)\n", GET_BM(addr), val, r->sr); + dolog("SR[%d] <- 0x%x (sr 0x%x)", GET_BM(addr), val, r->sr); break; default: - dolog("U nabm writew 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writew 0x%x <- 0x%x", addr, val); break; } } @@ -863,22 +861,22 @@ static void nabm_writel(void *opaque, uint32_t addr, = uint32_t val) case MC_BDBAR: r =3D &s->bm_regs[GET_BM(addr)]; r->bdbar =3D val & ~3; - dolog("BDBAR[%d] <- 0x%x (bdbar 0x%x)\n", GET_BM(addr), val, r->bd= bar); + dolog("BDBAR[%d] <- 0x%x (bdbar 0x%x)", GET_BM(addr), val, r->bdba= r); break; case GLOB_CNT: /* TODO: Handle WR or CR being set (warm/cold reset requests) */ if (!(val & (GC_WR | GC_CR))) { s->glob_cnt =3D val & GC_VALID_MASK; } - dolog("glob_cnt <- 0x%x (glob_cnt 0x%x)\n", val, s->glob_cnt); + dolog("glob_cnt <- 0x%x (glob_cnt 0x%x)", val, s->glob_cnt); break; case GLOB_STA: s->glob_sta &=3D ~(val & GS_WCLEAR_MASK); s->glob_sta |=3D (val & ~(GS_WCLEAR_MASK | GS_RO_MASK)) & GS_VALID= _MASK; - dolog("glob_sta <- 0x%x (glob_sta 0x%x)\n", val, s->glob_sta); + dolog("glob_sta <- 0x%x (glob_sta 0x%x)", val, s->glob_sta); break; default: - dolog("U nabm writel 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writel 0x%x <- 0x%x", addr, val); break; } } @@ -903,7 +901,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, addr, tmpbuf, to_copy); copied =3D AUD_write(s->voice_po, tmpbuf, to_copy); - dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x\n", + dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x", max, to_copy, copied); if (!copied) { *stop =3D 1; @@ -916,7 +914,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, =20 if (!temp) { if (to_copy < 4) { - dolog("whoops\n"); + dolog("whoops"); s->last_samp =3D 0; } else { s->last_samp =3D *(uint32_t *)&tmpbuf[to_copy - 4]; @@ -929,7 +927,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, =20 static void write_bup(AC97LinkState *s, int elapsed) { - dolog("write_bup\n"); + dolog("write_bup"); if (!(s->bup_flag & BUP_SET)) { if (s->bup_flag & BUP_LAST) { int i; @@ -997,7 +995,7 @@ static void transfer_audio(AC97LinkState *s, int index,= int elapsed) int stop =3D 0; =20 if (s->invalid_freq[index]) { - AUD_log("ac97", "attempt to use voice %d with invalid frequency %d= \n", + error_report("ac97: attempt to use voice %d with invalid frequency= %d", index, s->invalid_freq[index]); return; } @@ -1017,12 +1015,12 @@ static void transfer_audio(AC97LinkState *s, int in= dex, int elapsed) int temp; =20 if (!r->bd_valid) { - dolog("invalid bd\n"); + dolog("invalid bd"); fetch_bd(s, r); } =20 if (!r->picb) { - dolog("fresh bd %d is empty 0x%x 0x%x\n", + dolog("fresh bd %d is empty 0x%x 0x%x", r->civ, r->bd.addr, r->bd.ctl_len); if (r->civ =3D=3D r->lvi) { r->sr |=3D SR_DCH; /* CELV? */ @@ -1059,7 +1057,7 @@ static void transfer_audio(AC97LinkState *s, int inde= x, int elapsed) } =20 if (r->civ =3D=3D r->lvi) { - dolog("Underrun civ (%d) =3D=3D lvi (%d)\n", r->civ, r->lv= i); + dolog("Underrun civ (%d) =3D=3D lvi (%d)", r->civ, r->lvi); =20 new_sr |=3D SR_LVBCI | SR_DCH | SR_CELV; stop =3D 1; diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 50bbb97a56..231055b8b5 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -29,24 +29,20 @@ #include "audio/audio.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "qemu/error-report.h" #include "qom/object.h" =20 -//#define DEBUG +#define DEBUG 0 =20 #define ADLIB_KILL_TIMERS 1 =20 #define ADLIB_DESC "Yamaha YM3812 (OPL2)" =20 -#ifdef DEBUG +#if DEBUG #include "qemu/timer.h" #endif =20 -#define dolog(...) AUD_log ("adlib", __VA_ARGS__) -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define ldebug(fmt, ...) do { if (DEBUG) error_report("adlib: " fmt, ##__V= A_ARGS__); } while(0) =20 #include "fmopl.h" #define SHIFT 1 @@ -64,7 +60,7 @@ struct AdlibState { int enabled; int active; int bufpos; -#ifdef DEBUG +#if DEBUG int64_t exp[2]; #endif int16_t *mixbuf; @@ -92,7 +88,7 @@ static void adlib_kill_timers (AdlibState *s) =20 delta =3D AUD_get_elapsed_usec_out (s->voice, &s->ats); ldebug ( - "delta =3D %f dexp =3D %f expired =3D> %d\n", + "delta =3D %f dexp =3D %f expired =3D> %d", delta / 1000000.0, s->dexp[i] / 1000000.0, delta >=3D s->dexp[i] @@ -131,7 +127,7 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) { AdlibState *s =3D opaque; unsigned n =3D c & 1; -#ifdef DEBUG +#if DEBUG double interval; int64_t exp; #endif @@ -142,7 +138,7 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) } =20 s->ticking[n] =3D 1; -#ifdef DEBUG +#if DEBUG interval =3D NANOSECONDS_PER_SECOND * interval_Sec; exp =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + interval; s->exp[n] =3D exp; diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index c8837fe269..062af7628b 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -30,7 +30,7 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/module.h" -#include "qemu/timer.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qom/object.h" =20 @@ -43,21 +43,17 @@ More... */ =20 -/* #define DEBUG */ +#define DEBUG 0 /* #define DEBUG_XLAW */ =20 static struct { int aci_counter; } conf =3D {1}; =20 -#ifdef DEBUG -#define dolog(...) AUD_log ("cs4231a", __VA_ARGS__) -#else -#define dolog(...) -#endif +#define dolog(fmt, ...) do { if (DEBUG) error_report("cs4231a: " fmt, ##__= VA_ARGS__); } while(0) =20 -#define lwarn(...) AUD_log ("cs4231a", "warning: " __VA_ARGS__) -#define lerr(...) AUD_log ("cs4231a", "error: " __VA_ARGS__) +#define lwarn(fmt, ...) warn_report("cs4231a: " fmt, ##__VA_ARGS__) +#define lerr(fmt, ...) error_report("cs4231a: " fmt, ##__VA_ARGS__) =20 #define CS_REGS 16 #define CS_DREGS 32 @@ -284,7 +280,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) as.freq =3D freqs[xtal][(val >> 1) & 7]; =20 if (as.freq =3D=3D -1) { - lerr ("unsupported frequency (val=3D%#x)\n", val); + lerr ("unsupported frequency (val=3D%#x)", val); goto error; } =20 @@ -319,11 +315,11 @@ static void cs_reset_voices (CSState *s, uint32_t val) =20 case 7: case 4: - lerr ("attempt to use reserved format value (%#x)\n", val); + lerr ("attempt to use reserved format value (%#x)", val); goto error; =20 case 5: - lerr ("ADPCM 4 bit IMA compatible format is not supported\n"); + lerr ("ADPCM 4 bit IMA compatible format is not supported"); goto error; } =20 @@ -393,7 +389,7 @@ static uint64_t cs_read (void *opaque, hwaddr addr, uns= igned size) ret =3D s->regs[saddr]; break; } - dolog ("read %d:%d -> %d\n", saddr, iaddr, ret); + dolog ("read %d:%d -> %d", saddr, iaddr, ret); return ret; } =20 @@ -425,7 +421,7 @@ static void cs_write (void *opaque, hwaddr addr, case RESERVED: case RESERVED_2: case RESERVED_3: - lwarn ("attempt to write %#x to reserved indirect register %d\= n", + lwarn ("attempt to write %#x to reserved indirect register %d", val, iaddr); break; =20 @@ -439,7 +435,7 @@ static void cs_write (void *opaque, hwaddr addr, cs_reset_voices (s, val); } else { - lwarn ("[P]MCE(%#x, %#x) is not set, val=3D%#x\n", + lwarn ("[P]MCE(%#x, %#x) is not set, val=3D%#x", s->regs[Index_Address], s->dregs[Alternate_Feature_Status], val); @@ -453,7 +449,7 @@ static void cs_write (void *opaque, hwaddr addr, val &=3D ~(1 << 5); /* D5 is reserved */ s->dregs[iaddr] =3D val; if (val & PPIO) { - lwarn ("PIO is not supported (%#x)\n", val); + lwarn ("PIO is not supported (%#x)", val); break; } if (val & PEN) { @@ -472,11 +468,11 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case Error_Status_And_Initialization: - lwarn ("attempt to write to read only register %d\n", iaddr); + lwarn ("attempt to write to read only register %d", iaddr); break; =20 case MODE_And_ID: - dolog ("val=3D%#x\n", val); + dolog ("val=3D%#x", val); if (val & MODE2) s->dregs[iaddr] |=3D MODE2; else @@ -485,7 +481,7 @@ static void cs_write (void *opaque, hwaddr addr, =20 case Alternate_Feature_Enable_I: if (val & TE) - lerr ("timer is not yet supported\n"); + lerr ("timer is not yet supported"); s->dregs[iaddr] =3D val; break; =20 @@ -499,7 +495,7 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case Version_Chip_ID: - lwarn ("write to Version_Chip_ID register %#x\n", val); + lwarn ("write to Version_Chip_ID register %#x", val); s->dregs[iaddr] =3D val; break; =20 @@ -507,7 +503,7 @@ static void cs_write (void *opaque, hwaddr addr, s->dregs[iaddr] =3D val; break; } - dolog ("written value %#x to indirect register %d\n", val, iaddr); + dolog ("written value %#x to indirect register %d", val, iaddr); break; =20 case Status: @@ -519,7 +515,7 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case PIO_Data: - lwarn ("attempt to write value %#x to PIO register\n", val); + lwarn ("attempt to write value %#x to PIO register", val); break; } } diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 8cb47589c3..ac5a6aba85 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -32,7 +32,7 @@ #include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" -#include "system/dma.h" +#include "qemu/error-report.h" #include "qom/object.h" #include "trace.h" =20 @@ -190,7 +190,7 @@ static void print_ctl(uint32_t val) a(CDC_EN); a(SERR_DIS); #undef a - AUD_log("es1370", "ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n", + error_report("es1370: ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n= ", (val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV, DAC2_DIVTOSR((val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], @@ -226,7 +226,7 @@ static void print_sctl(uint32_t val) } #undef b #undef a - AUD_log("es1370", + error_report("es1370: " "%s p2_end_inc %d, p2_st_inc %d," " r1_fmt %s, p2_fmt %s, p1_fmt %s\n", buf, @@ -238,10 +238,10 @@ static void print_sctl(uint32_t val) } } =20 -#define lwarn(...) \ +#define lwarn(fmt, ...) \ do { \ if (VERBOSE_ES1370) { \ - AUD_log("es1370: warning", __VA_ARGS__); \ + error_report("es1370: " fmt, ##__VA_ARGS__); \ } \ } while (0) =20 @@ -502,10 +502,10 @@ static void es1370_write(void *opaque, hwaddr addr, u= int64_t val, unsigned size) break; =20 case ES1370_REG_PHANTOM_FRAMECNT: - lwarn("writing to phantom frame count 0x%" PRIx64 "\n", val); + lwarn("writing to phantom frame count 0x%" PRIx64, val); break; case ES1370_REG_PHANTOM_FRAMEADR: - lwarn("writing to phantom frame address 0x%" PRIx64 "\n", val); + lwarn("writing to phantom frame address 0x%" PRIx64, val); break; =20 case ES1370_REG_ADC_FRAMECNT: @@ -522,7 +522,7 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) break; =20 default: - lwarn("writel 0x%" PRIx64 " <- 0x%" PRIx64 "\n", addr, val); + lwarn("writel 0x%" PRIx64 " <- 0x%" PRIx64, addr, val); break; } } @@ -586,16 +586,16 @@ static uint64_t es1370_read(void *opaque, hwaddr addr= , unsigned size) =20 case ES1370_REG_PHANTOM_FRAMECNT: val =3D ~0U; - lwarn("reading from phantom frame count\n"); + lwarn("reading from phantom frame count"); break; case ES1370_REG_PHANTOM_FRAMEADR: val =3D ~0U; - lwarn("reading from phantom frame address\n"); + lwarn("reading from phantom frame address"); break; =20 default: val =3D ~0U; - lwarn("readl 0x%" PRIx64 " -> 0x%x\n", addr, val); + lwarn("readl 0x%" PRIx64 " -> 0x%x", addr, val); break; } return val; @@ -677,7 +677,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, * when the sample count reaches zero) or 1 for stop mode (set * interrupt and stop recording). */ - AUD_log ("es1370: warning", "non looping mode\n"); + warn_report("es1370: non looping mode"); } else { d->frame_cnt =3D size; =20 diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 2c84740adf..40073f2d4f 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -32,15 +32,12 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "gusemu.h" -#include "gustate.h" +#include "qemu/error-report.h" #include "qom/object.h" =20 -#define dolog(...) AUD_log ("audio", __VA_ARGS__) -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define DEBUG 0 + +#define ldebug(fmt, ...) do { if (DEBUG) error_report("gus: " fmt, ##__VA_= ARGS__); } while (0) =20 #define TYPE_GUS "gus" OBJECT_DECLARE_SIMPLE_TYPE(GUSState, GUS) @@ -154,14 +151,14 @@ int GUS_irqrequest (GUSEmuState *emu, int hwirq, int = n) /* qemu_irq_lower (s->pic); */ qemu_irq_raise (s->pic); s->irqs +=3D n; - ldebug ("irqrequest %d %d %d\n", hwirq, n, s->irqs); + ldebug("irqrequest %d %d %d", hwirq, n, s->irqs); return n; } =20 void GUS_irqclear (GUSEmuState *emu, int hwirq) { GUSState *s =3D emu->opaque; - ldebug ("irqclear %d %d\n", hwirq, s->irqs); + ldebug("irqclear %d %d", hwirq, s->irqs); qemu_irq_lower (s->pic); s->irqs -=3D 1; #ifdef IRQ_STORM @@ -175,7 +172,7 @@ void GUS_dmarequest (GUSEmuState *emu) { GUSState *s =3D emu->opaque; IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); - ldebug ("dma request %d\n", der->gusdma); + ldebug("dma request %d", s->emu.gusdma); k->hold_DREQ(s->isa_dma, s->emu.gusdma); } =20 @@ -186,13 +183,13 @@ static int GUS_read_DMA (void *opaque, int nchan, int= dma_pos, int dma_len) QEMU_UNINITIALIZED char tmpbuf[4096]; int pos =3D dma_pos, mode, left =3D dma_len - dma_pos; =20 - ldebug ("read DMA %#x %d\n", dma_pos, dma_len); + ldebug("read DMA %#x %d", dma_pos, dma_len); mode =3D k->has_autoinitialization(s->isa_dma, s->emu.gusdma); while (left) { int to_copy =3D MIN ((size_t) left, sizeof (tmpbuf)); int copied; =20 - ldebug ("left=3D%d to_copy=3D%d pos=3D%d\n", left, to_copy, pos); + ldebug("left=3D%d to_copy=3D%d pos=3D%d", left, to_copy, pos); copied =3D k->read_memory(s->isa_dma, nchan, tmpbuf, pos, to_copy); gus_dma_transferdata (&s->emu, tmpbuf, copied, left =3D=3D copied); left -=3D copied; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 12a214c566..c8c63b7915 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -124,7 +124,7 @@ static int pcspk_audio_init(PCSpkState *s) =20 s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); if (!s->voice) { - AUD_log(s_spk, "Could not open voice\n"); + error_report("pcspk: Could not open voice"); return -1; } =20 diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index cd7e813d05..069cf6e120 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -30,22 +30,17 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/timer.h" +#include "qemu/error-report.h" #include "qemu/host-utils.h" #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" #include "qom/object.h" =20 -#define dolog(...) AUD_log ("sb16", __VA_ARGS__) - -/* #define DEBUG */ +#define DEBUG 0 /* #define DEBUG_SB16_MOST */ =20 -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define ldebug(fmt, ...) do { if (DEBUG) error_report("sb16: " fmt, ##__VA= _ARGS__); } while (0) =20 static const char e3[] =3D "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; =20 @@ -157,7 +152,7 @@ static int irq_of_magic (int magic) #if 0 static void log_dsp (SB16State *dsp) { - ldebug ("%s:%s:%d:%s:dmasize=3D%d:freq=3D%d:const=3D%d:speaker=3D%d\n", + ldebug ("%s:%s:%d:%s:dmasize=3D%d:freq=3D%d:const=3D%d:speaker=3D%d", dsp->fmt_stereo ? "Stereo" : "Mono", dsp->fmt_signed ? "Signed" : "Unsigned", dsp->fmt_bits, @@ -182,7 +177,7 @@ static void control (SB16State *s, int hold) IsaDmaClass *k =3D ISADMA_GET_CLASS(isa_dma); s->dma_running =3D hold; =20 - ldebug ("hold %d high %d dma %d\n", hold, s->use_hdma, dma); + ldebug ("hold %d high %d dma %d", hold, s->use_hdma, dma); =20 if (hold) { k->hold_DREQ(isa_dma, dma); @@ -290,7 +285,7 @@ static void dma_cmd8 (SB16State *s, int mask, int dma_l= en) } =20 ldebug ("freq %d, stereo %d, sign %d, bits %d, " - "dma %d, auto %d, fifo %d, high %d\n", + "dma %d, auto %d, fifo %d, high %d", s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits, s->block_size, s->dma_auto, s->fifo, s->highspeed); =20 @@ -338,7 +333,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) } =20 ldebug ("freq %d, stereo %d, sign %d, bits %d, " - "dma %d, auto %d, fifo %d, high %d\n", + "dma %d, auto %d, fifo %d, high %d", s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits, s->block_size, s->dma_auto, s->fifo, s->highspeed); =20 @@ -395,7 +390,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) =20 static inline void dsp_out_data (SB16State *s, uint8_t val) { - ldebug ("outdata %#x\n", val); + ldebug ("outdata %#x", val); if ((size_t) s->out_data_len < sizeof (s->out_data)) { s->out_data[s->out_data_len++] =3D val; } @@ -407,14 +402,14 @@ static inline uint8_t dsp_get_data (SB16State *s) return s->in2_data[--s->in_index]; } else { - dolog ("buffer underflow\n"); + warn_report("sb16: buffer underflow"); return 0; } } =20 static void command (SB16State *s, uint8_t cmd) { - ldebug ("command %#x\n", cmd); + ldebug ("command %#x", cmd); =20 if (cmd > 0xaf && cmd < 0xd0) { if (cmd & 8) { @@ -651,7 +646,7 @@ static void command (SB16State *s, uint8_t cmd) } =20 if (!s->needed_bytes) { - ldebug ("\n"); + ldebug ("!needed_bytes"); } =20 exit: @@ -687,7 +682,7 @@ static uint16_t dsp_get_hilo (SB16State *s) static void complete (SB16State *s) { int d0, d1, d2; - ldebug ("complete command %#x, in_index %d, needed_bytes %d\n", + ldebug ("complete command %#x, in_index %d, needed_bytes %d", s->cmd, s->in_index, s->needed_bytes); =20 if (s->cmd > 0xaf && s->cmd < 0xd0) { @@ -696,11 +691,11 @@ static void complete (SB16State *s) d0 =3D dsp_get_data (s); =20 if (s->cmd & 8) { - dolog ("ADC params cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d= \n", + warn_report("sb16: ADC params cmd =3D %#x d0 =3D %d, d1 =3D %d= , d2 =3D %d", s->cmd, d0, d1, d2); } else { - ldebug ("cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d\n", + ldebug ("cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d", s->cmd, d0, d1, d2); dma_cmd (s, s->cmd, d0, d1 + (d2 << 8)); } @@ -711,13 +706,13 @@ static void complete (SB16State *s) s->csp_mode =3D dsp_get_data (s); s->csp_reg83r =3D 0; s->csp_reg83w =3D 0; - ldebug ("CSP command 0x04: mode=3D%#x\n", s->csp_mode); + ldebug ("CSP command 0x04: mode=3D%#x", s->csp_mode); break; =20 case 0x05: s->csp_param =3D dsp_get_data (s); s->csp_value =3D dsp_get_data (s); - ldebug ("CSP command 0x05: param=3D%#x value=3D%#x\n", + ldebug ("CSP command 0x05: param=3D%#x value=3D%#x", s->csp_param, s->csp_value); break; @@ -725,9 +720,9 @@ static void complete (SB16State *s) case 0x0e: d0 =3D dsp_get_data (s); d1 =3D dsp_get_data (s); - ldebug ("write CSP register %d <- %#x\n", d1, d0); + ldebug ("write CSP register %d <- %#x", d1, d0); if (d1 =3D=3D 0x83) { - ldebug ("0x83[%d] <- %#x\n", s->csp_reg83r, d0); + ldebug ("0x83[%d] <- %#x", s->csp_reg83r, d0); s->csp_reg83[s->csp_reg83r % 4] =3D d0; s->csp_reg83r +=3D 1; } @@ -738,10 +733,10 @@ static void complete (SB16State *s) =20 case 0x0f: d0 =3D dsp_get_data (s); - ldebug ("read CSP register %#x -> %#x, mode=3D%#x\n", + ldebug ("read CSP register %#x -> %#x, mode=3D%#x", d0, s->csp_regs[d0], s->csp_mode); if (d0 =3D=3D 0x83) { - ldebug ("0x83[%d] -> %#x\n", + ldebug ("0x83[%d] -> %#x", s->csp_reg83w, s->csp_reg83[s->csp_reg83w % 4]); dsp_out_data (s, s->csp_reg83[s->csp_reg83w % 4]); @@ -754,7 +749,7 @@ static void complete (SB16State *s) =20 case 0x10: d0 =3D dsp_get_data (s); - dolog ("cmd 0x10 d0=3D%#x\n", d0); + warn_report("sb16: cmd 0x10 d0=3D%#x\n", d0); break; =20 case 0x14: @@ -763,7 +758,7 @@ static void complete (SB16State *s) =20 case 0x40: s->time_const =3D dsp_get_data (s); - ldebug ("set time const %d\n", s->time_const); + ldebug ("set time const %d", s->time_const); break; =20 case 0x41: @@ -776,12 +771,12 @@ static void complete (SB16State *s) * http://homepages.cae.wisc.edu/~brodskye/sb16doc/sb16doc.htm= l#SamplingRate */ s->freq =3D restrict_sampling_rate(dsp_get_hilo(s)); - ldebug ("set freq %d\n", s->freq); + ldebug ("set freq %d", s->freq); break; =20 case 0x48: s->block_size =3D dsp_get_lohi (s) + 1; - ldebug ("set dma block len %d\n", s->block_size); + ldebug ("set dma block len %d", s->block_size); break; =20 case 0x74: @@ -811,21 +806,21 @@ static void complete (SB16State *s) ); } } - ldebug ("mix silence %d %d %" PRId64 "\n", samples, bytes,= ticks); + ldebug ("mix silence %d %d %" PRId64, samples, bytes, tick= s); } break; =20 case 0xe0: d0 =3D dsp_get_data (s); s->out_data_len =3D 0; - ldebug ("E0 data =3D %#x\n", d0); + ldebug ("E0 data =3D %#x", d0); dsp_out_data (s, ~d0); break; =20 case 0xe2: -#ifdef DEBUG +#if DEBUG d0 =3D dsp_get_data (s); - dolog ("E2 =3D %#x\n", d0); + warn_report("sb16: E2 =3D %#x", d0); #endif break; =20 @@ -835,7 +830,7 @@ static void complete (SB16State *s) =20 case 0xf9: d0 =3D dsp_get_data (s); - ldebug ("command 0xf9 with %#x\n", d0); + ldebug ("command 0xf9 with %#x", d0); switch (d0) { case 0x0e: dsp_out_data (s, 0xff); @@ -862,7 +857,7 @@ static void complete (SB16State *s) } } =20 - ldebug ("\n"); + ldebug (""); s->cmd =3D -1; } =20 @@ -926,7 +921,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) =20 iport =3D nport - s->port; =20 - ldebug ("write %#x <- %#x\n", nport, val); + ldebug ("write %#x <- %#x", nport, val); switch (iport) { case 0x06: switch (val) { @@ -976,7 +971,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) } else { if (s->in_index =3D=3D sizeof (s->in2_data)) { - dolog ("in data overrun\n"); + warn_report("sb16: in data overrun"); } else { s->in2_data[s->in_index++] =3D val; @@ -992,7 +987,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) break; =20 default: - ldebug ("(nport=3D%#x, val=3D%#x)\n", nport, val); + ldebug ("(nport=3D%#x, val=3D%#x)", nport, val); break; } } @@ -1016,7 +1011,7 @@ static uint32_t dsp_read(void *opaque, uint32_t nport) } else { if (s->cmd !=3D -1) { - dolog ("empty output buffer for command %#x\n", + warn_report("sb16: empty output buffer for command %#x", s->cmd); } retval =3D s->last_read_byte; @@ -1029,7 +1024,7 @@ static uint32_t dsp_read(void *opaque, uint32_t nport) break; =20 case 0x0d: /* timer interrupt clear */ - /* dolog ("timer interrupt clear\n"); */ + /* warn_report("sb16: timer interrupt clear"); */ retval =3D 0; break; =20 @@ -1056,13 +1051,13 @@ static uint32_t dsp_read(void *opaque, uint32_t npo= rt) } =20 if (!ack) { - ldebug ("read %#x -> %#x\n", nport, retval); + ldebug ("read %#x -> %#x", nport, retval); } =20 return retval; =20 error: - dolog ("warning: dsp_read %#x error\n", nport); + warn_report("sb16: dsp_read %#x error", nport); return 0xff; } =20 @@ -1108,7 +1103,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) SB16State *s =3D opaque; =20 (void) nport; - ldebug ("mixer_write [%#x] <- %#x\n", s->mixer_nreg, val); + ldebug ("mixer_write [%#x] <- %#x", s->mixer_nreg, val); =20 switch (s->mixer_nreg) { case 0x00: @@ -1118,7 +1113,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) case 0x80: { int irq =3D irq_of_magic (val); - ldebug ("setting irq to %d (val=3D%#x)\n", irq, val); + ldebug ("setting irq to %d (val=3D%#x)", irq, val); if (irq > 0) { s->irq =3D irq; } @@ -1150,7 +1145,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) =20 default: if (s->mixer_nreg >=3D 0x80) { - ldebug ("attempt to write mixer[%#x] <- %#x\n", s->mixer_nreg,= val); + ldebug ("attempt to write mixer[%#x] <- %#x", s->mixer_nreg, v= al); } break; } @@ -1165,11 +1160,11 @@ static uint32_t mixer_read(void *opaque, uint32_t n= port) (void) nport; #ifndef DEBUG_SB16_MOST if (s->mixer_nreg !=3D 0x82) { - ldebug ("mixer_read[%#x] -> %#x\n", + ldebug ("mixer_read[%#x] -> %#x", s->mixer_nreg, s->mixer_regs[s->mixer_nreg]); } #else - ldebug ("mixer_read[%#x] -> %#x\n", + ldebug ("mixer_read[%#x] -> %#x", s->mixer_nreg, s->mixer_regs[s->mixer_nreg]); #endif return s->mixer_regs[s->mixer_nreg]; @@ -1241,7 +1236,7 @@ static int SB_read_DMA (void *opaque, int nchan, int = dma_pos, int dma_len) till =3D s->left_till_irq; =20 #ifdef DEBUG_SB16_MOST - dolog ("pos:%06d %d till:%d len:%d\n", + warn_report("sb16: pos:%06d %d till:%d len:%d", dma_pos, free, till, dma_len); #endif =20 @@ -1265,7 +1260,7 @@ static int SB_read_DMA (void *opaque, int nchan, int = dma_pos, int dma_len) } =20 #ifdef DEBUG_SB16_MOST - ldebug ("pos %5d free %5d size %5d till % 5d copy %5d written %5d size= %5d\n", + ldebug ("pos %5d free %5d size %5d till % 5d copy %5d written %5d size= %5d", dma_pos, free, dma_len, s->left_till_irq, copy, written, s->block_size); #endif --=20 2.51.0