From owner-freebsd-drivers@FreeBSD.ORG Mon Feb 19 12:55:51 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C40BE16A420 for ; Mon, 19 Feb 2007 12:55:51 +0000 (UTC) (envelope-from groot@kde.org) Received: from poster.science.ru.nl (poster.science.ru.nl [131.174.30.28]) by mx1.freebsd.org (Postfix) with ESMTP id 5D5E413C4AC for ; Mon, 19 Feb 2007 12:55:51 +0000 (UTC) (envelope-from groot@kde.org) Received: from smeltpunt.science.ru.nl [131.174.16.145] (helo=smeltpunt.science.ru.nl) by poster.science.ru.nl (8.13.7/5.11) with ESMTP id l1JChQBu006970 for ; Mon, 19 Feb 2007 13:43:27 +0100 (MET) Received: from n142198.science.ru.nl [131.174.142.198] (helo=n142198.science.ru.nl) by smeltpunt.science.ru.nl (8.13.7/5.11) with ESMTP id l1JChNpd028596; Mon, 19 Feb 2007 13:43:24 +0100 (MET) From: Adriaan de Groot Organization: KDE e.V. To: freebsd-hardware@freebsd.org, freebsd-drivers@freebsd.org Date: Mon, 19 Feb 2007 13:44:04 +0100 User-Agent: KMail/1.9.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702191344.04383.groot@kde.org> X-Spam-Score: -1.3 () ALL_TRUSTED,BAYES_50 X-Scanned-By: MIMEDefang 2.56 on 131.174.16.145 Cc: Subject: SiI3124 / ATA hw.end_transaction X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2007 12:55:51 -0000 At the beginning of February I posted [1] that I had a SiI3124 (SATA-II, RAID, PCI-X) card (works in PCI slot, too) for testing and that worst-case I would write the driver myself. Since there was no response, I wrote the driver myself. Mostly, anyway. I've written it to be part of the ata driver (long term this does not seem like a good idea, what with PMs pushing the number of devices per SATA channel > 1; having one CAM bus would be doable, I think, since 4 ports * hypothetical 15-port-multiplier is as far as this chipset can go) and so far it handles interrupts and ATA IDENTIFY returns the correct information. So I end up with (paraphrase, the machine I have the hardware in isn't connected today): atapci1: SiI 3124 ata6: .. ata9: ad12: TOSHIBA ... on ata6-master Anyway, I'm having real trouble figuring out how the hw.begin_transaction, hw.end_transaction and hw.status methods interact in struct ata_lowlevel. Commands are issued (like ATA INDENTIFY) and go through begin_transaction. I post the command to the device. On next interrupt for the channel (meaning the command is completed) .. something. This is where I don't understand what is happening or what is supposed to happen. status returns 0 or 1; in ata-chipset.c these are typically documented as "have seen any device action", but I don't know entirely what this is supposed to check. Given the context I may be able to just return 1, but ata_pci_status() returns 0 if the channel is busy (by the taskfile registers). And then there's the end_transaction stuff; this should, presumably, set request->result and request->error and request->status. Here, I'm in the dark as to what values mean what. I've tried just retrieving them from the taskfile (on the assumption that the 3124 updates the FIS after command completion) but all I get for my trouble are request timeouts for SETMODE, ENABLE_WCACHE, ... and the occasional READ_LBA. Booting this way takes a long time, but eventually the ATA system gives up on the disk and boot continues normally -- woe betide if I try dd if=/dev/ad12 though :) So my question is particularly: what are status and end_transaction expected to do? Is there documentation anywhere? dev/ata/* seems very light on how-it-works and design docs -- although the code is clean and usually explains what it is doing, so I've been able to get this far. [1] http://lists.freebsd.org/pipermail/freebsd-hardware/2007-February/004184.html -- Adriaan de Groot KDE Quality Team http://www.englishbreakfastnetwork.org/ SQO-OSS Researcher http://www.sqo-oss.eu/