NetBSD Problem Report #9039

Received: (qmail 7851 invoked from network); 22 Dec 1999 08:27:19 -0000
Message-Id: <199912190757.QAA00622@itojun.org>
Date: Sun, 19 Dec 1999 16:57:40 +0900 (JST)
From: itojun@itojun.org
Reply-To: itojun@itojun.org
To: gnats-bugs@gnats.netbsd.org
Cc: itojun@itojun.org
Subject: pciide misbehaves on ThinkPad 570
X-Send-Pr-Version: 3.95

>Number:         9039
>Category:       port-i386
>Synopsis:       pciide misbehaves on ThinkPad 570
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 22 00:30:01 +0000 1999
>Closed-Date:    Tue Apr 08 19:25:17 +0000 2003
>Last-Modified:  Sat Oct 07 19:17:51 +0000 2006
>Originator:     Jun-ichiro itojun Hagino
>Release:        1.4.1
>Organization:
itojun.org
>Environment:
1.4.1: NetBSD lychee.itojun.org 1.4.1 NetBSD 1.4.1 (LYCHEE.v6) #434: Sun Dec 19 16:24:18 JST 1999 itojun@lychee.itojun.org:/export/home/itojun/k/kame/netbsd/sys/arch/i386/compile/LYCHEE.v6 i386

	also applies to -current

>Description:
	There seem to be some problem with sys/dev/pci/pciide.c with
	ThinkPad 570 (both celeron366 model and Pen2-366 model).
	Thinkpad 570 has PIIX4 with it, NetBSD-1.4.1 (revision 1.33.2.4) works
	just fine.
Dec 19 16:35:14 lychee /netbsd: pciide0: primary channel interrupting at irq 14
Dec 19 16:35:14 lychee /netbsd: pciide0: secondary channel wired to compatibilit
y mode
Dec 19 16:35:14 lychee /netbsd: pciide0: secondary channel ignored (disabled)
Dec 19 16:35:14 lychee /netbsd: wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)

	NetBSD-current last week (revision 1.49) probes and attaches fine,
	but shows message like this on root mount and locks up solid.
	Boot floppy from NetBSD-current binary snapshot as of Nov 13
	(not sure about revision, around 1.46 or 1.47) also show this behabior.

Dec 19 16:13:39 lychee /netbsd: pciide0:0:0: lost interrupt
Dec 19 16:13:39 lychee /netbsd:         type: ata
Dec 19 16:13:39 lychee /netbsd:         c_bcount: 512
Dec 19 16:13:39 lychee /netbsd:         c_skip: 0

	There can be some timing issue involved; I sometimes able to boot it.
	(1 in 10 boot)

>How-To-Repeat:
	boot Nov 13 boot floppy at
	ftp://ftp.netbsd.org/pub/NetBSD/arch/i386/snapshot/19991113/.
>Fix:
	temporary fix: disable pciide.
>Release-Note:
>Audit-Trail:

