From owner-freebsd-current@FreeBSD.ORG Sun Sep 7 11:20:30 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 18D4E16A4BF for ; Sun, 7 Sep 2003 11:20:30 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAA9443F75 for ; Sun, 7 Sep 2003 11:20:28 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id EAA08204; Mon, 8 Sep 2003 04:20:23 +1000 Date: Mon, 8 Sep 2003 04:20:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: freebsd-current@freebsd.org In-Reply-To: <20030907175620.GA3962@laptop.lambertfam.org> Message-ID: <20030908040227.D2362@gamplex.bde.org> References: <200309070852.h878qHVi031712@spider.deepcore.dk> <20030907175620.GA3962@laptop.lambertfam.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Soren Schmidt Subject: Re: ATAng problems X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2003 18:20:30 -0000 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 @@ -271,10 +271,15 @@ 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 - "); @@ -283,4 +288,8 @@ 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: 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: 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: