Subject: port-i386/11884: ISAPNP overallocates interrupts
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ncrnko@jps.net>
List: netbsd-bugs
Date: 01/03/2001 18:27:15
>Number:         11884
>Category:       port-i386
>Synopsis:       ISAPNP overallocates interrupts
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 03 18:27:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nenad Crnko
>Release:        NetBSD 1.5
>Organization:
>Environment:
AMD K6-2 400MHz, motherboard FIC VA-503+,
legacy ISA serial port hadwired as com2 (0x3e8 irq 5),
Creative SB AWE64 PnP

NetBSD aeolus 1.5 NetBSD 1.5 (GENERIC) #1: Sun Nov 19 21:42:11 MET 2000
  fvdl@sushi:/work/trees/netbsd-1-5/sys/arch/i386/compile/GENERIC i386
>Description:
NetBSD 1.5 i386 GENERIC overallocates irq 5. That renders tty02
unoperational. When attempting tip(1) through tty02, tip becomes
unresponsive and gets stuck so badly that it can not be removed
even with kill -9.

Relevant lines from dmesg(8) (notice that irq 5 gets assigned both
to com2 and sb1):
========================================================================
NetBSD 1.5 (GENERIC) #1: Sun Nov 19 21:42:11 MET 2000
fvdl@sushi:/work/trees/netbsd-1-5/sys/arch/i386/compile/GENERIC
cpu0: AMD K6-2 (586-class)
total memory = 65088 KB
avail memory = 55208 KB
using 839 buffers containing 3356 KB of memory
BIOS32 rev. 0 found at 0xfb2a0
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 0 function 0
pchb0: VIA Technologies VT82C597 (Apollo VP3) Host-PCI Bridge (rev. 0x04)
ppb0 at pci0 dev 1 function 0: VIA Technologies VT82C598 (Apollo MVP3) PCI-AGP (rev. 0x00)
pci1 at ppb0 bus 1
pci1: i/o space, memory space enabled
pcib0 at pci0 dev 7 function 0
pcib0: VIA Technologies VT82C586 (Apollo VP) PCI-ISA Bridge (rev. 0x41)
< ...skip...>
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
com2 at isa0 port 0x3e8-0x3ef irq 5: ns16550a, working fifo
< ...skip...>
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
isapnp0: read port 0x203
sb1 at isapnp0 port 0x220/16,0x330/2,0x388/4 irq 5 drq 1,5
sb1: Creative SB AWE64 PnP Audio: dsp v4.16
audio0 at sb1: full duplex, mmap, independent
mpu0 at sb1
midi1 at mpu0: SB MPU-401 MIDI UART
opl0 at sb1: model OPL3
midi2 at opl0: SB Yamaha OPL3
joy0 at isapnp0 port 0x200/8
joy0: Creative SB AWE64 PnP Game
joy0: joystick not connected
isapnp0: <Creative SB AWE64 PnP, CTL0022, , WaveTable> port 0x620/4 not configured
biomask eb45 netmask ef45 ttymask ffc7
=======================================================================

>How-To-Repeat:
 - install a legacy com2 serial port and AWE64 pnp soundblaster
 - boot GENERIC
 - attempt communicating through com2 using tip(1).
>Fix:
It seems that
/usr/src/sys/arch/i386/isa/isa_machdep.c:isa_intr_alloc()
gets called from
/usr/src/sys/dev/isapnp/isapnp.c:isa_pnp_alloc_irq()
with mask=~0 (0xffff)
and that isa_intr_alloc() is unaware of irqs hardwired to ISA devices.

#define ISAPNP_ALLOC_INTR_MASK 0xff5f /* (~0) */
in
/usr/src/sys/dev/isapnp/isapnp.c
appears to cure the problem. If there is no better way of fixing this
problem, ISAPNP_ALLOC_INTR_MASK can trivially be made one of the kernel
options(4). When recompiled and rebooted irq 5 is left to com2 and
sb1 gets irq 9. Output from dmesg(8) changes to:
=======================================================================
isapnp0: read port 0x203
sb1 at isapnp0 port 0x220/16,0x300/2,0x388/4 irq 9 drq 0,5
sb1: Creative SB AWE64 PnP Audio: dsp v4.16
audio0 at sb1: full duplex, mmap, independent
=======================================================================

>Release-Note:
>Audit-Trail:
>Unformatted: