Subject: Any way to get virtual addr from pci_mapreg_map()?
To: None <tech-kern@NetBSD.ORG>
From: Dave Huang <khym@bga.com>
List: tech-kern
Date: 08/12/1997 06:57:50
Hiyas... FreeBSD's NCR 53c8xx driver now supports copying the SCRIPTS
microcode stuff to the chip's onboard RAM, if it has any (53c825a,
53c875, and 53c895, apparently), and I'm trying to port the changes to
the NetBSD driver. I've run into a problem though...

I'm using pci_mapreg_map() to map the chip's RAM, passing it
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT for the "expected"
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.

As a workaround, I'm just using the bus_space_handle_t that I get back
as the pointer to the memory (since at least on the i386, that's what
it is), but this is probably not a good MI thing to be doing :)

Any suggestions? Thanks! :)

Name: Dave Huang     |   Mammal, mammal / their names are called /
INet: khym@bga.com   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 21 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++