Re: mmap() in device driver

Wolfgang Jung (woju@keep.in-berlin.de)
Sat, 19 Aug 1995 12:46:09 +0200 (MET DST)


#
#I have a PCI board that I want to mmap() from user space.
#I can do so manually using /dev/mem, but that requires
#that I know the offset of the device in main memory so
#that I can ask to get a pointer to that location.
#
#In the BSD/sysV world I can create an mmap() call as part of a
#character driver. What I'm looking for is the code I need to put in the
#kernel function. Do I have to perform the mapping myself? In a BSD
#devname_mmap(), all I do is return a page pointer relative to the base
#address of the device. Higher-level mmap() kernel functions take care
#of the actual mapping.
#
#I've looked through the source tree and I don't see any example
#code.
#
#The KHG says that it'll eventually add a pointer to the "new VMM"
#stuff. I can't find anything on that in my docs.
#
#Any pointers would be appreciated.
#
#I'm using 1.2.11.

Hmmm, since you can mmap using /dev/mem, you just need to know where
the card has its Physical Memory (take a look at the XFree86 Accell
Xserver (ie S3 driver, which uses a memorywindow)) just let the
driver return the Physical Address thrue some IOCTL and then get the
area mmap'ed. This should suffice ?

Gruss
Wolfgang