>Number:         162181
>Category:       kern
>Synopsis:       [patch] The kernel sound driver module snd_emu10k1.ko hangs 
>when loaded.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 31 05:00:26 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Geoff Bailey
>Release:        FreeBSD 9.0-RC1 i386
>Organization:
>Environment:
System: 
FreeBSD leon 9.0-RC1 FreeBSD 9.0-RC1 #0: Tue Oct 18 18:30:38 UTC 2011 
[email protected]:/usr/obj/usr/src/sys/GENERIC i386

Sound Card: 
pcm0: <Creative EMU10K1> port 0xdf80-0xdf9f irq 9 at device 12.0 on pci2

pciconf -lbv:
pcm0@pci0:2:12:0: class=0x040100 card=0x80271102 chip=0x00021102 rev=0x08 
hdr=0x00
    vendor     = 'Creative Labs'
    device     = 'SB Live! EMU10k1'
    class      = multimedia
    subclass   = audio
    bar   [10] = type I/O Port, range 32, base 0xdf80, size 32, enabled

>Description:
When you load the emu10k1 sound driver (kldload snd_emu10k1) it prints the   
sndstat message "<Creative EMU10K1> port 0xdf80-0xdf9f irq 9 at device 12.0 on 
pci2" then the system hangs and must be powered down to continue.
        
The hang usually happens in the middle of the emu_init() function while 
initializing the envelope engine, yet the problem appears not to be related to 
this section of code.
                
The emu10kx driver works on my box but midi has been disabled in this driver.
>How-To-Repeat:
kldload snd_emu10k1
>Fix:
1.  In the "emu_pci_attach()" function, move the "snd_setup_intr()" call before
    the call to "emu_init()".

2.  Disable hardware midi interrupts in function "emu_midiattach()", since the 
    midi2 driver uses software interrupts.

    With Fix-1 above only, the driver continuously sends "dodgy irq" messages
    from the "emu_intr()" function and the system hangs again.
    
    
With these two changes (see attached patch), both audio and midi work as 
expected.

Patch attached with submission follows:

--- /usr/src/sys/dev/sound/pci/emu10k1.c Sun 30 Oct 2011 13:42:48 PDT
+++ /usr/src/sys/dev/sound/pci/emu10k1.c Sun 30 Oct 2011 13:42:48 PDT
@@ -1120,12 +1120,14 @@
 static void
 emu_midiattach(struct sc_info *sc)
 {
+       /* midi2 uses a software interupt
        int i;
 
        i = emu_rd(sc, INTE, 4);
        i |= INTE_MIDIRXENABLE;
        emu_wr(sc, INTE, i, 4);
-
+       */
+       
        sc->mpu = mpu401_init(&emu_mpu_class, sc, emu_intr2, &sc->mpu_intr);
 }
 /* -------------------------------------------------------------------- */
@@ -2026,7 +2028,16 @@
                device_printf(dev, "unable to create dma tag\n");
                goto bad;
        }
-
+       
+       i = 0;
+       sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i,
+           RF_ACTIVE | RF_SHAREABLE);
+       if (!sc->irq ||
+           snd_setup_intr(dev, sc->irq, INTR_MPSAFE, emu_intr, sc, &sc->ih)) {
+               device_printf(dev, "unable to map interrupt\n");
+               goto bad;
+       }
+       
        if (emu_init(sc) == -1) {
                device_printf(dev, "unable to initialize the card\n");
                goto bad;
@@ -2039,15 +2050,6 @@
 
        emu_midiattach(sc);
 
-       i = 0;
-       sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i,
-           RF_ACTIVE | RF_SHAREABLE);
-       if (!sc->irq ||
-           snd_setup_intr(dev, sc->irq, INTR_MPSAFE, emu_intr, sc, &sc->ih)) {
-               device_printf(dev, "unable to map interrupt\n");
-               goto bad;
-       }
-
        snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s",
            rman_get_start(sc->reg), rman_get_start(sc->irq),
            PCM_KLDSTRING(snd_emu10k1));


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to