Subject: kern/29372: notebook with Maestro 2E sound chip crashes (w/ fix)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <salvet@ics.muni.cz>
List: netbsd-bugs
Date: 02/14/2005 17:08:00
>Number:         29372
>Category:       kern
>Synopsis:       notebook with Maestro 2E sound chip crashes (w/ fix)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 14 17:08:00 +0000 2005
>Originator:     Zdenek Salvet <salvet@ics.muni.cz>
>Release:        NetBSD 2.0
>Organization:
Masaryk University, Brno, Czech Republic
>Environment:
System: NetBSD azaghal.ics.muni.cz 2.0 NetBSD 2.0 (AZAGHAL_MODM2E) #0: Sat Feb 12 03:47:41 MET 2005 salvet@azaghal.ics.muni.cz:/p3/src/sys/arch/i386/compile/AZAGHAL_MODM2E i386
Architecture: i386
Machine: i386
>Description:
	NetBSD 2.0 on Toshiba 4100XDVD notebook crashes if sound device is
	used after suspend/resume. This is caused by esm driver's failure
	to refill address registers of the sound chip (Maestro 2E) upon resume.
	The problem did not appear with 1.6.2 (the driver code has been
	restructured slightly in the meantime).
 
>How-To-Repeat:
>Fix:
	Apply the following patch (tested by myself):
--- esm.c.orig	2004-09-22 22:58:37.000000000 +0200
+++ esm.c	2005-02-12 03:18:10.000000000 +0100
@@ -1763,11 +1763,17 @@
 esm_resume(struct esm_softc *ess)
 {
 	int x;
+	u_int16_t pcmbar;
 
 	esm_power(ess, PCI_PMCSR_STATE_D0);
 	delay(100000);
 	esm_init(ess);
 
+	/* set DMA base address */
+	for (pcmbar = WAVCACHE_PCMBAR; pcmbar < WAVCACHE_PCMBAR + 4; pcmbar++)
+		wc_wrreg(ess, pcmbar,
+		    DMAADDR(&ess->sc_dma) >> WAVCACHE_BASEADDR_SHIFT);
+
 	(*ess->codec_if->vtbl->restore_ports)(ess->codec_if);
 #if 0
 	if (mixer_reinit(dev)) {