Subject: Re: My first try; /dev/rom
To: Stefan Arentz <stefan.arentz@soze.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-mac68k
Date: 03/21/1998 14:07:18
On Sat, 21 Mar 1998 23:08:17 +0100 
 Stefan Arentz <stefan.arentz@soze.com> wrote:

 > /* minor device 3 is ROM */
 >         case 3:
 >             if (uio->uio_rw == UIO_WRITE)
 >                 return EFAULT;
 >             v = uio->uio_offset + ROMBASE;
 >             c = min(iov->iov_len, ROMLEN);
 >             error = uiomove((caddr_t)v, c, uio);
 >             continue;
 > 
 > But I'm getting the following results:
 > 
 > wopr# hexdump /dev/rom 
 > hexdump: /dev/rom: Bad address
 > 
 > What am I doing wrong here? I was under the impression that it was
 > possible to read from the ROM while in kernel mode...
 > 
 > This is on a Q660AV, NetBSD 1.3

If ROMBASE is a physical address, you need to map each page of the ROM
into kernel virtual address space as you access it (before the uiomove()
step).

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 415 428 6939