From owner-freebsd-current@FreeBSD.ORG Tue Aug 24 07:58:46 2004 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 D010916A4CE for ; Tue, 24 Aug 2004 07:58:46 +0000 (GMT) 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 0B0BD43D39 for ; Tue, 24 Aug 2004 07:58:46 +0000 (GMT) (envelope-from sos@DeepCore.dk) Received: from [194.192.25.143] (laptop.deepcore.dk [194.192.25.143]) by spider.deepcore.dk (8.12.11/8.12.10) with ESMTP id i7O7wip9024639; Tue, 24 Aug 2004 09:58:44 +0200 (CEST) (envelope-from sos@DeepCore.dk) Message-ID: <412AF51B.8010801@DeepCore.dk> Date: Tue, 24 Aug 2004 09:58:19 +0200 From: =?ISO-8859-1?Q?S=F8ren_Schmidt?= User-Agent: Mozilla Thunderbird 0.7.2 (X11/20040802) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brian Rogers References: <412AD147.7050502@truffula.net> In-Reply-To: <412AD147.7050502@truffula.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable cc: freebsd-current@freebsd.org Subject: Re: ATAPI_RESET hang fix 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: Tue, 24 Aug 2004 07:58:46 -0000 Brian Rogers wrote: > I was getting the hang on start after the "ATAPI_RESET time =3D x"=20 > message. I stuck in a diagnostic printf before the ATAPI_RESET, and=20 > that actually fixed the hang. So I replaced it with a DELAY(50), and=20 > that also avoids the hang. >=20 > I guess some ATAPI devices don't like being reset right after being=20 > queried. (Or there is a bug with handling that in FreeBSD) Patch is=20 > attached. Hmm, you could be on to something, but instead of using a fixed delay=20 I'd rather (re)introduce the wait for ready before selecting the device=20 in ata_command. Could you please try the following patch and let me know = if that fixes the problem as well ? -S=F8ren Index: ata-lowlevel.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/dev/ata/ata-lowlevel.c,v retrieving revision 1.44 diff -u -r1.44 ata-lowlevel.c --- ata-lowlevel.c 16 Aug 2004 09:32:35 -0000 1.44 +++ ata-lowlevel.c 24 Aug 2004 07:21:12 -0000 @@ -721,6 +721,12 @@ rman_get_start(atadev->channel->r_io[ATA_DATA].res), command, (intmax_t)lba, count, feature); + /* ready to select device ? */ + if (ata_wait(atadev, 0) < 0) { + ata_prtdev(atadev, "timeout waiting for ready command=3D%02x\n", = command); + return -1; + } + /* select device */ ATA_IDX_OUTB(atadev->channel, ATA_DRIVE, ATA_D_IBM | atadev->unit);=