Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!paperboy!hsdndev!dartvax!eleazar.dartmouth.edu!rj0q From: rj0q@eleazar.dartmouth.edu (Rodney D. Jacobson) Newsgroups: comp.unix.aix Subject: RS/6000 device driver Message-ID: <1991Apr9.131843.4409@dartvax.dartmouth.edu> Date: 9 Apr 91 13:18:43 GMT Sender: news@dartvax.dartmouth.edu (The News Manager) Organization: Dartmouth College, Hanover, NH Lines: 72 We at Aesculys Research Corp are trying to install a TrueVision Targa+ card in a rs/6000 model 320. Actually, the install is simple once you figure out that the key needs to be in the service position to open the case. What we are having trouble with is using the card without writing an official device driver. What we want to do for now is port a task we have running on a MIPS 3000 with an ISA bus targa card. On the MIPS, we open /dev/mem, allocate some memory and use mmap() to map card registers and memory into an address in (privileged) user space. We have made a little progress on getting the Targa+ card to work in the rs/6000, but some issues remain. Satya Rao of IBM Austin sent us some code which shows how a user process can read and write to the mca POS registers and to registers on the board. This works and we can verify that the Targa board has the id it's supposed to and that we can read and write i/o registers on the board. The remaining problems are: 1. how to read and write to Targa memory. 2. how to insure that we do not set Targa i/o and memory locations on top of those used by other boards on the system. Issue 1 is the biggest mystery to us at this point. We can probably solve issues 2 by playing dungeons and dragons with info and odme, but some outside help would make things much easier. The track that Satya has sent us along is to use /dev/bus0 and ioctl() calls. We have verified that the following ioctl() functions are useful: 1. IOCINFO - get device info 2. MIOCCGET - get/read pos register contents 3. MIOCCPUT - set pos register contents 4. MIOBUSGET - read from a register 5. MIOBUSPUT - write to a mca register so for example to write a byte stored in uchar newVal into the register 0x200 we do the following: int fd = open("/dev/bus0",O_RDWR); static MACH_DD_IO mdd = {0, sizeof(newVal), MV_BYTE, &newVal}; mdd.md_addr = addr; // ie 0x200 ioctl(fd, MIOBUSPUT, &mdd); Satya's notes did not show how to access board memory and we are at a loss on how to proceed. It is not clear that /dev/bus0 will help us on this one. The big question is can we access memory on an mca card from a user - vs device driver - process and how do we do it? As far as avoiding conflicts with other mca boards goes, it looks like we need to search through odme and figure out what devices use what addresses. However I have not figured out an efficient way of telling what addresses are currently used. I also have not figured out how to tell the system what addresses the Targa board will use with a given pos register setting. On a ps/2, there is apparently a configuration program which reads a @*.adf file. Is there any equivalent way to do that on the rs/6000? The stuff in /usr/lpp/bos/samples apparently shows how one might do this in a device driver, but it is not clear if it helps me in this case. Sincerely, David L. Hawley Aesculys Research Corp (603)488-4900 (603)488-0104 (fax) dartvax!axsys!dave (e-mail)