Subject: Re: I/O-mapped I/O on PC clone NetBSD-1.0#6
To: Mike Long <mike.long@analog.com>
From: Tom Pavel <pavel@MAILBOX.SLAC.Stanford.EDU>
List: netbsd-help
Date: 07/11/1995 10:48:57
>>>>> On Mon, 10 Jul 1995, Mike Long <mike.long@analog.com> writes:

> >Date: Mon, 10 Jul 1995 08:55:20 -0700 (PDT)
> >From: Tom Pavel <pavel@MAILBOX.SLAC.Stanford.EDU>
> >
> >
> >>>>>> On Thu, 6 Jul 1995, Mike Long <mike.long@analog.com> writes:
> >
> >> Any process that opens /dev/io can write to any I/O port.  After your
> >> program opens /dev/io, you can use the inb(), &c., functions in
> >> /usr/include/machine/pio.h.
> 
> >Does anyone have any working code to serve as an example?  I tried
> >this, but I keep getting bus errors on the inb()/outb() calls.  [I was
> >trying to play with my Sony CDU31.  BTW, has anyone worked on porting
> >the FreeBSD or Linux Sony CD drivers?]

> I just took another look at /sys/arch/i386/i386/mem.c, so now I have
> this question:  Did you open /dev/io read-write or read-only?  From
> what I see in the source, you have to open /dev/io for writing in
> order for it to do its thing.


Yes, indeed, it turns out that this was my problem.  I was not opening
the /dev/io for write.  Once I did, the inb()/outb() calls work fine.

I wish I could say that I managed to make my Sony CDROM do something,
but I haven't gotten that far yet.  Looks like some more studying of
the Linux/FreeBSD drivers is in order...


Tom Pavel

Stanford Linear Accelerator Center
pavel@slac.stanford.edu