Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: John Ward <wardj@cfl.rr.com>
Subject: Alpha and PCI Driver (w/ mmap) problems ...
Date: 2000/05/10	[thread overview]
Message-ID: <391958A4.4D5D66C7@cfl.rr.com> (raw)

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
wardj@cctcorp.com



             reply	other threads:[~2000-05-10  4:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-10  4:00 John Ward [this message]
2000-05-11  4:00 ` Alpha and PCI Driver (w/ mmap) problems Georg Acher
2000-05-12  4:00   ` John Ward
2000-05-11  4:00 ` John Ward
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox