From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 14 15:41:07 2006 Return-Path: X-Original-To: acpi@FreeBSD.org Delivered-To: freebsd-acpi@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F256916A400; Fri, 14 Apr 2006 15:41:06 +0000 (UTC) (envelope-from sos@FreeBSD.org) Received: from spider.deepcore.dk (cpe.atm2-0-53484.0x50a6c9a6.abnxx9.customer.tele.dk [80.166.201.166]) by mx1.FreeBSD.org (Postfix) with ESMTP id 11CB543D45; Fri, 14 Apr 2006 15:41:05 +0000 (GMT) (envelope-from sos@FreeBSD.org) Received: from sos.deepcore.dk (sos.deepcore.dk [194.192.25.130]) by spider.deepcore.dk (8.13.6/8.13.4) with ESMTP id k3EFf4wp011328; Fri, 14 Apr 2006 17:41:04 +0200 (CEST) (envelope-from sos@FreeBSD.org) From: =?ISO-8859-1?Q?S=F8ren?= Schmidt To: Mitsuru IWASAKI In-Reply-To: <20060414.233013.41626908.iwasaki@jp.FreeBSD.org> References: <20060413.012156.56054177.iwasaki@jp.FreeBSD.org> <443F54DF.3080809@root.org> <20060414.180622.30189283.iwasaki@jp.FreeBSD.org> <20060414.233013.41626908.iwasaki@jp.FreeBSD.org> Content-Type: text/plain; charset=iso8859-1 Organization: FreeBSD project Date: Fri, 14 Apr 2006 17:41:03 +0200 Message-Id: <1145029263.912.4.camel@sos.deepcore.dk> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 8bit X-mail-scanned: by DeepCore Virus & Spam killer v1.16 Cc: acpi@FreeBSD.org, current@FreeBSD.org Subject: Re: CFR: ACPI Dock driver X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: sos@FreeBSD.org List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2006 15:41:07 -0000 On Fre, 2006-04-14 at 23:30 +0900, Mitsuru IWASAKI wrote: > Hi, Soren. > I've found the problem with detached ATA channel suspending. > After detaching second channel, the system drops into infinity > loop at ata_suspend(). > I'll commit the following patches with acpi_dock patches, so > please refine these if they have any problem. Uhm, would this simple patch help you ? --- ata-all.c 31 Mar 2006 08:09:04 -0000 1.271 +++ ata-all.c 14 Apr 2006 15:39:20 -0000 @@ -277,8 +277,8 @@ if (!dev || !(ch = device_get_softc(dev))) return ENXIO; - /* wait for the channel to be IDLE before entering suspend mode */ - while (1) { + /* wait for the channel to be IDLE or detached before suspending */ + while (ch->r_irq) { mtx_lock(&ch->state_mtx); if (ch->state == ATA_IDLE) { ch->state = ATA_ACTIVE; That I'll gladly commit for you instead... -Søren > > Thanks > > Index: ata-all.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v > retrieving revision 1.271 > diff -u -r1.271 ata-all.c > --- ata-all.c 31 Mar 2006 08:09:04 -0000 1.271 > +++ ata-all.c 14 Apr 2006 14:03:24 -0000 > @@ -277,6 +277,10 @@ > if (!dev || !(ch = device_get_softc(dev))) > return ENXIO; > > + /* if the channel is already detached, skip waiting for IDLE */ > + if ((ch->state & ATA_STALL_QUEUE) == ATA_STALL_QUEUE) > + goto out; > + > /* wait for the channel to be IDLE before entering suspend mode */ > while (1) { > mtx_lock(&ch->state_mtx); > @@ -288,6 +292,7 @@ > mtx_unlock(&ch->state_mtx); > tsleep(ch, PRIBIO, "atasusp", hz/10); > } > +out: > ATA_LOCKING(dev, ATA_LF_UNLOCK); > return 0; > } >