From owner-p4-projects@FreeBSD.ORG Fri Oct 9 17:38:07 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9EBE61065679; Fri, 9 Oct 2009 17:38:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6366E1065672 for ; Fri, 9 Oct 2009 17:38:07 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 52A4B8FC0A for ; Fri, 9 Oct 2009 17:38:07 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n99Hc7XO084929 for ; Fri, 9 Oct 2009 17:38:07 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n99Hc7QN084927 for perforce@freebsd.org; Fri, 9 Oct 2009 17:38:07 GMT (envelope-from mav@freebsd.org) Date: Fri, 9 Oct 2009 17:38:07 GMT Message-Id: <200910091738.n99Hc7QN084927@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Cc: Subject: PERFORCE change 169347 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 17:38:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=169347 Change 169347 by mav@mav_mavtest on 2009/10/09 17:37:25 Use ata_wait() command for waiting for !BSY and !ERR after PACKET command submission. It allows to less confuse ATA drive and recover faster. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-lowlevel.c#14 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-lowlevel.c#14 (text+ko) ==== @@ -666,6 +666,7 @@ if (request->flags & ATA_R_ATAPI) { int timeout = 5000; + int res; /* issue packet command to controller */ if (request->flags & ATA_R_DMA) { @@ -684,6 +685,13 @@ if (request->flags & ATA_R_ATAPI_INTR) return 0; + /* command processed ? */ + res = ata_wait(ch, request->unit, 0); + if (res != 0) { + if (res < 0) + device_printf(request->parent, "timeout waiting for PACKET command\n"); + return (-1); + } /* wait for ready to write ATAPI command block */ while (timeout--) { int reason = ATA_IDX_INB(ch, ATA_IREASON);