All of lore.kernel.org
 help / color / mirror / Atom feed
* mmap problem another :)
@ 2004-12-08 16:40 Dmitriy Tochansky
  2004-12-08 17:27 ` Dan Malek
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitriy Tochansky @ 2004-12-08 16:40 UTC (permalink / raw)
  To: linux-mips

Ok. I did as you say and got that mmap func:

static int
mdrv_mmap (struct file *file, struct vm_area_struct *vma)
{
  unsigned long offset = 0;
  int ret;
  struct inode *inode;
  inode = file->f_dentry->d_inode;

  struct pci_dev *curdev = NULL;

  int minor = MINOR (inode->i_rdev);
  
  printk("minor = 0x%X\n",minor);

  curdev = (devs[minor]);

  unsigned long start = vma->vm_start;
  unsigned long size = (vma->vm_end - vma->vm_start);
  offset = pci_resource_start (curdev, IOMEM0);
  
  printk("offset = 0x%X\n",(unsigned int)offset);

  ret = remap_page_range_high (start, offset, size, vma->vm_page_prot);
  
  return ret;
}

And it works fine but... but when I try to do mmap not /dev/mboard0 but /dev/mboard1 Im again
have the "bad" result. :( Is there something specific to mmap several devices?

^ permalink raw reply	[flat|nested] 7+ messages in thread
* mmap problem another :)
@ 2004-12-09 13:12 Dmitriy Tochansky
  2004-12-09 14:36 ` Dan Malek
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitriy Tochansky @ 2004-12-09 13:12 UTC (permalink / raw)
  To: linux-mips

Seems like I found problem.

Look ret = io_remap_page_range(start, offset, size, vma->vm_page_prot); remaps
from "offset" which I got from pci_resource_start (curdev, IOMEM0); its ok
from first board where it eq 0x40000000 but on second it 0x40002040

Then I'm reading from x = mmap (NULL, MMAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); with
shift 0x3C>>2 where I expect board register. But for second board x points to where?
0x40000000 or 0x40002040 or as I think remap_page_range or sonething realign offset to 
PAGE so x points to 0x40002000 or 0x40003000 and reading with shift 0x3C have no sense.

Am I rigth?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-12-14  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-08 16:40 mmap problem another :) Dmitriy Tochansky
2004-12-08 17:27 ` Dan Malek
2004-12-08 18:20   ` Pete Popov
2004-12-09  6:56   ` Dmitriy Tochansky
  -- strict thread matches above, loose matches on Subject: below --
2004-12-09 13:12 Dmitriy Tochansky
2004-12-09 14:36 ` Dan Malek
2004-12-14  7:51   ` Dmitriy Tochansky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.