linux-mips
[Top] [All Lists]

Re: mmap problem

To: Dan Malek <dan@embeddededge.com>
Subject: Re: mmap problem
From: Dmitriy Tochansky <toch@dfpost.ru>
Date: Wed, 8 Dec 2004 10:40:17 +0300
Cc: linux-mips@linux-mips.org
In-reply-to: <AD0D6ED2-4868-11D9-BB64-003065F9B7DC@embeddededge.com>
Organization: Special Technology Center
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20041207184258.071bf401.toch@dfpost.ru> <AD0D6ED2-4868-11D9-BB64-003065F9B7DC@embeddededge.com>
Sender: linux-mips-bounce@linux-mips.org
On Tue, 7 Dec 2004 10:57:20 -0500
Dan Malek <dan@embeddededge.com> wrote:

> >   ret = remap_page_range( start, 0x40000000, size, vma->vm_page_prot
> >   
> > ); //
> 
> Use io_remap_page_range, it has the same parameters, and is
> designed to work with > 32-bit physical addresses.
  Well, I test it. On module load - unresolved symbol remap_page_range_high. I 
looking for some ifdefs
where this function blocked, but seems like everithing is ok. :(

> 
> Also, you should really use pci_resource_* functions to get
> information about the pci address, size, etc.  Don't hardcode this,
> even for testing.

There is a new variant. If I by hand make io_remap_page_range visible - system 
hangs. :(
  

#define MAX_DEV 4

struct pci_dev *devs[MAX_DEV];
struct pci_dev *dev = NULL;

...

static unsigned long *offset;

static int mdrv_mmap(struct file * file, struct vm_area_struct *vma)            
                       
{                                                                               
                       
                                                                                
                       
 int ret;                                                                       
                       
 struct inode *inode;                                                           
                       
 inode = file->f_dentry->d_inode;                                               
                       
 
 ret = -EINVAL;                                                                 
                       
 unsigned long start = vma->vm_start;                                           
                       
 unsigned long size = (vma->vm_end-vma->vm_start);                              
                       
 
 struct pci_dev *curdev = NULL;
 
 int minor = MINOR(inode->i_rdev);
 
 printk("minor = %d\n",minor);
 
 curdev = (devs[minor]);
 
 offset = (unsigned long *)pci_resource_start(curdev,0);
 
 printk("offset = 0x%X\n", offset );

 ret = io_remap_page_range( start, offset, size, vma->vm_page_prot );

 return ret;                                                               
}


<Prev in Thread] Current Thread [Next in Thread>