Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: acher@atbode61.informatik.tu-muenchen.de (Georg Acher)
Subject: Re: Alpha and PCI Driver (w/ mmap) problems ...
Date: 2000/05/11	[thread overview]
Message-ID: <8febtf$ei9$1@sunsystem5.informatik.tu-muenchen.de> (raw)
In-Reply-To: 391958A4.4D5D66C7@cfl.rr.com

In article <391958A4.4D5D66C7@cfl.rr.com>,
 John Ward <wardj@cfl.rr.com> writes:
|> 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. 

Are you sure, that you really map the actual PCI address space? On Alpha, the
tiny 32bit-PCI space is not starting at CPU address 0. To convert the PCI
address into the addresses as needed by the CPU, you should use bus_to_virt.

Accessing PCI memory in userspace via /dev/mem has similar problems, but there
exists a library (included somewhere in XFree) that calculates the necessary
offset.

-- 
         Georg Acher, acher@in.tum.de         
         http://www.in.tum.de/~acher/
          "Oh no, not again !" The bowl of petunias          



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

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