mmap() driver for PCI Alpha

mmap() driver for PCI Alpha

Post by kudz » Fri, 16 Mar 2001 02:15:00



Does anybody know of a place I can find a sample source
for implementing the mmap() routine for a character device driver on
a PCI bus platform running 4.0F?

Thanks,

k.

_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com

 
 
 

1. Alpha and PCI Driver (w/ mmap) problems ...

I have a "simple" PCI card that has a memory region which is mmap'able
... so I wrote a driver which identifies the card with the
pci_find_device() call, and then mmap's the information out of the
appropriate base address using the following call:

remap_page_range(vma->vm_start, (vma->vm_offset + g_offset),
(vma->vm_end
 - vma->vm_start), vma->vm_page_prot);

Anyhow, I have a corresponding application program that simply opens the
device and then prints out the contents of a mmap'd region:

fd = open("/dev/truetime", O_RDWR));

ptr = mmap(0, MAX_DEV_MEM_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED,
fd, 0);

etc ...

Problem is that on my alpha system I get all 0's ... nada ... zilch.
BUT when I run it on our Intel/Linux systems it works just fine.  I can
see the data changing, set some registers, etc ... The only thing I did
differently on the alpha system was add a flag to my compile code:

"-ffixed-8" ... otherwise I got some weird error, actually this error:
------------------------------------------------------
In file included from /usr/include/asm/semaphore.h:11,
                 from /usr/include/linux/fs.h:164,
                 from truetime.c:9:
/usr/include/asm/current.h:4: global register variable follows a
function definition
/usr/include/asm/current.h:4: warning: call-clobbered register used for
global register variable
------------------------

So the -ffixed-8 seemed to fix this ... don't know if it's causing
another problem or not ... I've tried various compile flags, I can read
all of the  PCI configuration registers using either setpci or my driver
itself, but I just can't seem to get at the data, I print out the
address returned from my mmap call and it matches the same virtual
memory address that I get inside my driver, so technically I should be
pointed to the correct address space ...

SO, anybody with experience writing Alpha/Linux device drivers ... could
you offer any suggestions? <I can provide more complete code snippets if
necessary>

Here's some basic system specs:
        RH Linux, kernel 2.2.15 w/ SMP support, on Compaq ES40 system.

In addition here's a little more of the PCI information:

% lspci -vv
...
...
...
01:03.0 Bridge: PLX Technology, Inc. PCI <-> IOBus Bridge (rev 01)
   Subsystem: True Time Inc.: Unknown device 5900
   Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping-
 SERR- FastB2B-
   Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
   Interrupt: pin A routed to IRQ 32
   Region 0: Memory at 0000000001211400 (32-bit, non-prefetchable)
   Region 1: I/O ports at 11200
   Region 2: Memory at 0000000001211000 (32-bit, non-prefetchable)
...
...
...

(Region 2 or BASE_ADDRESS_2 is where my data is located)

Thanks in advance,

John Ward

2. Mach 64 probs

3. mmap problem in pci driver

4. Premium Provider in IT Certifications

5. mmap and PCI driver

6. Rend386 And Linux

7. AIX 5.1 kernel pci driver mmap

8. Linux and large Hard Drives: Problems ?

9. PCI driver location & Where can I get more PCI drivers?

10. QUERY:- pci driver to mini-pci driver

11. Sample PCI Driver for Alpha DS10 5.1

12. DLPI driver and mmap() driver together

13. using mmap() on DEC Alpha OSF- addemdum