rd@tarpit.UUCP (Bob Thrush x210) (04/26/89)
[ Since the original article didn't make it to the West Coast and I haven't had any comments, I'm reposting. If you've already seen this posting, please excuse... ] >Newsgroups: comp.unix.microport,comp.unix.i386 >Subject: Help with DMA driver on uport 386 >Message-ID: <2271@tarpit.UUCP> >Date: 17 Apr 89 01:48:27 GMT >Reply-To: rd@tarpit.UUCP (Bob Thrush x210) >Organization: Automation Intelligence,Inc; Orlando,FL >Lines: 71 >Xref: tarpit comp.unix.microport:1190 comp.unix.i386:303 I am writing a device driver for a Metrabyte PDMA-32 board. The PDMA-32 provides (in an IBM AT form factor) a 16-bit parallel interface with several options including DMA on any of the 7 available DMA levels. I am currently using Microport System V/386 3.0e.1 on an AST Premium/386. The application will only use digital output. My first version xferred one 16 bit word per interrupt. However, I wish to utilize DMA to improve performance and reduce system load. I need help specifically in the area of integrating the DMA device with the Microport kernel. My basic problem stems from a lack of documentation about the Microport DMA services and virtual to physical memory translation. I have written DMA device drivers for other Intel CPU-based operating systems that used 8257/37 chips, so I'm fairly familiar with that hardware although not in a virtual memory environment. There are a few kernel DMA service functions documented in an addendum to the SDS manual; however, they are only in the cartridge tape driver modules (and are multiply defined to boot). From the Addendum to Microport's "Release and Installation Notes for Software Development System Version 3.0e" dated September, 1988, there are brief descriptions of _disabledma(), _dmastatus(), _setdma(), and _resdma(). However, the only place that I find these functions are in the cartridge tape driver modules. The functions appear in the supplied modules/ct/ct.o(8237.c), modules/ev/ev.o(dmatape.c), and the beta combined ar/ev driver modules/qic/dmatape.o(dmatape.c). I have found no Microport documentation regarding translation of virtual addresses to physical addresses. I quickly disassembled the qic driver and found that it used svirtophys(). For AT style DMA there should also be function that verifies that the DMA buffer will not wrap around the 64k/128k byte pages. I have the AT&T System V, Release 3 BCI Driver Reference Manual (307-192) and the System V/386 Release 3.2 Integrated Software Development Guide (307-092). In those manuals there is a dma_breakup(D3X) function (for 3b2 hardware only). That function is also in 3.0e.1 in modules/kernel/io.o(physdsk.c). When using that function in my prototype driver to break up struct buf *bp, I get very small chunks, ie. 4096 bytes. I had expected (hoped?) to obtain buffers as large as would fit into the AT DMA 64k/128k limit. This 4096 no. is the mmu page size so I suspect that dma_breakup() is not the optimum function for performance. On to specific questions: 1. Has anybody outside of Microport written a device driver using DMA xfers? Is source available? 2. Have I completely missed the documentation? If so, please feel free to tell me where in the FM is it. Or what manual to purchase. 3. Since the system will have a tape drive as well as the PDMA driver, can I safely use the DMA services in that driver? 4. Has anybody else been in the same predicament? Suggestions? I hope I won't have to de-compile one of the cartridge tape drivers to find out how to get DMA to work. It should be very straight forward (with adequate documentation). -- Bob Thrush UUCP: {rtmvax,ucf-cs}!tarpit!rd Automation Intelligence, 1200 W. Colonial Drive, Orlando, Florida 32804