DELAY() woes

From: Lucius Windschuh <lwindschuh_at_googlemail.com>
Date: Wed, 3 Oct 2007 11:52:05 +0200
Hi,
I'm using FreeBSD -CURRENT as of October the 2nd and ran into some
troubles with ACPI suspend on my Thinkpad T41. It is patched with
Ariff's vpc patch and the one from PR kern/114649. My kernel config is
GENERIC with SCHED_ULE instead of SCHED_4BSD and without WITNESS.

On resuming from ACPI S3, I got: "ad0: detached"
Some googling led me to
http://lists.freebsd.org/pipermail/freebsd-current/2007-February/069214.html
Alex sent me his solution:

--- sys/dev/ata/ata-all.c-orig  2007-10-03 00:03:11.000000000 +0200
+++ sys/dev/ata/ata-all.c       2007-10-03 00:10:10.000000000 +0200
_at__at_ -295,6 +295,9 _at__at_
     struct ata_channel *ch;
     int error;

+               device_printf(dev, " a small delay to wait until the
disk is ready\n");
+               ata_udelay(2000000);
+
     /* check for valid device */
     if (!dev || !(ch = device_get_softc(dev)))
        return ENXIO;

I tried it and nothing changed (except the new log message about the
"small delay" of 2 seconds;) ). Enlarging the delay to 10 seconds
showed: DELAY(10000000) took only an unnoticable amount of time
instead of 10 sec.
Exchanging DELAY(10000000) with pause("atares", hz*10) gave the desired effect.
Knowing this, I removed the extra lines above and changed ata_udelay
so that it uses pause() for delays <= 100 ms instead of DELAY().
This solved the "ad0: detached" problems on ACPI S3 resume (now, I can
see the 100 ms delays when probing the ATA devices in
ata_generic_reset()).

So now I'm confused about DELAY(). It seems to behave strange
shortly after resuming, and "normalizes" its behaviour later on.
Is this a known problem?

Greetings,

Lucius
Received on Wed Oct 03 2007 - 08:17:39 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:18 UTC