Can't get MMIO working implementing a Kdriver driver

"Franco Catrin L." <[email protected]>
Newsgroups gmane.comp.freedesktop.xserver
Organization TUXPAN
Message-ID <[email protected]>
Hi!

I'm implementing the Kdrive driver for neomagic based cards.

My approach was to write a VESA wrapper first, and then I began adding
some acceleration support (*)

This is my first time I work on something like this, but I have some
background knowledge on standard VGA programming using PIO.

I'm using the source code from several KDrive drivers (ati, i810, nvidia
and trident) to see how KDrive interfaces work, and the source from
other drivers (xizzle, directfb, kernel framebuffer) to see neomagic
specific operations.

One of the most important things to succed is to get MMIO working,
because neomagic acceleration registers are accesible under MMIO and not
under PIO (AFAICT).  

It has been impossible for me to get MMIO working.

I've tried to dump MMIO registers, but they shows me 0xFFFFFFFF (32-bit
registers).

What am I doing?

1. Geting  Register Base address from card->attr.address[1] &
0xFFF80000.  I get the same address that I get from /proc/pci (2nd
reource: Non-prefetchable 32 bit memory)

2. Mapping this address through KdMapDevice, and saving it to variable
called mmio

3. Setting the mapping mode through KdSetMappedMode

4. Unlock VGa registers and neomagic registers

Then I use the address saved in mmio to read/write registers with no
success.  If I write to any register, I get 0xFFFFFFFF when I read it
back.

I'm writing using something like:

*mmio = val
*(mmio + register) = val

and reading using something like:

val = *mmio;
val = *(mmio + register)

I hope that any of the expert Video/PCI programmers could help me.  You
can see relevant source code in:

http://www.tuxpan.com/fcatrin/fdo

(*) I began adding hardware cursor support, but then I decided to
concentrate in solving MMIO, because it's only a two color cursor sprite

Thanks
-- 
Franco Catrin L. TUXPAN
http://www.tuxpan.com/fcatrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.