Subject: port-i386/8302: isapnp tries to share interrupts
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@rumolt.teuto.de>
List: netbsd-bugs
Date: 08/31/1999 13:14:50
>Number:         8302
>Category:       port-i386
>Synopsis:       isapnp tries to share interrupts, which doesn't work
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-i386-maintainer (NetBSD/i386 Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 31 12:50:03 1999
>Last-Modified:
>Originator:     Martin Husemann
>Organization:
	
>Release:        current from August 30
>Environment:
	
System: NetBSD rumolt.teuto.de 1.4K NetBSD 1.4K (RUMOLT) #4: Tue Aug 31 21:32:49 MEST 1999 root@rumolt.teuto.de:/usr/src/sys-i4b/arch/i386/compile/RUMOLT i386

Filed as category port-i386, because I didn't check the other ports 
isa_machdep.c implementation. Might be a more general problem.


>Description:

I have two ISA PnP cards, one ISDN and one soundcard. The first has 
"acceptable" configurations nearly everywhere and might be configured
as you please. The second one (a soundblaster) has for history DOS 
traditions one "prefered" configuration at IRQ 5, port 0x220, DRQ 1/3, 
but can live with "acceptable" configs at other places too. So I don't
have a real problem, everything would probably work with Windows...

Now see what happens (some debugging printf's inserted, the soundblaster
not configured into the kernel):

isapnp0: read port 0x203
isa_intr_alloc: request for irq mask 9cb8, type 2
isa_intr_alloc succeded: irq 5
isapnp_alloc_irq succeeded
isic0 at isapnp0 port 0x160/8 irq 5: Elsa QuickStep 1000 (ISA)
isic0: ISAC 2085 Version A1/A2 or 2086/2186 Version 1.1 (IOM-2)
isic0: HSCX 82525 or 21525 Version 2.1
isa_intr_alloc: request for irq mask 20, type 2
isa_intr_alloc: returning bestirq = 5 with count = 1
isa_intr_alloc succeded: irq 5
isapnp_alloc_irq succeeded
isapnp0: <Creative ViBRA16X PnP, CTL0043, , Audio> port 0x220/16,0x330/2,0x388/4 irq 5 drq 1,3 not configured

The ISDN card is OK and working. BUT: the soundcard (if it were configured
into the kernel) would go on IRQ 5 as well. If I try that, the ISDN card 
stops working (IRQ's don't get through).

I suppose what should happen is: the call to isa_intr_alloc with mask 0x20 
(from the prefered config of the soundblaster) should fail, as this IRQ is
already in use (the isic driver has already called isa_intr_establish).

Isapnp would the proceed with the other configs of the card and attach it
probably at IRQ 7.

This doesn't happen because the irq type is 2 (IST_EDGE), and 
arch/i386/isa/isa_machdep.c believes these type of interrupts to be
sharable.

Obviously, at least on this hardware, they are not. I'm not a hardware
guy, so please enlighten me...


>How-To-Repeat:

Read the code.

>Fix:

Someone with deeper hardware knowledge should decide what to do: are these
interrupts realy edge triggered? Are all edge triggered interrupts realy
sharable? The change to $ARCH/isa/isa_machdep.c is easy, if you know
what should happen
>Audit-Trail:
>Unformatted: