Re: CFR: ACPI Dock driver

From: Søren Schmidt <sos_at_FreeBSD.org>
Date: Fri, 14 Apr 2006 17:41:03 +0200
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
_at__at_ -277,8 +277,8 _at__at_
     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
> _at__at_ -277,6 +277,10 _at__at_
>      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);
> _at__at_ -288,6 +292,7 _at__at_
>  	mtx_unlock(&ch->state_mtx);
>  	tsleep(ch, PRIBIO, "atasusp", hz/10);
>      }
> +out:
>      ATA_LOCKING(dev, ATA_LF_UNLOCK);
>      return 0;
>  }
> 
Received on Fri Apr 14 2006 - 13:41:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC