Subject: Re: Any way to get virtual addr from pci_mapreg_map()?
To: Dave Huang <>
From: Ignatios Souvatzis <>
List: tech-kern
Date: 08/12/1997 14:05:04 (Dave Huang) writes:

> I'm using pci_mapreg_map() to map the chip's RAM, passing it
> argument. This gets me a tag and handle that I can use with the
> bus_space_* macros/functions to access the memory. However, the driver
> wants to be able to access the memory as a struct, and do stuff like
> "scriptstruct->member = somevalue". I could use the bus_space_write*
> macros, but that kinda seems like it'd make the code harder to read,
> so I'm wondering if it's possible to get a virtual address out of the
> tag and handle that I can assign to a pointer.

You don't want to do this.

Ok, maybe you do want to do this, but I don't think any NetBSD driver
(especially for machine-independent busses like PCI, ISA or SBUS) should
be written linke this.

Even if it were guaranteed to work by the bus_xxx() stuff, which it isn't and
can't be, it would be non-portable code, working only on a single cpu with
a single compiler.