From: itojun@iijlab.net
To: None <gnats-bugs@gnats.netbsd.org>
Cc:  Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sat, 05 Feb 2000 01:53:39 +0900

 the problem still persists for today's current.
 100% repeatable for two of thinkpad570 I got.  (one is penII-333,
 the other is celeron-366)

 The following configuration exhibits problem:
 - GENERIC with apm enabled
 - GENERIC with apm enabled, with options PCIBIOS
 - GENERIC with apm enabled, and flags=0x0001 to pciide 

 The only workaround is for me is to disable pciide.

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@itojun.org
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 9 Feb 2000 14:58:10 +0100

 Hi,
 Sorry for the late anserw, I missed this one.

 Can you try to enter ddb when the kernel is locked up ?

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 09 Feb 2000 22:59:39 +0900

 >Hi,
 >Sorry for the late anserw, I missed this one.
 >Can you try to enter ddb when the kernel is locked up ?

 	Fine I'll try to.

 itojun

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>, gnats-bugs@gnats.netbsd.org
Cc:  Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Thu, 10 Feb 2000 00:41:15 +0900

 >>Hi,
 >>Sorry for the late anserw, I missed this one.
 >>Can you try to enter ddb when the kernel is locked up ?
 >	Fine I'll try to.

 	I couldn't even go into DDB (ctl-alt-esc).  The symptom is the
 	same - right after the kernel boots up (after attaching all devices),
 	the following message comes:
 >pciide0:0:0: lost interrupt
 >	type: ata
 >	c_bcount: 512
 >	c_skip: 0
 	and disk access indicator is kept to ON, no activity is possible
 	(other than reset).

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 9 Feb 2000 20:51:02 +0100

 On Thu, Feb 10, 2000 at 12:41:15AM +0900, itojun@iijlab.net wrote:
 > 	I couldn't even go into DDB (ctl-alt-esc).  The symptom is the
 > 	same - right after the kernel boots up (after attaching all devices),
 > 	the following message comes:
 > >pciide0:0:0: lost interrupt
 > >	type: ata
 > >	c_bcount: 512
 > >	c_skip: 0
 > 	and disk access indicator is kept to ON, no activity is possible
 > 	(other than reset).

 Ok, could you try to turn on INTR debugging (set wdcdebug_mask to DEBUG_INTR:
 gdb --write netbsd
 set wdcdebug_mask=0x01) ?

 Maybe it's an interrupt loop.

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Thu, 10 Feb 2000 11:47:03 +0900

 >Ok, could you try to turn on INTR debugging (set wdcdebug_mask to DEBUG_INTR:
 >gdb --write netbsd
 >set wdcdebug_mask=0x01) ?
 >Maybe it's an interrupt loop.

 	I see the following messages.  not sure if it is locked inside or
 	of interrupt logic, or not.  what other things I can do to track it?

 itojun


 sm1: supplying EUI64: 00:00:86:ff:fe:05:80:da	<--- last device attach
 wdcintr
 __wdccommand_intr pciide0:0:0
 wdcintr
 wdcintr
 wdcintr
 wdcintr
 pciide0:0:0: lost interrupt
 	type: ata
 	c_bcount: 512
 	c_skip: 0

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Mon, 14 Feb 2000 10:28:38 +0100

 On Thu, Feb 10, 2000 at 11:47:03AM +0900, itojun@iijlab.net wrote:
 > 
 > >Ok, could you try to turn on INTR debugging (set wdcdebug_mask to DEBUG_INTR:
 > >gdb --write netbsd
 > >set wdcdebug_mask=0x01) ?
 > >Maybe it's an interrupt loop.
 > 
 > 	I see the following messages.  not sure if it is locked inside or
 > 	of interrupt logic, or not.  what other things I can do to track it?
 > 
 > itojun
 > 
 > 
 > sm1: supplying EUI64: 00:00:86:ff:fe:05:80:da	<--- last device attach
 > wdcintr
 > __wdccommand_intr pciide0:0:0
 > wdcintr
 > wdcintr
 > wdcintr
 > wdcintr
 > pciide0:0:0: lost interrupt
 > 	type: ata
 > 	c_bcount: 512
 > 	c_skip: 0

 Ok, so it doesn't look up in the interrupt handler.
 Could you turn on full debugging (set wdcdebug_mask to 0xff) ?

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Tue, 15 Feb 2000 02:11:55 +0900

 >> sm1: supplying EUI64: 00:00:86:ff:fe:05:80:da	<--- last device attach
 >> wdcintr
 >> __wdccommand_intr pciide0:0:0
 >> wdcintr
 >> wdcintr
 >> wdcintr
 >> wdcintr
 >> pciide0:0:0: lost interrupt
 >> 	type: ata
 >> 	c_bcount: 512
 >> 	c_skip: 0
 >Ok, so it doesn't look up in the interrupt handler.
 >Could you turn on full debugging (set wdcdebug_mask to 0xff) ?

 	it was like this.  I can repeat the behavior every time I do this.

 itojun



 --
 wdc_exec_xfer 0xf06f1000 channel 0 driver 0
 wdcstart from wdc_exec_xfer, flags 0x0
 wdcstart: xfer 0xf06f1000 channel 0 driver 0
 wdcwait pciide0:0
 wdccommandshort pciide0:0:0 command 0x10
 wdcintr
 wdcwait pciide0:0
 wdccommand pciide0:0:0 command 0xef cylin=0 head=0 sector=0 count=12 precomp=3
 wdcintr
 wdcwait pciide0:0
 wdccommand pciide0:0:0 command 0xef cylin=0 head=0 sector=0 count=66 precomp=3
 wdcintr
 wdcwait pciide0:0
 wdccommand pciide0:0:0 command 0xc6 cylin=0 head=0 sector=0 count=16 precomp=0
 wdcintr
 wdcwait pciide0:0
 wdcwait pciide0:0
 wdccommand pciide0:0:0 command 0xc8 cylin=0 head=64 sector=0 count=1 precomp=0
 (3 or 4 seconds of delay)
 wdctimeout
 pciide0:0:0: lost interrupt
 	type: ata
 	c_bcount: 512
 	c_skip: 0
 wdcwait pciide0:0
 (lock up solid)

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Tue, 15 Feb 2000 11:57:11 +0100

 On Tue, Feb 15, 2000 at 02:11:55AM +0900, itojun@iijlab.net wrote:
 > 	it was like this.  I can repeat the behavior every time I do this.

 Ok, thanks. Looks like something I had on a PIIX4 when UltraDMA was
 misconfigured, it seems this can look up the PCI bus.
 Could you reset wdcdebug_mask to 0 and set wdcdebug_pciide_mask to 0x10
 please ?
 You need to find a way to grab the boot messages, I can build you a boot
 floppy if this can help ...

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Tue, 15 Feb 2000 21:41:15 +0900

 >> 	it was like this.  I can repeat the behavior every time I do this.
 >Ok, thanks. Looks like something I had on a PIIX4 when UltraDMA was
 >misconfigured, it seems this can look up the PCI bus.
 >Could you reset wdcdebug_mask to 0 and set wdcdebug_pciide_mask to 0x10
 >please ?

 	I will.

 >You need to find a way to grab the boot messages, I can build you a boot
 >floppy if this can help ...

 	Yes that would really help us.
 	Please enable serial console so that I can grab full output...

 itojun

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 16 Feb 2000 17:05:41 +0900

 >Ok, thanks. Looks like something I had on a PIIX4 when UltraDMA was
 >misconfigured, it seems this can look up the PCI bus.
 >Could you reset wdcdebug_mask to 0 and set wdcdebug_pciide_mask to 0x10
 >please ?
 >You need to find a way to grab the boot messages, I can build you a boot
 >floppy if this can help ...

 	Nothing appears with wdcdebug_pciide_mask = 0x10.

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 16 Feb 2000 11:31:33 +0100

 On Wed, Feb 16, 2000 at 05:05:41PM +0900, itojun@iijlab.net wrote:
 > 	Nothing appears with wdcdebug_pciide_mask = 0x10.

 The kernel should print extra infos but not just before hanging, it's
 at pciide/wd attach time.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 16 Feb 2000 11:43:22 +0100

 Oh, and could you also send me the dmesg of a working kernel with
 wdcdebug_pciide_mask set to 0x10 ? Thanks.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sun, 27 Feb 2000 02:37:30 +0900

 >Oh, and could you also send me the dmesg of a working kernel with
 >wdcdebug_pciide_mask set to 0x10 ? Thanks.

 	sorry to be VERY late, here's output from wdcdebug_pciide_mask = 0x10.
 	it locked up solid when it attempts to mount root.  the kernel is
 	GENERIC + apm + IPv6 + IPsec.
 	(we need to improve bootloader for switching consoles...)

 itojun


 [ preserving 417052 bytes of netbsd ELF symbol table ]
 Copyright (c) 1996, 1997, 1998, 1999, 2000
     The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
     The Regents of the University of California.  All rights reserved.

 NetBSD 1.4T (STARFRUIT.pciide) #5: Sun Feb 27 02:27:43 JST 2000
     itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT.pciide
 cpu0: family 6 model 6 step a
 cpu0: Intel Pentium II (Celeron) (686-class)
 total memory = 65088 KB
 avail memory = 55756 KB
 using 839 buffers containing 3356 KB of memory
 BIOS32 rev. 0 found at 0xfd840
 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: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 vga1 at pci1 dev 0 function 0: Neomagic MagicMedia 256AV VGA (rev. 0x20)
 wsdisplay0 at vga1
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 0 not configured
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 1 not configured
 clcs0 at pci0 dev 5 function 0: Cirrus Logic CS4280 CrystalClear Audio Interface (rev. 0x01)
 clcs0: interrupting at irq 11
 clcs0: Cirrus Logic CS4297 codec; headphone, 18 bit DAC, 18 bit ADC, no 3D stereo
 audio0 at clcs0: full duplex, independent
 pcib0 at pci0 dev 6 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 pciide0 at pci0 dev 6 function 1: Intel 82371AB IDE controller (PIIX4)
 PCI configuration registers:
   Common header:
     0x00: 0x71118086 0x02800005 0x01018001 0x00004000

     Vendor Name: Intel (0x8086)
     Device Name: 82371AB IDE controller (PIIX4) (0x7111)
     Command register: 0x0005
       I/O space accesses: on
       Memory space accesses: off
       Bus mastering: on
       Special cycles: off
       MWI transactions: off
       Palette snooping: off
       Parity error checking: off
       Address/data stepping: off
       System error (SERR): off
       Fast back-to-back transactions: off
     Status register: 0x0280
       Capability List support: off
       66 MHz capable: off
       User Definable Features (UDF) support: off
       Fast back-to-back capable: on
       Data parity error detected: off
       DEVSEL timing: medium (0x1)
       Slave signaled Target Abort: off
       Master received Target Abort: off
       Master received Master Abort: off
       Asserted System Error (SERR): off
       Parity error detected: off
     Class Name: mass storage (0x01)
     Subclass Name: IDE (0x01)
     Interface: 0x80
     Revision ID: 0x01
     BIST: 0x00
     Header Type: 0x00 (0x00)
     Latency Timer: 0x40
     Cache Line Size: 0x00

   Type 0 ("normal" device) header:
     0x10: 0x00000000 0x00000000 0x00000000 0x00000000
     0x20: 0x00001801 0x00000000 0x00000000 0x00000000
     0x30: 0x00000000 0x00000000 0x00000000 0x00000000

     Base address register at 0x10
       not implemented(?)
     Base address register at 0x14
       not implemented(?)
     Base address register at 0x18
       not implemented(?)
     Base address register at 0x1c
       not implemented(?)
     Base address register at 0x20
       type: i/o
       base: 0x00001800, size: 0x00000010
     Base address register at 0x24
       not implemented(?)
     Cardbus CIS Pointer: 0x00000000
     Subsystem vendor ID: 0x0000
     Subsystem ID: 0x0000
     Expansion ROM Base Address: 0x00000000
     Reserved @ 0x34: 0x00000000
     Reserved @ 0x38: 0x00000000
     Maximum Latency: 0x00
     Minimum Grant: 0x00
     Interrupt pin: 0x00 (none)
     Interrupt line: 0x00

   Device-dependent header:
     0x40: 0x0000a307 0x00000000 0x00020001 0x00000000
     0x50: 0x00000000 0x00000000 0x00000000 0x00000000
     0x60: 0x00000000 0x00000000 0x00000000 0x00000000
     0x70: 0x00000000 0x00000000 0x00000000 0x00000000
     0x80: 0x00000000 0x00000000 0x00000000 0x00000000
     0x90: 0x00000000 0x00000000 0x00000000 0x00000000
     0xa0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xb0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xc0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xd0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xe0: 0x00000000 0x00000000 0x00000000 0x00000000
     0xf0: 0x00000000 0x00000000 0x00000f30 0x00000000

     Don't know how to pretty-print device-dependent header.

 pciide0: bus-master DMA support present
 piix_setup_chip: old idetim=0xa307, sidetim=0x0, udamreg 0x20001
 pciide0: primary channel wired to compatibility mode
 wd0 at pciide0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: 32-bits data port
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 pciide0: primary channel interrupting at irq 14
 pciide_dma_table_setup: table at 0xc5629000 len 136, phy 0x10000
 pciide_dma_table_setup: phy addr of table 0x10000
 wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 piix_setup_chip: idetim=0xa307, sidetim=0x0, udamreg 0x20001
 pciide: command/status register=2800005
 uhci0 at pci0 dev 6 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 11
 usb0 at uhci0: USB revision 1.0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 6 function 3 not configured
 AT&T Microelectronics product 0x0448 (miscellaneous communications, revision 0x01) at pci0 dev 7 function 0 not configured
 isa0 at pcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 com0: console
 com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0
 pms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 wsmouse0 at pms0 mux 0
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcmcia0 at pcic0 controller 0 socket 0
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 apm0 at mainbus0: Power Management spec V1.2
 apm0: battery life expectancy: 100%
 apm0: A/C state: on
 apm0: battery charge state: high
 biomask efe5 netmask efe5 ttymask ffe7
 pcic0: controller 0 detecting irqs with mask 0xdeb8:..5..7..9..10..15
 pcic0: using irq 5 for socket events
 IPsec: Initialized Security Association Processing.
 sm1 at pcmcia1 function 0 port 0x340-0x34f: Megahertz X-JACK Ethernet
 sm1: SMC91C90/91C92, revision 3
 sm1: MAC address 00:00:86:05:80:da, default media UTP
 sm1: supplying EUI64: 00:00:86:ff:fe:05:80:da
 pciide0:0:0: lost interrupt
 	type: ata
 	c_bcount: 512
 	c_skip: 0

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Thu, 2 Mar 2000 19:07:27 +0100

 Hi,
 re-reading the PR database I noticed that it works if you disable pciide.
 Can you try a kernel with pciide enabled but DMA disabled please ?
 You'll do this with:
 wd*     at pciide? channel ? drive ? flags 0x0ff0

 Could you also try:
 wd*     at pciide? channel ? drive ? flags 0x0f00
 which should enable multiword DMA but not Ultra-DMA.

 I hope I didn't already ask you these infos, it's been so long since the
 begining of this problem I don't remember all the details :)
 I didn't find any infos on this in the PR database.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Fri, 03 Mar 2000 23:22:49 +0900

 ------- =_aaaaaaaaaa0
 Content-Type: text/plain; charset="us-ascii"
 Content-ID: <4085.952093360.1@coconut.itojun.org>
 Content-Transfer-Encoding: 7bit

 >re-reading the PR database I noticed that it works if you disable pciide.
 >Can you try a kernel with pciide enabled but DMA disabled please ?
 >You'll do this with:
 >wd*     at pciide? channel ? drive ? flags 0x0ff0
 >Could you also try:
 >wd*     at pciide? channel ? drive ? flags 0x0f00
 >which should enable multiword DMA but not Ultra-DMA.
 >I hope I didn't already ask you these infos, it's been so long since the
 >begining of this problem I don't remember all the details :)
 >I didn't find any infos on this in the PR database.

 	Both 0x0ff0 and 0x0f00 hanged up with the same symptom.
 	Also I should note that 1.4.1 kernel is working perfectly, even with
 	pciide turned on as 1.4.1 GENERIC kernel does - are there significant
 	differences between 1.4.1 and current?

 	1.4.1 dmesg (as plaintext), and 0x0ff0 and 0x0f00 boot message
 	(uuencoded) are attached.

 itojun

 ------- =_aaaaaaaaaa0
 Content-Type: text/plain; charset="us-ascii"
 Content-ID: <4085.952093360.2@coconut.itojun.org>
 Content-Transfer-Encoding: 7bit

 . 0x01)
 uhci0: interrupting at irq 11
 uhci0: USB version 1.0
 usb0 at uhci0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 6 function 3 not configured
 Fujitsu Limited (4th PCI Vendor ID) product 0x0448 (miscellaneous communications, revision 0x01) at pci0 dev 7 function 0 not configured
 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
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard
 opms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: <PC speaker>
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xd7fff: using irq 5
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcmcia0 at pcic0 controller 0 socket 0
 cnw0 at pcmcia0 function 0 port 0x330-0x33f: can't allocate memory
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 apm0 at mainbus0: Power Management spec V1.1
 apm0: battery life expectancy: 90%
 apm0: A/C state: on
 apm0: battery charge state: high charging
 biomask 4840 netmask 4840 ttymask 5862
 altq: major number is 65
 IPsec: Initialized Security Association Processing.
 wscons: wskbd0 glued to wsdisplay0 (console)
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)
 syncing disks... 4 4 done
 rebooting...
 NetBSD 1.4.1 (LYCHEE.v6) #725: Thu Mar  2 22:18:18 JST 2000
     itojun@lychee.itojun.org:/export/home/itojun/k/kame/netbsd/sys/arch/i386/compile/LYCHEE.v6
 cpu0: family 6 model 6 step a
 cpu0: Intel Pentium II (Celeron) (686-class)
 real mem  = 200867840
 avail mem = 182521856
 using 2477 buffers containing 10145792 bytes of memory
 mainbus0 (root)
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o enabled, memory enabled
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o enabled, memory enabled
 vga1 at pci1 dev 0 function 0: Neomagic product 0x0005 (rev. 0x20)
 wsdisplay0 at vga1: console (80x25, vt100 emulation)
 Texas Instruments product 0xac1b (CardBus bridge, revision 0x03) at pci0 dev 2 function 0 not configured
 Texas Instruments product 0xac1b (CardBus bridge, revision 0x03) at pci0 dev 2 function 1 not configured
 Cirrus Logic CS4280 CrystalClear Audio Interface (audio multimedia, revision 0x01) at pci0 dev 5 function 0 not configured
 pcib0 at pci0 dev 6 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 pciide0 at pci0 dev 6 function 1: Intel 82371AB IDE controller (PIIX4)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 wd0 at pciide0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: 32-bits data port
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 pciide0: primary channel interrupting at irq 14
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
 uhci0 at pci0 dev 6 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 11
 uhci0: USB version 1.0
 usb0 at uhci0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 6 function 3 not configured
 Fujitsu Limited (4th PCI Vendor ID) product 0x0448 (miscellaneous communications, revision 0x01) at pci0 dev 7 function 0 not configured
 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
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard
 opms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: <PC speaker>
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff: using irq 5
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcmcia0 at pcic0 controller 0 socket 0
 cnw0 at pcmcia0 function 0 port 0x330-0x33f: Xircom CreditCard Netwave (Canada)
 cnw0: address 00:20:d8:00:6f:28
 cnw0: supplying EUI64: 00:20:d8:ff:fe:00:6f:28
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 apm0 at mainbus0: Power Management spec V1.1
 apm0: battery life expectancy: 93%
 apm0: A/C state: on
 apm0: battery charge state: high charging
 biomask 4840 netmask 4840 ttymask 5862
 altq: major number is 65
 IPsec: Initialized Security Association Processing.
 wscons: wskbd0 glued to wsdisplay0 (console)
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)
 pcmcia0: card irq 7
 cnw0: starting DAD for fe80:0001::0220:d8ff:fe00:6f28
 cnw0: DAD complete for fe80:0001::0220:d8ff:fe00:6f28 - no duplicates found
 com3 at pcmcia1 function 0 port 0x3e8-0x3ef: serial device
 com3: ns16550a, working fifo
 stray interrupt 7
 pcmcia1: card irq 7
 ppp0: IPv6 not supported
 ppp0: IPv6 not supported
 pcmcia0: card irq 9
 stray interrupt 7
 stray interrupt 7
 pcmcia1: card irq 7
 ppp0: IPv6 not supported
 ppp0: IPv6 not supported
 stray interrupt 7
 stray interrupt 7; stopped logging
 pcmcia1: card irq 7
 pcmcia1: card irq 7
 pcmcia1: card irq 7
 ppp0: IPv6 not supported
 ppp0: IPv6 not supported
 pcmcia0: card irq 7
 cnw0: starting DAD for 2001:0218:0420:0:0220:d8ff:fe00:6f28
 cnw0: starting DAD for 3ffe:8020:10ff:0001:0220:d8ff:fe00:6f28
 cnw0: starting DAD for 3ffe:0507:0001:0001:0220:d8ff:fe00:6f28
 cnw0: starting DAD for 3ffe:0501:0410:0:0220:d8ff:fe00:6f28
 cnw0: DAD complete for 2001:0218:0420:0:0220:d8ff:fe00:6f28 - no duplicates found
 cnw0: DAD complete for 3ffe:8020:10ff:0001:0220:d8ff:fe00:6f28 - no duplicates found
 cnw0: DAD complete for 3ffe:0507:0001:0001:0220:d8ff:fe00:6f28 - no duplicates found
 cnw0: DAD complete for 3ffe:0501:0410:0:0220:d8ff:fe00:6f28 - no duplicates found
 defrouter_select: there's no default router and no default interface
 pcmcia0: card irq 7
 pcmcia0: card irq 7
 defrouter_select: there's no default router and no default interface
 pcmcia0: card irq 7
 com3 detached
 ne2 at pcmcia1 function 0 port 0x340-0x34f port 0x350-0x35f
 ne2: National Semiconductor InfoMover Ethernet
 ne2: Ethernet address 08:00:5a:38:6f:86
 pcmcia1: card irq 9
 ne2: starting DAD for fe80:0017::0a00:5aff:fe38:6f86
 ne2: DAD complete for fe80:0017::0a00:5aff:fe38:6f86 - no duplicates found
 ne2: starting DAD for 3ffe:0507:0:0001:0a00:5aff:fe38:6f86
 ne2: DAD complete for 3ffe:0507:0:0001:0a00:5aff:fe38:6f86 - no duplicates found
 pcmcia0: card irq 7
 pcmcia1: card irq 9
 defrouter_select: there's no default router and no default interface
 pcmcia0: card irq 7
 pcmcia1: card irq 9
 cnw0: starting DAD for 3ffe:0507:0200:0001:0220:d8ff:fe00:6f28
 cnw0: DAD complete for 3ffe:0507:0200:0001:0220:d8ff:fe00:6f28 - no duplicates found

 ------- =_aaaaaaaaaa0
 Content-Type: text/plain; charset="us-ascii"
 Content-ID: <4085.952093360.3@coconut.itojun.org>
 Content-Transfer-Encoding: 7bit

 begin 644 pciide.tar.gz
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
 %R@!0``!,
 `
 end

 ------- =_aaaaaaaaaa0--

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sat, 11 Mar 2000 19:00:43 +0100

 --nFreZHaLTZJo0R7j
 Content-Type: text/plain; charset=us-ascii

 Hi,
 ok, this looks really like what I get when I intentionally set the controller
 to Ultra-DMA and the drive to DMA on my PIIX4. As the controller settings looks
 rigth on your machine I suspect the drive doesn't get the rigth settings,
 although the correct command seems issued.
 I've found a difference between 1.4.1 and -current which affects timing;
 delay between 2 consecutive commands on 1.4.1 was a bit higther because
 a untimeout()/timeout() was done between 2 commands (this is now done per
 xfer). The attached patch will add delays at the place where calls to
 timeout/untimeout were previously. Could you test it ?
 If it works please try to remove the delays one by one to try to find which
 one is relevant; especially the delay() in wdcintr will inpact performances,
 I'd prefer to avoid it :)

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

 --nFreZHaLTZJo0R7j
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=diff

 --- ic/wdc.c.old	Sat Mar 11 18:47:44 2000
 +++ ic/wdc.c	Sat Mar 11 18:48:11 2000
 @@ -672,6 +672,7 @@
  	WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR);
  	chp->ch_flags &= ~WDCF_IRQ_WAIT;
  	xfer = chp->ch_queue->sc_xfer.tqh_first;
 +	DELAY(1);
  	ret = xfer->c_intr(chp, xfer, 1);
  	if (ret == 0) /* irq was not for us, still waiting for irq */
  		chp->ch_flags |= WDCF_IRQ_WAIT;
 --- ata/ata_wdc.c.old	Sat Mar 11 18:44:16 2000
 +++ ata/ata_wdc.c	Sat Mar 11 18:47:36 2000
 @@ -213,6 +213,7 @@
  		drvp->state = RECAL_WAIT;
  		if ((ata_bio->flags & ATA_POLL) == 0) {
  			chp->ch_flags |= WDCF_IRQ_WAIT;
 +			DELAY(10);
  		} else {
  			/* Wait for at last 400ns for status bit to be valid */
  			DELAY(1);
 @@ -753,6 +754,7 @@

  	if ((ata_bio->flags & ATA_POLL) == 0) {
  		chp->ch_flags |= WDCF_IRQ_WAIT;
 +		DELAY(10);
  	} else {
  		goto again;
  	}

 --nFreZHaLTZJo0R7j--

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sun, 19 Mar 2000 19:20:49 +0900

 	sorry to be very late.

 >Hi,
 >ok, this looks really like what I get when I intentionally set the controller
 >to Ultra-DMA and the drive to DMA on my PIIX4. As the controller settings looks
 >rigth on your machine I suspect the drive doesn't get the rigth settings,
 >although the correct command seems issued.
 >I've found a difference between 1.4.1 and -current which affects timing;
 >delay between 2 consecutive commands on 1.4.1 was a bit higther because
 >a untimeout()/timeout() was done between 2 commands (this is now done per
 >xfer). The attached patch will add delays at the place where calls to
 >timeout/untimeout were previously. Could you test it ?
 >If it works please try to remove the delays one by one to try to find which
 >one is relevant; especially the delay() in wdcintr will inpact performances,
 >I'd prefer to avoid it :)

 	The diff (adding DELAY) did not make any change.  I'll try to increase
 	delays one by one to see what happens.

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Wed, 22 Mar 2000 20:04:52 +0100

 On Sun, Mar 19, 2000 at 07:20:49PM +0900, itojun@iijlab.net wrote:
 > 
 > 	sorry to be very late.
 > 
 > 	The diff (adding DELAY) did not make any change.  I'll try to increase
 > 	delays one by one to see what happens.

 Hum, I expected that a very small delay (a few PCI cycles) would be enouth.
 I need to think more about this, and carefully compare the 1.4.1 and
 -current codes again... I which I had the hardware in my hands :)

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sun, 26 Mar 2000 20:30:41 +0200

 --n8g4imXOkfNTN/H1
 Content-Type: text/plain; charset=us-ascii

 Hi,
 I've done some changes that may impact the problem: now the IDE driver
 stops the DMA engine before reading the drive's status (the ide dma specs
 says nothing about this but the PIIX4 data sheed gives this order).
 Could you try the attached patch ?
 I've compiled 2 generic kernels:
 ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd
 and
 ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd-com0

 The first one is a standart GENERIC kernel (with my changes) and the later
 is GENERIC with
 options        "CONSDEVNAME=\"com\"",CONADDR=0x2f8,CONSPEED=57600
 and
 options        CONS_OVERRIDE


 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

 --n8g4imXOkfNTN/H1
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=diff

 Index: ata/ata_wdc.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ata/ata_wdc.c,v
 retrieving revision 1.25
 diff -u -r1.25 ata_wdc.c
 --- ata_wdc.c	2000/03/25 21:37:51	1.25
 +++ ata_wdc.c	2000/03/26 16:19:42
 @@ -226,7 +226,6 @@
  		if (drvp->n_xfers <= NXFER)
  			drvp->n_xfers++;
  		dma_flags = (ata_bio->flags & ATA_READ) ?  WDC_DMA_READ : 0;
 -		dma_flags |= (ata_bio->flags & ATA_POLL) ?  WDC_DMA_POLL : 0;
  	}
  	if (ata_bio->flags & ATA_SINGLE)
  		ata_delay = ATA_DELAY;
 @@ -306,7 +305,8 @@
  			    head, sect, nblks, 0);
  			/* start the DMA channel */
  			(*chp->wdc->dma_start)(chp->wdc->dma_arg,
 -			    chp->channel, xfer->drive, dma_flags);
 +			    chp->channel, xfer->drive);
 +			chp->ch_flags |= WDCF_DMA_WAIT;
  			/* wait for irq */
  			goto intr;
  		} /* else not DMA */
 @@ -389,6 +389,10 @@
  	} else {
  		/* Wait for at last 400ns for status bit to be valid */
  		delay(1);
 +		if (chp->ch_flags & WDCF_DMA_WAIT) {
 +			wdc_dmawait(chp, xfer, ATA_DELAY);
 +			chp->ch_flags &= ~WDCF_DMA_WAIT;
 +		}
  		wdc_ata_bio_intr(chp, xfer, 0);
  		if ((ata_bio->flags & ATA_ITSDONE) == 0)
  			goto again;
 @@ -413,7 +417,6 @@
  	struct ata_bio *ata_bio = xfer->cmd;
  	struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
  	int drv_err;
 -	int dma_flags = 0;

  	WDCDEBUG_PRINT(("wdc_ata_bio_intr %s:%d:%d\n",
  	    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive),
 @@ -428,11 +431,6 @@
  		panic("wdc_ata_bio_intr: bad state\n");
  	}

 -	if (xfer->c_flags & C_DMA) {
 -		dma_flags = (ata_bio->flags & ATA_READ) ?  WDC_DMA_READ : 0;
 -		dma_flags |= (ata_bio->flags & ATA_POLL) ?  WDC_DMA_POLL : 0;
 -	}
 -
  	/*
  	 * if we missed an interrupt in a PIO transfer, reset and restart.
  	 * Don't try to continue transfer, we may have missed cycles.
 @@ -451,10 +449,8 @@
  		printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n",
  		    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
  		    xfer->c_bcount, xfer->c_skip);
 -		/* if we were using DMA, turn off DMA channel */
 +		/* if we were using DMA, flag a DMA error */
  		if (xfer->c_flags & C_DMA) {
 -			(*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 -			    chp->channel, xfer->drive, dma_flags);
  			ata_dmaerr(drvp);
  		}
  		ata_bio->error = TIMEOUT;
 @@ -482,8 +478,7 @@
  				drv_err = WDC_ATA_ERR;
  			}
  		}
 -		if ((*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 -		    chp->channel, xfer->drive, dma_flags) != 0) {
 +		if (chp->wdc->dma_status != 0) {
  			if (drv_err != WDC_ATA_ERR) {
  				ata_bio->error = ERR_DMA;
  				drv_err = WDC_ATA_ERR;
 Index: ic/wdc.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
 retrieving revision 1.82
 diff -u -r1.82 wdc.c
 --- wdc.c	2000/03/23 15:04:49	1.82
 +++ wdc.c	2000/03/26 16:19:43
 @@ -673,8 +673,18 @@
  	}

  	WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR);
 -	chp->ch_flags &= ~WDCF_IRQ_WAIT;
  	xfer = chp->ch_queue->sc_xfer.tqh_first;
 +	if (chp->ch_flags & WDCF_DMA_WAIT) {
 +		chp->wdc->dma_status =
 +		    (*chp->wdc->dma_finish)(chp->wdc->dma_arg, chp->channel,
 +			xfer->drive, 0);
 +		if (chp->wdc->dma_status & WDC_DMAST_NOIRQ) {
 +			/* IRQ not for us, not detected by DMA engine */
 +			return 0;
 +		}
 +		chp->ch_flags &= ~WDCF_DMA_WAIT;
 +	}
 +	chp->ch_flags &= ~WDCF_IRQ_WAIT;
  	ret = xfer->c_intr(chp, xfer, 1);
  	if (ret == 0) /* irq was not for us, still waiting for irq */
  		chp->ch_flags |= WDCF_IRQ_WAIT;
 @@ -863,6 +873,30 @@
  	return 0;
  }

 +/*
 + * Busy-wait for DMA to complete
 + */
 +int
 +wdc_dmawait(chp, xfer, timeout)
 +	struct channel_softc *chp;
 +	struct wdc_xfer *xfer;
 +	int timeout;
 +{
 +	int time;
 +	for (time = 0;  time < timeout * 1000 / WDCDELAY; time++) {
 +		chp->wdc->dma_status =
 +		    (*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 +			chp->channel, xfer->drive, 0);
 +		if ((chp->wdc->dma_status & WDC_DMAST_NOIRQ) == 0)
 +			return 0;
 +		delay(WDCDELAY);
 +	}
 +	/* timeout, force a DMA halt */
 +	chp->wdc->dma_status = (*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 +	    chp->channel, xfer->drive, 1);
 +	return 1;
 +}
 +
  void
  wdctimeout(arg)
  	void *arg;
 @@ -880,6 +914,12 @@
  		    "atapi":"ata");
  		printf("\tc_bcount: %d\n", xfer->c_bcount);
  		printf("\tc_skip: %d\n", xfer->c_skip);
 +		if (chp->ch_flags & WDCF_DMA_WAIT) {
 +			chp->wdc->dma_status =
 +			    (*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 +				chp->channel, xfer->drive, 1);
 +			chp->ch_flags &= ~WDCF_DMA_WAIT;
 +		}
  		/*
  		 * Call the interrupt routine. If we just missed and interrupt,
  		 * it will do what's needed. Else, it will take the needed
 Index: ic/wdcvar.h
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ic/wdcvar.h,v
 retrieving revision 1.23
 diff -u -r1.23 wdcvar.h
 --- wdcvar.h	2000/03/23 08:20:06	1.23
 +++ wdcvar.h	2000/03/26 16:19:43
 @@ -68,6 +68,7 @@
  	int ch_flags;
  #define WDCF_ACTIVE   0x01	/* channel is active */
  #define WDCF_IRQ_WAIT 0x10	/* controller is waiting for irq */
 +#define WDCF_DMA_WAIT 0x20	/* controller is waiting for DMA */
  	u_int8_t ch_status;         /* copy of status register */
  	u_int8_t ch_error;          /* copy of error register */
  	/* per-drive infos */
 @@ -112,11 +113,15 @@
  	void            *dma_arg;
  	int            (*dma_init) __P((void *, int, int, void *, size_t,
  	                int));
 -	void           (*dma_start) __P((void *, int, int, int));
 +	void           (*dma_start) __P((void *, int, int));
  	int            (*dma_finish) __P((void *, int, int, int));
 -/* flags passed to DMA functions */
 +/* flags passed to dma_init */
  #define WDC_DMA_READ 0x01
 -#define WDC_DMA_POLL 0x02
 +#define WDC_DMA_IRQW 0x02
 +	int		dma_status; /* status returned from dma_finish() */
 +#define WDC_DMAST_NOIRQ	0x01	/* missing IRQ */
 +#define WDC_DMAST_ERR	0x02	/* DMA error */
 +#define WDC_DMAST_UNDER	0x04	/* DMA underrun */

  	/* if WDC_CAPABILITY_HWLOCK set in 'cap' */
  	int            (*claim_hw) __P((void *, int));
 @@ -174,6 +179,7 @@
  #define VERBOSE 1 
  #define SILENT 0 /* wdcreset will not print errors */
  int   wdcwait __P((struct channel_softc *, int, int, int));
 +int   wdc_dmawait __P((struct channel_softc *, struct wdc_xfer *, int));
  void  wdcbit_bucket __P(( struct channel_softc *, int));
  void  wdccommand __P((struct channel_softc *, u_int8_t, u_int8_t, u_int16_t,
  	                  u_int8_t, u_int8_t, u_int8_t, u_int8_t));
 Index: isa/wdc_isa.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/isa/wdc_isa.c,v
 retrieving revision 1.18
 diff -u -r1.18 wdc_isa.c
 --- wdc_isa.c	2000/03/23 07:01:35	1.18
 +++ wdc_isa.c	2000/03/26 16:19:43
 @@ -76,7 +76,7 @@

  static void	wdc_isa_dma_setup __P((struct wdc_isa_softc *));
  static int	wdc_isa_dma_init __P((void*, int, int, void *, size_t, int));
 -static void 	wdc_isa_dma_start __P((void*, int, int, int));
 +static void 	wdc_isa_dma_start __P((void*, int, int));
  static int	wdc_isa_dma_finish __P((void*, int, int, int));

  int
 @@ -207,7 +207,7 @@
  }

  static void
 -wdc_isa_dma_start(v, channel, drive, read)
 +wdc_isa_dma_start(v, channel, drive)
  	void *v;
  	int channel, drive;
  {
 Index: pci/pciide.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/pci/pciide.c,v
 retrieving revision 1.55
 diff -u -r1.55 pciide.c
 --- pciide.c	2000/03/10 21:21:48	1.55
 +++ pciide.c	2000/03/26 16:19:45
 @@ -188,7 +188,7 @@
  void pciide_channel_dma_setup __P((struct pciide_channel *));
  int  pciide_dma_table_setup __P((struct pciide_softc*, int, int));
  int  pciide_dma_init __P((void*, int, int, void *, size_t, int));
 -void pciide_dma_start __P((void*, int, int, int));
 +void pciide_dma_start __P((void*, int, int));
  int  pciide_dma_finish __P((void*, int, int, int));
  void pciide_print_modes __P((struct pciide_channel *));

 @@ -865,13 +865,15 @@
  	bus_space_write_1(sc->sc_dma_iot, sc->sc_dma_ioh,
  	    IDEDMA_CMD + IDEDMA_SCH_OFFSET * channel,
  	    (flags & WDC_DMA_READ) ? IDEDMA_CMD_WRITE: 0);
 +	/* remember flags */
 +	dma_maps->dma_flags = flags;
  	return 0;
  }

  void
 -pciide_dma_start(v, channel, drive, flags)
 +pciide_dma_start(v, channel, drive)
  	void *v;
 -	int channel, drive, flags;
 +	int channel, drive;
  {
  	struct pciide_softc *sc = v;

 @@ -883,28 +885,25 @@
  }

  int
 -pciide_dma_finish(v, channel, drive, flags)
 +pciide_dma_finish(v, channel, drive, force)
  	void *v;
  	int channel, drive;
 -	int flags;
 +	int force;
  {
  	struct pciide_softc *sc = v;
  	u_int8_t status;
 +	int error = 0;
  	struct pciide_dma_maps *dma_maps =
  	    &sc->pciide_channels[channel].dma_maps[drive];

 -	/* Unload the map of the data buffer */
 -	bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, 0,
 -	    dma_maps->dmamap_xfer->dm_mapsize,
 -	    (flags & WDC_DMA_READ) ?
 -	    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 -	bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer);
 -
  	status = bus_space_read_1(sc->sc_dma_iot, sc->sc_dma_ioh,
  	    IDEDMA_CTL + IDEDMA_SCH_OFFSET * channel);
  	WDCDEBUG_PRINT(("pciide_dma_finish: status 0x%x\n", status),
  	    DEBUG_XFERS);

 +	if (force == 0 && (status & IDEDMA_CTL_INTR) == 0)
 +		return WDC_DMAST_NOIRQ;
 +
  	/* stop DMA channel */
  	bus_space_write_1(sc->sc_dma_iot, sc->sc_dma_ioh,
  	    IDEDMA_CMD + IDEDMA_SCH_OFFSET * channel,
 @@ -916,24 +915,31 @@
  	    IDEDMA_CTL + IDEDMA_SCH_OFFSET * channel,
  	    status);

 +	/* Unload the map of the data buffer */
 +	bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, 0,
 +	    dma_maps->dmamap_xfer->dm_mapsize,
 +	    (dma_maps->dma_flags & WDC_DMA_READ) ?
 +	    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 +	bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer);
 +
  	if ((status & IDEDMA_CTL_ERR) != 0) {
  		printf("%s:%d:%d: bus-master DMA error: status=0x%x\n",
  		    sc->sc_wdcdev.sc_dev.dv_xname, channel, drive, status);
 -		return -1;
 +		error |= WDC_DMAST_ERR;
  	}

 -	if ((flags & WDC_DMA_POLL) == 0 && (status & IDEDMA_CTL_INTR) == 0) {
 +	if ((status & IDEDMA_CTL_INTR) == 0) {
  		printf("%s:%d:%d: bus-master DMA error: missing interrupt, "
  		    "status=0x%x\n", sc->sc_wdcdev.sc_dev.dv_xname, channel,
  		    drive, status);
 -		return -1;
 +		error |= WDC_DMAST_NOIRQ;
  	}

  	if ((status & IDEDMA_CTL_ACT) != 0) {
  		/* data underrun, may be a valid condition for ATAPI */
 -		return 1;
 +		error |= WDC_DMAST_UNDER;
  	}
 -	return 0;
 +	return error;
  }

  /* some common code used by several chip_map */
 Index: pci/pciidevar.h
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/pci/pciidevar.h,v
 retrieving revision 1.3
 diff -u -r1.3 pciidevar.h
 --- pciidevar.h	1999/11/13 13:40:29	1.3
 +++ pciidevar.h	2000/03/26 16:19:45
 @@ -67,6 +67,7 @@
  			bus_dmamap_t    dmamap_table;
  			struct idedma_table *dma_table;
  			bus_dmamap_t    dmamap_xfer;
 +			int dma_flags;
  		} dma_maps[2];
  	} pciide_channels[PCIIDE_NUM_CHANNELS];
  };
 Index: scsipi/atapi_wdc.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/scsipi/atapi_wdc.c,v
 retrieving revision 1.32
 diff -u -r1.32 atapi_wdc.c
 --- atapi_wdc.c	2000/03/23 07:01:43	1.32
 +++ atapi_wdc.c	2000/03/26 16:19:45
 @@ -343,6 +343,10 @@
  		while ((sc_xfer->xs_status & XS_STS_DONE) == 0) {
  			/* Wait for at last 400ns for status bit to be valid */
  			DELAY(1);
 +			if (chp->ch_flags & WDCF_DMA_WAIT) {
 +				wdc_dmawait(chp, xfer, sc_xfer->timeout);
 +				chp->ch_flags &= ~WDCF_DMA_WAIT;
 +			}
  			wdc_atapi_intr(chp, xfer, 0);
  		}
  	}
 @@ -357,7 +361,7 @@
  	struct scsipi_xfer *sc_xfer = xfer->cmd;
  	struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
  	int len, phase, i, retries=0;
 -	int ire, dma_err = 0;
 +	int ire;
  	int dma_flags = 0;
  	struct scsipi_generic _cmd_reqsense;
  	struct scsipi_sense *cmd_reqsense =
 @@ -394,15 +398,19 @@
  		printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip=%d\n",
  		    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
  		    xfer->c_bcount, xfer->c_skip);
 -		if (xfer->c_flags & C_DMA)
 +		if (xfer->c_flags & C_DMA) {
 +			printf("ata_dmaerr1\n");
  			ata_dmaerr(drvp);
 +		}
  		sc_xfer->error = XS_TIMEOUT;
  		wdc_atapi_reset(chp, xfer);
  		return 1;
  	}
  	/* If we missed an IRQ and were using DMA, flag it as a DMA error */
 -	if ((xfer->c_flags & C_TIMEOU) && (xfer->c_flags & C_DMA))
 +	if ((xfer->c_flags & C_TIMEOU) && (xfer->c_flags & C_DMA)) {
 +		printf("ata_dmaerr2\n");
  		ata_dmaerr(drvp);
 +	}
  	/* 
  	 * if the request sense command was aborted, report the short sense
  	 * previously recorded, else continue normal processing
 @@ -418,12 +426,9 @@
  		return 1;
  	}

 -	if (xfer->c_flags & C_DMA) {
 +	if (xfer->c_flags & C_DMA)
  		dma_flags = ((sc_xfer->xs_control & XS_CTL_DATA_IN) ||
  		    (xfer->c_flags & C_SENSE)) ?  WDC_DMA_READ : 0;
 -		dma_flags |= sc_xfer->xs_control & XS_CTL_POLL ?
 -		    WDC_DMA_POLL : 0;
 -	}
  again:
  	len = bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_cyl_lo) +
  	    256 * bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_cyl_hi);
 @@ -483,7 +488,8 @@
  		/* Start the DMA channel if necessary */
  		if (xfer->c_flags & C_DMA) {
  			(*chp->wdc->dma_start)(chp->wdc->dma_arg,
 -			    chp->channel, xfer->drive, dma_flags);
 +			    chp->channel, xfer->drive);
 +			chp->ch_flags |= WDCF_DMA_WAIT;
  		}

  		if ((sc_xfer->xs_control & XS_CTL_POLL) == 0) {
 @@ -498,8 +504,7 @@
  		    (xfer->c_flags & C_DMA) != 0) {
  			printf("wdc_atapi_intr: bad data phase DATAOUT\n");
  			if (xfer->c_flags & C_DMA) {
 -				(*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 -				    chp->channel, xfer->drive, dma_flags);
 +				printf("ata_dmaerr3\n");
  				ata_dmaerr(drvp);
  			}
  			sc_xfer->error = XS_TIMEOUT;
 @@ -576,8 +581,7 @@
  		    (xfer->c_flags & C_DMA) != 0) {
  			printf("wdc_atapi_intr: bad data phase DATAIN\n");
  			if (xfer->c_flags & C_DMA) {
 -				(*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 -				    chp->channel, xfer->drive, dma_flags);
 +				printf("ata_dmaerr4\n");
  				ata_dmaerr(drvp);
  			}
  			sc_xfer->error = XS_TIMEOUT;
 @@ -649,8 +653,6 @@
  		WDCDEBUG_PRINT(("PHASE_COMPLETED\n"), DEBUG_INTR);
  		/* turn off DMA channel */
  		if (xfer->c_flags & C_DMA) {
 -			dma_err = (*chp->wdc->dma_finish)(chp->wdc->dma_arg,
 -			    chp->channel, xfer->drive, dma_flags);
  			if (xfer->c_flags & C_SENSE)
  				xfer->c_bcount -=
  				    sizeof(sc_xfer->sense.scsi_sense);
 @@ -658,13 +660,18 @@
  				xfer->c_bcount -= sc_xfer->datalen;
  		}
  		if (xfer->c_flags & C_SENSE) {
 -			if ((chp->ch_status & WDCS_ERR) || dma_err < 0) {
 +			if ((chp->ch_status & WDCS_ERR) ||
 +			    (chp->wdc->dma_status &
 +				(WDC_DMAST_NOIRQ | WDC_DMAST_ERR))) {
  				/*
  				 * request sense failed ! it's not suppossed
  				 * to be possible
  				 */
 -				if (xfer->c_flags & C_DMA)
 +				if (xfer->c_flags & C_DMA) {
 +					printf("ata_dmaerr5 %x %x %d\n",
 +					    chp->ch_status, chp->ch_error, chp->wdc->dma_status);
  					ata_dmaerr(drvp);
 +				}
  				sc_xfer->error = XS_RESET;
  				wdc_atapi_reset(chp, xfer);
  				return (1);
 @@ -700,7 +707,9 @@
  					wdc_atapi_start(chp, xfer);
  					return 1;
  				}
 -			} else if (dma_err < 0) {
 +			} else if (chp->wdc->dma_status &
 +			    (WDC_DMAST_NOIRQ | WDC_DMAST_ERR)) {
 +				printf("ata_dmaerr6\n");
  				ata_dmaerr(drvp);
  				sc_xfer->error = XS_RESET;
  				wdc_atapi_reset(chp, xfer);
 @@ -733,8 +742,10 @@
  			sc_xfer->error = XS_SHORTSENSE;
  			sc_xfer->sense.atapi_sense = chp->ch_error;
  		} else {
 -			if (xfer->c_flags & C_DMA)
 +			if (xfer->c_flags & C_DMA) {
 +				printf("ata_dmaerr7\n");
  				ata_dmaerr(drvp);
 +			}
  			sc_xfer->error = XS_RESET;
  			wdc_atapi_reset(chp, xfer);
  			return (1);

 --n8g4imXOkfNTN/H1--

From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570 
Date: Mon, 27 Mar 2000 07:54:18 +0900

 >Hi,
 >I've done some changes that may impact the problem: now the IDE driver
 >stops the DMA engine before reading the drive's status (the ide dma specs
 >says nothing about this but the PIIX4 data sheed gives this order).
 >Could you try the attached patch ?
 >I've compiled 2 generic kernels:
 >ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd
 >and
 >ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd-com0
 >
 >The first one is a standart GENERIC kernel (with my changes) and the later
 >is GENERIC with
 >options        "CONSDEVNAME=\"com\"",CONADDR=0x2f8,CONSPEED=57600
 >and
 >options        CONS_OVERRIDE

 	Thanks, will be able to test it tonight.

 itojun

From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570 
Date: Mon, 27 Mar 2000 23:26:31 +0900

 >Hi,
 >I've done some changes that may impact the problem: now the IDE driver
 >stops the DMA engine before reading the drive's status (the ide dma specs
 >says nothing about this but the PIIX4 data sheed gives this order).
 >Could you try the attached patch ?
 >I've compiled 2 generic kernels:
 >ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd
 >and
 >ftp://ftp.antioche.eu.org//pub/bouyer/tmp/netbsd-com0
 >
 >The first one is a standart GENERIC kernel (with my changes) and the later
 >is GENERIC with
 >options        "CONSDEVNAME=\"com\"",CONADDR=0x2f8,CONSPEED=57600
 >and
 >options        CONS_OVERRIDE

 	I stlil experience hangup with the patched tree.  The hangup symptom
 	looks to be very much the same.  Sorry I have almost no idea about
 	pciide internals so it makes it hard for me to track it down myself...

 	I have no crossover cable right now.  will send more diagnostics
 	later.  Also I should look at BIOS interference more closely.

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Tue, 28 Mar 2000 19:22:01 +0200

 On Mon, Mar 27, 2000 at 11:26:31PM +0900, Jun-ichiro itojun Hagino wrote:
 > 	I stlil experience hangup with the patched tree.  The hangup symptom
 > 	looks to be very much the same.  Sorry I have almost no idea about
 > 	pciide internals so it makes it hard for me to track it down myself...
 > 
 > 	I have no crossover cable right now.  will send more diagnostics
 > 	later.  Also I should look at BIOS interference more closely.

 Maybe you could single-step in ddb until it hangs ?
 You can set a breakpoint at wdctimeout() and step from here.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sat, 01 Jul 2000 09:40:55 +0900

 	the problem still persists on 1.5B.  I have tested this on IBM
 	ThinkPad T20 (Mobile pentium III) and it happened too.

 	an openbsd guy had similar symptom, as presented in:
 	http://www.geocrawler.com/archives/3/261/1999/10/0/2745536/ 
 	in his case, when he disabled secondary IDE port, the problem went
 	away (IIRC).  for me, it is not possible due to BIOS restriction.
 	T20 has cdrom on wdc1, the problem did not change even if i remove
 	cdrom drive from T20 for testing.

 	sorry that i supply insufficient information.  if you are in tokyo
 	i would give you a direct access to my machines...

 itojun


 --- here's an dmesg output with pciide disabled.
 NetBSD 1.5B (STARFRUIT) #2: Sat Jul  1 05:00:58 JST 2000
     itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT
 cpu0: family 6 model 8 step 3
 cpu0: Intel Pentium III (E) (686-class)
 total memory = 127 MB
 avail memory = 113 MB
 using 1658 buffers containing 6632 KB of memory
 BIOS32 rev. 0 found at 0xfd820
 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: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 vga1 at pci1 dev 0 function 0: S3 Savage/IX+MV (rev. 0x11)
 wsdisplay0 at vga1: console (80x25, vt100 emulation)
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 0 not configured
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 1 not configured
 fxp0 at pci0 dev 3 function 0: Intel i82557 Ethernet, rev 9
 fxp0: interrupting at irq 11
 fxp0: Ethernet address 00:90:27:96:1c:e1, 10/100 Mb/s
 inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 4
 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 Xircom product 0x000c (serial communications, interface 0x02) at pci0 dev 3 function 1 not configured
 clcs0 at pci0 dev 5 function 0: Cirrus Logic CS4280 CrystalClear Audio Interface (rev. 0x01)
 clcs0: interrupting at irq 11
 clcs0: CRY20 codec; headphone, 20 bit DAC, 18 bit ADC, Spatializer 3D
 clcs0: AC97 read fail (VSTS==0) for add=0x1a
 audio0 at clcs0: full duplex, independent
 pcib0 at pci0 dev 7 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 Intel 82371AB IDE controller (PIIX4) (IDE mass storage, interface 0x80, revision 0x01) at pci0 dev 7 function 1 not configured
 uhci0 at pci0 dev 7 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 11
 usb0 at uhci0: USB revision 1.0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x03) at pci0 dev 7 function 3 not configured
 isa0 at pcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard, using wsdisplay0
 pms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 wsmouse0 at pms0 mux 0
 wdc0 at isa0 port 0x1f0-0x1f7 irq 14
 wd0 at wdc0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 wdc1 at isa0 port 0x170-0x177 irq 15
 atapibus0 at wdc1 channel 0
 cd0 at atapibus0 drive 0: <TOSHIBA DVD-ROM SD-C2302, 3000007184, 1125> type 5 cdrom removable
 cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcic0: controller 1 (Intel 82365SL Revision 1) has no sockets
 pcmcia0 at pcic0 controller 0 socket 0
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 apm0 at mainbus0: Power Management spec V1.2
 biomask efed netmask efed ttymask ffef
 pcic0: controller 0 detecting irqs with mask 0xdeb8:..3..5..7..9..10
 pcic0: using irq 3 for socket events
 IPsec: Initialized Security Association Processing.
 com3 at pcmcia0 function 0 port 0x2f8-0x2ff: serial device
 com3: ns16550a, working fifo
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)
 wsmux1: connecting to wsdisplay0
 ugen0 at uhub0 port 1
 ugen0: vendor 0x0a16 product 0x1111, rev 1.10/1.00, addr 2

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sun, 2 Jul 2000 13:45:00 +0200

 On Sat, Jul 01, 2000 at 09:40:55AM +0900, itojun@iijlab.net wrote:
 > 	the problem still persists on 1.5B.  I have tested this on IBM
 > 	ThinkPad T20 (Mobile pentium III) and it happened too.

 Ok, I was about to ask you to try again :)

 > 
 > 	an openbsd guy had similar symptom, as presented in:

 Not surprising, it's almost the same code :)

 > 	http://www.geocrawler.com/archives/3/261/1999/10/0/2745536/ 
 > 	in his case, when he disabled secondary IDE port, the problem went
 > 	away (IIRC).  for me, it is not possible due to BIOS restriction.
 > 	T20 has cdrom on wdc1, the problem did not change even if i remove
 > 	cdrom drive from T20 for testing.
 > 
 > 	sorry that i supply insufficient information.  if you are in tokyo
 > 	i would give you a direct access to my machines...

 Well, I'm not sure I can afford such a long trip, just to debug this.
 Any plans to come in France ? :)
 I have access to a thinkpad of some sort at work, I'll try on it. But I fear
 this is completely depedant of the HD.

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Sun, 02 Jul 2000 22:04:54 +0900

 >> 	http://www.geocrawler.com/archives/3/261/1999/10/0/2745536/ 
 >> 	in his case, when he disabled secondary IDE port, the problem went
 >> 	away (IIRC).  for me, it is not possible due to BIOS restriction.
 >> 	T20 has cdrom on wdc1, the problem did not change even if i remove
 >> 	cdrom drive from T20 for testing.
 >> 
 >> 	sorry that i supply insufficient information.  if you are in tokyo
 >> 	i would give you a direct access to my machines...
 >Well, I'm not sure I can afford such a long trip, just to debug this.
 >Any plans to come in France ? :)
 >I have access to a thinkpad of some sort at work, I'll try on it. But I fear
 >this is completely depedant of the HD.

 	you mean this is issue with the disk, not the controller?
 	in that case could you add my disk to quirk table so that it will not
 	be probed as pciide-ready?

 	also, I'll try to test this on different it on HD.

 itojun

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Mon, 03 Jul 2000 06:58:11 +0900

 >> 	in his case, when he disabled secondary IDE port, the problem went
 >> 	away (IIRC).  for me, it is not possible due to BIOS restriction.
 >> 	T20 has cdrom on wdc1, the problem did not change even if i remove
 >> 	cdrom drive from T20 for testing.
 >> 
 >> 	sorry that i supply insufficient information.  if you are in tokyo
 >> 	i would give you a direct access to my machines...
 >
 >Well, I'm not sure I can afford such a long trip, just to debug this.
 >Any plans to come in France ? :)
 >I have access to a thinkpad of some sort at work, I'll try on it. But I fear
 >this is completely depedant of the HD.

 	I now see.  The drive chokes on both ThinkPad 570 and T20:

 >itojun[starfruit:~/NetBSD/pkgsrc/security/openssh] uname -a
 >NetBSD starfruit.itojun.org 1.5B NetBSD 1.5B (STARFRUIT) #16: Mon Jul  3 06:29:52 JST 2000     itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT i386
 >itojun[starfruit:~/NetBSD/pkgsrc/security/openssh] dmesg|grep wd
 >wdc0 at isa0 port 0x1f0-0x1f7 irq 14
 >wd0 at wdc0 channel 0 drive 0: <IBM-DBCA-206480>
 >wd0: drive supports 16-sector pio transfers, lba addressing
 >wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 >wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 >wdc1 at isa0 port 0x170-0x177 irq 15

 	The drive does not, at least on ThinkPad 570:

 >% uname -a
 >NetBSD mango.itojun.org 1.4Z NetBSD 1.4Z (GENERIC) #12: Sat May 27 16:55:41 PDT 2000     root@swinger:/u1/snapshots/src/sys/arch/i386/compile/GENERIC i386
 >% /sbin/dmesg|grep wd
 >wd0 at pciide0 channel 0 drive 0: <IBM-DARA-212000>
 >wd0: drive supports 16-sector pio transfers, lba addressing
 >wd0: 11509 MB, 16383 cyl, 15 head, 63 sec, 512 bytes/sect x 23572080 sectors
 >wd0: 32-bit data port
 >wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 4
 >wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)

 itojun

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>, gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Mon, 03 Jul 2000 12:09:27 +0900

 >	I now see.  The drive chokes on both ThinkPad 570 and T20:
 >
 >>itojun[starfruit:~/NetBSD/pkgsrc/security/openssh] uname -a
 >>NetBSD starfruit.itojun.org 1.5B NetBSD 1.5B (STARFRUIT) #16: Mon Jul  3 06:29:52 JST 2000     itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT i386
 >>itojun[starfruit:~/NetBSD/pkgsrc/security/openssh] dmesg|grep wd
 >>wdc0 at isa0 port 0x1f0-0x1f7 irq 14
 >>wd0 at wdc0 channel 0 drive 0: <IBM-DBCA-206480>
 >>wd0: drive supports 16-sector pio transfers, lba addressing
 >>wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 >>wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 >>wdc1 at isa0 port 0x170-0x177 irq 15

 	btw, the same drive works with pciide code in 1.4.2.  I suspect
 	there's some logic change in pciide (last time I diff'ed, there are
 	many differences due to additional chip suport) and specific drive
 	chokes with the change.

 itojun



 itojun[lychee:~/k/kame/netbsd] uname -a
 NetBSD lychee.itojun.org 1.4.2 NetBSD 1.4.2 (LYCHEE.v6) #1003: Mon Jul  3 10:24:59 JST 2000     itojun@lychee.itojun.org:/export/home/itojun/k/kame/netbsd/sys/arch/i386/compile/LYCHEE.v6 i386
 itojun[lychee:~/k/kame/netbsd] dmesg | egrep '(wd|pciide)'
 pciide0 at pci0 dev 6 function 1: Intel 82371AB IDE controller (PIIX4)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 wd0 at pciide0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: 32-bits data port
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 pciide0: primary channel interrupting at irq 14
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
 boot device: wd0
 root on wd0a dumps on wd0b

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Mon, 3 Jul 2000 15:15:47 +0200

 On Mon, Jul 03, 2000 at 12:09:27PM +0900, itojun@iijlab.net wrote:
 > 	btw, the same drive works with pciide code in 1.4.2.  I suspect
 > 	there's some logic change in pciide (last time I diff'ed, there are
 > 	many differences due to additional chip suport) and specific drive
 > 	chokes with the change.

 Are you sure this is a plain 1.4.2 kernel ? I though the problem was due
 to changes in ata_wdc.c 1.20, which has been pulled up to the release branch
 as 1.19.2.1 (1.4.2 should have ata_wdc.c 1.19.2.2)

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Mon, 03 Jul 2000 22:18:29 +0900

 >> 	btw, the same drive works with pciide code in 1.4.2.  I suspect
 >> 	there's some logic change in pciide (last time I diff'ed, there are
 >> 	many differences due to additional chip suport) and specific drive
 >> 	chokes with the change.
 >Are you sure this is a plain 1.4.2 kernel ? I though the problem was due
 >to changes in ata_wdc.c 1.20, which has been pulled up to the release branch
 >as 1.19.2.1 (1.4.2 should have ata_wdc.c 1.19.2.2)

 	i'm using kame-ready 1.4.2. and ata_wdc.c is 1.19.2.2:
 >/*      $NetBSD: ata_wdc.c,v 1.19.2.2 2000/01/23 12:26:01 he Exp $      */

 	i'll make it sure later by booting from kernel on ftp site.

 itojun

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>, gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: port-i386/9039: pciide misbehaves on ThinkPad 570
Date: Tue, 04 Jul 2000 00:33:27 +0900

 >>> 	btw, the same drive works with pciide code in 1.4.2.  I suspect
 >>> 	there's some logic change in pciide (last time I diff'ed, there are
 >>> 	many differences due to additional chip suport) and specific drive
 >>> 	chokes with the change.
 >>Are you sure this is a plain 1.4.2 kernel ? I though the problem was due
 >>to changes in ata_wdc.c 1.20, which has been pulled up to the release branch
 >>as 1.19.2.1 (1.4.2 should have ata_wdc.c 1.19.2.2)
 >	i'm using kame-ready 1.4.2. and ata_wdc.c is 1.19.2.2:
 >>/*      $NetBSD: ata_wdc.c,v 1.19.2.2 2000/01/23 12:26:01 he Exp $      */
 >	i'll make it sure later by booting from kernel on ftp site.

 	here's dmesg output from the following kernel.  it works just fine.

 ftp://ftp.iij.ad.jp/pub/NetBSD/NetBSD-1.4.2/i386/binary/sets/kern.tgz
 MD5 (kern.tgz) = a66d12f8e16a356f61938e5ec329663c

 itojun

 NetBSD 1.4.2 (GENERIC) #3: Wed Mar 15 23:41:54 PST 2000
     toddpw@vader.toddpw.net:/usr/src/sys/arch/i386/compile/GENERIC
 cpu0: family 6 model 6 step a
 cpu0: Intel Pentium II (Celeron) (686-class)
 real mem  = 66650112
 avail mem = 58204160
 using 839 buffers containing 3436544 bytes of memory
 mainbus0 (root)
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o enabled, memory enabled
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o enabled, memory enabled
 vga1 at pci1 dev 0 function 0: Neomagic product 0x0005 (rev. 0x20)
 wsdisplay0 at vga1: console (80x25, vt100 emulation)
 Texas Instruments product 0xac1b (CardBus bridge, revision 0x03) at pci0 dev 2 function 0 not configured
 Texas Instruments product 0xac1b (CardBus bridge, revision 0x03) at pci0 dev 2 function 1 not configured
 Cirrus Logic CS4280 CrystalClear Audio Interface (audio multimedia, revision 0x01) at pci0 dev 5 function 0 not configured
 pcib0 at pci0 dev 6 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 pciide0 at pci0 dev 6 function 1: Intel 82371AB IDE controller (PIIX4)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 wd0 at pciide0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: 32-bits data port
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 pciide0: primary channel interrupting at irq 14
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
 uhci0 at pci0 dev 6 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 11
 uhci0: USB version 1.0
 usb0 at uhci0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 6 function 3 not configured
 Fujitsu Limited (4th PCI Vendor ID) product 0x0448 (miscellaneous communications, revision 0x01) at pci0 dev 7 function 0 not configured
 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
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard
 opms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: <PC speaker>
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xd3fff: using irq 5
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcmcia0 at pcic0 controller 0 socket 0
 pcmcia1 at pcic0 controller 0 socket 1
 ep1 at pcmcia1 function 0 port 0x330-0x33f: 3Com 3c589 10Mbps Ethernet
 ep1: address 00:50:da:87:4b:be, 8KB byte-wide FIFO, 5:3 Rx:Tx split
 ep1: 10baseT, 10base5, 10base2 (default 10baseT)
 isapnp0: no ISA Plug 'n Play devices found
 biomask 4840 netmask 4840 ttymask 5862
 wscons: wskbd0 glued to wsdisplay0 (console)
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)


From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: gnats-bugs@gnats.netbsd.org
Cc: bouyer@antioche.eu.org
Subject: Re: port-i386/9039
Date: Sat, 19 Aug 2000 16:37:58 +0900

 	just to refresh memory for myself, here's summary:
 	- if we use Ultra-DMA mode 2 (or 1?), system locks up after lost
 	  interrupt after "DMA READ (IDE command 0xc8)".
 	- The symptom happens with the following condition:
 		IBM ThinkPad 570, Pentium II 300MHz
 		IBM ThinkPad 570, Celeron 350MHz
 		IBM T20, Pentium III 700MHz
 	  AND drive is IBM-DBCA-206480
 	- started from 1.4.2, or somewhere between 1.4[A-Z].  1.4.1 was fine
 	- if we do not use pciide, the symptom does not happen
 	- if we turn off Ultra-DMA using wd* flags (like 0x0f00), the symptom
 	  does not happen
 	- IBM webservers has no caveat/erratta for the drive.

 	i'm wondering what i can do with lost interrupt recovery logic.

 itojun


 --- okay case (pciide is turned off)
 NetBSD 1.5E (STARFRUIT) #99: Sat Aug 19 11:17:09 JST 2000
     itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT
 cpu0: Intel Pentium III (E) (686-class)
 total memory = 127 MB
 avail memory = 113 MB
 using 1658 buffers containing 6632 KB of memory
 BIOS32 rev. 0 found at 0xfd820
 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: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 vga1 at pci1 dev 0 function 0: S3 Savage/IX+MV (rev. 0x11)
 wsdisplay0 at vga1: console (80x25, vt100 emulation)
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 0 not configured
 Texas Instruments PCI1450 PCI-CardBus Bridge (CardBus bridge, revision 0x03) at pci0 dev 2 function 1 not configured
 fxp0 at pci0 dev 3 function 0: Intel i82557 Ethernet, rev 9
 fxp0: interrupting at irq 11
 fxp0: Ethernet address 00:90:27:96:1c:e1, 10/100 Mb/s
 inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 4
 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 Xircom product 0x000c (serial communications, interface 0x02) at pci0 dev 3 function 1 not configured
 clcs0 at pci0 dev 5 function 0: Cirrus Logic CS4280 CrystalClear Audio Interface (rev. 0x01)
 clcs0: interrupting at irq 11
 clcs0: CRY20 codec; headphone, 20 bit DAC, 18 bit ADC, Spatializer 3D
 audio0 at clcs0: full duplex, independent
 midi0 at clcs0: CS4280 MIDI UART
 pcib0 at pci0 dev 7 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 Intel 82371AB IDE controller (PIIX4) (IDE mass storage, interface 0x80, revision 0x01) at pci0 dev 7 function 1 not configured
 uhci0 at pci0 dev 7 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 11
 usb0 at uhci0: USB revision 1.0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x03) at pci0 dev 7 function 3 not configured
 isa0 at pcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard, using wsdisplay0
 pms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 wsmouse0 at pms0 mux 0
 wdc0 at isa0 port 0x1f0-0x1f7 irq 14
 wd0 at wdc0 channel 0 drive 0: <IBM-DBCA-206480>
 wd0: drive supports 16-sector pio transfers, lba addressing
 wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 wdc1 at isa0 port 0x170-0x177 irq 15
 lpt2 at isa0 port 0x3bc-0x3bf: polled
 pcppi0 at isa0 port 0x61
 midi1 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcic0: controller 1 (Intel 82365SL Revision 1) has no sockets
 pcmcia0 at pcic0 controller 0 socket 0
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 apm0 at mainbus0: Power Management spec V1.2
 biomask efed netmask efed ttymask ffef
 pcic0: controller 0 detecting irqs with mask 0xde98:..3..7..9..10
 pcic0: using irq 3 for socket events
 IPsec: Initialized Security Association Processing.
 wi0 at pcmcia0 function 0 port 0x400-0x43f
 wi0: address 00:60:1d:f1:86:61
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)
 wsmux1: connecting to wsdisplay0

From: itojun@iijlab.net
To: gnats-bugs@gnats.netbsd.org, bouyer@antioche.eu.org
Cc:  
Subject: Re: port-i386/9039
Date: Sun, 20 Aug 2000 21:56:39 +0900

 	this is the exact location where it locks up.
 	call chain is:

 	sys/dev/ic/wdc.c:wdctimeout()
 		xfer->c_intr(chp, xfer, 1);
 	sys/dev/ic/pci/ata_wdc.c:wdc_ata_bio_intr()
 		near /* Ack interrupt done by wait_for_unbusy */, calls
 		wait_for_unbusy()
 	sys/dev/ic/wdc.c:wdcwait()
 		locks up with first bus_space_read_1() of wd_status.
 		timeout == time == 0.

 	one question for ata_wdc.c; is it okay to try to ACK the interrupt,
 	when we have no interrupt?

 	also it seems slightly timing-related.  when i put bunch of printf()
 	for debugging, sometimes (like 1 time in 10 times) it works fine.

 itojun


 - sys/dev/ic/wdc.c
 /*
  * Wait for a drive to be !BSY, and have mask in its status register.
  * return -1 for a timeout after "timeout" ms.
  */
 int
 wdcwait(chp, mask, bits, timeout)
 	struct channel_softc *chp;
 	int mask, bits, timeout;
 {
 	u_char status;
 	int time = 0;
 #ifdef WDCNDELAY_DEBUG
 	extern int cold;
 #endif

 	WDCDEBUG_PRINT(("wdcwait %s:%d\n", chp->wdc ?chp->wdc->sc_dev.dv_xname
 	    :"none", chp->channel), DEBUG_STATUS);
 	chp->ch_error = 0;

 	timeout = timeout * 1000 / WDCDELAY; /* delay uses microseconds */

 	for (;;) {
 		/* XXXX on lockup, the following line never returns XXXX */
 		chp->ch_status = status =
 		    bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_status);
 		/* XXXX so we never reach here XXX */
 		if ((status & WDCS_BSY) == 0 && (status & mask) == bits)
 			break;

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Wed, 23 Aug 2000 17:59:56 +0200

 On Sun, Aug 20, 2000 at 09:56:39PM +0900, itojun@iijlab.net wrote:
 > 	this is the exact location where it locks up.
 > 	call chain is:
 > 
 > 	sys/dev/ic/wdc.c:wdctimeout()
 > 		xfer->c_intr(chp, xfer, 1);
 > 	sys/dev/ic/pci/ata_wdc.c:wdc_ata_bio_intr()
 > 		near /* Ack interrupt done by wait_for_unbusy */, calls
 > 		wait_for_unbusy()
 > 	sys/dev/ic/wdc.c:wdcwait()
 > 		locks up with first bus_space_read_1() of wd_status.
 > 		timeout == time == 0.
 > 
 > 	one question for ata_wdc.c; is it okay to try to ACK the interrupt,
 > 	when we have no interrupt?

 It should. It's not safe to read the others drive registers when the drive is
 busy, but we should be able to read status (which tells us if the drive is
 busy or not).
 I'm not sure if it's the disk or the controllers which locks up hard
 the machine here.

 > 
 > 	also it seems slightly timing-related.  when i put bunch of printf()
 > 	for debugging, sometimes (like 1 time in 10 times) it works fine.

 I believe it's timing related too.
 When it hangs, does it hang at the very first xfer ?
 That is, either is hangs at the first xfer or it works without problems ?
 Also, when it works, does it go though a timeout/downgrade, or does it
 use DMA properly ?

 I compiled 3 1.4.x kernel, available at ftp://antioche.lip6.fr/pub/bouyer/tmp/
 (there's all ELF because I compiled on a -current system but this should'nt
 be a problem). I started from netbsd-1-4-PATCH001 and integrated IDE changes
 incrementally. Could you try them and tell me which one works, and which ones
 don't ?

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039 
Date: Thu, 24 Aug 2000 09:44:16 +0900

 >> 	one question for ata_wdc.c; is it okay to try to ACK the interrupt,
 >> 	when we have no interrupt?
 >It should. It's not safe to read the others drive registers when the drive is
 >busy, but we should be able to read status (which tells us if the drive is
 >busy or not).

 	I see.

 >I'm not sure if it's the disk or the controllers which locks up hard
 >the machine here.

 	I'm not sure about it too.

 >> 	also it seems slightly timing-related.  when i put bunch of printf()
 >> 	for debugging, sometimes (like 1 time in 10 times) it works fine.
 >I believe it's timing related too.
 >When it hangs, does it hang at the very first xfer ?
 >That is, either is hangs at the first xfer or it works without problems ?
 >Also, when it works, does it go though a timeout/downgrade, or does it
 >use DMA properly ?

 	while i was testing it, I have never seen the timeout -> downgrade
 	message.  so I suppose delays made Ultra DMA mode 2 to work properly.

 >I compiled 3 1.4.x kernel, available at ftp://antioche.lip6.fr/pub/bouyer/tmp/
 >(there's all ELF because I compiled on a -current system but this should'nt
 >be a problem). I started from netbsd-1-4-PATCH001 and integrated IDE changes
 >incrementally. Could you try them and tell me which one works, and which ones
 >don't ?

 	i will do that when i go back to tokyo.

 itojun@beijin

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Wed, 30 Aug 2000 01:37:09 +0900

 >> 		near /* Ack interrupt done by wait_for_unbusy */, calls
 >> 		wait_for_unbusy()
 >> 	sys/dev/ic/wdc.c:wdcwait()
 >> 		locks up with first bus_space_read_1() of wd_status.
 >> 		timeout == time == 0.
 >> 
 >> 	one question for ata_wdc.c; is it okay to try to ACK the interrupt,
 >> 	when we have no interrupt?
 >
 >It should. It's not safe to read the others drive registers when the drive is
 >busy, but we should be able to read status (which tells us if the drive is
 >busy or not).
 >I'm not sure if it's the disk or the controllers which locks up hard
 >the machine here.
 >
 >> 
 >> 	also it seems slightly timing-related.  when i put bunch of printf()
 >> 	for debugging, sometimes (like 1 time in 10 times) it works fine.
 >
 >I believe it's timing related too.
 >When it hangs, does it hang at the very first xfer ?
 >That is, either is hangs at the first xfer or it works without problems ?
 >Also, when it works, does it go though a timeout/downgrade, or does it
 >use DMA properly ?
 >
 >I compiled 3 1.4.x kernel, available at ftp://antioche.lip6.fr/pub/bouyer/tmp/
 >(there's all ELF because I compiled on a -current system but this should'nt
 >be a problem). I started from netbsd-1-4-PATCH001 and integrated IDE changes
 >incrementally. Could you try them and tell me which one works, and which ones
 >don't ?

 	sorry for the delay, i've tested those kernels.

 	netbsd-1.4.1.gz: works just fine (*)
 	netbsd-wdc1.66.2.3.gz: works just fine
 	netbsd-wdc1.66.2.6.gz: every time i boot it, it chokes like follows.
 		good thing is that it *sometimes* downgreade to PIO mode 4
 		(the lockup recovery is better than 1.5).
 >wscons: wskbd0 glued to wsdisplay0 (console)
 >pciide0:0:0: lost interrupt
 >	type: ata
 >	c_bcount: 512
 >	c_skip: 0		(30 seconds of lockup here)
 >pciide0:0:0: Bus-Master DMA error: missing interrupt, status=0x21
 >wd0: transfer error, downgrading to Ultra-DMA mode 1
 >wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA 1 (using DMA data transfer)
 >wd0d: DMA error reading fsbn 0(wd0 bn 0: cn 0 tn 0 sn 0), retrying
 >wd0: soft error (corrected)
 >boot device: wd0
 >root on wd0a dumps on wd0b
 >wd0: transfer error, downgrading to PIO mode 4
 >wd0(pciide0:0:0): using PIO mode 4
 >wd0a:  aborted command, interface CRC error reading fsbn 16 of 16-31 (wd0 bn 79; cn 0 tn 1 sn 16), retrying
 >wd0: soft error (corrected)
 >root file system type: ffs

 	so i suspect there's something between 1.66.2.3 and 1.66.2.6.

 	(*) work fine = mount -a -o ro; find / -type f -print

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Fri, 1 Sep 2000 17:47:06 +0200

 On Wed, Aug 30, 2000 at 01:37:09AM +0900, itojun@iijlab.net wrote:
 > 	sorry for the delay, i've tested those kernels.
 > 
 > 	netbsd-1.4.1.gz: works just fine (*)
 > 	netbsd-wdc1.66.2.3.gz: works just fine
 > 	netbsd-wdc1.66.2.6.gz: every time i boot it, it chokes like follows.
 > 		good thing is that it *sometimes* downgreade to PIO mode 4
 > 		(the lockup recovery is better than 1.5).

 Ok, thanks. So it seems that the problem isn't related to the timeout changes
 as I suspected, but something else.
 I've built a new round of kernels, ftp://antioche.lip6.fr/pub/bouyer/tmp/

 Please test again netbsd-wdc1.66.2.3, just to make sure I didn't forget a
 file somewhere. Also, if 1.66.2.4 and 1.66.2.5 works, please try
 1.66.2.6 again.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Sun, 03 Sep 2000 22:29:38 +0900

 >> 	sorry for the delay, i've tested those kernels.
 >> 	netbsd-1.4.1.gz: works just fine (*)
 >> 	netbsd-wdc1.66.2.3.gz: works just fine
 >> 	netbsd-wdc1.66.2.6.gz: every time i boot it, it chokes like follows.
 >> 		good thing is that it *sometimes* downgreade to PIO mode 4
 >> 		(the lockup recovery is better than 1.5).
 >Ok, thanks. So it seems that the problem isn't related to the timeout changes
 >as I suspected, but something else.
 >I've built a new round of kernels, ftp://antioche.lip6.fr/pub/bouyer/tmp/
 >Please test again netbsd-wdc1.66.2.3, just to make sure I didn't forget a
 >file somewhere. Also, if 1.66.2.4 and 1.66.2.5 works, please try
 >1.66.2.6 again.

 	weird.

 	netbsd-wdc1.66.2.3: locks up with the following message, no downgrades
 		pciide0:0:0: lost interrupt
 			type: ata
 			c_bcount: 512
 			c_skip: 0
 	netbsd-wdc1.66.2.6: locks up with the following message, no downgrades

 	i bet other two images will behave the same.  are there any other files
 	you have changed from the prior batch of kernels?

 itojun

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Tue, 5 Sep 2000 15:42:18 +0200

 On Sun, Sep 03, 2000 at 10:29:38PM +0900, itojun@iijlab.net wrote:
 > 	weird.
 > 
 > 	netbsd-wdc1.66.2.3: locks up with the following message, no downgrades
 > 		pciide0:0:0: lost interrupt
 > 			type: ata
 > 			c_bcount: 512
 > 			c_skip: 0
 > 	netbsd-wdc1.66.2.6: locks up with the following message, no downgrades
 > 
 > 	i bet other two images will behave the same.  are there any other files
 > 	you have changed from the prior batch of kernels?

 Should not, but as I worked with CVS and didn't keep the source tree I can't
 tell. I rebuilt a 1.66.2.3 kernel starting from a clean 1.4.1 tree and updating
 the ata/atapi files.
 ftp://antioche.lip6.fr/pub/bouyer/tmp/netbsd-wdc1.66.2.3.gz

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Wed, 06 Sep 2000 00:23:37 +0900

 >On Sun, Sep 03, 2000 at 10:29:38PM +0900, itojun@iijlab.net wrote:
 >> 	weird.
 >> 
 >> 	netbsd-wdc1.66.2.3: locks up with the following message, no downgrades
 >> 		pciide0:0:0: lost interrupt
 >> 			type: ata
 >> 			c_bcount: 512
 >> 			c_skip: 0
 >> 	netbsd-wdc1.66.2.6: locks up with the following message, no downgrades
 >> 
 >> 	i bet other two images will behave the same.  are there any other files
 >> 	you have changed from the prior batch of kernels?
 >
 >Should not, but as I worked with CVS and didn't keep the source tree I can't
 >tell. I rebuilt a 1.66.2.3 kernel starting from a clean 1.4.1 tree and updating
 >the ata/atapi files.
 >ftp://antioche.lip6.fr/pub/bouyer/tmp/netbsd-wdc1.66.2.3.gz

 	the kernel raises page fault at wdcattach+0x67, just afte rprobing
 	pciide0.  could you check?

 itojun


 --
 pciide0 at pci0 dev 7 function 1: Intel 82371AB IDE controller (PIIX4)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatiblity mode
 (DDB)

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Tue, 5 Sep 2000 18:42:32 +0200

 On Wed, Sep 06, 2000 at 12:23:37AM +0900, itojun@iijlab.net wrote:
 > >the ata/atapi files.
 > >ftp://antioche.lip6.fr/pub/bouyer/tmp/netbsd-wdc1.66.2.3.gz
 > 
 > 	the kernel raises page fault at wdcattach+0x67, just afte rprobing
 > 	pciide0.  could you check?

 Ok, looks like not all IDE-related files have been recompiled.
 The new kernel is at the same place. Sorry for the trouble.

 --
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
 --

From: itojun@iijlab.net
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Wed, 06 Sep 2000 01:55:35 +0900

 >> 	the kernel raises page fault at wdcattach+0x67, just afte rprobing
 >> 	pciide0.  could you check?
 >Ok, looks like not all IDE-related files have been recompiled.
 >The new kernel is at the same place. Sorry for the trouble.

 	it locked the machine up, just like before.  i'm now completely
 	confused...  it may be a indication that it is purely timing related.
 -rwxr-xr-x  1 331  wheel  1524954 Sep  5 16:41 netbsd-wdc1.66.2.3.gz

 itojun


 pciide0:0:0: lost interrupt
 	type: atamc_bcount: 512
 	c_skip: 0

From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-i386/9039
Date: Tue, 5 Sep 2000 18:58:29 +0200

 On Wed, Sep 06, 2000 at 01:55:35AM +0900, itojun@iijlab.net wrote:
 > >> 	the kernel raises page fault at wdcattach+0x67, just afte rprobing
 > >> 	pciide0.  could you check?
 > >Ok, looks like not all IDE-related files have been recompiled.
 > >The new kernel is at the same place. Sorry for the trouble.
 > 
 > 	it locked the machine up, just like before.  i'm now completely
 > 	confused...  it may be a indication that it is purely timing related.
 > -rwxr-xr-x  1 331  wheel  1524954 Sep  5 16:41 netbsd-wdc1.66.2.3.gz

 Or that I just messed up something with the first netbsd-wdc1.66.2.3.gz.
 I'll try to do kernels with incremental changes between 1.4.1 and wdc1.66.2.3
 tomorow.

 Thanks !

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: port-i386/9039
Date: Thu, 19 Jul 2001 18:34:11 +0900

 	I got another symptom where pciide fails badly.  with the following 
 	machine (desktop, celeron 300 dual CPU but only one is up),
 	- if I put lmc0 card, pciide dies badly with "lost interrupt"
 	- if I remove lmc0 card, it is okay
 	i guess it is related to pci interrupt routing and such.

 itojun


 ---
 NetBSD 1.5W (PAPAYA) #2: Thu Jul 19 08:59:17 JST 2001
     itojun@papaya.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/PAPAYA
 cpu0: Intel Celeron (Mendocino) (686-class), 300.70 MHz
 cpu0: I-cache 16 KB 32b/line 4-way, D-cache 16 KB 32b/line 2-way
 cpu0: L2 cache 128 KB 32b/line 4-way
 cpu0: features 183fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
 cpu0: features 183fbff<PGE,MCA,CMOV,FGPAT,PSE36,MMX,FXSR>
 total memory = 255 MB
 avail memory = 231 MB
 using 3297 buffers containing 13188 KB of memory
 BIOS32 rev. 0 found at 0xfb3f0
 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: Intel 82443BX Host Bridge/Controller (rev. 0x03)
 ppb0 at pci0 dev 1 function 0: Intel 82443BX AGP Interface (rev. 0x03)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 pcib0 at pci0 dev 7 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 Intel 82371AB IDE controller (PIIX4) (IDE mass storage, interface 0x80, revision 0x01) at pci0 dev 7 function 1 not configured
 uhci0 at pci0 dev 7 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: interrupting at irq 5
 usb0 at uhci0: USB revision 1.0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 7 function 3 not configured
 lmc0 at pci0 dev 11 function 0: Lan Media Corporation T1
 lmc0: pass 2.2, serial 00:60:99:00:24:58, irq 11
 vga1 at pci0 dev 13 function 0: S3 Trio32/64 (rev. 0x00)
 wsdisplay0 at vga1: console (80x25, vt100 emulation)
 de0 at pci0 dev 15 function 0
 de0: interrupting at irq 10
 de0: 21140A [10-100Mb/s] pass 2.2
 de0: address 00:40:05:a7:f0:92
 Triones Technologies HPT366/370 IDE Controller (miscellaneous mass storage, revision 0x01) at pci0 dev 19 function 0 not configured
 Triones Technologies HPT366/370 IDE Controller (miscellaneous mass storage, revision 0x01) at pci0 dev 19 function 1 not configured
 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
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard, using wsdisplay0
 wdc0 at isa0 port 0x1f0-0x1f7 irq 14
 wd0 at wdc0 channel 0 drive 0: <Maxtor 91303D6>
 wd0: drive supports 16-sector PIO transfers, LBA addressing
 wd0: 12427 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 25450992 sectors
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
 wdc1 at isa0 port 0x170-0x177 irq 15
 lpt0 at isa0 port 0x378-0x37b irq 7
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 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
 pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xdffff
 pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
 pcic0: controller 1 (Intel 82365SL Revision 1) has no sockets
 pcmcia0 at pcic0 controller 0 socket 0
 pcmcia1 at pcic0 controller 0 socket 1
 isapnp0: no ISA Plug 'n Play devices found
 biomask f365 netmask ff65 ttymask ffe7
 pcic0: controller 0 detecting irqs with mask 0xdeb8:..9
 pcic0: can't share irq with cards; polling for socket events
 lmc0: Red Alarm
 IPsec: Initialized Security Association Processing.
 boot device: wd0
 root on wd0a dumps on wd0b
 root file system type: ffs
 de0: setting full duplex.
 de0: enabling Full Duplex 100baseTX port
 de0: setting full duplex.
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)
 wsmux1: connecting to wsdisplay0
 lmc0: down

From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: port-i386/9039 
Date: Thu, 19 Jul 2001 19:00:18 +0900

 >	I got another symptom where pciide fails badly.  with the following 
 >	machine (desktop, celeron 300 dual CPU but only one is up),
 >	- if I put lmc0 card, pciide dies badly with "lost interrupt"
 >	- if I remove lmc0 card, it is okay
 >	i guess it is related to pci interrupt routing and such.

 	the previous dmesg was taken with kernel without pciide devices.

 itojun
Responsible-Changed-From-To: port-i386-maintainer->bouyer 
Responsible-Changed-By: bouyer 
Responsible-Changed-When: Mon Apr 7 09:07:16 PDT 2003 
Responsible-Changed-Why:  
I'm responsible for pciide 
State-Changed-From-To: open->feedback 
State-Changed-By: bouyer 
State-Changed-When: Mon Apr 7 09:08:00 PDT 2003 
State-Changed-Why:  
Him, 
this is quite old. Do you know if it's still a problem ? 
State-Changed-From-To: feedback->dead 
State-Changed-By: bouyer 
State-Changed-When: Tue Apr 8 12:24:46 PDT 2003 
State-Changed-Why:  
Hardware not available any more. 
State-Changed-From-To: dead->closed
State-Changed-By: elad@netbsd.org
State-Changed-When: Sat, 07 Oct 2006 19:17:51 +0000
State-Changed-Why:
closing "dead" bugs - tihs category should go away


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.