On 05/23/10 01:03 AM, 邓宁 wrote:
Hi all,

I am writing a driver for a memory mapped PCI device, in which I
implemented a segmap(9E) and a devmap(9E) to mmap a device memory into
the userland.

myDevice = (unsigned int *) mmap (NULL, LENGTH, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0); //myDevice stores the start virtual address of the
mmaped memory region.

Two questions:

(1) I want to know which one of the PCI spaces(ConfigSpace, MemorySpace,
and I/OSpace) is actually mapped by the the mmap() ?

Someone told me that the ConfigSpace is  mapped region of the mmap() by
defualt, but I comparied the contents of the mapped region with the
ConfigSpace (Vendor ID and Device ID...according to the PCI
specification) and find they are inconsistent.

There is no default.  Your driver's devmap() function will
call devmap_devmem_setup() with the fourth argument specifying
the register set number.  What is this argument set to when the
user space offset value is 0 (third arg of devmap()) and what does
your reg property look like?


(2) Is there any function to get the physical address of a certain
virtual address? as the same function of  the virt_to_phys(myDevice)

I want to check the start *physical address* of the mmaped memory
region, since I've known that the PCI ConfigSpace is physically mapped
at the 0x0000040262000000.

There is no stable user space API to translate UVA->PA.
_______________________________________________
driver-discuss mailing list
driver-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to