Re: ATAng problems

From: Bruce Evans <bde_at_zeta.org.au>
Date: Mon, 8 Sep 2003 04:20:22 +1000 (EST)
On Sun, 7 Sep 2003, Scott Lambert wrote:

> I thought I was going to miss out on the ATAng issues...
>
> I use a SanDisk CompactFlash PC Card Adapter to read my digital camera
> pictures.  It worked fine before ATAng.  Now I get:
>
> ata2: spurious interrupt - status=0xff error=0x00 reason=0x00
> ata2: spurious interrupt - status=0xff error=0x00 reason=0x00
> ata2: spurious interrupt - status=0xff error=0x00 reason=0x00
> ata2: spurious interrupt - status=0xff error=0x00 reason=0x00
> ata2: spurious interrupt - status=0xff error=0x00 reason=0x00
> ...
>
> And after transferring some data the machine locks up.

I get endless spurious interrupts at boot time and use the following
fix.

%%%
Index: ata-lowlevel.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-lowlevel.c,v
retrieving revision 1.8
diff -u -2 -r1.8 ata-lowlevel.c
--- ata-lowlevel.c	1 Sep 2003 11:13:21 -0000	1.8
+++ ata-lowlevel.c	1 Sep 2003 18:03:56 -0000
_at__at_ -271,10 +271,15 _at__at_
     struct ata_channel *ch = (struct ata_channel *)data;
     struct ata_request *request = ch->running;
+    static int spurcount;
+    static int spurtotcount;
     int length;

     /* if we dont have a running request shout and ignore this interrupt */
     if (request == NULL) {
-	if (bootverbose) {
-	    printf("ata%d: spurious interrupt - ", device_get_unit(ch->dev));
+	spurcount++;
+	spurtotcount++;
+	if (1 || bootverbose) {
+	    printf("ata%d: %d/%dth spurious interrupt - ",
+		   device_get_unit(ch->dev), spurtotcount, spurcount);
 	    if (request)
 		printf("request OK - ");
_at__at_ -283,4 +288,8 _at__at_
 		   ATA_IDX_INB(ch, ATA_IREASON));
 	}
+	if (spurcount == 10) {
+		(void)ATA_IDX_INB(ch, ATA_STATUS);
+		spurcount = 0;
+	}
 	return;
     }
%%%

More details:
- most of the above is debuggig code.  Only on line near the end that
  reads the status register is necessary.  The debugging code waits for
  10 spurious interrupts before clearing the interrupt.
- the spurious interrupts somehow go away without the above change after
  2 or 3 of them for plain -current, but repeat endlessly with my version
  of -current.  The hardware interrupt is not repeated, but something at
  a level between Xintr*() and ata_highpoint_intr() apparently keeps
  dispatching the interrupt.
- the spurious interrupts only happen on a channel with an atapi slave.
  They don't happen on channels with both slaves and masters or on an
  empty channel.

Some dmesg output with the above fix:

%%%
...
atapci1: <HighPoint HPT366 UDMA66 controller> port 0xbc00-0xbcff,0xb800-0xb803,0xb400-0xb407 irq 11 at device 19.0 on pci0
ithread_add_handler: atapci1: id -1
atapci1: [MPSAFE]
ata2: at 0xb400 on atapci1
ata2: [MPSAFE]
atapci2: <HighPoint HPT366 UDMA66 controller> port 0xc800-0xc8ff,0xc400-0xc403,0xc000-0xc007 irq 11 at device 19.1 on pci0
ithread_add_handler: atapci2: id -1
atapci2: [MPSAFE]
ata3: at 0xc000 on atapci2
ata3: [MPSAFE]
orm0: <Option ROMs> at iomem 0xc8000-0xcbfff,0xc0000-0xc7fff on isa0
fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0
ithread_add_handler: fdc0: id -1
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
ithread_add_handler: atkbd0: id -1
psm0: <PS/2 Mouse> irq 12 on atkbdc0
ithread_add_handler: psm0: id -1
psm0: model Generic PS/2 mouse, device ID 0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x90 on isa0
sio0: type 16550A
ithread_add_handler: sio0: id -1
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ithread_add_handler: sio1: id -1
cy0 at iomem 0xd4000-0xd5fff irq 10 on isa0
ithread_add_handler: tty:cy: id 10
ithread_add_handler: cy: id -1
cy0: driver is using old-style compatibility shims
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/16 bytes threshold
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
ithread_add_handler: ppc0: id -1
unknown: <PNP0303> can't assign resources (port)
pca1: <AT-style speaker sound> at port 0x61 on isa0
unknown: <PNP0a03> can't assign resources (port)
unknown: <PNP0f13> can't assign resources (irq)
unknown: <PNP0501> can't assign resources (port)
unknown: <PNP0700> can't assign resources (port)
unknown: <PNP0401> can't assign resources (port)
unknown: <PNP0501> can't assign resources (port)
ithread_add_handler: clk: id -1
ata0: 1/1th spurious interrupt - status=0x00 error=0x01 reason=0x01
ata1: 2/2th spurious interrupt - status=0x50 error=0x02 reason=0x1d
ithread_add_handler: rtc: id -1
Timecounter "TSC" frequency 367500056 Hz quality 800
Timecounters tick every 10.000 msec
BRIDGE 020214 loaded
ipfw2 initialized, divert enabled, rule-based forwarding enabled, default to accept, logging disabled
ad0: 6149MB <QUANTUM FIREBALL ST6.4A> [13328/15/63] at ata0-master UDMA33
afd0: REMOVABLE <IOMEGA ZIP 100 ATAPI> at ata0-slave PIO0
ad2: 8809MB <QUANTUM FIREBALLP KA9.1> [17898/16/63] at ata1-master UDMA33
acd0: CDRW <RICOH CD-RW MP7320A> at ata1-slave UDMA33
ata2: 3/3th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 4/4th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 5/5th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 6/6th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 7/7th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 8/8th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 9/9th spurious interrupt - status=0x50 error=0x00 reason=0x03
ata2: 10/10th spurious interrupt - status=0x50 error=0x00 reason=0x03
acd1: CDROM <ATAPI 44X CDROM> at ata2-slave PIO4
da0 at ata0 bus 0 target 1 lun 0
da0: <IOMEGA ZIP 100 14.A> Removable Direct Access SCSI-0 device
da0: 3.300MB/s transfers
da0: 96MB (196608 512 byte sectors: 64H 32S/T 96C)
cd0 at ata1 bus 0 target 1 lun 0
cd0: <RICOH CD-RW MP7320A bp13> Removable CD-ROM SCSI-0 device
cd0: 33.000MB/s transfers
cd0: cd present [320930 x 2048 byte records]
cd1 at ata2 bus 0 target 1 lun 0
cd1: <ATAPI 44X CDROM 3.40> Removable CD-ROM SCSI-0 device
cd1: 16.000MB/s transfers
cd1: cd present [317714 x 2048 byte records]
Mounting root from ufs:ad0s2a
...
%%%

Bruce
Received on Sun Sep 07 2003 - 09:20:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC