From owner-freebsd-current@FreeBSD.ORG Sat Feb 7 10:56:20 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 976411065680; Sat, 7 Feb 2009 10:56:20 +0000 (UTC) (envelope-from mikulas@artax.karlin.mff.cuni.cz) Received: from artax.karlin.mff.cuni.cz (artax.karlin.mff.cuni.cz [195.113.26.195]) by mx1.freebsd.org (Postfix) with ESMTP id 248E58FC12; Sat, 7 Feb 2009 10:56:19 +0000 (UTC) (envelope-from mikulas@artax.karlin.mff.cuni.cz) Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17421) id 1C54598359; Sat, 7 Feb 2009 11:27:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by artax.karlin.mff.cuni.cz (Postfix) with ESMTP id 15D1C982D7; Sat, 7 Feb 2009 11:27:35 +0100 (CET) Date: Sat, 7 Feb 2009 11:27:34 +0100 (CET) From: Mikulas Patocka To: sos@FreeBSD.org, bofh@terranova.net Message-ID: X-Personality-Disorder: Schizoid MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Mailman-Approved-At: Sat, 07 Feb 2009 16:45:15 +0000 Cc: freebsd-current@freebsd.org Subject: HT 1000 SATA suggestion X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 07 Feb 2009 10:56:21 -0000 Hi I found that you have problems with HT1000 SATA in FreeBSD. The problem is actually explained in the comments in the Linux driver. For normal IDE & legacy SATA cards, the sequence to perform DMA is this: - load register file - submit the command to the disk - setup dma sg table address and start dma But for ServerWorks SATA chips this sequence is wrong. If there is some CPU latency and data from the disk arrive BEFORE you start the dma engine, the controller will hang or corrupt the data. The correct sequence is to first start dma and then write the command to the taskfile. (Linux does this on serverworks SATA chips for both read and write commands, likely it doesn't cause problems with write commands) I am not a FreeBSD user or developer and I don't have a FreeBSD machine here to test, I was just developing ServerWorks SATA driver for another system, read the Linux driver, searched for HT1000 on the internet and found some your discussion where you desperately tried to work around the bugs in the chip and ended up restricting the transfer size (and then restricted it even more because it still didn't work perfectly) ... then I looked into FreeBSD source and saw that you start DMA after sending the command. So I'm writing you this like a suggestion to try. Mikulas