From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 15 22:49:10 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 83D4816A4B3 for ; Mon, 15 Sep 2003 22:49:10 -0700 (PDT) Received: from alo.louko.com (x1.louko.com [195.218.71.106]) by mx1.FreeBSD.org (Postfix) with SMTP id 0A85043F85 for ; Mon, 15 Sep 2003 22:49:09 -0700 (PDT) (envelope-from alo@x1.louko.com) Received: (qmail 95093 invoked by uid 406); 16 Sep 2003 05:49:06 -0000 Date: 16 Sep 2003 05:49:06 -0000 Message-ID: <20030916054906.95092.qmail@alo.louko.com> To: freebsd-hackers@freebsd.org From: alo@louko.com (Antti Louko) Subject: Problems when writing to a Compact Flash card, FreeBSD 5.1, solution found. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Sep 2003 05:49:10 -0000 Finally, after adding and removing printfs and DELAYs in different places, I found that probably after status inquiry, one must wait just a little moment before doing anything with IDE device. The following patch seems to fix the problem. Thank you for all of you who participated in the effort with suggestions or sympathy! Regards, Antti Louko P.S. If I won't find further problems, I will send this as a bug report so this will get into the releases, too. I haven't tried CURRENT yet but it seems that it might have the problem, too. *** dev/ata/ata-all.c.orig Sun May 18 19:43:08 2003 --- dev/ata/ata-all.c Tue Sep 16 08:14:56 2003 *************** *** 978,983 **** --- 978,984 ---- DELAY(1); while (timeout < 5000000) { /* timeout 5 secs */ atadev->channel->status = ATA_IDX_INB(atadev->channel, ATA_STATUS); + DELAY(1); /* if drive fails status, reselect the drive just to be sure */ if (atadev->channel->status == 0xff) {