From owner-freebsd-hackers Tue Jun 3 08:39:44 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA04722 for hackers-outgoing; Tue, 3 Jun 1997 08:39:44 -0700 (PDT) Received: from sos.freebsd.dk (sos.freebsd.dk [195.8.129.33]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA04717 for ; Tue, 3 Jun 1997 08:39:41 -0700 (PDT) Received: (from sos@localhost) by sos.freebsd.dk (8.8.5/8.7.3) id RAA25432; Tue, 3 Jun 1997 17:39:45 +0200 (MEST) From: Søren Schmidt Message-Id: <199706031539.RAA25432@sos.freebsd.dk> Subject: Re: DMA for IDE drives ? In-Reply-To: <199706031041.MAA25969@labinfo.iet.unipi.it> from Luigi Rizzo at "Jun 3, 97 12:41:14 pm" To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Date: Tue, 3 Jun 1997 17:39:45 +0200 (MEST) Cc: toor@dyson.iquest.net, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL30 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk In reply to Luigi Rizzo who wrote: > Following the suggestion from John Dyson, I have downloaded the > documents for the PIIX controller (i82371FB/i82371SB) which is used > on several of our motherboards. > > Maybe I am oversimplifying things but it seems that DMA for IDE > could be implemented as follows: > > assuming that the conditions to use DMA on IDE apply (i.e a PIIX > controller is detected, a drive supporting DMA is present on the > channel), a read or write operation is required: > > in wdstart(): > > for write operations: > instead of calling the outsw()/outsl, program the controller > as specified in the PIIX manual, bottom of page 97, steps 1, 2, > 4 (step 3 should have been already taken care of; or the > command to request a DMA write transfer is different from a > regular write command ?) > > for read operations: > before returning, program the PIIX controller executing steps > 1,2,4 as above; > > in wdintr() > > clear the stop bit in the dma-ide command register of the PIIX > (step 7 page 98 of the docs) > > additionally, for read ops, do not issue the insw/insl instructions Pretty to the point, but you also need code to check if the drive really supports DMAr. the struct wdparam has to be enlarged. I'm currently testing exactly this here, it seems to work so far. More later... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Søren Schmidt (sos@FreeBSD.org) FreeBSD Core Team Even more code to hack -- will it ever end ..